Compare commits

..

No commits in common. "master" and "2-2.1" have entirely different histories.

2 changed files with 21 additions and 49 deletions

View file

@ -23,7 +23,7 @@ toriptables2.py -l
* [Check My IPx](https://ipx.ac/) * [Check My IPx](https://ipx.ac/)
* [Check Tor Project](https://check.torproject.org) * [Check Tor Project](https://check.torproject.org)
* [Do I leak](https://www.doileak.com/classic.html) * [Do I leak](http://www.doileak.com/)
* [DNS leak test](http://dnsleaktest.com) * [DNS leak test](http://dnsleaktest.com)
* [Test IPv6](http://ipv6-test.com/) * [Test IPv6](http://ipv6-test.com/)
* [What is my proxy](http://whatismyproxy.com) * [What is my proxy](http://whatismyproxy.com)
@ -34,14 +34,9 @@ toriptables2.py -l
--- ---
#### To change Tor IP address: #### To change Tor IP address:
<details><summary>Expand for change Tor IP</summary>
<br>
```bash ```bash
toriptables2.py -r toriptables2.py -r
``` ```
</details>
--- ---
#### To automate changing Tor IP: #### To automate changing Tor IP:
@ -73,42 +68,18 @@ toriptables2.py -r
#### Dependencies: #### Dependencies:
Install [python-notify](http://ftp.br.debian.org/debian/pool/main/n/notify-python/python-notify_0.1.1-4_amd64.deb)
```bash ```bash
apt install tor apt install tor
``` ```
***
#### Screenshots: #### Screenshots:
<details><summary>Expand for screenshots</summary>
<br>
* [Kali Linux, Rolling Edition [ON]](https://drive.google.com/open?id=0B79r4wTVj-CZSEdkaTBNOVc5aUU) * [Kali Linux, Rolling Edition [ON]](https://drive.google.com/open?id=0B79r4wTVj-CZSEdkaTBNOVc5aUU)
* [Kali Linux, Rolling Edition [OFF]](https://drive.google.com/file/d/1NPZ1SKI9rh9XkaplF2_DzHSoPL77aiy-/view?usp=sharing) * [Kali Linux, Rolling Edition [OFF]](https://drive.google.com/file/d/1NPZ1SKI9rh9XkaplF2_DzHSoPL77aiy-/view?usp=sharing)
</details> </details>
***
#### Usage Demo:
<details><summary>Exapand for notification demo</summary>
<br>
* [Kali Linux, Rolling Edition [Demo]](https://drive.google.com/file/d/1kWdp8ciWTX5onuinR-3DjYKgcTFh9QJM/view?usp=sharing)
</details>
</details>
--- ---
# [toriptables3](https://github.com/ruped24/toriptables3)
<details><summary>Expand for toriptables3</summary>
<br>
Upgrade to [toriptables3](https://github.com/ruped24/toriptables3/releases/tag/v3.0) the successor to [toriptables2](https://github.com/ruped24/toriptables2/releases/tag/2-2.1).
</details>
---
### [Installation Methods](https://github.com/ruped24/toriptables2/wiki/Optional-Installation-methods-for-toriptables2.py) ### [Installation Methods](https://github.com/ruped24/toriptables2/wiki/Optional-Installation-methods-for-toriptables2.py)
### [Troubleshooting and FAQ](https://github.com/ruped24/toriptables2/wiki/Troubleshooting) ### [Troubleshooting and FAQ](https://github.com/ruped24/toriptables2/wiki/Troubleshooting)

View file

@ -1,4 +1,4 @@
#! /usr/bin/env python3 #! /usr/bin/env python2
# Written by Rupe version 2.1 # Written by Rupe version 2.1
# #
""" """
@ -7,15 +7,16 @@ that sets up iptables and tor to route all services
and traffic including DNS through the tor network. and traffic including DNS through the tor network.
""" """
from subprocess import call, check_call, getoutput, CalledProcessError from __future__ import print_function
from commands import getoutput
from subprocess import call, check_call, CalledProcessError
from os.path import isfile, basename from os.path import isfile, basename
from os import devnull from os import devnull
from sys import exit, stdout, stderr from sys import stdout, stderr
from atexit import register from atexit import register
from argparse import ArgumentParser from argparse import ArgumentParser
from json import load from json import load
from urllib.request import urlopen from urllib2 import urlopen, URLError
from urllib.error import URLError
from time import sleep from time import sleep
@ -53,15 +54,15 @@ DNSPort %s
fnull = open(devnull, 'w') fnull = open(devnull, 'w')
try: try:
tor_restart = check_call( tor_restart = check_call(
["systemctl", "restart", "tor"], ["service", "tor", "restart"],
stdout=fnull, stderr=fnull) stdout=fnull, stderr=fnull)
if tor_restart == 0: if tor_restart is 0:
print((" {0}".format( print(" {0}".format(
"[\033[92m+\033[0m] Anonymizer status \033[92m[ON]\033[0m"))) "[\033[92m+\033[0m] Anonymizer status \033[92m[ON]\033[0m"))
self.get_ip() self.get_ip()
except CalledProcessError as err: except CalledProcessError as err:
print(("\033[91m[!] Command failed: %s\033[0m" % ' '.join(err.cmd))) print("\033[91m[!] Command failed: %s\033[0m" % ' '.join(err.cmd))
# See https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy#WARNING # See https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy#WARNING
# See https://lists.torproject.org/pipermail/tor-talk/2014-March/032503.html # See https://lists.torproject.org/pipermail/tor-talk/2014-March/032503.html
@ -95,8 +96,8 @@ DNSPort %s
call(["iptables", "-A", "OUTPUT", "-j", "REJECT"]) call(["iptables", "-A", "OUTPUT", "-j", "REJECT"])
def get_ip(self): def get_ip(self):
print((" {0}".format( print(" {0}".format(
"[\033[92m*\033[0m] Getting public IP, please wait..."))) "[\033[92m*\033[0m] Getting public IP, please wait..."))
retries = 0 retries = 0
my_public_ip = None my_public_ip = None
while retries < 12 and not my_public_ip: while retries < 12 and not my_public_ip:
@ -108,12 +109,12 @@ DNSPort %s
print(" [\033[93m?\033[0m] Still waiting for IP address...") print(" [\033[93m?\033[0m] Still waiting for IP address...")
except ValueError: except ValueError:
break break
print() print
if not my_public_ip: if not my_public_ip:
my_public_ip = getoutput('wget -qO - ifconfig.me') my_public_ip = getoutput('wget -qO - ifconfig.me')
if not my_public_ip: if not my_public_ip:
exit(" \033[91m[!]\033[0m Can't get public ip address!") exit(" \033[91m[!]\033[0m Can't get public ip address!")
print((" {0}".format("[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))) print(" {0}".format("[\033[92m+\033[0m] Your IP is \033[92m%s\033[0m" % my_public_ip))
if __name__ == '__main__': if __name__ == '__main__':
@ -149,8 +150,8 @@ if __name__ == '__main__':
load_tables.load_iptables_rules() load_tables.load_iptables_rules()
elif args.flush: elif args.flush:
load_tables.flush_iptables_rules() load_tables.flush_iptables_rules()
print((" {0}".format( print(" {0}".format(
"[\033[93m!\033[0m] Anonymizer status \033[91m[OFF]\033[0m"))) "[\033[93m!\033[0m] Anonymizer status \033[91m[OFF]\033[0m"))
elif args.ip: elif args.ip:
load_tables.get_ip() load_tables.get_ip()
elif args.refresh: elif args.refresh:
@ -159,4 +160,4 @@ if __name__ == '__main__':
else: else:
parser.print_help() parser.print_help()
except Exception as err: except Exception as err:
print(("[!] Run as super user: %s" % err)) print("[!] Run as super user: %s" % err[1])