Skip to main content


Enhancing Network Scanning with ProxyChains in Ethical Hacking
ProxyChains is a powerful tool that enhances the capabilities of ethical hackers and penetration testers by allowing them to conduct network scans through dynamic tunnels. In this article, we'll explore how to pivot through a SOCKS4 proxy using ProxyChains and demonstrate its application in network scanning with Nmap.

Configuring ProxyChains for Dynamic Tunneling
Before diving into network scanning, let's add our SOCKS4 proxy to the ProxyChains configuration file. The configuration file is typically located at /etc/proxychains.conf
You can view and edit it using a text editor like nano or cat:

kali@kali:~$ cat /etc/proxychains.conf
# add proxy here ...
# meanwhile
# defaults set to "tor"
socks4 8080

Here, we've added a SOCKS4 proxy at Adjust the configuration based on your proxy setup.

Dynamic Tunneling with Nmap
Now, let's utilize ProxyChains to scan a target machine through a dynamic tunnel. In this example, we'll replace the IP address with <TARGET IP>:

sudo proxychains nmap --top-ports=20 -sT -Pn <TARGET IP>

This command tells Nmap to scan the top 20 ports of the specified target through the SOCKS4 proxy configured in ProxyChains. The -sT flag specifies a TCP connect scan, and -Pn skips host discovery since we already know the target.

Configuring ProxyChains for Versatility
By default, ProxyChains reads its configuration file from various locations, giving us the flexibility to run tools through multiple dynamic tunnels. The order of preference is:

    1. Current directory

    2. User's $(HOME)/.proxychains directory
    3. /etc/proxychains.conf

This flexibility allows ethical hackers to adapt their tunneling configurations based on specific testing requirements.