A WSL distro changes its IP and gateway address every time it restarts, so using proxychains would be a painful experience because the proxychains config file can not use domain names. The proxy runs on the host, forwarding traffic to a remote server.
So a script to dynamically generate proxychains config file would be helpful.
#!/bin/bash | |
# wsl's host ip address may change every time it reboots, | |
# this is a problem if you map your host address as proxy. | |
# Use the script to generate a new config of proxychains | |
# each time proxychains runs. | |
# put an entry | |
# http wsl-host 3128 | |
# in your /etc/proxychains.conf | |
# Copy the script as ./local/bin/wsl-proxychains.sh | |
# run your program with proxychains like | |
# wsl-proxychains.sh <YOUR PROGRAM> | |
gateway=`ip route|grep default|grep eth0|cut -d' ' -f 3` | |
sed "s/wsl-host/${gateway}/g" /etc/proxychains4.conf > /tmp/proxychains.conf | |
proxychains -f /tmp/proxychains.conf $@ |
Top comments (0)