mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 12:18:47 +00:00
Add my multiple config file fixes to proxychain.
This commit is contained in:
parent
4c7262163e
commit
85aec8878d
@ -136,16 +136,20 @@ static void init_lib()
|
|||||||
init_l = 1;
|
init_l = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX. Same thing is defined in proxychains main.c it
|
||||||
|
* needs to be changed, too.
|
||||||
|
*/
|
||||||
|
#define PROXYCHAINS_CONF_FILE "PROXYCHAINS_CONF_FILE"
|
||||||
|
|
||||||
static inline void get_chain_data(
|
static inline void get_chain_data(
|
||||||
proxy_data *pd,
|
proxy_data *pd,
|
||||||
unsigned int *proxy_count,
|
unsigned int *proxy_count,
|
||||||
chain_type *ct)
|
chain_type *ct)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int count=0,port_n=0,list=0;
|
int count=0,port_n=0,list=0;
|
||||||
char buff[1024],type[1024],host[1024],user[1024];
|
char buff[1024],type[1024],host[1024],user[1024];
|
||||||
|
char *env;
|
||||||
FILE* file;
|
FILE* file;
|
||||||
|
|
||||||
if(proxychains_got_chain_data)
|
if(proxychains_got_chain_data)
|
||||||
@ -156,8 +160,17 @@ static inline void get_chain_data(
|
|||||||
tcp_connect_time_out=10*1000;
|
tcp_connect_time_out=10*1000;
|
||||||
*ct=DYNAMIC_TYPE;
|
*ct=DYNAMIC_TYPE;
|
||||||
|
|
||||||
|
env = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get path to configuration file from env this file has priority
|
||||||
|
* if it's defined.
|
||||||
|
*/
|
||||||
|
env = getenv(PROXYCHAINS_CONF_FILE);
|
||||||
|
|
||||||
snprintf(buff,256,"%s/.proxychains/proxychains.conf",getenv("HOME"));
|
snprintf(buff,256,"%s/.proxychains/proxychains.conf",getenv("HOME"));
|
||||||
|
|
||||||
|
if(!(file=fopen(env,"r")))
|
||||||
if(!(file=fopen("./proxychains.conf","r")))
|
if(!(file=fopen("./proxychains.conf","r")))
|
||||||
if(!(file=fopen(buff,"r")))
|
if(!(file=fopen(buff,"r")))
|
||||||
if(!(file=fopen("/etc/proxychains.conf","r")))
|
if(!(file=fopen("/etc/proxychains.conf","r")))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
main.c - description
|
main.c - description
|
||||||
-------------------
|
q -------------------
|
||||||
begin : Tue May 14 2002
|
begin : Tue May 14 2002
|
||||||
copyright : netcreature (C) 2002
|
copyright : netcreature (C) 2002
|
||||||
email : netcreature@users.sourceforge.net
|
email : netcreature@users.sourceforge.net
|
||||||
@ -32,17 +32,54 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind, opterr, optopt
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX. Same thing is defined in proxychains main.c it
|
||||||
|
* needs to be changed, too.
|
||||||
|
*/
|
||||||
|
#define PROXYCHAINS_CONF_FILE "PROXYCHAINS_CONF_FILE"
|
||||||
|
|
||||||
|
static usage(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
printf("\nUsage: %s [h] [f] config_file program_name [arguments]\n"
|
||||||
|
"\t for example : proxychains telnet somehost.com\n"
|
||||||
|
"More help in README file\n", argv[0], );
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if(argc<2)
|
char *path;
|
||||||
{
|
|
||||||
printf("\nUsage: proxychains program_name [arguments]\n"
|
path = NULL;
|
||||||
"\t for example : proxychains telnet somehost.com\n"
|
|
||||||
"More help in README file\n");
|
while ((opt = getopt(argc, argv, "fh:")) != -1) {
|
||||||
return 0 ;
|
switch (opt) {
|
||||||
|
case 'h':
|
||||||
|
usage();
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
path = (char *)optarg;
|
||||||
|
break;
|
||||||
|
default: /* '?' */
|
||||||
|
usage();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Proxychains are going to use %s as config file.\n", path);
|
||||||
|
printf("argv = %s\n", argv[1]);
|
||||||
|
|
||||||
|
/* Set PROXYCHAINS_CONF_FILE to get proxychains lib to
|
||||||
|
use new config file. */
|
||||||
|
setenv(PROXYCHAINS_CONF_FILE, path, 1);
|
||||||
|
|
||||||
|
/*XXX. proxychains might be installed in some different location */
|
||||||
putenv("LD_PRELOAD=/usr/lib/libproxychains.so");
|
putenv("LD_PRELOAD=/usr/lib/libproxychains.so");
|
||||||
execvp(argv[1],&argv[1]);
|
execvp(argv[1],&argv[1]);
|
||||||
perror("proxychains can't load process....");
|
perror("proxychains can't load process....");
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "ProxyChains-3.1 (http://proxychains.sf.net)"
|
echo "ProxyChains-3.1 (http://proxychains.sf.net)"
|
||||||
if [ $# = 0 ] ; then
|
|
||||||
|
usage() {
|
||||||
|
|
||||||
echo " usage:"
|
echo " usage:"
|
||||||
echo " proxychains <prog> [args]"
|
echo " $0 [h] [f config-file] <prog> [args]"
|
||||||
exit
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# = 0 ] ; then
|
||||||
|
usage
|
||||||
fi
|
fi
|
||||||
export LD_PRELOAD=libproxychains.so
|
|
||||||
|
if [ $1 = "-h" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "-f" ]; then
|
||||||
|
export PROXYCHAINS_CONF_FILE=$2;
|
||||||
|
shift;
|
||||||
|
shift;
|
||||||
|
fi
|
||||||
|
|
||||||
|
export LD_PRELOAD=libproxychains.so.3
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user