adaption for slackware and using personal ident service

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-11-15 14:44:46 -05:00
parent f06f5622f4
commit f84a3a4f79
Signed by: vbatts
GPG key ID: 10937E57733F1362

View file

@ -28,7 +28,7 @@ class TorIptables(object):
self.local_loopback = "127.0.0.1" # Local loopback self.local_loopback = "127.0.0.1" # Local loopback
self.non_tor_net = ["192.168.0.0/16", "172.16.0.0/12"] self.non_tor_net = ["192.168.0.0/16", "172.16.0.0/12"]
self.non_tor = ["127.0.0.0/9", "127.128.0.0/10", "127.0.0.0/8"] self.non_tor = ["127.0.0.0/9", "127.128.0.0/10", "127.0.0.0/8"]
self.tor_uid = getoutput("id -ur debian-tor") # Tor user uid self.tor_uid = getoutput("id -ur tor") # Tor user uid
self.trans_port = "9040" # Tor port self.trans_port = "9040" # Tor port
self.tor_config_file = '/etc/tor/torrc' self.tor_config_file = '/etc/tor/torrc'
self.torrc = r''' self.torrc = r'''
@ -54,7 +54,7 @@ DNSPort %s
fnull = open(devnull, 'w') fnull = open(devnull, 'w')
try: try:
tor_restart = check_call( tor_restart = check_call(
["service", "tor", "restart"], ["/etc/rc.d/rc.tor", "restart"],
stdout=fnull, stderr=fnull) stdout=fnull, stderr=fnull)
if tor_restart is 0: if tor_restart is 0:
@ -67,7 +67,7 @@ DNSPort %s
while retries < 12 and not my_public_ip: while retries < 12 and not my_public_ip:
retries += 1 retries += 1
try: try:
my_public_ip = load(urlopen('http://ident.me/.json'))['address'] my_public_ip = load(urlopen('http://ip.thisco.de/json'))['ip']
except URLError: except URLError:
sleep(5) sleep(5)
print(" [\033[93m?\033[0m] Still waiting for IP address...") print(" [\033[93m?\033[0m] Still waiting for IP address...")