From 0f8581b399b63ed8214011d8d6d902b1d2d1a9b8 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 18 Aug 2018 14:38:15 -0500 Subject: [PATCH 1/2] fixed crash in mail --- onionr/static-data/default-plugins/pms/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index 300c9625..27f56438 100644 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -108,6 +108,7 @@ class OnionrMail: except KeyError: pass else: + cancel = '' readBlock.verifySig() print('Message recieved from %s' % (readBlock.signer,)) print('Valid signature:', readBlock.validSig) From 9d827493e40dbf295a7b6b10f0595cede861c8d7 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 18 Aug 2018 23:07:09 -0500 Subject: [PATCH 2/2] + v3 onion config + use newer ubuntu --- Dockerfile | 4 ++-- onionr/communicator2.py | 2 ++ onionr/netcontroller.py | 9 +++++++-- onionr/onionrcrypto.py | 4 ++++ onionr/onionrutils.py | 4 +++- onionr/static-data/default_config.json | 2 +- 6 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90f16342..c83de87d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM ubuntu:xenial +FROM ubuntu:bionic #Base settings ENV HOME /root #Install needed packages -RUN apt update && apt install -y python3 python3-dev python3-pip tor locales +RUN apt update && apt install -y python3 python3-dev python3-pip tor locales nano RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ locale-gen diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 42be9e45..38ba2692 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -318,6 +318,8 @@ class OnionrCommunicatorDaemon: self.addBootstrapListToPeerList(peerList) for address in peerList: + if not config.get('tor.v3onions') and len(address) == 62: + continue if len(address) == 0 or address in tried or address in self.onlinePeers: continue if self.shutdown: diff --git a/onionr/netcontroller.py b/onionr/netcontroller.py index 19f355e4..3749ce7a 100644 --- a/onionr/netcontroller.py +++ b/onionr/netcontroller.py @@ -18,7 +18,7 @@ along with this program. If not, see . ''' -import subprocess, os, random, sys, logger, time, signal +import subprocess, os, random, sys, logger, time, signal, config from onionrblockapi import Block class NetController: @@ -33,6 +33,7 @@ class NetController: self.hsPort = hsPort self._torInstnace = '' self.myID = '' + config.reload() ''' if os.path.exists(self.torConfigLocation): torrc = open(self.torConfigLocation, 'r') @@ -47,11 +48,15 @@ class NetController: ''' Generate a torrc file for our tor instance ''' - + hsVer = '# v2 onions' + if config.get('tor.v3onions'): + hsVer = 'HiddenServiceVersion 3' + logger.info('Using v3 onions :)') if os.path.exists(self.torConfigLocation): os.remove(self.torConfigLocation) torrcData = '''SocksPort ''' + str(self.socksPort) + ''' HiddenServiceDir data/hs/ +\n''' + hsVer + '''\n HiddenServicePort 80 127.0.0.1:''' + str(self.hsPort) + ''' DataDirectory data/tordata/ ''' diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py index 40dca90f..00c5a604 100644 --- a/onionr/onionrcrypto.py +++ b/onionr/onionrcrypto.py @@ -247,6 +247,10 @@ class OnionrCrypto: return result def sha3Hash(self, data): + try: + data = data.encode() + except AttributeError: + pass hasher = hashlib.sha3_256() hasher.update(data) return hasher.hexdigest() diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 7e0abd94..951f546a 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -43,7 +43,7 @@ class OnionrUtils: self.avoidDupe = [] # list used to prevent duplicate requests per peer for certain actions self.peerProcessing = {} # dict of current peer actions: peer, actionList - + config.reload() return def getTimeBypassToken(self): @@ -128,6 +128,8 @@ class OnionrUtils: for adder in newAdderList.split(','): adder = adder.strip() if not adder in self._core.listAdders(randomOrder = False) and adder != self.getMyAddress() and not self._core._blacklist.inBlacklist(adder): + if not config.get('tor.v3onions') and len(address) == 62: + continue if self._core.addAddress(adder): logger.info('Added %s to db.' % adder, timestamp = True) retVal = True diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index fcbf733e..5458db4a 100644 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -41,7 +41,7 @@ }, "tor" : { - + "v3onions": false }, "i2p":{