-
-
Save x0341/a54df43a69b0552c54dca90ed42d280f to your computer and use it in GitHub Desktop.
VirtualBox and ToR transparent proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------- | |
#TOR CONFIGURATION: | |
# transparent tor: | |
#TransPort 9040 | |
#TransListenAddress 10.0.0.1 | |
#DNSPort 53 | |
#DNSListenAddress 10.0.0.1 | |
----------------------------------------------- | |
#!/bin/sh | |
HR="--------------------------------" | |
echo Creating Virtual Interface $HR | |
ifname=`sudo tunctl -u 1000| grep -o tap[0-9]` | |
sudo ifconfig $ifname up | |
sudo ifconfig $ifname 10.0.0.1/24 | |
echo Enabling ToR $BR | |
rc.d start tor | |
echo Creating IP Tables Rules $HR | |
# Tor's TransPort | |
TRANS_PORT="9040" | |
INT_IF="tap0" | |
sudo iptables -F | |
sudo iptables -t nat -F | |
sudo iptables -t nat -A PREROUTING -i $INT_IF -p udp --dport 53 -j REDIRECT --to-ports 53 | |
sudo iptables -t nat -A PREROUTING -i $INT_IF -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT | |
echo Starting up VirtualBox $HR | |
# Run virtual and block | |
VirtualBox | |
echo Deleting Virtual Interface $HR | |
tunctl -d $ifname | |
echo Deleting IP Tables Rules $HR | |
sudo iptables -t nat -A PREROUTING -i $INT_IF -p udp --dport 53 -j REDIRECT --to-ports 53 | |
sudo iptables -t nat -A PREROUTING -i $INT_IF -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment