1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-08 22:22:52 +08:00

some cosmetic changes

This commit is contained in:
rofl0r 2011-09-04 02:03:47 +02:00
parent 5095296ddf
commit 218d242aab
3 changed files with 24 additions and 9 deletions

View File

@ -201,7 +201,7 @@ static int timed_connect(int sock, const struct sockaddr *addr, socklen_t len)
static int tunnel_to(int sock, unsigned int ip, unsigned short port, proxy_type pt,char *user,char *pass) static int tunnel_to(int sock, unsigned int ip, unsigned short port, proxy_type pt,char *user,char *pass)
{ {
#ifdef DEBUG #ifdef DEBUG
PDEBUG("tunnel to\n"); PDEBUG("tunnel_to()\n");
#endif #endif
int len; int len;
char buff[BUFF_SIZE]; char buff[BUFF_SIZE];

View File

@ -61,7 +61,7 @@ static void init_lib(void);
static void init_lib(void) static void init_lib(void)
{ {
proxychains_write_log("ProxyChains-3.1 (http://proxychains.sf.net)\n"); proxychains_write_log("ProxyChains-3.2 (http://github.com/rofl0r/proxychains)\n");
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct); get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
true_connect = (connect_t) dlsym(RTLD_NEXT, "connect"); true_connect = (connect_t) dlsym(RTLD_NEXT, "connect");
@ -359,9 +359,11 @@ int connect (int sock, const struct sockaddr *addr, unsigned int len)
struct hostent *gethostbyname(const char *name) struct hostent *gethostbyname(const char *name)
{ {
PDEBUG("gethostbyname: %s\n",name);
if(!init_l) if(!init_l)
init_lib(); init_lib();
PDEBUG("gethostbyname: %s\n",name);
if(proxychains_resolver) if(proxychains_resolver)
return proxy_gethostbyname(name); return proxy_gethostbyname(name);
else else
@ -375,9 +377,12 @@ int getaddrinfo(const char *node, const char *service,
struct addrinfo **res) struct addrinfo **res)
{ {
int ret = 0; int ret = 0;
PDEBUG("getaddrinfo: %s %s\n",node ,service);
if(!init_l) if(!init_l)
init_lib(); init_lib();
PDEBUG("getaddrinfo: %s %s\n",node ,service);
if(proxychains_resolver) if(proxychains_resolver)
ret = proxy_getaddrinfo(node, service, hints, res); ret = proxy_getaddrinfo(node, service, hints, res);
else else
@ -388,9 +393,11 @@ int getaddrinfo(const char *node, const char *service,
void freeaddrinfo(struct addrinfo *res) void freeaddrinfo(struct addrinfo *res)
{ {
PDEBUG("freeaddrinfo %p \n",res);
if(!init_l) if(!init_l)
init_lib(); init_lib();
PDEBUG("freeaddrinfo %p \n",res);
if(!proxychains_resolver) if(!proxychains_resolver)
true_freeaddrinfo(res); true_freeaddrinfo(res);
else { else {
@ -413,9 +420,12 @@ int getnameinfo (const struct sockaddr * sa,
#endif #endif
{ {
int ret = 0; int ret = 0;
PDEBUG("getnameinfo: %s %s\n", host, serv);
if(!init_l) if(!init_l)
init_lib(); init_lib();
PDEBUG("getnameinfo: %s %s\n", host, serv);
if(!proxychains_resolver) { if(!proxychains_resolver) {
ret = true_getnameinfo(sa,salen,host,hostlen, ret = true_getnameinfo(sa,salen,host,hostlen,
serv,servlen,flags); serv,servlen,flags);
@ -456,12 +466,17 @@ struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
static char ipv4[4]; static char ipv4[4];
static char* list[2]; static char* list[2];
static struct hostent he; static struct hostent he;
PDEBUG("TODO: proper gethostbyaddr hook\n");
if(!init_l) if(!init_l)
init_lib(); init_lib();
PDEBUG("TODO: proper gethostbyaddr hook\n");
if(!proxychains_resolver) if(!proxychains_resolver)
return true_gethostbyaddr(addr,len,type); return true_gethostbyaddr(addr,len,type);
else { else {
PDEBUG("len %u\n", len);
if(len != 4) return NULL; if(len != 4) return NULL;
he.h_name = buf; he.h_name = buf;
memcpy(ipv4, addr, 4); memcpy(ipv4, addr, 4);

View File

@ -72,8 +72,8 @@ int main(int argc, char *argv[]) {
} }
have: have:
printf("Proxychains is going to use %s as config file.\n", path); printf("using config file: %s\n", path);
printf("argv = %s\n", argv[1]); //printf("argv = %s\n", argv[1]);
/* Set PROXYCHAINS_CONF_FILE to get proxychains lib to use new config file. */ /* Set PROXYCHAINS_CONF_FILE to get proxychains lib to use new config file. */
setenv("PROXYCHAINS_CONF_FILE", path, 1); setenv("PROXYCHAINS_CONF_FILE", path, 1);