1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2026-05-13 17:03:07 +08:00

Compare commits

..

2 Commits

  • Preserve dnat mapping when used with localnet.
    This allows using proxychains as a means of just changing the
    destination IP and port of network traffic similar to iptables DNAT
    without the need for root permissions.
    
    Example usage:
    
    localnet 127.0.0.0/8
    dnat 1.1.1.1:1234 127.0.0.1:8123
    
    This will redirect traffic to 1.1.1.1 on port 1234 to 127.0.0.1:8123.
4 changed files with 6 additions and 14 deletions
-9
View File
@@ -263,15 +263,6 @@ Known Problems:
there are unconfirmed reports that it works as root though.
musl libc is unaffected from the bug.
Useful links
------------
the following sites may prove useful to check for leaks:
https://ipfighter.com/
https://browserleaks.com/webrtc
https://dnsleaktest.com
http://check.torproject.org - tor specific
http://ifconfig.me - can be used via curl
http://ifconfig.io/
Community:
----------
Vendored
+1 -3
View File
@@ -182,7 +182,6 @@ ishaiku() {
check_compile 'whether C compiler works' '' 'int main() {return 0;}' || fail 'error: install a C compiler and library'
check_compile 'whether libc headers are complete' '' '#include <netdb.h>\nint main() {return 0;}' || fail 'error: necessary libc headers are not installed'
check_compile 'whether C compiler understands -Wno-unknown-pragmas' '-Wno-unknown-pragmas' 'int main() {return 0;}'
check_compile 'whether C compiler understands -Werror=implicit-function-declaration' '-Werror=implicit-function-declaration' 'int main() {return 0;}'
if ! check_compile 'whether getnameinfo() servlen argument is POSIX compliant (socklen_t)' "-DGN_NODELEN_T=socklen_t -DGN_SERVLEN_T=socklen_t -DGN_FLAGS_T=int" \
'#define _GNU_SOURCE\n#include <netdb.h>\nint getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);int main() {\nreturn 0;}' ; then
@@ -221,7 +220,6 @@ check_define __APPLE__ && {
fi
}
check_define __FreeBSD__ && bsd_detected=true
check_define __NetBSD__ && bsd_detected=true
check_define __OpenBSD__ && {
bsd_detected=true
echo "CFLAGS+=-DIS_OPENBSD">>config.mak
@@ -251,7 +249,7 @@ check_link "whether we can use -Wl,--no-as-needed" "-Wl,--no-as-needed" \
LD_SONAME_FLAG=
printf "checking what's the option to use in linker to set library name ... "
for o in --soname -h -soname -install_name; do
check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(void) {}" && LD_SONAME_FLAG=$o && break
check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(int a) {}" && LD_SONAME_FLAG=$o && break
done
if [ -z "$LD_SONAME_FLAG" ]; then
printf '\ncannot find an option to set library name\n'
-1
View File
@@ -5,7 +5,6 @@
*/
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <unistd.h>
#define _POSIX_C_SOURCE 200809L
+5 -1
View File
@@ -241,7 +241,7 @@ static int proxy_from_string(const char *proxystring,
ul = p-u;
p++;
pl = at-p;
if(ul > 255 || pl > 255)
if(proxytype == RS_PT_SOCKS5 && (ul > 255 || pl > 255))
return 0;
memcpy(user_buf, u, ul);
user_buf[ul]=0;
@@ -745,6 +745,10 @@ HOOKFUNC(int, connect, int sock, const struct sockaddr *addr, unsigned int len)
if((p_addr_in->s_addr ^ localnet_addr[i].in_addr.s_addr) & localnet_addr[i].in_mask.s_addr)
continue;
}
if (!v6 && dnat) {
memcpy(&((struct sockaddr_in *) addr)->sin_addr, p_addr_in, sizeof(*p_addr_in));
((struct sockaddr_in *) addr)->sin_port = htons(port);
}
PDEBUG("accessing localnet using true_connect\n");
return true_connect(sock, addr, len);
}