Advertisement
Guest User

torroute.sh

a guest
Mar 18th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Orange Pi TOR ethernet router, also works with Raspberry Pi
  4. # Requires a usb to ethernet adapter as shown here
  5. # https://www.bitchute.com/video/jTVLs2mDaTWS/
  6. #
  7. # https://www.bitchute.com/channel/mechatroniac/
  8. #
  9. # If you find this useful please deposit half your life's savings to this Monero account:
  10. #
  11. # 44HwLi3kBw5DkF32D6DjjQ64W3uqqLT5dYjpQr4vHuZMX7zPYnwLeFbBrB46zL9E21NTQSeNa93B9dSLR9EpwXKdCvK2JBV
  12. #
  13. # modified from https://github.com/arpitjindal97/raspbian-recipes/blob/master/wifi-to-eth-route.sh
  14. #
  15. #
  16. #
  17. # This script is created to work with Raspbian Stretch
  18. # but it can be used with most of the distributions
  19. # by making few changes.
  20. #
  21. # Make sure you have already installed `dnsmasq`
  22. # Please modify the variables according to your need
  23. # Don't forget to change the name of network interface
  24. # Check them with `ifconfig`
  25.  
  26. #hide our mac addresses(optional)
  27. sudo ifconfig enx00e04c534458 down
  28. sudo macchanger -r enx00e04c534458
  29. sudo ifconfig enx00e04c534458 up
  30.  
  31. sudo ifconfig eth0 down
  32. sudo macchanger -r eth0
  33. sudo ifconfig eth0 up
  34.  
  35.  
  36. ip_address="192.168.2.1"
  37. netmask="255.255.255.0"
  38. dhcp_range_start="192.168.2.2"
  39. dhcp_range_end="192.168.2.100"
  40. dhcp_time="12h"
  41. eth="eth0"
  42. #eth1="eth1"
  43. #replace enx00e04c534458 with your 2nd interface, find it with 'sudo ifconfig'
  44. eth1="enx00e04c534458"
  45.  
  46. sudo systemctl start network-online.target &> /dev/null
  47.  
  48. sudo iptables -F
  49. sudo iptables -t nat -F
  50.  
  51. #TOR routing, comment the following two lines out with #'s to disable TOR
  52. sudo iptables -t nat -A PREROUTING -i $eth -p udp --dport 53 -j REDIRECT --to-ports 53
  53. sudo iptables -t nat -A PREROUTING -i $eth -p tcp --syn -j REDIRECT --to-ports 9040
  54.  
  55.  
  56. sudo iptables -t nat -A POSTROUTING -o $eth1 -j MASQUERADE
  57. sudo iptables -A FORWARD -i $eth1 -o $eth -m state --state RELATED,ESTABLISHED -j ACCEPT
  58. sudo iptables -A FORWARD -i $eth -o $eth1 -j ACCEPT
  59. sudo iptables -A INPUT -i $eth -p tcp -m tcp --dport 22 -m start --start NEW -j ACCEPT
  60.  
  61. sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
  62.  
  63. sudo ifconfig $eth $ip_address netmask $netmask
  64.  
  65. # Remove default route created by dhcpcd
  66. sudo ip route del 0/0 dev $eth &> /dev/null
  67.  
  68. sudo systemctl stop dnsmasq
  69.  
  70. sudo rm -rf /etc/dnsmasq.d/* &> /dev/null
  71.  
  72. echo -e "interface=$eth\n\
  73. bind-interfaces\n\
  74. #put in your DNS server below if this doesn't work or if you don't know one you can use 1.1.1.1 or 8.8.8.8
  75. server=176.103.130.130\n\
  76. server=45.33.97.5\n\
  77. #server=1.1.1.1\n\
  78. domain-needed\n\
  79. bogus-priv\n\
  80. dhcp-range=$dhcp_range_start,$dhcp_range_end,$dhcp_time" > /tmp/custom-dnsmasq.conf
  81.  
  82. sudo cp /tmp/custom-dnsmasq.conf /etc/dnsmasq.d/custom-dnsmasq.conf
  83. sudo systemctl start dnsmasq
  84. sudo service tor start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement