Skip to content

Instantly share code, notes, and snippets.

@mushonnip
Last active October 9, 2022 16:44
Show Gist options
  • Save mushonnip/00bde36340bedd6bd45f39933be034eb to your computer and use it in GitHub Desktop.
Save mushonnip/00bde36340bedd6bd45f39933be034eb to your computer and use it in GitHub Desktop.
badvpn-tun2socks accept proxy from mobile hotspot
#!/bin/sh
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
setup_tap_and_route(){
sudo ifconfig tun0 10.0.0.1 netmask 255.255.255.0
if route | grep tun0; then
sudo route add default gw 10.0.0.2 metric 6
fi
}
run_badvpn(){
sudo badvpn-tun2socks --tundev tun0 --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 192.168.43.1:7380 --udpgw-remote-server-addr 127.0.0.1:7380 --loglevel 0 &
setup_tap_and_route
}
if pidof badvpn-tun2socks; then
printf "${YELLOW}badvpn-tun2socks is already running, killing it...${NC}\n"
sudo killall badvpn-tun2socks
fi
if sudo ip tuntap add dev tun0 mode tun user abu; then
echo "tap device added"
fi
run_badvpn
printf "${GREEN}badvpn-tun2socks is running${NC}\n"%
tasklist /fi "IMAGENAME eq badvpn-tun2socks.exe" /fo csv 2>NUL | find /I "badvpn-tun2socks.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /im badvpn-tun2socks.exe /t /f
badvpn-tun2socks.exe --tundev "tap0901:Ethernet 2:10.0.0.1:10.0.0.0:255.255.255.0" --netif-ipaddr 10.0.0.2 --netif-netmask 255.255.255.0 --socks-server-addr 192.168.43.1:1080 --udpgw-remote-server-addr 127.0.0.1:7380 --loglevel 0 &
route add 0.0.0.0 mask 0.0.0.0 10.0.0.2 metric 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment