mirror of
https://github.com/rofl0r/proxychains-ng
synced 2026-05-13 17:03:07 +08:00
Compare commits
14 Commits
@@ -4,6 +4,10 @@
|
||||
*.lo
|
||||
.deps/
|
||||
.libs/
|
||||
*.rcb
|
||||
*.out
|
||||
*~
|
||||
*.patch
|
||||
|
||||
# Autoconf stuff
|
||||
libtool
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
original code
|
||||
original code up to version 3.1
|
||||
N3E7CR34TUR3.
|
||||
http://proxychains.sourceforge.net
|
||||
netcreature@users.sourceforge.net
|
||||
@@ -9,9 +9,15 @@ rofl0r.
|
||||
https://github.com/rofl0r/proxychains
|
||||
|
||||
localnet, bugfixes
|
||||
jianing yang.
|
||||
https://github.com/jianingy/proxychains
|
||||
https://sourceforge.net/projects/proxychains/forums/forum/644747/topic/3498696
|
||||
|
||||
poll_retry (fixes for signal handling)
|
||||
colin cross.
|
||||
https://sourceforge.net/projects/proxychains/forums/forum/644747/topic/2367923
|
||||
|
||||
collecting patches from px forum and putting it into a repo
|
||||
adam hamsik.
|
||||
https://github.com/haad/proxychains
|
||||
|
||||
localnet-port, bugfixes
|
||||
jianing yang.
|
||||
https://github.com/jianingy/proxychains
|
||||
|
||||
@@ -18,7 +18,7 @@ OBJS = $(SRCS:.c=.o)
|
||||
LOBJS = src/core.o src/common.o src/libproxychains.o
|
||||
|
||||
CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DTHREAD_SAFE
|
||||
LDFLAGS = -shared -fPIC -ldl -lpthread
|
||||
LDFLAGS = -shared -fPIC -Wl,--no-as-needed -ldl -lpthread
|
||||
INC =
|
||||
PIC = -fPIC
|
||||
AR = $(CROSS_COMPILE)ar
|
||||
|
||||
+6
-1
@@ -2,7 +2,12 @@
|
||||
#define PROXYCHAINS_QUIET_MODE_ENV_VAR "PROXYCHAINS_QUIET_MODE"
|
||||
#define PROXYCHAINS_CONF_FILE "proxychains.conf"
|
||||
#define LOG_PREFIX "[proxychains] "
|
||||
#ifndef SYSCONFDIR
|
||||
#define SYSCONFDIR "/etc"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
char *get_config_path(char* default_path, char* pbuf, size_t bufsize);
|
||||
char *get_config_path(char* default_path, char* pbuf, size_t bufsize);
|
||||
|
||||
//RcB: DEP "common.c"
|
||||
+23
-8
@@ -37,6 +37,7 @@
|
||||
#ifdef THREAD_SAFE
|
||||
#include <pthread.h>
|
||||
pthread_mutex_t internal_ips_lock;
|
||||
pthread_mutex_t hostdb_lock;
|
||||
#endif
|
||||
|
||||
#include "core.h"
|
||||
@@ -737,6 +738,11 @@ int connect_proxy_chain(int sock, ip_type target_ip,
|
||||
|
||||
static const ip_type local_host = { {127, 0, 0, 1} };
|
||||
|
||||
static void gethostbyname_data_setstring(struct gethostbyname_data* data, char* name) {
|
||||
snprintf(data->addr_name, sizeof(data->addr_name), "%s", name);
|
||||
data->hostent_space.h_name = data->addr_name;
|
||||
}
|
||||
|
||||
struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data* data) {
|
||||
char buff[256];
|
||||
uint32_t i, hash;
|
||||
@@ -750,8 +756,12 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
|
||||
data->resolved_addr_p[1] = NULL;
|
||||
|
||||
data->hostent_space.h_addr_list = data->resolved_addr_p;
|
||||
// let aliases point to the NULL member, mimicking an empty list.
|
||||
data->hostent_space.h_aliases = &data->resolved_addr_p[1];
|
||||
|
||||
data->resolved_addr = 0;
|
||||
data->hostent_space.h_addrtype = AF_INET;
|
||||
data->hostent_space.h_length = sizeof(in_addr_t);
|
||||
|
||||
gethostname(buff, sizeof(buff));
|
||||
|
||||
@@ -759,15 +769,20 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
|
||||
data->resolved_addr = inet_addr(buff);
|
||||
if(data->resolved_addr == (in_addr_t) (-1))
|
||||
data->resolved_addr = (in_addr_t) (local_host.as_int);
|
||||
return &data->hostent_space;
|
||||
goto retname;
|
||||
}
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
|
||||
// this iterates over the "known hosts" db, usually /etc/hosts
|
||||
MUTEX_LOCK(&hostdb_lock);
|
||||
while((hp = gethostent()))
|
||||
if(!strcmp(hp->h_name, name))
|
||||
return hp;
|
||||
|
||||
if(!strcmp(hp->h_name, name) && hp->h_addrtype == AF_INET && hp->h_length == sizeof(in_addr_t)) {
|
||||
data->resolved_addr = *((in_addr_t*)(hp->h_addr_list[0]));
|
||||
MUTEX_UNLOCK(&hostdb_lock);
|
||||
goto retname;
|
||||
}
|
||||
MUTEX_UNLOCK(&hostdb_lock);
|
||||
|
||||
hash = dalias_hash((char *) name);
|
||||
|
||||
@@ -819,11 +834,11 @@ struct hostent *proxy_gethostbyname(const char *name, struct gethostbyname_data*
|
||||
have_ip:
|
||||
|
||||
MUTEX_UNLOCK(&internal_ips_lock);
|
||||
|
||||
retname:
|
||||
|
||||
strncpy(data->addr_name, name, sizeof(data->addr_name));
|
||||
|
||||
data->hostent_space.h_name = data->addr_name;
|
||||
data->hostent_space.h_length = sizeof(in_addr_t);
|
||||
gethostbyname_data_setstring(data, (char*) name);
|
||||
|
||||
return &data->hostent_space;
|
||||
|
||||
err_plus_unlock:
|
||||
|
||||
@@ -45,6 +45,7 @@ extern internal_ip_lookup_table internal_ips;
|
||||
#ifdef THREAD_SAFE
|
||||
#include <pthread.h>
|
||||
extern pthread_mutex_t internal_ips_lock;
|
||||
extern pthread_mutex_t hostdb_lock;
|
||||
# define MUTEX_LOCK(x) pthread_mutex_lock(x)
|
||||
# define MUTEX_UNLOCK(x) pthread_mutex_unlock(x)
|
||||
# define MUTEX_INIT(x,y) pthread_mutex_init(x, y)
|
||||
@@ -149,3 +150,7 @@ void pc_stringfromipv4(unsigned char *ip_buf_4_bytes, char *outbuf_16_bytes);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
//RcB: DEP "core.c"
|
||||
//RcB: DEP "libproxychains.c"
|
||||
//RcB: LINK "-Wl,--no-as-needed -ldl -lpthread"
|
||||
@@ -93,6 +93,7 @@ static void* load_sym(char* symname, void* proxyfunc) {
|
||||
|
||||
static void do_init(void) {
|
||||
MUTEX_INIT(&internal_ips_lock, NULL);
|
||||
MUTEX_INIT(&hostdb_lock, NULL);
|
||||
/* read the config file */
|
||||
get_chain_data(proxychains_pd, &proxychains_proxy_count, &proxychains_ct);
|
||||
|
||||
@@ -400,6 +401,7 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
|
||||
static char buf[16];
|
||||
static char ipv4[4];
|
||||
static char *list[2];
|
||||
static char *aliases[1];
|
||||
static struct hostent he;
|
||||
|
||||
INIT();
|
||||
@@ -419,7 +421,8 @@ struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
|
||||
list[1] = NULL;
|
||||
he.h_addr_list = list;
|
||||
he.h_addrtype = AF_INET;
|
||||
he.h_aliases = NULL;
|
||||
aliases[0] = NULL;
|
||||
he.h_aliases = aliases;
|
||||
he.h_length = 4;
|
||||
pc_stringfromipv4((unsigned char *) addr, buf);
|
||||
return &he;
|
||||
|
||||
+3
-1
@@ -24,7 +24,7 @@
|
||||
static int usage(char **argv) {
|
||||
printf("\nUsage:\t%s -q -f config_file program_name [arguments]\n"
|
||||
"\t-q makes proxychains quiet - this overrides the config setting\n"
|
||||
"\t-t allows to manually specify a configfile to use\n"
|
||||
"\t-f allows to manually specify a configfile to use\n"
|
||||
"\tfor example : proxychains telnet somehost.com\n" "More help in README file\n\n", argv[0]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -103,6 +103,8 @@ int main(int argc, char *argv[]) {
|
||||
// search DLL
|
||||
|
||||
set_own_dir(argv[0]);
|
||||
|
||||
i = 0;
|
||||
|
||||
while(dll_dirs[i]) {
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dll_dirs[i], dll_name);
|
||||
|
||||
+17
-5
@@ -1,7 +1,7 @@
|
||||
# proxychains.conf VER 3.1
|
||||
# proxychains.conf VER 4.x
|
||||
#
|
||||
# HTTP, SOCKS4, SOCKS5 tunneling proxifier with DNS.
|
||||
#
|
||||
# HTTP, SOCKS4a, SOCKS5 tunneling proxifier with DNS.
|
||||
|
||||
|
||||
# The option below identifies how the ProxyList is treated.
|
||||
# only one option should be uncommented at time,
|
||||
@@ -37,7 +37,7 @@ strict_chain
|
||||
# Proxy DNS requests - no leak for DNS data
|
||||
proxy_dns
|
||||
|
||||
# set the class A subnet number to usefor use of the internal remote DNS mapping
|
||||
# set the class A subnet number to use for the internal remote DNS mapping
|
||||
# we use the reserved 224.x.x.x range by default,
|
||||
# if the proxified app does a DNS request, we will return an IP from that range.
|
||||
# on further accesses to this ip we will send the saved DNS name to the proxy.
|
||||
@@ -54,7 +54,8 @@ remote_dns_subnet 224
|
||||
tcp_read_time_out 15000
|
||||
tcp_connect_time_out 8000
|
||||
|
||||
# Example for localnet exclusion
|
||||
### Examples for localnet exclusion
|
||||
## localnet ranges will *not* use a proxy to connect.
|
||||
## Exclude connections to 192.168.1.0/24 with port 80
|
||||
# localnet 192.168.1.0:80/255.255.255.0
|
||||
|
||||
@@ -64,6 +65,17 @@ tcp_connect_time_out 8000
|
||||
## Exclude connections to ANYwhere with port 80
|
||||
# localnet 0.0.0.0:80/0.0.0.0
|
||||
|
||||
## RFC5735 Loopback address range
|
||||
## if you enable this, you have to make sure remote_dns_subnet is not 127
|
||||
## you'll need to enable it if you want to use an application that
|
||||
## connects to localhost.
|
||||
# localnet 127.0.0.0/255.0.0.0
|
||||
|
||||
## RFC1918 Private Address Ranges
|
||||
# localnet 10.0.0.0/255.0.0.0
|
||||
# localnet 172.16.0.0/255.240.0.0
|
||||
# localnet 192.168.0.0/255.255.0.0
|
||||
|
||||
# ProxyList format
|
||||
# type host port [user pass]
|
||||
# (values separated by 'tab' or 'blank')
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include "../src/core.h"
|
||||
|
||||
void printhostent(struct hostent *hp) {
|
||||
char ipbuf[16];
|
||||
pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
|
||||
printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
|
||||
hp->h_aliases,
|
||||
hp->h_length,
|
||||
hp->h_name,
|
||||
hp->h_addr_list,
|
||||
hp->h_addrtype,
|
||||
ipbuf
|
||||
);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
struct hostent *hp;
|
||||
while((hp = gethostent())) {
|
||||
printhostent(hp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#include "../src/core.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void printhostent(struct hostent *hp) {
|
||||
char ipbuf[16];
|
||||
pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
|
||||
printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
|
||||
hp->h_aliases,
|
||||
hp->h_length,
|
||||
hp->h_name,
|
||||
hp->h_addr_list,
|
||||
hp->h_addrtype,
|
||||
ipbuf
|
||||
);
|
||||
}
|
||||
int main(int argc, char**argv) {
|
||||
struct hostent* ret;
|
||||
struct gethostbyname_data data;
|
||||
if(argc == 1) return 1;
|
||||
ret = proxy_gethostbyname(argv[1], &data);
|
||||
if(ret) printhostent(ret);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user