emergency commit
parent
d2d60fe6ce
commit
cb3de7056c
|
@ -57,6 +57,7 @@ class OnionrCommunicate:
|
||||||
def sendPeerProof(self, peerID, data):
|
def sendPeerProof(self, peerID, data):
|
||||||
'''This function sends the proof result to a peer previously fetched with getPeerProof'''
|
'''This function sends the proof result to a peer previously fetched with getPeerProof'''
|
||||||
return
|
return
|
||||||
|
|
||||||
shouldRun = False
|
shouldRun = False
|
||||||
debug = False
|
debug = False
|
||||||
developmentMode = False
|
developmentMode = False
|
||||||
|
|
|
@ -36,7 +36,7 @@ class NetController:
|
||||||
def generateTorrc(self):
|
def generateTorrc(self):
|
||||||
if os.path.exists(self.torConfigLocation):
|
if os.path.exists(self.torConfigLocation):
|
||||||
os.remove(self.torConfigLocation)
|
os.remove(self.torConfigLocation)
|
||||||
torrcData = '''SOCKSPORT ''' + str(self.socksPort) + '''
|
torrcData = '''SocksPort ''' + str(self.socksPort) + '''
|
||||||
HiddenServiceDir data/hs/
|
HiddenServiceDir data/hs/
|
||||||
HiddenServicePort 80 127.0.0.1:''' + str(self.hsPort) + '''
|
HiddenServicePort 80 127.0.0.1:''' + str(self.hsPort) + '''
|
||||||
'''
|
'''
|
||||||
|
@ -46,11 +46,16 @@ HiddenServicePort 80 127.0.0.1:''' + str(self.hsPort) + '''
|
||||||
return
|
return
|
||||||
|
|
||||||
def startTor(self):
|
def startTor(self):
|
||||||
|
'''Start Tor with onion service on port 80 & socks proxy on random port
|
||||||
|
'''
|
||||||
self.generateTorrc()
|
self.generateTorrc()
|
||||||
tor = subprocess.Popen(['tor', '-f', self.torConfigLocation], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
tor = subprocess.Popen(['tor', '-f', self.torConfigLocation], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
# wait for tor to get to 100% bootstrap
|
||||||
for line in iter(tor.stdout.readline, b''):
|
for line in iter(tor.stdout.readline, b''):
|
||||||
if 'Bootstrapped 100%: Done' in line.decode():
|
if 'Bootstrapped 100%: Done' in line.decode():
|
||||||
break
|
break
|
||||||
|
elif 'Opening Socks listener' in line.decode():
|
||||||
|
print(line.decode())
|
||||||
print('Finished starting Tor')
|
print('Finished starting Tor')
|
||||||
self.readyState = True
|
self.readyState = True
|
||||||
myID = open('data/hs/hostname', 'r')
|
myID = open('data/hs/hostname', 'r')
|
||||||
|
|
|
@ -118,10 +118,12 @@ class Onionr:
|
||||||
def daemon(self):
|
def daemon(self):
|
||||||
''' Start the Onionr communication daemon
|
''' Start the Onionr communication daemon
|
||||||
'''
|
'''
|
||||||
|
colors = Colors()
|
||||||
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
if not os.environ.get("WERKZEUG_RUN_MAIN") == "true":
|
||||||
net = NetController(self.config['CLIENT']['PORT'])
|
net = NetController(self.config['CLIENT']['PORT'])
|
||||||
print('Tor is starting...')
|
print('Tor is starting...')
|
||||||
net.startTor()
|
net.startTor()
|
||||||
|
print(colors.GREEN + 'Started Tor .onion service: ' + colors.UNDERLINE + net.myID + colors.RESET)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
subprocess.Popen(["./communicator.py", "run"])
|
subprocess.Popen(["./communicator.py", "run"])
|
||||||
print('Started communicator')
|
print('Started communicator')
|
||||||
|
|
Loading…
Reference in New Issue