diff --git a/.dockerignore b/.dockerignore
old mode 100644
new mode 100755
diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/.gitmodules b/.gitmodules
old mode 100644
new mode 100755
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
old mode 100644
new mode 100755
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
old mode 100644
new mode 100755
diff --git a/Dockerfile b/Dockerfile
old mode 100644
new mode 100755
diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md
old mode 100644
new mode 100755
diff --git a/LICENSE.txt b/LICENSE.txt
old mode 100644
new mode 100755
diff --git a/Makefile b/Makefile
old mode 100644
new mode 100755
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/docs/api.md b/docs/api.md
old mode 100644
new mode 100755
diff --git a/docs/onionr-logo.png b/docs/onionr-logo.png
old mode 100644
new mode 100755
diff --git a/docs/onionr-logo.png~ b/docs/onionr-logo.png~
old mode 100644
new mode 100755
diff --git a/docs/onionr-web.png b/docs/onionr-web.png
old mode 100644
new mode 100755
diff --git a/docs/tor-stinks-02.png b/docs/tor-stinks-02.png
old mode 100644
new mode 100755
diff --git a/docs/whitepaper.md b/docs/whitepaper.md
old mode 100644
new mode 100755
diff --git a/onionr/apimanager.py b/onionr/apimanager.py
deleted file mode 100644
index 44737097..00000000
--- a/onionr/apimanager.py
+++ /dev/null
@@ -1,75 +0,0 @@
-'''
- Onionr - P2P Anonymous Storage Network
-
- Handles api data exchange, interfaced by both public and client http api
-'''
-'''
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-'''
-import config, apipublic, apiprivate, core, socket, random, threading, time
-config.reload()
-
-PRIVATE_API_VERSION = 0
-PUBLIC_API_VERSION = 1
-
-DEV_MODE = config.get('general.dev_mode')
-
-def getOpenPort():
- '''Get a random open port'''
- p = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- p.bind(("127.0.0.1",0))
- p.listen(1)
- port = p.getsockname()[1]
- p.close()
- return port
-
-def getRandomLocalIP():
- '''Get a random local ip address'''
- hostOctets = [str(127), str(random.randint(0x02, 0xFF)), str(random.randint(0x02, 0xFF)), str(random.randint(0x02, 0xFF))]
- host = '.'.join(hostOctets)
- return host
-
-class APIManager:
- def __init__(self, coreInst):
- assert isinstance(coreInst, core.Core)
- self.core = coreInst
- self.utils = coreInst._utils
- self.crypto = coreInst._crypto
-
- # if this gets set to true, both the public and private apis will shutdown
- self.shutdown = False
-
- publicIP = '127.0.0.1'
- privateIP = '127.0.0.1'
- if DEV_MODE:
- # set private and local api servers bind IPs to random localhost (127.x.x.x), make sure not the same
- privateIP = getRandomLocalIP()
- while True:
- publicIP = getRandomLocalIP()
- if publicIP != privateIP:
- break
-
- # Make official the IPs and Ports
- self.publicIP = publicIP
- self.privateIP = privateIP
- self.publicPort = config.get('client.port', 59496)
- self.privatePort = config.get('client.port', 59496)
-
- # Run the API servers in new threads
- self.publicAPI = apipublic.APIPublic(self)
- self.privateAPI = apiprivate.APIPrivate(self)
- threading.Thread(target=self.publicAPI.run).start()
- threading.Thread(target=self.privateAPI.run).start()
- while not self.shutdown:
- time.sleep(1)
\ No newline at end of file
diff --git a/onionr/apiprivate.py b/onionr/apiprivate.py
deleted file mode 100644
index 7f62b9d5..00000000
--- a/onionr/apiprivate.py
+++ /dev/null
@@ -1,32 +0,0 @@
-'''
- Onionr - P2P Anonymous Storage Network
-
- Handle incoming commands from the client. Intended for localhost use
-'''
-'''
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-'''
-import flask, apimanager
-from flask import request, Response, abort, send_from_directory
-from gevent.pywsgi import WSGIServer
-
-class APIPrivate:
- def __init__(self, managerInst):
- assert isinstance(managerInst, apimanager.APIManager)
- self.app = flask.Flask(__name__) # The flask application, which recieves data from the greenlet wsgiserver
- self.httpServer = WSGIServer((managerInst.privateIP, managerInst.privatePort), self.app, log=None)
-
- def run(self):
- self.httpServer.serve_forever()
- return
\ No newline at end of file
diff --git a/onionr/apipublic.py b/onionr/apipublic.py
deleted file mode 100644
index 9308f50a..00000000
--- a/onionr/apipublic.py
+++ /dev/null
@@ -1,41 +0,0 @@
-'''
- Onionr - P2P Anonymous Storage Network
-
- Handle incoming commands from other Onionr nodes, over HTTP
-'''
-'''
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-'''
-import flask, apimanager
-from flask import request, Response, abort, send_from_directory
-from gevent.pywsgi import WSGIServer
-
-
-class APIPublic:
- def __init__(self, managerInst):
- assert isinstance(managerInst, apimanager.APIManager)
- app = flask.Flask(__name__)
- @app.route('/')
- def banner():
- try:
- with open('static-data/index.html', 'r') as html:
- resp = Response(html.read(), mimetype='text/html')
- except FileNotFoundError:
- resp = Response("")
- return resp
- self.httpServer = WSGIServer((managerInst.publicIP, managerInst.publicPort), app)
-
- def run(self):
- self.httpServer.serve_forever()
- return
diff --git a/onionr/blockimporter.py b/onionr/blockimporter.py
old mode 100644
new mode 100755
diff --git a/onionr/config.py b/onionr/config.py
old mode 100644
new mode 100755
diff --git a/onionr/core.py b/onionr/core.py
old mode 100644
new mode 100755
index 8634ab1f..47f0e1ad
--- a/onionr/core.py
+++ b/onionr/core.py
@@ -56,7 +56,7 @@ class Core:
self.privateApiHostFile = self.dataDir + 'private-host.txt'
self.addressDB = self.dataDir + 'address.db'
self.hsAddress = ''
- self.i2pAddress = config.get('i2p.ownAddr', None)
+ self.i2pAddress = config.get('i2p.own_addr', None)
self.bootstrapFileLocation = 'static-data/bootstrap-nodes.txt'
self.bootstrapList = []
self.requirements = onionrvalues.OnionrValues()
diff --git a/onionr/dbcreator.py b/onionr/dbcreator.py
old mode 100644
new mode 100755
diff --git a/onionr/dependencies/secrets.py b/onionr/dependencies/secrets.py
old mode 100644
new mode 100755
diff --git a/onionr/etc/onionrvalues.py b/onionr/etc/onionrvalues.py
old mode 100644
new mode 100755
diff --git a/onionr/etc/pgpwords.py b/onionr/etc/pgpwords.py
old mode 100644
new mode 100755
diff --git a/onionr/keymanager.py b/onionr/keymanager.py
old mode 100644
new mode 100755
diff --git a/onionr/logger.py b/onionr/logger.py
old mode 100644
new mode 100755
diff --git a/onionr/netcontroller.py b/onionr/netcontroller.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrblacklist.py b/onionr/onionrblacklist.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrblockapi.py b/onionr/onionrblockapi.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrdaemontools.py b/onionr/onionrdaemontools.py
old mode 100644
new mode 100755
index faea0070..d64a69ff
--- a/onionr/onionrdaemontools.py
+++ b/onionr/onionrdaemontools.py
@@ -43,37 +43,43 @@ class DaemonTools:
else:
peer = self.daemon.pickOnlinePeer()
- ourID = self.daemon._core.hsAddress.strip()
-
- url = 'http://' + peer + '/announce'
- data = {'node': ourID}
-
- combinedNodes = ourID + peer
- existingRand = self.daemon._core.getAddressInfo(peer, 'powValue')
- if type(existingRand) is type(None):
- existingRand = ''
-
- if peer in self.announceCache:
- data['random'] = self.announceCache[peer]
- elif len(existingRand) > 0:
- data['random'] = existingRand
- else:
- proof = onionrproofs.DataPOW(combinedNodes, forceDifficulty=4)
- try:
- data['random'] = base64.b64encode(proof.waitForResult()[1])
- except TypeError:
- # Happens when we failed to produce a proof
- logger.error("Failed to produce a pow for announcing to " + peer)
- announceFail = True
+ for x in range(1):
+ if x == 1 and self.daemon._core.config.get('i2p.host'):
+ ourID = self.daemon._core.config.get('i2p.own_addr').strip()
else:
- self.announceCache[peer] = data['random']
- if not announceFail:
- logger.info('Announcing node to ' + url)
- if self.daemon._core._utils.doPostRequest(url, data) == 'Success':
- logger.info('Successfully introduced node to ' + peer)
- retData = True
- self.daemon._core.setAddressInfo(peer, 'introduced', 1)
- self.daemon._core.setAddressInfo(peer, 'powValue', data['random'])
+ ourID = self.daemon._core.hsAddress.strip()
+
+ url = 'http://' + peer + '/announce'
+ data = {'node': ourID}
+
+ combinedNodes = ourID + peer
+ if ourID != 1:
+ #TODO: Extend existingRand for i2p
+ existingRand = self.daemon._core.getAddressInfo(peer, 'powValue')
+ if type(existingRand) is type(None):
+ existingRand = ''
+
+ if peer in self.announceCache:
+ data['random'] = self.announceCache[peer]
+ elif len(existingRand) > 0:
+ data['random'] = existingRand
+ else:
+ proof = onionrproofs.DataPOW(combinedNodes, forceDifficulty=4)
+ try:
+ data['random'] = base64.b64encode(proof.waitForResult()[1])
+ except TypeError:
+ # Happens when we failed to produce a proof
+ logger.error("Failed to produce a pow for announcing to " + peer)
+ announceFail = True
+ else:
+ self.announceCache[peer] = data['random']
+ if not announceFail:
+ logger.info('Announcing node to ' + url)
+ if self.daemon._core._utils.doPostRequest(url, data) == 'Success':
+ logger.info('Successfully introduced node to ' + peer)
+ retData = True
+ self.daemon._core.setAddressInfo(peer, 'introduced', 1)
+ self.daemon._core.setAddressInfo(peer, 'powValue', data['random'])
self.daemon.decrementThreadCount('announceNode')
return retData
diff --git a/onionr/onionrevents.py b/onionr/onionrevents.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrexceptions.py b/onionr/onionrexceptions.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrpeers.py b/onionr/onionrpeers.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrpluginapi.py b/onionr/onionrpluginapi.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrplugins.py b/onionr/onionrplugins.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrsockets.py b/onionr/onionrsockets.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrstorage.py b/onionr/onionrstorage.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrusers.py b/onionr/onionrusers.py
old mode 100644
new mode 100755
diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py
old mode 100644
new mode 100755
diff --git a/onionr/serializeddata.py b/onionr/serializeddata.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/bootstrap-nodes.txt b/onionr/static-data/bootstrap-nodes.txt
old mode 100644
new mode 100755
diff --git a/onionr/static-data/connect-check.txt b/onionr/static-data/connect-check.txt
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/cliui/info.json b/onionr/static-data/default-plugins/cliui/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/cliui/main.py b/onionr/static-data/default-plugins/cliui/main.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/encrypt/info.json b/onionr/static-data/default-plugins/encrypt/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/encrypt/main.py b/onionr/static-data/default-plugins/encrypt/main.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/flow/info.json b/onionr/static-data/default-plugins/flow/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/flow/main.py b/onionr/static-data/default-plugins/flow/main.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/metadataprocessor/info.json b/onionr/static-data/default-plugins/metadataprocessor/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/metadataprocessor/main.py b/onionr/static-data/default-plugins/metadataprocessor/main.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pluginmanager/.gitignore b/onionr/static-data/default-plugins/pluginmanager/.gitignore
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pluginmanager/LICENSE b/onionr/static-data/default-plugins/pluginmanager/LICENSE
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pluginmanager/README.md b/onionr/static-data/default-plugins/pluginmanager/README.md
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pluginmanager/info.json b/onionr/static-data/default-plugins/pluginmanager/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pluginmanager/main.py b/onionr/static-data/default-plugins/pluginmanager/main.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pms/info.json b/onionr/static-data/default-plugins/pms/info.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py
old mode 100644
new mode 100755
index 35b85519..7c971df3
--- a/onionr/static-data/default-plugins/pms/main.py
+++ b/onionr/static-data/default-plugins/pms/main.py
@@ -141,7 +141,11 @@ class OnionrMail:
logger.warn('This message has an INVALID signature. ANYONE could have sent this message.')
cancel = logger.readline('Press enter to continue to message, or -q to not open the message (recommended).')
if cancel != '-q':
- print(draw_border(self.myCore._utils.escapeAnsi(readBlock.bcontent.decode().strip())))
+ try:
+ print(draw_border(self.myCore._utils.escapeAnsi(readBlock.bcontent.decode().strip())))
+ except ValueError:
+ logger.warn('Error presenting message. This is usually due to a malformed or blank message.')
+ pass
reply = logger.readline("Press enter to continue, or enter %s to reply" % ("-r",))
if reply == "-r":
self.draftMessage(self.myCore._utils.bytesToStr(readBlock.signer,))
diff --git a/onionr/static-data/default-plugins/pms/sentboxdb.py b/onionr/static-data/default-plugins/pms/sentboxdb.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json
old mode 100644
new mode 100755
index b6cb3145..eeefe49a
--- a/onionr/static-data/default_config.json
+++ b/onionr/static-data/default_config.json
@@ -21,8 +21,7 @@
"private" : {
"run" : true,
"path" : "static-data/www/private/",
- "guess_mime" : true,
- "timing_protection" : true
+ "guess_mime" : true
},
"ui" : {
diff --git a/onionr/static-data/default_plugin.py b/onionr/static-data/default_plugin.py
old mode 100644
new mode 100755
diff --git a/onionr/static-data/header.txt b/onionr/static-data/header.txt
old mode 100644
new mode 100755
diff --git a/onionr/static-data/index.html b/onionr/static-data/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/board/board.js b/onionr/static-data/www/board/board.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/board/index.html b/onionr/static-data/www/board/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/board/theme.css b/onionr/static-data/www/board/theme.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/mail/index.html b/onionr/static-data/www/mail/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/mail/mail.css b/onionr/static-data/www/mail/mail.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/mail/mail.js b/onionr/static-data/www/mail/mail.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/private/index.html b/onionr/static-data/www/private/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/main/stats.js b/onionr/static-data/www/shared/main/stats.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/main/style.css b/onionr/static-data/www/shared/main/style.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/misc.js b/onionr/static-data/www/shared/misc.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/onionr-icon.png b/onionr/static-data/www/shared/onionr-icon.png
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/onionrblocks.js b/onionr/static-data/www/shared/onionrblocks.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/shared/panel.js b/onionr/static-data/www/shared/panel.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/README.md b/onionr/static-data/www/ui/README.md
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/default-icon.html b/onionr/static-data/www/ui/common/default-icon.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/footer.html b/onionr/static-data/www/ui/common/footer.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/header.html b/onionr/static-data/www/ui/common/header.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/onionr-reply-creator.html b/onionr/static-data/www/ui/common/onionr-reply-creator.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/onionr-timeline-post.html b/onionr/static-data/www/ui/common/onionr-timeline-post.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/onionr-timeline-reply-creator.html b/onionr/static-data/www/ui/common/onionr-timeline-reply-creator.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/common/onionr-timeline-reply.html b/onionr/static-data/www/ui/common/onionr-timeline-reply.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/config.json b/onionr/static-data/www/ui/config.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/css/main.css b/onionr/static-data/www/ui/dist/css/main.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/css/themes/dark.css b/onionr/static-data/www/ui/dist/css/themes/dark.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/img/default.png b/onionr/static-data/www/ui/dist/img/default.png
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/index.html b/onionr/static-data/www/ui/dist/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/js/main.js b/onionr/static-data/www/ui/dist/js/main.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/dist/js/timeline.js b/onionr/static-data/www/ui/dist/js/timeline.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/lang.json b/onionr/static-data/www/ui/lang.json
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/css/main.css b/onionr/static-data/www/ui/src/css/main.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/css/themes/dark.css b/onionr/static-data/www/ui/src/css/themes/dark.css
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/img/default.png b/onionr/static-data/www/ui/src/img/default.png
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/index.html b/onionr/static-data/www/ui/src/index.html
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/js/main.js b/onionr/static-data/www/ui/src/js/main.js
old mode 100644
new mode 100755
diff --git a/onionr/static-data/www/ui/src/js/timeline.js b/onionr/static-data/www/ui/src/js/timeline.js
old mode 100644
new mode 100755
diff --git a/onionr/storagecounter.py b/onionr/storagecounter.py
old mode 100644
new mode 100755
diff --git a/requirements.txt b/requirements.txt
old mode 100644
new mode 100755
diff --git a/run-windows.bat b/run-windows.bat
old mode 100644
new mode 100755