Skip to content

Instantly share code, notes, and snippets.

@socrateslee
Created December 23, 2023 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save socrateslee/63c0d86effcca91b0fcb300375129d5a to your computer and use it in GitHub Desktop.
Save socrateslee/63c0d86effcca91b0fcb300375129d5a to your computer and use it in GitHub Desktop.
Use proxychains in wsl
#!/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 $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment