Browse Source

refactoring, work on friends ui, bug fixes and whitepaper work

merge-requests/21/head
Kevin Froman 3 years ago
parent
commit
137d6f39dd
  1. 0
      .gitmodules
  2. 8
      README.md
  3. 14
      docs/whitepaper.md
  4. 2
      onionr/onionr.py
  5. 1
      onionr/onionrcommands/__init__.py
  6. 20
      onionr/onionrcommands/daemonlaunch.py
  7. 22
      onionr/onionrcommands/keyadders.py
  8. 20
      onionr/onionrcommands/plugincommands.py
  9. 4
      onionr/onionrutils.py
  10. 3
      onionr/static-data/www/friends/friends.js
  11. 6
      onionr/static-data/www/friends/index.html
  12. 10
      onionr/static-data/www/friends/style.css

0
.gitmodules

8
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.

14
docs/whitepaper.md

@ -1,25 +1,25 @@
<p align="center">
<img src="onionr-logo.png" alt="<h1>Onionr</h1>">
<img src="onionr-logo.png" alt="<h1>Onionr</h1>" width=200>
</p>
<p align="center">Anonymous, Decentralized, Distributed Network</p>
# 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.

2
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/'

1
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,

20
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 <https://www.gnu.org/licenses/>.
'''
import os, time, sys, platform, sqlite3
from threading import Thread
import onionr, api, logger, communicator

22
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 <https://www.gnu.org/licenses/>.
'''
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.")

20
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 <https://www.gnu.org/licenses/>.
'''
import sys
import logger, onionrplugins as plugins

4
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):
'''

3
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

6
onionr/static-data/www/friends/index.html

@ -11,6 +11,12 @@
<link rel='stylesheet' href='/friends/style.css'>
</head>
<body>
<div id="friendInfo" class='overlay'>
<div class='overlayContent'>
<button id='defriend' class='warnBtn'>Unfriend</button>
<label>Public Key <input id='friendPubkey' type='text' readonly></label>
</div>
</div>
<div class='content'>
<img class='logo' src='/shared/onionr-icon.png' alt='onionr logo'>
<span class='logoText'>Onionr Web Control Panel</span>

10
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;
}
Loading…
Cancel
Save