1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-09 23:02:52 +08:00
Commit Graph

95 Commits

Author SHA1 Message Date
hugoc
5660aea02e remove send_udp_packet() 2024-02-01 17:53:11 +01:00
hugoc
436f402f1e fix sockaddr / sockaddr_storage confusion 2024-02-01 17:24:36 +01:00
hugoc
44c4352d72 removed receive_udp_packet() 2024-01-17 12:48:20 +01:00
hugoc
120cfe96be comments 2024-01-17 10:34:41 +01:00
hugoc
23c9654cf8 hook connect and getpeername 2024-01-16 16:00:30 +01:00
hugoc
95036aac7b sendmmsg and fixes 2024-01-03 15:31:08 +01:00
hugoc
f3511f80a6 dig works 2023-12-13 02:22:20 +01:00
hugoc
8ed4b52140 separate functions, add utils, hook recvmsg 2023-12-12 00:27:51 +01:00
hugoc
4c75e059d9 implements udp reception and fixes 2023-12-10 16:05:19 +01:00
hugoc
560613256a add read_udp_header() 2023-11-29 01:13:01 +01:00
hugoc
68180a6b66 bug fixes 2023-09-11 13:22:16 +02:00
hugoc
8348e42608 udp wip 2 2023-09-08 16:42:54 +02:00
hugoc
2c5ad9f81a udp wip 2023-09-08 16:42:54 +02:00
rofl0r
66f99b19dd improve DNS failure handling with old proxyresolv method
should fix #493
2023-03-08 15:05:06 +00:00
Vladimir Panteleev
6abeb53e69 proxy_getaddrinfo(): Fill in ai_socktype if requested
If the application specifies a protocol but not a socket type,
normally getaddrinfo will select a corresponding protocol.

Mimic this behavior in our implementation of the function as well.
We only care about the case we're actually able to proxify
(SOCK_STREAM / IPPROTO_TCP).

Fixes proxifying pssh.
2022-01-22 20:05:47 +00:00
rofl0r
918855deed proxy_getaddrinfo(): debug: print hints->ai_flags 2021-02-05 01:50:39 +00:00
Alexandre Viau
159ab94635
support 'raw' proxy type (#348) 2020-12-12 08:25:36 +00:00
rofl0r
13680e775d proxy_gethostbyname_old(): fix omission of namebuffer population 2020-10-28 11:12:36 +00:00
rofl0r
55dce2c040 proxy_gethostbyname_old(): fix returned address type 2020-10-28 11:12:36 +00:00
rofl0r
82c766461c proxy_gethostbyname_old(): likewise. 2020-10-28 11:12:36 +00:00
rofl0r
59e8d1710a proxy_gethostbyname(): fix failure to omit DNS lookup for ipv4 addrs
gethostbyname() is specified to transform simple numeric ipv4 addresses
into their binary form. since proxy_gethostbyname() was used as a
backend for all resolver functions, somehow we assumed the check for
an ipv4 was done from another site, however this didn't hold true when
the caller used gethostbyname() directly.

fixes #347
2020-10-28 11:12:17 +00:00
rofl0r
486f8200ad tunnel_to: shrink huge buffer size
the buffer buff was only used for the initial handshake packets,
which in all supported protocols are usual less than a 100 bytes,
with user/pass and dns name at maximum we'd require 768 bytes,
which still leaves us a formidable 256 bytes for the rest of
the packet.
this fixes a segfault with microsocks which on musl uses tiny
thread stack sizes of 8KB.
2020-10-26 03:03:08 +00:00
rofl0r
c99d97983e shrink huge gethostbyname buffer
careful analysis has shown that the buffer is only ever used for
at most a single hostname, so 256 bytes are sufficient.
the huge 8KB buffer caused stack overflow when used with microsocks,
which defaults to tiny thread stacks of 8KB with musl libc.
2020-10-26 02:53:29 +00:00
rofl0r
7fe8139496 experimental new feature: proxy_dns_daemon
since many users complain about issues with modern, ultracomplex
clusterfuck software such as chromium, nodejs, etc, i've reconsidered
one of my original ideas how to implement remote dns lookup support.
instead of having a background thread serving requests via a pipe,
the user manually starts a background daemon process before running
proxychains, and the two processes then communicate via UDP.
this requires much less hacks (like hooking of close() to prevent
pipes from getting closed) and doesn't need to call any async-signal
unsafe code like malloc(). this means it should be much more compatible
than the previous method, however it's not as practical and slightly
slower.

it's recommended that the proxychains4-daemon runs on localhost, and
if you use proxychains-ng a lot you might want to set ip up as a service
that starts on boot. a single proxychains4-daemon should theoretically
be able to serve many parallel proxychains4 instances, but this has not
yet been tested so far. it's also possible to run the daemon on other
computers, even over internet, but currently there is no error-checking/
timeout code at all; that means the UDP connection needs to be very
stable.

the library code used for the daemon sources are from my projects
libulz[0] and htab[1], and the server code is loosely based on
microsocks[2]. their licenses are all compatible with the GPL.
if not otherwise mentioned, they're released for this purpose under
the standard proxychains-ng license (see COPYING).

[0]: https://github.com/rofl0r/libulz
[1]: https://github.com/rofl0r/htab
[2]: https://github.com/rofl0r/microsocks
2020-09-23 22:14:39 +01:00
rofl0r
1e00b9ac1e get rid of ip_type.c 2020-09-23 17:00:16 +01:00
rofl0r
e6c4764660 proxy_dns_old: use pipe2 if available, else O_CLOEXEC
make the old code a little less lame
2020-09-21 10:46:38 +01:00
rofl0r
2ab631918d add support for "proxy_dns_old" to use old 3.1 DNS lookup method
some lamer on IRC by the name of annoner/R3M0RS3/penis was complaining
that 3.1 is a lot better than proxychains-ng, because it happens to
work with the browser he's interested in.
since this wasn't the first time this is requested, let's give this
those lamers what they want: lame code!
2020-09-20 22:11:17 +01:00
rofl0r
3e791fd797 make sure allocator thread is only used if proxy_dns is requested 2020-09-20 18:21:40 +01:00
rofl0r
962373e5c6 getaddrinfo: fix behaviour when node is null and !passive
according to the spec, if these 2 conditions hold, the name shall
resolve to localhost.

closes #292
2019-07-21 14:27:55 +01:00
rofl0r
de4460fbd1 proxy_getaddrinfo: don't use sizeof(struct sockaddr_storage) for addr_len
this should fix an issue which seems to be mac's bind() only accepting
sizeof(struct sockaddr_in) for AF_INET.

ref: https://github.com/rofl0r/microsocks/issues/19
2019-05-25 02:23:38 +01:00
rofl0r
5ad7c2a183 proxy_getaddrinfo: implement support for numeric ipv6
closes #282
2019-04-25 14:36:08 +01:00
rofl0r
5c8f9a2922 shrink huge log buffer 2019-02-28 13:22:13 +00:00
rofl0r
49bf4ba772 replace getservbyname_r ifdef hacks with configure check
this should make it work automatically on any new platform without
having to add yet another ifdef hack.
should fix issues with android (#265).
additionally the code for the systems lacking GNU-compatible getservbyname_r()
is now guarded with a mutex, which prevents possible races, therefore
resolving the ancient "TODO" item.
2018-12-02 13:48:43 +00:00
amyangfei
eb36238c8a remove unused variable 2018-08-26 06:18:20 +01:00
amyangfei
275e64499e Fix select_proxy dead loop in round_roubin_chain
Fix issue #147.
If all proxies are in DOWN_STATE or BUSY_STATE state, select_proxy will run
forever in an infinite loop. When all proxies are not available, we wait some
intervals and retry. The wait time starts with 10 milliseconds and is
increased by 10 milliiseconds in each loop. 14 loops sums up with 1.05 second.
2018-08-23 12:40:27 +01:00
rofl0r
49d8ac9338 accept proper RFC1929 auth subnegotiation version field
this was wrongly fixed in 06c20ed394

instead of reverting we now accept the correct version
(version field containing 1) plus the incorrect version (5) given by some
proxyservers in the wild. curl accepts both forms too.

closing #224
addressing #221
2018-05-29 18:59:30 +01:00
rofl0r
06c20ed394 fix socks5 username/password auth
the version field in the auth check needs to be 5, not 1.

closes #221
2018-02-11 14:59:27 +00:00
WHR
35a674bdbc configure: Solaris detection, ld 'soname' option auto detection; other Solaris related fixes 2018-01-11 00:45:40 +08:00
Antonio Quartulli
46647bee44 fix memory leak
don't leak variable 'space' when the host is numeric

Signed-off-by: Antonio Quartulli <a@unstable.cc>
2017-08-28 15:19:43 +01:00
rofl0r
bf6eeff75a check snprintf return value for error 2016-12-20 22:18:21 +00:00
Carlos Maddela
5ed5089733 Avoid using %n$ operand number formats to compile cleanly with ISO C. 2016-12-13 20:27:56 +00:00
Carlos Maddela
0bd2130352 Fix spelling in log message: doesnt -> doesn't 2016-12-05 14:10:09 +11:00
forkbomber
cf9a16de06 core.c: add HOST header to each CONNECT request
fixes #92
closes #93
2016-10-16 19:43:00 +00:00
Jay Taylor
0f6b226b15 Fix random_chain on Mac OS X
On Mac OS X, random chain was broken and returned always the last proxy from the
config file.  Use fix as suggested by @ravomavain.

Closes #75.
2016-10-14 21:49:01 +00:00
rofl0r
2237749567 preliminary ipv6 support
only basic testing was done (with 2 socks5 proxies listening on ::1)
but seems to work as intended.

ipv6 support for the hostsreader (/etc/hosts) is not implemented so far.
2015-08-10 17:00:26 +01:00
rofl0r
9969dd3a22 fix socks5 bug: always requested user auth cap
since "user" always points to a statically allocated string buffer,
the test for if(user)... was bogus.
use ulen instead.

this bug should only be visible on socks servers that require auth
if username was not passed, so it was probably not really an issue.
2015-06-14 12:10:32 +01:00
rofl0r
ae16ae9fc9 remove commented-out code 2015-06-14 09:57:05 +01:00
rofl0r
338b9ce4e3 whitespace fixes for proxytype switch block 2015-06-13 20:32:15 +01:00
rofl0r
c6553c2cc5 replace string manip. in HTTP setup code with single snprintf 2015-06-13 20:21:59 +01:00
rofl0r
49adb6ce29 simplify socks5 buffer setup code 2015-06-13 19:02:11 +01:00