rofl0r / microsocks

tiny, portable SOCKS5 server with very moderate resource usage
Other
1.48k stars 266 forks source link

microsocks and proxychains-ng in combo? #19

Closed HeyJoe57 closed 5 years ago

HeyJoe57 commented 5 years ago

I want to run a proxy server on a local machine that will accept traffic and route whatever it gets through a chain of proxies. I figured this would work:

$ ./proxychains4 -f ./proxychains.conf microsocks [proxychains] config file found: ./proxychains-testing.conf [proxychains] preloading ./libproxychains4.dylib [proxychains] DLL init: proxychains-ng 4.14 server_setup: Invalid argument

But clearly it doesn't. Should it?

Both microsocks and proxychains4 work independently. Running on MacOS 10.14.1.

rofl0r commented 5 years ago

do you have strace on mac ? if so, running strace -f ./proxychains4 -f ./proxychains.conf microsocks could shed some light on what is going wrong. in particular the line containing EINVAL.

HeyJoe57 commented 5 years ago

There's no strace but there is dtrace/dtruss. The invalid argument appears to be in a call to bind:

Here's where it fails: $ tail -20 dtruss.output-withproxychains open_nocancel("/etc/.mdns_debug\0", 0x0, 0x0) = -1 Err#2 issetugid(0x0, 0x0, 0x0) = 0 0 issetugid(0x0, 0x0, 0x0) = 0 0 proc_info(0x2, 0x1774B, 0x11) = 56 0 proc_info(0x2, 0x1774B, 0x11) = 56 0 issetugid(0x0, 0x0, 0x0) = 0 0 openat(0xFFFFFFFFFFFFFFFE, "/Library/Preferences/Logging/com.apple.diagnosticd.filter.plist\0", 0x1000104, 0xFFFFFFFFEE0F79E0) = -1 Err#2 open("/private/tmp/./microsocks\0", 0x8004, 0x5788BDFA) = 7 0 fcntl(0x7, 0x32, 0x7FFEEE0F7430) = 0 0 close(0x7) = 0 0 open_nocancel("/etc/services\0", 0x0, 0x1B6) = 7 0 fstat64(0x7, 0x7FFEEE0F6DF8, 0x0) = 0 0 close_nocancel(0x7) = 0 0 socket(0x2, 0x1, 0x0) = 7 0 setsockopt(0x7, 0xFFFF, 0x4) = 0 0 bind(0x7, 0x7FE97BE00060, 0x80) = -1 Err#22 close(0x7) = 0 0 writev_nocancel(0x2, 0x7FFEEE0F9F90, 0x4) = 31 0 select(0x4, 0x70000D7BECD8, 0x0, 0x0, 0x0) = -1 Err#4

For comparison, here's microsocks without proxychains: $ tail -20 dtruss.output-normal mprotect(0x104B3F000, 0x1000, 0x1) = 0 0 mprotect(0x104B2D000, 0x90, 0x3) = 0 0 mprotect(0x104B2D000, 0x90, 0x1) = 0 0 getentropy(0x7FFEEB0D7B20, 0x20, 0x0) = 0 0 getpid(0x0, 0x0, 0x0) = 96061 0 stat64("/AppleInternal\0", 0x7FFEEB0D8630, 0x0) = -1 Err#2 csops(0x1773D, 0x7, 0x7FFEEB0D8160) = -1 Err#22 proc_info(0x2, 0x1773D, 0xD) = 64 0 csops(0x1773D, 0x7, 0x7FFEEB0D79B0) = -1 Err#22 sigaction(0xD, 0x7FFEEB0D9848, 0x7FFEEB0D9870) = 0 0 shm_open(0x7FFF57842CD8, 0x0, 0x0) = 3 0 mmap(0x0, 0x1000, 0x1, 0x1, 0x3, 0x0) = 0x104B40000 0 close_nocancel(0x3) = 0 0 open_nocancel("/etc/.mdns_debug\0", 0x0, 0x0) = -1 Err#2 socket(0x2, 0x1, 0x6) = 3 0 setsockopt(0x3, 0xFFFF, 0x4) = 0 0 bind(0x3, 0x7F9CBBD00520, 0x10) = 0 0 listen(0x3, 0x80, 0x0) = 0 0 accept(0x3, 0x7FFEEB0D9900, 0x7FFEEB0D987C) = -1 Err#4

(The second one was exited with ^C, hence the interrupted system call there.)

rofl0r commented 5 years ago

thanks, i pushed a fix to proxychains-ng repo. could you try whether it fixes the issue?

HeyJoe57 commented 5 years ago

It works. Thanks!

rofl0r commented 5 years ago

great, thanks for reporting&testing!