work on adding peers, updated readme

This commit is contained in:
Kevin Froman 2018-01-12 03:06:24 -06:00
parent 0c6d1ed790
commit 084b2425e9
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
3 changed files with 17 additions and 2 deletions

4
api.py
View File

@ -42,6 +42,7 @@ class API:
bindPort = int(self.config['CLIENT']['PORT']) bindPort = int(self.config['CLIENT']['PORT'])
self.bindPort = bindPort self.bindPort = bindPort
self.clientToken = self.config['CLIENT']['CLIENT HMAC'] self.clientToken = self.config['CLIENT']['CLIENT HMAC']
print(self.clientToken)
if not debug: if not debug:
hostNums = [random.randint(1, 255), random.randint(1, 255), random.randint(1, 255)] hostNums = [random.randint(1, 255), random.randint(1, 255), random.randint(1, 255)]
@ -99,6 +100,7 @@ class API:
requestingPeer = request.args.get('myID') requestingPeer = request.args.get('myID')
if action == 'firstConnect': if action == 'firstConnect':
pass pass
@app.errorhandler(404) @app.errorhandler(404)
@ -130,7 +132,7 @@ class API:
if not request.host.endswith('onion') and not request.hosst.endswith('i2p'): if not request.host.endswith('onion') and not request.hosst.endswith('i2p'):
abort(403) abort(403)
# Validate x-requested-with, to protect against CSRF/metadata leaks # Validate x-requested-with, to protect against CSRF/metadata leaks
if self._developmentMode: if not self._developmentMode:
try: try:
request.headers['x-requested-with'] request.headers['x-requested-with']
except: except:

View File

@ -19,5 +19,15 @@ import core
class OnionrCommunicate: class OnionrCommunicate:
def __init__(self): def __init__(self):
return return
def getKey(self, peerID):
'''This function contacts a peer and gets their main PGP key.
This is safe because Tor or I2P is used, but it does not insure that the person is who they say they are
'''
url = 'http://' + peerID + '/public/?action=getPGP'
r = requests.get(url, headers=headers)
response = r.text
return response
OnionrCommunicate() OnionrCommunicate()

View File

@ -2,8 +2,11 @@
P2P microblogging platform and social network, using Tor & I2P. P2P microblogging platform and social network, using Tor & I2P.
Major work in progress. *NOT USABLE OR SAFE YET* Major work in progress.
***THIS SOFTWARE IS NOT USABLE OR SAFE YET.***
# Development # Development
This software is in heavy development. If for some reason you want to get involved, get in touch first.