From 137d6f39dd5fe81d73f1e481500a6b85ab577577 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 9 Mar 2019 00:37:57 -0600 Subject: [PATCH] refactoring, work on friends ui, bug fixes and whitepaper work --- .gitmodules | 0 README.md | 8 ++++++-- docs/whitepaper.md | 14 +++++++------- onionr/onionr.py | 2 +- onionr/onionrcommands/__init__.py | 1 - onionr/onionrcommands/daemonlaunch.py | 20 ++++++++++++++++++++ onionr/onionrcommands/keyadders.py | 22 +++++++++++++++++++--- onionr/onionrcommands/plugincommands.py | 20 ++++++++++++++++++++ onionr/onionrutils.py | 4 ++++ onionr/static-data/www/friends/friends.js | 3 +++ onionr/static-data/www/friends/index.html | 6 ++++++ onionr/static-data/www/friends/style.css | 10 ++++++++++ 12 files changed, 96 insertions(+), 14 deletions(-) delete mode 100755 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100755 index e69de29b..00000000 diff --git a/README.md b/README.md index 3a4ab52d..119f5567 100755 --- a/README.md +++ b/README.md @@ -61,7 +61,9 @@ The following applies to Ubuntu Bionic. Other distros may have different package * Have python3.6+, python3-pip, Tor (daemon, not browser) installed (python3-dev recommended) * Clone the git repo: `$ git clone https://gitlab.com/beardog/onionr` * cd into install direction: `$ cd onionr/` -* Install the Python dependencies ([virtualenv strongly recommended](https://virtualenv.pypa.io/en/stable/userguide/)): `$ pip3 install -r requirements.txt` +* Install the Python dependencies ([virtualenv strongly recommended](https://virtualenv.pypa.io/en/stable/userguide/)): `$ pip3 install --require-hashes -r requirements.txt` + +(--require-hashes is intended to prevent exploitation via compromise of Pypi/CA certificates) ## Help out @@ -94,6 +96,8 @@ beardog [ at ] mailbox.org ## Disclaimer -The Tor Project, I2P developers, and anyone else do not own, create, or endorse this project, and are not otherwise involved. +The Tor Project and I2P developers do not own, create, or endorse this project, and are not otherwise involved. + +Tor is a trademark for the Tor Project. We do not own it. The 'open source badge' is by Maik Ellerbrock and is licensed under a Creative Commons Attribution 4.0 International License. \ No newline at end of file diff --git a/docs/whitepaper.md b/docs/whitepaper.md index 66bddad6..29f23bed 100755 --- a/docs/whitepaper.md +++ b/docs/whitepaper.md @@ -1,25 +1,25 @@

- <h1>Onionr</h1> + <h1>Onionr</h1>

Anonymous, Decentralized, Distributed Network

# Introduction -One of the most important things in the modern world is information. The ability to communicate freely with others is crucial for maintaining societal and personal liberty. The internet has provided humanity with the ability to spread information globally, but there are many people who try (and sometimes succeed) to stifle the flow of information. +We believe that the ability to communicate freely with others is crucial for maintaining societal and personal liberty. The internet has provided humanity with the ability to spread information globally, but there are many persons and organizations who try to stifle the flow of information, sometimes with success. Internet censorship comes in many forms, state censorship, corporate consolidation of media, threats of violence, network exploitation (e.g. denial of service attacks) and other threats. -To prevent censorship and loss of information, these measures must be in place: +We hold that in order to protect individual privacy, users must have the ability to communicate anonymously and with decentralization. + +We believe that in order to prevent censorship and loss of information, these measures must be in place: * Resistance to censorship of underlying infrastructure or of particular network hosts * Anonymization of users by default - * The Inability to coerce human users (personal threats/"doxxing", or totalitarian regime censorship) + * The Inability to coerce users (personal threats/"doxxing", or totalitarian regime censorship) * Economic availability. A system should not rely on a single device to be constantly online, and should not be overly expensive to use. The majority of people in the world own cell phones, but comparatively few own personal computers, particularly in developing countries. Internet connectivity can be slow or spotty in many areas. -There are many great projects that tackle decentralization and privacy issues, but there are none which tackle all of the above issues. Some of the existing networks have also not worked well in practice, or are more complicated than they need to be. - # Onionr Design Goals When designing Onionr we had these main goals in mind: @@ -131,4 +131,4 @@ We seek to protect the following information: We assume that Tor onion services (v3) and I2P services cannot be trivially deanonymized, and that the underlying cryptographic primitives we employ cannot be broken in any manner faster than brute force unless a quantum computer is used. -Once quantum safe algorithms are more mature and have relatively high level libraries, they will be deployed. +Once quantum safe algorithms are more mature and have decent high level libraries, they will be deployed. diff --git a/onionr/onionr.py b/onionr/onionr.py index fb9d7f20..3dff5cc3 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -156,7 +156,7 @@ class Onionr: with open('static-data/header.txt', 'rb') as file: # only to stdout, not file or log or anything sys.stderr.write(file.read().decode().replace('P', logger.colors.fg.pink).replace('W', logger.colors.reset + logger.colors.bold).replace('G', logger.colors.fg.green).replace('\n', logger.colors.reset + '\n').replace('B', logger.colors.bold).replace('A', '%s' % API_VERSION).replace('V', ONIONR_VERSION)) - logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n') + logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n', sensitive=True) def doExport(self, bHash): exportDir = self.dataDir + 'block-export/' diff --git a/onionr/onionrcommands/__init__.py b/onionr/onionrcommands/__init__.py index 35de3107..2889f182 100644 --- a/onionr/onionrcommands/__init__.py +++ b/onionr/onionrcommands/__init__.py @@ -122,7 +122,6 @@ def get_commands(onionr_inst): 'importblocks': onionr_inst.onionrUtils.importNewBlocks, 'introduce': onionr_inst.onionrCore.introduceNode, - 'connect': onionr_inst.addAddress, 'pex': onionr_inst.doPEX, 'getpassword': onionr_inst.printWebPassword, diff --git a/onionr/onionrcommands/daemonlaunch.py b/onionr/onionrcommands/daemonlaunch.py index b7452a46..b5334068 100644 --- a/onionr/onionrcommands/daemonlaunch.py +++ b/onionr/onionrcommands/daemonlaunch.py @@ -1,3 +1,23 @@ +''' + Onionr - P2P Anonymous Storage Network + + launch the api server and communicator +''' +''' + 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 os, time, sys, platform, sqlite3 from threading import Thread import onionr, api, logger, communicator diff --git a/onionr/onionrcommands/keyadders.py b/onionr/onionrcommands/keyadders.py index 5004afb3..48374fb9 100644 --- a/onionr/onionrcommands/keyadders.py +++ b/onionr/onionrcommands/keyadders.py @@ -1,6 +1,22 @@ -import sys -import logger +''' + Onionr - P2P Anonymous Storage Network + add keys (transport and pubkey) +''' +''' + 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 . +''' def add_peer(o_inst): try: newPeer = sys.argv[2] @@ -25,7 +41,7 @@ def add_address(o_inst): pass else: logger.info("Adding address: " + logger.colors.underline + newAddress) - if self.onionrCore.addAddress(newAddress): + if o_inst.onionrCore.addAddress(newAddress): logger.info("Successfully added address.") else: logger.warn("Unable to add address.") \ No newline at end of file diff --git a/onionr/onionrcommands/plugincommands.py b/onionr/onionrcommands/plugincommands.py index 5978f039..c357956f 100644 --- a/onionr/onionrcommands/plugincommands.py +++ b/onionr/onionrcommands/plugincommands.py @@ -1,3 +1,23 @@ +''' + Onionr - P2P Anonymous Storage Network + + plugin CLI commands +''' +''' + 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 sys import logger, onionrplugins as plugins diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index a5cfdc84..f3d47b73 100755 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -415,12 +415,14 @@ class OnionrUtils: This function is intended to scan for new blocks ON THE DISK and import them ''' blockList = self._core.getBlockList() + exist = False if scanDir == '': scanDir = self._core.blockDataLocation if not scanDir.endswith('/'): scanDir += '/' for block in glob.glob(scanDir + "*.dat"): if block.replace(scanDir, '').replace('.dat', '') not in blockList: + exist = True logger.info('Found new block on dist %s' % block) with open(block, 'rb') as newBlock: block = block.replace(scanDir, '').replace('.dat', '') @@ -430,6 +432,8 @@ class OnionrUtils: self._core._utils.processBlockMetadata(block) else: logger.warn('Failed to verify hash for %s' % block) + if not exist: + print('No blocks found to import') def progressBar(self, value = 0, endvalue = 100, width = None): ''' diff --git a/onionr/static-data/www/friends/friends.js b/onionr/static-data/www/friends/friends.js index c18da68b..71f20f98 100755 --- a/onionr/static-data/www/friends/friends.js +++ b/onionr/static-data/www/friends/friends.js @@ -72,6 +72,9 @@ fetch('/friends/list', { entry.appendChild(removeButton) entry.appendChild(nameText) friendListDisplay.appendChild(entry) + entry.onclick = (function(entry, nameText, peer) {return function() { + overlay('friendInfo') + };})(entry, nameText, peer); } // If friend delete buttons are pressed diff --git a/onionr/static-data/www/friends/index.html b/onionr/static-data/www/friends/index.html index 3d214274..ebcbff7e 100755 --- a/onionr/static-data/www/friends/index.html +++ b/onionr/static-data/www/friends/index.html @@ -11,6 +11,12 @@ +
+
+ + +
+
Onionr Web Control Panel diff --git a/onionr/static-data/www/friends/style.css b/onionr/static-data/www/friends/style.css index 663c4b4e..46affdd9 100755 --- a/onionr/static-data/www/friends/style.css +++ b/onionr/static-data/www/friends/style.css @@ -23,4 +23,14 @@ form label{ #friendList button{ display: inline; margin-right: 10px; +} + +#friendInfo .overlayContent{ + padding: 1em; + text-align: center; +} +#defriend{ + display: block; + margin-left: 50%; + margin-bottom: 1em; } \ No newline at end of file