Menu

Patch for env var "PROXYCONF"

sm4x
2009-07-24
2013-05-09
  • sm4x

    sm4x - 2009-07-24

    Hi - leet program y0z.. needed an env var to set the config on the fly... quick & dirty but works well - thought I'd share to help with the default config loading issue :-/.

    /sm4x

    ----------- begin patch

    --- libproxychains.c    2006-03-15 16:16:59.000000000 +0000
    +++ libproxychainsnew.c    2009-07-24 11:15:11.000000000 +0100
    @@ -156,14 +156,19 @@
         tcp_connect_time_out=10*1000;
         *ct=DYNAMIC_TYPE;

    -    snprintf(buff,256,"%s/.proxychains/proxychains.conf",getenv("HOME"));
    -
    -    if(!(file=fopen("./proxychains.conf","r")))
    -    if(!(file=fopen(buff,"r")))
    -    if(!(file=fopen("/etc/proxychains.conf","r")))
    -    {
    -        perror("Can't locate proxychains.conf");
    -        exit(1);
    +    // check to see if we have PROXYCONF set first
    +    if((file=fopen(getenv("PROXYCONF"), "r"))) {
    +        printf("|Loaded|: %s\n", getenv("PROXYCONF"));
    +        snprintf(buff,256,"%s",getenv("PROXYCONF"));
    +    } else {
    +        snprintf(buff,256,"%s/.proxychains/proxychains.conf",getenv("HOME"));
    +   
    +        if(!(file=fopen("./proxychains.conf","r")))
    +        if(!(file=fopen(buff,"r")))
    +        if(!(file=fopen("/etc/proxychains.conf","r"))) {   
    +            perror("Can't locate proxychains.conf");
    +            exit(1);
    +        }
         }

         while(fgets(buff,sizeof(buff),file)) {

     
    • sm4x

      sm4x - 2009-07-24

      all tabs were mangled on post.. so patch won't work unless you add the tabs yourself.. gg sf.

      /sm4x

       
  • Cousteau

    Cousteau - 2009-12-08

    A very good idea; either that or a "-c file.conf" option (although the environment variable seems easier to implement).

     

Log in to post a comment.