16 Commits

Author SHA1 Message Date
Adam Hamsik 9aff5523a4 Update mac os build. 2021-01-29 11:00:07 +01:00
Adam Hamsik ea89ca551a Merge pull request #109 from aviau/patch-1
proxychains.conf: mention `raw` type
2020-12-11 15:41:37 +01:00
Alexandre Viau d27fcbff9b proxychains.conf: mention raw type 2020-12-10 11:42:49 -05:00
Adam Hamsik 4c31f32dc9 Update version string 2020-12-10 14:05:01 +01:00
Adam Hamsik 5320c1bc22 Bump version string to 4.3.0 2020-12-10 14:04:16 +01:00
Adam Hamsik 2d2ba1c921 Merge pull request #108 from aviau/aviau/raw-proxy
support 'raw' proxy type
2020-12-10 14:02:52 +01:00
Adam Hamsik ed75dfa6e2 Merge pull request #104 from ChuanfengZhang/master
docs: fix link of pkgsrc
2020-12-10 14:00:53 +01:00
aviau 7b24b954c8 support 'raw' proxy type 2020-10-27 15:23:40 -04:00
zhangcf e8247feeda docs: fix link of pkgsrc 2020-09-14 15:30:42 +08:00
Adam Hamsik 99af45703e Update libproxychains.c
Fix redundant parenthesis.
2020-07-28 16:15:00 +02:00
Adam Hamsik 5dd8450452 Merge pull request #99 from tomgilon/dnat
Add dnat feature
2020-07-21 22:41:19 +02:00
Adam Hamsik 8dea4f9297 Merge pull request #98 from AdamVanScyoc/fix_conf_file_typo
Fix type on proxychains.conf fix_conf_file_type
2020-07-21 22:39:39 +02:00
Adam Hamsik 48c7a005e6 Merge pull request #100 from 0xflotus/patch-1
(docs): fixed possible typo error
2020-07-21 22:38:47 +02:00
0xflotus 7efa291d90 (docs): fixed possible typo error
in www.insecure.org/nmap
2020-05-24 14:22:02 +02:00
tom gilon d7096b4f98 Add option to change tcp destination port and ip before sending to proxy server 2020-05-07 00:10:59 +03:00
Adam Van Scyoc 6d1e0e8af6 Fix type on proxychains.conf fix_conf_file_type 2020-04-14 22:28:44 -04:00
9 changed files with 124 additions and 12 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
.deps/
.libs/
.*
src/*.d
# Autoconf stuff
libtool
config.*
+1 -1
View File
@@ -26,7 +26,7 @@ AR = $(CROSS_COMPILE)ar
RANLIB = $(CROSS_COMPILE)ranlib
LDSO_SUFFIX = so
LD_SET_SONAME = -Wl,-soname=
LD_SET_SONAME = -Wl
INSTALL_FLAGS = -D -m
-include config.mak
+4 -4
View File
@@ -1,4 +1,4 @@
= ProxyChains ver. 4.2.0 README
= ProxyChains ver. 4.3.0 README
image:https://travis-ci.org/haad/proxychains.svg?branch=master["Build Status", link="https://travis-ci.org/haad/proxychains"]
@@ -33,13 +33,13 @@ is currently the only known affected program.
=== Using release version
*Proxychains-4.2.0* are available with pkgsrc to everyone using it on _Linux_,
*Proxychains-4.3.0* are available with pkgsrc to everyone using it on _Linux_,
_NetBSD_, _FreeBSD_, _OpenBSD_, _DragonFlyBSD_ or _Mac OS X_. You just need to install
pkgsrc-wip repository and run
make install
in a wip/proxychains directory.
You can find out more about pkgsrc on link:www.pkgsrc.org[pkgsrc] and about pkgsrc-wip on
You can find out more about pkgsrc on link:http://www.pkgsrc.org[pkgsrc] and about pkgsrc-wip on
link:http://pkgsrc-wip.sourceforge.net[Pkgsrc-wip homepage]
=== Installing on Mac OS X with homebrew
@@ -103,7 +103,7 @@ it supports SOCKS4, SOCKS5 and HTTP CONNECT proxy servers.
dynamic order (smart exclude dead proxies from chain)
* You can use it with any TCP client application, even network scanners
yes, yes - you can make portscan via proxy (or chained proxies)
for example with Nmap scanner by fyodor (www.insecire.org/nmap).
for example with Nmap scanner by fyodor (www.insecure.org/nmap).
----
proxychains nmap -sT -PO -p 80 -iR (find some webservers through proxy)
----
Vendored
+5 -3
View File
@@ -97,9 +97,10 @@ echo sysconfdir=$sysconfdir>>config.mak
if ismac ; then
echo LDSO_SUFFIX=dylib>>config.mak
echo OS_CFLAGS+=-DIS_MAC=1 -arch x86_64 -arch i386 >>config.mak
echo OS_LDFLAGS+=-arch x86_64 -arch i386 -lpthread -ldl -Wl,>>config.mak
echo LD_SET_SONAME=-install_name,>>config.mak
echo OS_CFLAGS+=-DIS_MAC=1 -arch x86_64 >>config.mak
echo OS_LDFLAGS+=-arch x86_64 -lpthread -ldl -Wl,>>config.mak
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
echo LDSO_SUFFIX=dylib>>config.mak
echo INSTALL_FLAGS=-m>>config.mak
fi
@@ -117,3 +118,4 @@ fi
echo done, now run make \&\& make install
+1 -1
View File
@@ -7,7 +7,7 @@
#define LOG_PREFIX "[proxychains] "
#define PROXYCHAINS_VERSION_MAJOR 4
#define PROXYCHAINS_VERSION_MINOR 1
#define PROXYCHAINS_VERSION_MINOR 3
#define PROXYCHAINS_VERSION_BUGFIX 0
#include <stddef.h>
+4
View File
@@ -278,6 +278,10 @@ static int tunnel_to(int sock, ip_type ip, unsigned short port, proxy_type pt, c
//memset (buff, 0, sizeof(buff));
switch (pt) {
case RAW_TYPE: {
return SUCCESS;
}
break;
case HTTP_TYPE:{
if(!dns_len) {
inet_ntop(AF_INET, &ip.octet[0], ip_buf, sizeof(ip_buf));
+7
View File
@@ -20,6 +20,7 @@
#define __CORE_HEADER
#define BUFF_SIZE 8*1024 // used to read responses from proxies.
#define MAX_LOCALNET 64
#define MAX_DNAT 64
typedef union {
unsigned char octet[4];
@@ -66,6 +67,7 @@ typedef enum {
typedef enum {
HTTP_TYPE,
RAW_TYPE,
SOCKS4_TYPE,
SOCKS5_TYPE
} proxy_type;
@@ -93,6 +95,11 @@ typedef struct {
unsigned short port;
} localaddr_arg;
typedef struct {
struct in_addr orig_dst, new_dst;
unsigned short orig_port, new_port;
} dnat_arg;
typedef struct {
ip_type ip;
unsigned short port;
+80
View File
@@ -66,6 +66,8 @@ chain_type proxychains_ct;
proxy_data proxychains_pd[MAX_CHAIN];
size_t num_localnet_addr = 0;
dnat_arg dnats[MAX_DNAT];
size_t num_dnats = 0;
#ifdef THREAD_SAFE
pthread_once_t init_once = PTHREAD_ONCE_INIT;
@@ -188,6 +190,8 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
char *env;
char local_in_addr_port[32];
char local_in_addr[32], local_in_port[32], local_netmask[32];
char dnat_orig_addr_port[32], dnat_new_addr_port[32];
char dnat_orig_addr[32], dnat_orig_port[32], dnat_new_addr[32], dnat_new_port[32];
FILE *file = NULL;
if(proxychains_got_chain_data)
@@ -217,6 +221,8 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
if(!strcmp(type, "http")) {
pd[count].pt = HTTP_TYPE;
} else if(!strcmp(type, "raw")) {
pd[count].pt = RAW_TYPE;
} else if(!strcmp(type, "socks4")) {
pd[count].pt = SOCKS4_TYPE;
} else if(!strcmp(type, "socks5")) {
@@ -297,6 +303,55 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
proxychains_quiet_mode = 1;
} else if(strstr(buff, "proxy_dns")) {
proxychains_resolver = 1;
} else if(strstr(buff, "dnat")) {
if(sscanf(buff, "%s %21[^ ] %21s\n", user, dnat_orig_addr_port, dnat_new_addr_port) < 3) {
fprintf(stderr, "dnat format error");
exit(1);
}
/* clean previously used buffer */
memset(dnat_orig_port, 0, sizeof(dnat_orig_port) / sizeof(dnat_orig_port[0]));
memset(dnat_new_port, 0, sizeof(dnat_new_port) / sizeof(dnat_new_port[0]));
(void)sscanf(dnat_orig_addr_port, "%15[^:]:%5s", dnat_orig_addr, dnat_orig_port);
(void)sscanf(dnat_new_addr_port, "%15[^:]:%5s", dnat_new_addr, dnat_new_port);
if(num_dnats < MAX_DNAT) {
int error;
error =
inet_pton(AF_INET, dnat_orig_addr,
&dnats[num_dnats].orig_dst);
if(error <= 0) {
fprintf(stderr, "dnat original destination address error\n");
exit(1);
}
error =
inet_pton(AF_INET, dnat_new_addr,
&dnats[num_dnats].new_dst);
if(error <= 0) {
fprintf(stderr, "dnat effective destination address error\n");
exit(1);
}
if(dnat_orig_port[0]) {
dnats[num_dnats].orig_port =
(short) atoi(dnat_orig_port);
} else {
dnats[num_dnats].orig_port = 0;
}
if(dnat_new_port[0]) {
dnats[num_dnats].new_port =
(short) atoi(dnat_new_port);
} else {
dnats[num_dnats].new_port = 0;
}
PDEBUG("added dnat: orig-dst=%s orig-port=%d new-dst=%s new-port=%d\n", dnat_orig_addr, dnats[num_dnats].orig_port, dnat_new_addr, dnats[num_dnats].new_port);
++num_dnats;
} else {
fprintf(stderr, "# of dnat exceed %d.\n", MAX_DNAT);
}
}
}
}
@@ -350,6 +405,8 @@ int connect(int sock, const struct sockaddr *addr, socklen_t len) {
char str[256];
#endif
struct in_addr *p_addr_in;
struct sockaddr_in new_addr;
dnat_arg *dnat = NULL;
unsigned short port;
size_t i;
int remote_dns_connect = 0;
@@ -373,6 +430,29 @@ int connect(int sock, const struct sockaddr *addr, socklen_t len) {
// check if connect called from proxydns
remote_dns_connect = (ntohl(p_addr_in->s_addr) >> 24 == remote_dns_subnet);
// more specific first
for(i = 0; i < num_dnats && !remote_dns_connect && !dnat; i++)
if(dnats[i].orig_dst.s_addr == p_addr_in->s_addr)
if(dnats[i].orig_port && (dnats[i].orig_port == port))
dnat = &dnats[i];
for(i = 0; i < num_dnats && !remote_dns_connect && !dnat; i++)
if(dnats[i].orig_dst.s_addr == p_addr_in->s_addr)
if(!dnats[i].orig_port)
dnat = &dnats[i];
if (dnat) {
if (dnat->new_port)
new_addr.sin_port = htons(dnat->new_port);
else
new_addr.sin_port = htons(port);
new_addr.sin_addr = dnat->new_dst;
addr = (struct sockaddr *)&new_addr;
p_addr_in = &((struct sockaddr_in *) addr)->sin_addr;
port = ntohs(((struct sockaddr_in *) addr)->sin_port);
}
for(i = 0; i < num_localnet_addr && !remote_dns_connect; i++) {
if((localnet_addr[i].in_addr.s_addr & localnet_addr[i].netmask.s_addr)
== (p_addr_in->s_addr & localnet_addr[i].netmask.s_addr)) {
+21 -2
View File
@@ -73,6 +73,24 @@ localnet 127.0.0.0/255.0.0.0
## Exclude connections to ANYwhere with port 80
# localnet 0.0.0.0:80/0.0.0.0
### Examples for dnat
## Trying to proxy connections to destinations which are dnatted,
## will result in proxying connections to the new given destinations.
## Whenever I connect to 1.1.1.1 on port 1234 actually connect to 1.1.1.2 on port 443
# dnat 1.1.1.1:1234 1.1.1.2:443
## Whenever I connect to 1.1.1.1 on port 443 actually connect to 1.1.1.2 on port 443
## (no need to write :443 again)
# dnat 1.1.1.2:443 1.1.1.2
## No matter what port I connect to on 1.1.1.1 port actually connect to 1.1.1.2 on port 443
# dnat 1.1.1.1 1.1.1.2:443
## Always, instead of connecting to 1.1.1.1, connect to 1.1.1.2
# dnat 1.1.1.1 1.1.1.2
# ProxyList format
# type host port [user pass]
# (values separated by 'tab' or 'blank')
@@ -86,12 +104,13 @@ localnet 127.0.0.0/255.0.0.0
# http 192.168.39.93 8080
#
#
# proxy types: http, socks4, socks5
# proxy types: http, socks4, socks5, raw
# * raw: The traffic is simply forwarded to the proxy without modification.
# ( auth types supported: "basic"-http "user/pass"-socks )
#
[ProxyList]
# add proxy here ...
# meanwile
# meanwhile
# defaults set to "tor"
socks4 127.0.0.1 9050