shunf4 / proxychains-windows

Windows and Cygwin port of proxychains, based on MinHook and DLL Injection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get to use it on Cygwin

Saya47 opened this issue · comments

Hello! I hope you're doing great!
Here's what I did:

mv proxychains.conf /etc/
mv proxychains_cygwin_x64.exe /usr/bin/proxychains.exe
mv proxychains_helper_cygwin_x64.exe /usr/bin/
mv cygproxychains_hook_x64.dll /usr/bin/

chmod 755 /usr/bin/proxychains.exe
chmod 755 /usr/bin/cygproxychains_hook_x64.dll
chmod 755 /usr/bin/proxychains_helper_cygwin_x64.exe
chmod 644 /etc/proxychains.conf

setfacl -b /usr/bin/proxychains.exe
setfacl -b /usr/bin/cygproxychains_hook_x64.dll
setfacl -b /usr/bin/proxychains_helper_cygwin_x64.exe
setfacl -b /etc/proxychains.conf

ls -al /usr/bin/*proxychains*
ls -al /etc/proxychains.conf

But I get this error no matter what:

[E] 2023/01/17 10:02:00 Error reading hosts file: The system cannot read from the specified device.(30)
Error: The system cannot read from the specified device.(30)

I tried running it as Admin as well, but to no avail.
How can I get this to work?
Thanks very much!

Try

cat /etc/hosts
ls -l /etc/hosts

/etc/hosts should be a symlink that points to your Win32 system's hosts file.

Try

cat /etc/hosts
ls -l /etc/hosts

/etc/hosts should be a symlink that points to your Win32 system's hosts file.

Hello @shunf4 , thanks for replying!
Here's the results:

$ cat /etc/hosts
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost

And:

$ ls -l /etc/hosts
lrwxrwxrwx 1 S None 46 Jul 27  2018 /etc/hosts -> /cygdrive/c/Windows/System32/drivers/etc/hosts

Have you provided custom hosts file path in the configuration file?

I have not, I am using the default config that comes with the release, I only added a proxy address and port at the end.
And I got the error above, so I tried comparing it to the config that comes with proxychains3, so I commented a lot of lines and tried this one as well:

strict_chain
remote_dns_subnet 224
localnet 127.0.0.0/255.0.0.0
 
log_level 600
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 localhost 2080

Would you mind sharing your hosts file (as attachment file)?

Meanwhile, trim the hosts file (removing unnecessary lines, changing line break type, or creating a new file from scratch etc) and see if it fixes the issue.

ahh I see, the file has an issue! I created a new file on desktop and used custom hosts path and the proxychains worked! But when I copied the hosts file from C:\Windows\System32\drivers\etc to my desktop, even when I removed all lines inside it, it still gave the above error!

Thanks very much for helping me!
hosts.zip

Your hosts file starts with UTF-8 Signature (BOM), but that should've been correctly handled since version 0.6.5.

Are you using the latest version (0.6.8) of proxychains?

Yes I actually only found out this repository today! And downloaded the latest version.

I used your hosts file by specifying custom hosts path, and the problem wasn't reproduced.

$ md5sum /cygdrive/c/Users/shunf4/Downloads/hosts
9c6a0bf13d68274c0e3d2ab05beca9f9 */cygdrive/c/Users/shunf4/Downloads/hosts

$ proxychainsd.exe curl ipinfo.io
[I] 2023/01/17 21:18:36 Configuration file: /home/shunf4/.proxychains/proxychains.conf
[...]
[D] 2023/01/17 21:18:36 HostsFilePath: /cygdrive/c/Users/shunf4/Downloads/hosts
[...]
[D] 2023/01/17 21:18:36 [HostsEntry] Offset: 14412, sizeof(): 644, Length: 0
[...]
[D] 2023/01/17 21:18:36 Main Program Hooked!
[...]

That's weird I'm on:
Proxychains.exe Cygwin 64-bit Release 0.6.8 - proxifier for Win32 and Cygwin.
I even removed all lines on the hosts file and the issue still happens, I bundled the exe and dll file and the hosts file here:
Downloads.zip