Compare commits

...

75 Commits

Author SHA1 Message Date
Kevin Froman 81c8c4f124 mass removal for redesigns 11 months ago
Kevin Froman 7fba65c459 work on torgossip 11 months ago
Kevin Froman 4b36e9d3da work on torgossip 11 months ago
Kevin Froman 346d30086e work on torgossip 11 months ago
Kevin Froman 60dfa8fb7e work on torgossip 11 months ago
Kevin Froman db5320124f work on torgossip 11 months ago
Kevin Froman 2ffcc2e18e work on torgossip 11 months ago
Kevin Froman 630a9b1522 work on torgossip 11 months ago
Kevin Froman 4bf1acf446 work on torgossip 11 months ago
Kevin Froman 257bef6ca0 added subprocess validator 12 months ago
Kevin Froman d9c0adcc7b work on torgossip 12 months ago
Kevin Froman 8a6129f4e2 work on torgossip 12 months ago
Kevin Froman 18d4a87973 added onion service key storage database to overcome limitations in normal torrc-based system 12 months ago
Kevin Froman ad103ee8b0 work on torgossip 12 months ago
Kevin Froman b720f2f1d5 Work on torgossip client 12 months ago
Kevin Froman bae7f745ee implemented peer announce in torgossip 12 months ago
Kevin Froman 227472d4dc implemented peer announce in torgossip 12 months ago
Kevin Froman f4182cb996 implemented peer exchange 12 months ago
Kevin Froman b4127c9836 work on torgossip 12 months ago
Kevin Froman 9d546432f5 added traceback handler 12 months ago
Kevin Froman 5ea90acd3f work on torgossip 12 months ago
Kevin Froman 9d8c7a7224 added peerDB to torgossip 12 months ago
Kevin Froman 582ac1607e remove streamfill 12 months ago
Kevin Froman c40effd520 added offset block list getter 12 months ago
Kevin Froman 9d13c0c989 work on implementing torgossip 12 months ago
Kevin Froman ee8b81ead6 work on implementing torgossip 12 months ago
Kevin Froman 418237cfc6 fix extra onion icon displaying in stat panel 12 months ago
Kevin Froman 84987cfc21 added unsafe socks denial to torrc generator 12 months ago
Kevin Froman 63f7209bdd Added blockcreatorqueue and subprocess generator for new block system 12 months ago
Kevin Froman 67d9dc3557 added more modules to dependencycheck.py 12 months ago
Kevin Froman a2da6b8c89 added serialized api work 12 months ago
Kevin Froman 6625b7ce19 added serialized api work 12 months ago
Kevin Froman da353476cf remove floodfill script 12 months ago
Kevin Froman 828c78a569 work on torgossip, added base64 code whitelist because of a werid plugin issue with bigbrother 12 months ago
Kevin Froman a55055e720 started work on new gossip streaming protocol 1 year ago
Kevin Froman ba8ba6d3d8 properly clean block list in blockio 1 year ago
Kevin Froman 708c5d2e71 added block cleaning method for new database 1 year ago
Kevin Froman 75234310ca added blockio load implementation 1 year ago
Kevin Froman 5ed5b8455a bump blocks version 1 year ago
Kevin Froman 003718db04 Merge branch 'master' into integrate-new-blocks 1 year ago
Kevin Froman db96f6ad7e bump blocks version 1 year ago
Kevin Froman 7cb4731156 Fix scroll jumping by changing connected node list to an iframe 1 year ago
Kevin Froman d03620db7e merge after rebasing toast fix 1 year ago
Kevin Froman 1d1edfd0f1 work on blockio api 1 year ago
Kevin Froman 001bdda433 reload config before spawning daemon threads 1 year ago
Kevin Froman aeb2e16d8b bump dep version for faster vdf 1 year ago
Kevin Froman 847f80b8f4 implemented fetch block in blockio 1 year ago
Kevin Froman 2ffc8c637e fix broken non protected safedb get 1 year ago
Kevin Froman e41e3fd01d bump onionrblocks for missing generator module 1 year ago
Kevin Froman a3ce191ed3 renamed old block api due to namespace conflict 1 year ago
Kevin Froman 9e2d374270 bump onionrblocks for missing kasten dependency 1 year ago
Kevin Froman 504ef3a49a work on removing communicator 1 year ago
Kevin Froman ec9dbe383c added blockio doc for db keys 1 year ago
Kevin Froman 7390539d50 added blockio module directory 1 year ago
Kevin Froman 0f7ea4e4c8 added license boilerplate to safedb 1 year ago
Kevin Froman 86dca2dd2b added work on faster and safer database for blocks and general KV 1 year ago
Kevin Froman 0e69d88708 added put/get from db 1 year ago
Kevin Froman cd0ec77189 added work on faster and safer database for blocks and general KV 1 year ago
Kevin Froman 6bcfd91352 bump dependencies 1 year ago
Kevin Froman 5df747d658 added work on faster and safer database for blocks and general KV 1 year ago
Kevin Froman b7ab487fac fixed toast spam #29 1 year ago
Kevin Froman f44ca60c6e implemented fetch block in blockio 1 year ago
Kevin Froman b6bb350b65 fix broken non protected safedb get 1 year ago
Kevin Froman 30b73c7f7c bump onionrblocks for missing generator module 1 year ago
Kevin Froman ca37f6df9d renamed old block api due to namespace conflict 1 year ago
Kevin Froman f5dfd16408 bump onionrblocks for missing kasten dependency 1 year ago
Kevin Froman 9ed17f4fb6 work on removing communicator 1 year ago
Kevin Froman dc51c26b13 added blockio doc for db keys 1 year ago
Kevin Froman db641341c5 added blockio module directory 1 year ago
Kevin Froman 8ddc38515d added license boilerplate to safedb 1 year ago
Kevin Froman 7ab330a710 added work on faster and safer database for blocks and general KV 1 year ago
Kevin Froman 153d530f38 added put/get from db 1 year ago
Kevin Froman 9e01c65c0f added work on faster and safer database for blocks and general KV 1 year ago
Kevin Froman 2eb3e93666 bump dependencies 1 year ago
Kevin Froman f1edd1932e added work on faster and safer database for blocks and general KV 1 year ago
  1. 26
      README.md
  2. 18
      docs/TODO.txt
  3. 6
      docs/dev/blockio-keys.txt
  4. 12
      docs/dev/http-api.md
  5. 1
      docs/dev/selected-papers.md
  6. 5
      requirements.in
  7. 153
      requirements.txt
  8. 6
      scripts/block-spammer.py
  9. 21
      scripts/closeness-calculator.py
  10. 15
      scripts/disable-dev-config.py
  11. 22
      scripts/enable-dev-config.py
  12. 33
      scripts/floodfill-network-visualizer.py
  13. 47
      scripts/generate-onions.py
  14. 2
      scripts/show-blocks.py
  15. 4
      scripts/testblock.py
  16. 3
      src/__init__.py
  17. 24
      src/anonvdf-block-creator.py
  18. 38
      src/anonvdf-block-validator.py
  19. 1
      src/apiservers/README.md
  20. 3
      src/apiservers/__init__.py
  21. 44
      src/apiservers/private/__init__.py
  22. 38
      src/apiservers/private/register_private_blueprints.py
  23. 76
      src/apiservers/public/__init__.py
  24. 3
      src/bigbrother/ministry/ofcommunication.py
  25. 26
      src/bigbrother/ministry/ofexec.py
  26. 83
      src/blockcreatorqueue/__init__.py
  27. 23
      src/blockio/__init__.py
  28. 2
      src/blockio/clean/__init__.py
  29. 33
      src/blockio/clean/cleanblocklistentries.py
  30. 48
      src/blockio/clean/cleanexpired.py
  31. 54
      src/blockio/load/__init__.py
  32. 43
      src/blockio/store/__init__.py
  33. 45
      src/blockio/subprocgenerate.py
  34. 19
      src/blockio/subprocvalidate.py
  35. 136
      src/communicator/__init__.py
  36. 36
      src/communicator/bootstrappeers.py
  37. 28
      src/communicator/daemoneventhooks/__init__.py
  38. 33
      src/communicator/daemoneventhooks/removefrominsertqueue.py
  39. 12
      src/communicator/onlinepeers/README.md
  40. 6
      src/communicator/onlinepeers/__init__.py
  41. 35
      src/communicator/onlinepeers/clearofflinepeer.py
  42. 63
      src/communicator/onlinepeers/onlinepeers.py
  43. 47
      src/communicator/onlinepeers/pickonlinepeers.py
  44. 38
      src/communicator/onlinepeers/removeonlinepeer.py
  45. 78
      src/communicator/peeraction.py
  46. 73
      src/communicator/uploadqueue/__init__.py
  47. 33
      src/communicatorutils/README.md
  48. 0
      src/communicatorutils/__init__.py
  49. 77
      src/communicatorutils/announcenode.py
  50. 117
      src/communicatorutils/connectnewpeers.py
  51. 60
      src/communicatorutils/cooldownpeer.py
  52. 35
      src/communicatorutils/deniableinserts.py
  53. 173
      src/communicatorutils/downloadblocks/__init__.py
  54. 42
      src/communicatorutils/downloadblocks/shoulddownload.py
  55. 108
      src/communicatorutils/housekeeping.py
  56. 66
      src/communicatorutils/lookupadders.py
  57. 126
      src/communicatorutils/lookupblocks.py
  58. 64
      src/communicatorutils/netcheck.py
  59. 28
      src/communicatorutils/proxypicker.py
  60. 28
      src/communicatorutils/restarttor.py
  61. 148
      src/communicatorutils/uploadblocks/__init__.py
  62. 48
      src/communicatorutils/uploadblocks/mixmate/__init__.py
  63. 71
      src/communicatorutils/uploadblocks/mixmate/pool.py
  64. 57
      src/communicatorutils/uploadblocks/session.py
  65. 127
      src/communicatorutils/uploadblocks/sessionmanager.py
  66. 1
      src/coredb/__init__.py
  67. 84
      src/coredb/blockmetadb/__init__.py
  68. 49
      src/coredb/blockmetadb/add.py
  69. 41
      src/coredb/blockmetadb/expiredblocks.py
  70. 52
      src/coredb/blockmetadb/updateblockinfo.py
  71. 11
      src/coredb/dbfiles.py
  72. 1
      src/coredb/keydb/__init__.py
  73. 88
      src/coredb/keydb/addkeys.py
  74. 86
      src/coredb/keydb/listkeys.py
  75. 60
      src/coredb/keydb/removekeys.py
  76. 85
      src/coredb/keydb/transportinfo.py
  77. 73
      src/coredb/keydb/userinfo.py
  78. 1
      src/etc/cleanup/__init__.py
  79. 14
      src/etc/dependencycheck.py
  80. 40
      src/etc/humanreadabletime.py
  81. 31
      src/etc/onionrvalues.py
  82. 21
      src/filepaths/__init__.py
  83. 2
      src/httpapi/README.md
  84. 32
      src/httpapi/__init__.py
  85. 4
      src/httpapi/apiutils/__init__.py
  86. 38
      src/httpapi/apiutils/getblockdata.py
  87. 1
      src/httpapi/apiutils/shutdown.py
  88. 75
      src/httpapi/friendsapi/__init__.py
  89. 91
      src/httpapi/insertblock.py
  90. 2
      src/httpapi/miscclientapi/__init__.py
  91. 31
      src/httpapi/miscclientapi/addpeer.py
  92. 123
      src/httpapi/miscclientapi/endpoints.py
  93. 65
      src/httpapi/miscclientapi/getblocks.py
  94. 27
      src/httpapi/miscclientapi/motd/__init__.py
  95. 6
      src/httpapi/miscpublicapi/__init__.py
  96. 62
      src/httpapi/miscpublicapi/announce.py
  97. 91
      src/httpapi/miscpublicapi/endpoints.py
  98. 73
      src/httpapi/miscpublicapi/getblocks.py
  99. 94
      src/httpapi/miscpublicapi/upload.py
  100. 94
      src/httpapi/onionrsitesapi/__init__.py

26
README.md

@ -21,7 +21,7 @@
| [Docs](#documentation)/[web copy](https://beardog108.github.io/onionr/) | [Get involved](#help-out) | [Onionr.net](https://onionr.net/)/[.onion](http://onionrbak72t5zhbzuey2fdkpczlvhowgcpqc6uoyrd3uxztzxwz5cyd.onion/) |
<hr>
---
**The main repository for this software is at https://git.VoidNet.tech/kev/onionr/**
@ -30,20 +30,26 @@ Mirrors: [Github](https://github.com/beardog108/onionr), [Gitlab](https://gitlab
Onionr ("Onion Relay") is a decentralized/distributed peer-to-peer communication network, designed to be anonymous and resistant to (meta)data analysis, spam, and corruption.
Onionr stores data in independent packages referred to as 'blocks'. The blocks are distributed to all interested nodes. Blocks and user IDs cannot be easily proven to have been created by a particular user. Even if there is enough evidence to believe that a specific user created a block, nodes still operate behind Tor and as such cannot be trivially unmasked. Anonymity is achieved by a stateless network, with no given indication of what node a block originates from. In fact, since one is not required to participate in routing or storage to insert a message, blocks often do not originate from any identifiable node.
Onionr gives the individual the ability to speak freely, without fear of surveillance and censorship.
Through message mixing and key privacy, it is intended to be nigh impossible to discover the identity of a message creator or recipient. Via long-term traffic analysis, a well funded adversary may discover the most probable node(s) to be creating a set of related blocks, however doing so would only lead them to a node behind Tor. As the first node that a block appears on is almost always not the creator of the block, there is plausible deniability regarding the true creator of the block.
---
Onionr gives the individual the ability to speak freely, without fear of surveillance and censorship.
Onionr stores data in independent packages referred to as 'blocks'. The blocks are distributed to all nodes interested in their data type. Blocks and user IDs cannot be easily proven to have been created by a particular user. Even if there is enough evidence to believe that a specific user created a block, nodes still operate behind Tor and as such cannot be trivially unmasked. Anonymity is achieved by a stateless network, with no given indication of what node a block originates from. In fact, since one is not required to participate in routing or storage to insert a message, blocks often do not originate from any identifiable node.
Onionr works primarily via epidemic/gossip style routing, with message delivery taking roughly log<sub>F</sub>(N) cycles where F is the number of nodes to send a message to each cycle and N is the number of connected nodes. So a network of 100 million nodes can deliver messages in a few minutes even with high packet loss and malfunctioning nodes.
Through message mixing and key privacy, it is intended to be nigh impossible to discover the identity of a message creator or recipient. Via long-term traffic analysis, a well funded adversary may discover the most probable node(s) to be creating a set of related blocks, however doing so would only lead them to a node behind Tor. As the first node that a block appears on is almost always not the creator of the block, there is plausible deniability regarding the true creator of the block.
Users are identified by ed25519/curve25519 public keys, which can be used to sign blocks or send encrypted data.
Onionr can be used for mail, as a social network, instant messenger, file sharing software, or for encrypted group discussion.
Due to the nature of anonymity, the graph as implemented in this reference network is dense, undirected, cyclic and can be disconnected. As a result, current scalability is poor but sufficient for high latency communications. As the need arises isolated stream solutions may be implemented (in a manner similar to described in the Bitmessage whitepaper). Since Onionr is technically just a data format, any routing scheme can be used to pass messages.
Due to the nature of anonymity, the graph as implemented in this reference network is dense, undirected, cyclic and can be disconnected. Since Onionr is technically just a data format, any routing scheme can be used to pass messages.
The whitepaper is available [here](docs/whitepaper.md).
---
## Main Features
* [X] 🌐 Fully p2p/decentralized, no trackers or other single points of failure
@ -57,9 +63,9 @@ Onionr ships with various application plugins ready for use out of the box:
Currently usable:
* Mail
* Public anonymous chat/message board
* Simple webpage hosting - Will be greatly extended
* 📨 Mail
* 💬 Public anonymous chat/message board
* 📃 Simple webpage hosting - Will be greatly extended
* File sharing (Work in progress)
Not yet usable:
@ -154,9 +160,9 @@ Donating at least $3 gets you cool Onionr stickers. Get in touch if you want the
* Monero: 4B5BA24d1P3R5aWEpkGY5TP7buJJcn2aSGBVRQCHhpiahxeB4aWsu15XwmuTjC6VF62NApZeJGTS248RMVECP8aW73Uj2ax
* USD (Card/Paypal): [Ko-Fi](https://www.ko-fi.com/beardogkf)
* USD (Card/Paypal (no account required)): [Ko-Fi](https://www.ko-fi.com/beardogkf)
* [Indiegogo](https://igg.me/at/onionr/x#/)
* Sign up for [privacy.com (refferal link)](https://privacy.com/join/FNNDF) to protect your personal information when contributing or shopping elsewhere, we both get $5 USD.
Note: probably not tax deductible

18
docs/TODO.txt

@ -1,18 +0,0 @@
* add GUI config editor
* add multi-device forward secrecy
* document anonymity & security theory
* document usage
* ensure accessibility for Onionr web UI
* make forward secrecy compatible with multiple devices
* add way to mark key as dead
* add hashable set password for web ui
* add edits to circles posts
* make node "speed" setting such as when ui is open to reduce bandwidth usage
* localization support
* add BCC support to mail
* truncate last N blocks when sharing list

6
docs/dev/blockio-keys.txt

@ -0,0 +1,6 @@
Blockio wraps safedb, the new key value database module
This is how the keys are setup and what they are for:
bl-{type}: bytes of hashes for each block type
{block hash}: block data

12
docs/dev/http-api.md

@ -64,18 +64,6 @@ Please note: endpoints that simply provide static web app files are not document
* /getuptime
- Methods: GET
- Returns uptime in seconds
* /getActivePubkey
- Methods: GET
- Returns the current active public key in base32 format
* /getHumanReadable/pubkey
- Methods: GET
- Echos the specified public key in mnemonic format
* /insertblock
- Methods: POST
- Accepts JSON data for creating a new block. 'message' contains the block data, 'to' specifies the peer's public key to encrypt the data to, 'sign' is a boolean for signing the message.
* /torready
- Methods: POST
- Returns boolean if Tor is started or not
# Public API

1
docs/dev/selected-papers.md

@ -7,3 +7,4 @@ A paper being listed here is not end-all-be-all endorsement of every detail insi
* [Protecting Free Expression Online with Freenet](https://freenetproject.org/assets/papers/ddisrs.pdf)
* [Bitmessage: A Peer‐to‐Peer Message Authentication and Delivery System](https://archive.org/details/BitmessageWhitepaper/)
* [MuON: Epidemic based Mutual Anonymity](https://web.archive.org/web/20060901153544/http://www.csl.mtu.edu/cs6461/www/Reading/MuON_ICNP2005.pdf)
* [SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol](https://www.cs.cornell.edu/projects/Quicksilver/public_pdfs/SWIM.pdf)

5
requirements.in

@ -1,7 +1,7 @@
urllib3==1.25.11
requests==2.25.1
PyNaCl==1.4.0
gevent==20.9.0
gevent==20.12.1
Flask==1.1.2
PySocks==1.7.1
stem==1.8.0
@ -14,4 +14,5 @@ psutil==5.8.0
filenuke==0.0.0
watchdog==1.0.2
ujson==4.0.1
cffi==1.14.4
cffi==1.14.4
onionrblocks==4.1.0

153
requirements.txt

@ -2,11 +2,11 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --generate-hashes requirements.in
# pip-compile --generate-hashes --output-file=requirements.txt requirements.in
#
certifi==2018.11.29 \
--hash=sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7 \
--hash=sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033 \
--hash=sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033
# via requests
cffi==1.14.4 \
--hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \
@ -44,39 +44,55 @@ cffi==1.14.4 \
--hash=sha256:ec80dc47f54e6e9a78181ce05feb71a0353854cc26999db963695f950b5fb375 \
--hash=sha256:f032b34669220030f905152045dfa27741ce1a6db3324a5bc0b96b6c7420c87b \
--hash=sha256:f60567825f791c6f8a592f3c6e3bd93dd2934e3f9dac189308426bd76b00ef3b \
--hash=sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f \
# via -r requirements.in, pynacl
--hash=sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f
# via
# -r requirements.in
# pynacl
chardet==3.0.4 \
--hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae \
--hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \
--hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691
# via requests
click==7.0 \
--hash=sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13 \
--hash=sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7 \
--hash=sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7
# via flask
deadsimplekv==0.3.2 \
--hash=sha256:a725f4a9d1156ebb66b7535ac150006881e0365b715e34e3709214827b8b0c4c \
--hash=sha256:df00262d26c3dcfecb710425a7413059480d8cf026216042d7cbffb8514818b2 \
--hash=sha256:df00262d26c3dcfecb710425a7413059480d8cf026216042d7cbffb8514818b2
# via -r requirements.in
filenuke==0.0.0 \
--hash=sha256:147011c0125121469cae0a8a7f4df399f470e54aa29a08f2d2c099bf0118dcee \
--hash=sha256:c55535dcecfdb27c5f4ce664d46e115950b5429763b5db75c198053646177f8f \
--hash=sha256:c55535dcecfdb27c5f4ce664d46e115950b5429763b5db75c198053646177f8f
# via -r requirements.in
flask==1.1.2 \
--hash=sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060 \
--hash=sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557 \
--hash=sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557
# via -r requirements.in
gevent==20.9.0 \
--hash=sha256:1628a403fc9c3ea9b35924638a4d4fbe236f60ecdf4e22ed133fbbaf0bc7cb6b \
--hash=sha256:2269574444113cb4ca1c1808ab9460a87fe25e1c34a6e36d975d4af46e4afff9 \
--hash=sha256:324808a8558c733f7a9734525483795d52ca3bbd5662b24b361d81c075414b1f \
--hash=sha256:5f6d48051d336561ec08995431ee4d265ac723a64bba99cc58c3eb1a4d4f5c8d \
--hash=sha256:a8733a01974433d91308f8c44fa6cc13428b15bb39d46540657e260ff8852cb1 \
--hash=sha256:adbb267067f56696b2babced3d0856aa39dcf14b8ccd2dffa1fab587b00c6f80 \
--hash=sha256:b07fcbca3e819296979d82fac3d8b44f0d5ced57b9a04dffcfd194da99c8eb2d \
--hash=sha256:b2948566003a1030e47507755fe1f446995e8671c0c67571091539e01faf94cc \
--hash=sha256:e11de4b4d107ca2f35000eb08e9c4c4621c153103b400f48a9ea95b96d8c7e0b \
--hash=sha256:fb33dc1ab27557bccd64ad4bf81e68c8b0d780fe937b1e2c0814558798137229 \
gevent==20.12.1 \
--hash=sha256:0f9fa230c5878704b9e286ad5038bac3b70d293bf10e9efa8b2ae1d7d80e7e08 \
--hash=sha256:19bd3fe60dec45fe6420b7772496950215f1b36701905876ba1644b6b2064163 \
--hash=sha256:2d05f38a5ef1ebb7ceb692897674b11ba603914524765b989c65c020c7b08360 \
--hash=sha256:4b0a5626c4e534d184cdf00d66f06de3885beafaaa5f7b98d47186ea175629a1 \
--hash=sha256:4baecba0fd614e14dc1f3f8c35616cb248cdb893de576150ed1fc7fc66b8ba3d \
--hash=sha256:60799fd7dcbb622f8435eb12436d48a8d27f8e7b3d23631e32ccc04ddd2097c2 \
--hash=sha256:69ddc1767a02f68e71d5e0d3215aa4d28872187715627f71ff0eadd7b7a5e7f4 \
--hash=sha256:7a808c63f065a303bbbe87c5c0754e06abb1e23e18752f418dce1eb3189cb43d \
--hash=sha256:81e38ed46e21e0b00b930efce1a1ff46c7722ad83d84052f71a757f23cbed1c0 \
--hash=sha256:895c76a89907d9d37fdfaf5321cb0fff0cba396f003bedb4f5fc13836da6f250 \
--hash=sha256:89c583744f91052ae987356660f5ed0b8fc59a1230b051d6ccc10d37a155fe01 \
--hash=sha256:99b68765767bb3e2244a66b012883899a6f17c23b6dc1cd80b793df341e15f08 \
--hash=sha256:9d001fc899db6e140110ae7484e58cd74b0dfa5cee021a0347f00bb441ac78bd \
--hash=sha256:b57586ad3fedf13d351d2559b70d6fe593c50400315d52bb3c072285da60fa37 \
--hash=sha256:ba244028225ff8d3a58f344fcd16ab05b0e3642b34d81f51f7fa3c70761f6c34 \
--hash=sha256:bf946a99e364ebcc95b82c794d5d1a67f13115adbefab7b9e12791f13184cfd5 \
--hash=sha256:c3706a620e167c4bd007f16f113928324c4e07a7bae11d6d18d65f82abcd7a58 \
--hash=sha256:c570a2e3100f758a5c2f9b993ecf870ee784390e44e1a292c361d6b32fb3ad4c \
--hash=sha256:caec00914e8f21b2c77a29bbc2ef3abfeadf7515656e5451dfb14c2064733998 \
--hash=sha256:e233ae153b586b61e492806d4cd1be2217de7441922c02053b67de14800bce96 \
--hash=sha256:f020bfb34d57caa10029111be776524c378a4aac8417bc6fb1154b05e00fc220 \
--hash=sha256:f3faf1834464f1b0731aa6346cd9f41029fa9e208d6ecbce4a736c19562c86aa \
--hash=sha256:f857adbe1bf41e620d86173a53100f4ec328eba3089069a4815b3d9f4229dee8 \
--hash=sha256:ffa1be13963db6aa55c50d2fd4a656c82f53a03a47e37aaa69e79a488123538d
# via -r requirements.in
greenlet==0.4.17 \
--hash=sha256:1023d7b43ca11264ab7052cb09f5635d4afdb43df55e0854498fc63070a0b206 \
@ -96,20 +112,24 @@ greenlet==0.4.17 \
--hash=sha256:ccd62f09f90b2730150d82f2f2ffc34d73c6ce7eac234aed04d15dc8a3023994 \
--hash=sha256:d3436110ca66fe3981031cc6aff8cc7a40d8411d173dde73ddaa5b8445385e2d \
--hash=sha256:e495096e3e2e8f7192afb6aaeba19babc4fb2bdf543d7b7fed59e00c1df7f170 \
--hash=sha256:e66a824f44892bc4ec66c58601a413419cafa9cec895e63d8da889c8a1a4fa4a \
--hash=sha256:e66a824f44892bc4ec66c58601a413419cafa9cec895e63d8da889c8a1a4fa4a
# via gevent
idna==2.7 \
--hash=sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e \
--hash=sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16 \
--hash=sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16
# via requests
itsdangerous==1.1.0 \
--hash=sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19 \
--hash=sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749 \
--hash=sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749
# via flask
jinja2==2.11.1 \
--hash=sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250 \
--hash=sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49 \
--hash=sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49
# via flask
kasten==3.0.0 \
--hash=sha256:52894af46d6e1339f0d5fa8961892b292f99176848bce11877fe4a435b6782e5 \
--hash=sha256:b22ebdc5f475c2ef9ab74abc36552add0b37732a7ce2be6bd7977ee41b2163b4
# via onionrblocks
markupsafe==1.1.1 \
--hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \
--hash=sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161 \
@ -143,11 +163,48 @@ markupsafe==1.1.1 \
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \
--hash=sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2 \
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be \
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be
# via jinja2
mimcvdf==1.2.0 \
--hash=sha256:647009b6f13173ac84a683b491566c8b63bc3dd5d60edd1e109b41cd311e2c08
# via kasten
msgpack==1.0.2 \
--hash=sha256:0cb94ee48675a45d3b86e61d13c1e6f1696f0183f0715544976356ff86f741d9 \
--hash=sha256:1026dcc10537d27dd2d26c327e552f05ce148977e9d7b9f1718748281b38c841 \
--hash=sha256:26a1759f1a88df5f1d0b393eb582ec022326994e311ba9c5818adc5374736439 \
--hash=sha256:2a5866bdc88d77f6e1370f82f2371c9bc6fc92fe898fa2dec0c5d4f5435a2694 \
--hash=sha256:31c17bbf2ae5e29e48d794c693b7ca7a0c73bd4280976d408c53df421e838d2a \
--hash=sha256:497d2c12426adcd27ab83144057a705efb6acc7e85957a51d43cdcf7f258900f \
--hash=sha256:5a9ee2540c78659a1dd0b110f73773533ee3108d4e1219b5a15a8d635b7aca0e \
--hash=sha256:8521e5be9e3b93d4d5e07cb80b7e32353264d143c1f072309e1863174c6aadb1 \
--hash=sha256:87869ba567fe371c4555d2e11e4948778ab6b59d6cc9d8460d543e4cfbbddd1c \
--hash=sha256:8ffb24a3b7518e843cd83538cf859e026d24ec41ac5721c18ed0c55101f9775b \
--hash=sha256:92be4b12de4806d3c36810b0fe2aeedd8d493db39e2eb90742b9c09299eb5759 \
--hash=sha256:9ea52fff0473f9f3000987f313310208c879493491ef3ccf66268eff8d5a0326 \
--hash=sha256:a4355d2193106c7aa77c98fc955252a737d8550320ecdb2e9ac701e15e2943bc \
--hash=sha256:a99b144475230982aee16b3d249170f1cccebf27fb0a08e9f603b69637a62192 \
--hash=sha256:ac25f3e0513f6673e8b405c3a80500eb7be1cf8f57584be524c4fa78fe8e0c83 \
--hash=sha256:b28c0876cce1466d7c2195d7658cf50e4730667196e2f1355c4209444717ee06 \
--hash=sha256:b55f7db883530b74c857e50e149126b91bb75d35c08b28db12dcb0346f15e46e \
--hash=sha256:b6d9e2dae081aa35c44af9c4298de4ee72991305503442a5c74656d82b581fe9 \
--hash=sha256:c747c0cc08bd6d72a586310bda6ea72eeb28e7505990f342552315b229a19b33 \
--hash=sha256:d6c64601af8f3893d17ec233237030e3110f11b8a962cb66720bf70c0141aa54 \
--hash=sha256:d8167b84af26654c1124857d71650404336f4eb5cc06900667a493fc619ddd9f \
--hash=sha256:de6bd7990a2c2dabe926b7e62a92886ccbf809425c347ae7de277067f97c2887 \
--hash=sha256:e36a812ef4705a291cdb4a2fd352f013134f26c6ff63477f20235138d1d21009 \
--hash=sha256:e89ec55871ed5473a041c0495b7b4e6099f6263438e0bd04ccd8418f92d5d7f2 \
--hash=sha256:f3e6aaf217ac1c7ce1563cf52a2f4f5d5b1f64e8729d794165db71da57257f0c \
--hash=sha256:f484cd2dca68502de3704f056fa9b318c94b1539ed17a4c784266df5d6978c87 \
--hash=sha256:fae04496f5bc150eefad4e9571d1a76c55d021325dcd484ce45065ebbdd00984 \
--hash=sha256:fe07bc6735d08e492a327f496b7850e98cb4d112c56df69b0c844dbebcbb47f6
# via kasten
niceware==0.2.1 \
--hash=sha256:0f8b192f2a1e800e068474f6e208be9c7e2857664b33a96f4045340de4e5c69c \
--hash=sha256:cf2dc0e1567d36d067c61b32fed0f1b9c4534ed511f9eeead4ba548d03b5c9eb \
--hash=sha256:cf2dc0e1567d36d067c61b32fed0f1b9c4534ed511f9eeead4ba548d03b5c9eb
# via -r requirements.in
onionrblocks==4.1.0 \
--hash=sha256:2f806d1a4cf332ffef8630ac3d362499854316d957945be0a090c7ff6917a6c4 \
--hash=sha256:bfdfa90df6fcdaef44b9ff1bc8f7b645fc41d10cf46481a3158d6c77e3832507
# via -r requirements.in
psutil==5.8.0 \
--hash=sha256:0066a82f7b1b37d334e68697faba68e5ad5e858279fd6351c8ca6024e8d6ba64 \
@ -177,10 +234,10 @@ psutil==5.8.0 \
--hash=sha256:ea313bb02e5e25224e518e4352af4bf5e062755160f77e4b1767dd5ccb65f876 \
--hash=sha256:ea372bcc129394485824ae3e3ddabe67dc0b118d262c568b4d2602a7070afdb0 \
--hash=sha256:f4634b033faf0d968bb9220dd1c793b897ab7f1189956e1aa9eae752527127d3 \
--hash=sha256:fcc01e900c1d7bee2a37e5d6e4f9194760a93597c97fee89c4ae51701de03563 \
--hash=sha256:fcc01e900c1d7bee2a37e5d6e4f9194760a93597c97fee89c4ae51701de03563
# via -r requirements.in
pycparser==2.19 \
--hash=sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3 \
--hash=sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3
# via cffi
pynacl==1.4.0 \
--hash=sha256:06cbb4d9b2c4bd3c8dc0d267416aaed79906e7b33f114ddbf0911969794b1cc4 \
@ -198,30 +255,34 @@ pynacl==1.4.0 \
--hash=sha256:cd401ccbc2a249a47a3a1724c2918fcd04be1f7b54eb2a5a71ff915db0ac51c6 \
--hash=sha256:d452a6746f0a7e11121e64625109bc4468fc3100452817001dbe018bb8b08514 \
--hash=sha256:ea6841bc3a76fa4942ce00f3bda7d436fda21e2d91602b9e21b7ca9ecab8f3ff \
--hash=sha256:f8851ab9041756003119368c1e6cd0b9c631f46d686b3904b18c0139f4419f80 \
# via -r requirements.in
--hash=sha256:f8851ab9041756003119368c1e6cd0b9c631f46d686b3904b18c0139f4419f80
# via
# -r requirements.in
# onionrblocks
pysocks==1.7.1 \
--hash=sha256:08e69f092cc6dbe92a0fdd16eeb9b9ffbc13cadfe5ca4c7bd92ffb078b293299 \
--hash=sha256:2725bd0a9925919b9b51739eea5f9e2bae91e83288108a9ad338b2e3a4435ee5 \
--hash=sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0 \
--hash=sha256:3f8804571ebe159c380ac6de37643bb4685970655d3bba243530d6558b799aa0
# via -r requirements.in
requests==2.25.1 \
--hash=sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804 \
--hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e \
# via -r requirements.in, streamedrequests
--hash=sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e
# via
# -r requirements.in
# streamedrequests
six==1.12.0 \
--hash=sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c \
--hash=sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73 \
--hash=sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73
# via pynacl
stem==1.8.0 \
--hash=sha256:a0b48ea6224e95f22aa34c0bc3415f0eb4667ddeae3dfb5e32a6920c185568c2 \
--hash=sha256:a0b48ea6224e95f22aa34c0bc3415f0eb4667ddeae3dfb5e32a6920c185568c2
# via -r requirements.in
streamedrequests==1.0.3 \
--hash=sha256:4388ffc0ee94dda719dafc4324b8ddd108cb2231ec59871de79e2592bf4eef0a \
--hash=sha256:ee68417a1522e75c35b1b2d5f3b6f7e76a3a1a6c0ef5e0c573d08307910079d8 \
--hash=sha256:ee68417a1522e75c35b1b2d5f3b6f7e76a3a1a6c0ef5e0c573d08307910079d8
# via -r requirements.in
toomanyobjs==1.1.0 \
--hash=sha256:99e27468f9dad19127be9e2fb086b42acd69aed9ad7e63cef74d6e4389be0534 \
--hash=sha256:99e27468f9dad19127be9e2fb086b42acd69aed9ad7e63cef74d6e4389be0534
# via -r requirements.in
ujson==4.0.1 \
--hash=sha256:078808c385036cba73cad96f498310c61e9b5ae5ac9ea01e7c3996ece544b556 \
@ -244,16 +305,18 @@ ujson==4.0.1 \
--hash=sha256:c354c1617b0a4378b6279d0cd511b769500cf3fa7c42e8e004cbbbb6b4c2a875 \
--hash=sha256:c604024bd853b5df6be7d933e934da8dd139e6159564db7c55b92a9937678093 \
--hash=sha256:e7ab24942b2d57920d75b817b8eead293026db003247e26f99506bdad86c61b4 \
--hash=sha256:f8a60928737a9a47e692fcd661ef2b5d75ba22c7c930025bd95e338f2a6e15bc \
--hash=sha256:f8a60928737a9a47e692fcd661ef2b5d75ba22c7c930025bd95e338f2a6e15bc
# via -r requirements.in
unpaddedbase32==0.2.0 \
--hash=sha256:4aacee75f8fd6c8cf129842ecba45ca59c11bfb13dae19d86f32b48fa3715403 \
--hash=sha256:b7b780c31d27d55e66abf6c221216a35690ee8892c2daacff7f2528e229bd9c3 \
--hash=sha256:b7b780c31d27d55e66abf6c221216a35690ee8892c2daacff7f2528e229bd9c3
# via -r requirements.in
urllib3==1.25.11 \
--hash=sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2 \
--hash=sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e \
# via -r requirements.in, requests
--hash=sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e
# via
# -r requirements.in
# requests
watchdog==1.0.2 \
--hash=sha256:016b01495b9c55b5d4126ed8ae75d93ea0d99377084107c33162df52887cee18 \
--hash=sha256:101532b8db506559e52a9b5d75a308729b3f68264d930670e6155c976d0e52a0 \
@ -271,15 +334,15 @@ watchdog==1.0.2 \
--hash=sha256:e7c73edef48f4ceeebb987317a67e0080e5c9228601ff67b3c4062fa020403c7 \
--hash=sha256:ee21aeebe6b3e51e4ba64564c94cee8dbe7438b9cb60f0bb350c4fa70d1b52c2 \
--hash=sha256:f1d0e878fd69129d0d68b87cee5d9543f20d8018e82998efb79f7e412d42154a \
--hash=sha256:f84146f7864339c8addf2c2b9903271df21d18d2c721e9a77f779493234a82b5 \
--hash=sha256:f84146f7864339c8addf2c2b9903271df21d18d2c721e9a77f779493234a82b5
# via -r requirements.in
werkzeug==0.15.5 \
--hash=sha256:87ae4e5b5366da2347eb3116c0e6c681a0e939a33b2805e2c0cbd282664932c4 \
--hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6 \
--hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6
# via flask
zope.event==4.4 \
--hash=sha256:69c27debad9bdacd9ce9b735dad382142281ac770c4a432b533d6d65c4614bcf \
--hash=sha256:d8e97d165fd5a0997b45f5303ae11ea3338becfe68c401dd88ffd2113fe5cae7 \
--hash=sha256:d8e97d165fd5a0997b45f5303ae11ea3338becfe68c401dd88ffd2113fe5cae7
# via gevent
zope.interface==5.1.0 \
--hash=sha256:0103cba5ed09f27d2e3de7e48bb320338592e2fabc5ce1432cf33808eb2dfd8b \
@ -321,7 +384,7 @@ zope.interface==5.1.0 \
--hash=sha256:ef739fe89e7f43fb6494a43b1878a36273e5924869ba1d866f752c5812ae8d58 \
--hash=sha256:f40db0e02a8157d2b90857c24d89b6310f9b6c3642369852cdc3b5ac49b92afc \
--hash=sha256:f68bf937f113b88c866d090fea0bc52a098695173fc613b055a17ff0cf9683b6 \
--hash=sha256:fb55c182a3f7b84c1a2d6de5fa7b1a05d4660d866b91dbf8d74549c57a1499e8 \
--hash=sha256:fb55c182a3f7b84c1a2d6de5fa7b1a05d4660d866b91dbf8d74549c57a1499e8
# via gevent
# WARNING: The following packages were not pinned, but pip requires them to be

6
scripts/block-spammer.py

@ -11,7 +11,7 @@ import os
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
import onionrblocks
import oldblocks
amount = int(input("Number of blocks:"))
@ -24,8 +24,8 @@ else:
for i in range(amount):
if expire:
print(onionrblocks.insert(data=os.urandom(32), expire=expire))
print(oldblocks.insert(data=os.urandom(32), expire=expire))
else:
print(onionrblocks.insert(data=os.urandom(32)))
print(oldblocks.insert(data=os.urandom(32)))
print(i, "done")

21
scripts/closeness-calculator.py

@ -1,21 +0,0 @@
import sys
import os
import subprocess
import base64
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
from streamfill import identify_neighbors
onions = []
p = subprocess.Popen(["scripts/generate-onions.py", '5'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
for line in iter(p.stdout.readline, b''):
line = line.decode()
onions.append(line.strip())
for onion in onions:
print(onion, identify_neighbors(onion, onions, 3))

15
scripts/disable-dev-config.py

@ -6,27 +6,14 @@ import json
conf = json.load(open('static-data/default_config.json', 'r'))
conf['tor']['use_existing_tor'] = False
conf['tor']['existing_control_port'] = 0
conf['tor']['existing_control_password'] = ""
conf['tor']['existing_socks_port'] = 0
conf['general']['dev_mode'] = False
conf['general']['insert_deniable_blocks'] = True
conf['general']['random_bind_ip'] = True
conf['general']['display_header'] = True
conf['general']['security_level'] = 0
conf['general']['use_bootstrap_list'] = True
conf['onboarding']['done'] = False
conf['general']['minimum_block_pow'] = 5
conf['general']['minimum_send_pow'] = 5
conf['log']['file']['remove_on_exit'] = True
conf['transports']['lan'] = True
conf['transports']['tor'] = True
conf['transports']['sneakernet'] = True
conf['statistics']['i_dont_want_privacy'] = False
conf['statistics']['server'] = ''
conf['ui']['animated_background'] = True
conf['runtests']['skip_slow'] = False
json.dump(conf, open('static-data/default_config.json', 'w'), sort_keys=True, indent=4)

22
scripts/enable-dev-config.py

@ -8,32 +8,16 @@ input("enter to continue") # hack to avoid vscode term input
conf = json.load(open('static-data/default_config.json', 'r'))
block_pow = int(input("Block POW level:"))
conf['general']['security_level'] = int(input("Security level:"))
conf['transports']['tor'] = False
if input('Use Tor? y/n').lower() == 'y':
conf['transports']['tor'] = True
if input("Reuse Tor? y/n:").lower() == 'y':
conf['tor']['use_existing_tor'] = True
conf['tor']['existing_control_port'] = int(input("Enter existing control port:"))
conf['tor']['existing_control_password'] = input("Tor pass:")
conf['tor']['existing_socks_port'] = int(input("Existing socks port:"))
conf['general']['dev_mode'] = True
conf['general']['insert_deniable_blocks'] = False
conf['general']['random_bind_ip'] = False
conf['onboarding']['done'] = True
conf['general']['minimum_block_pow'] = block_pow
conf['general']['minimum_send_pow'] = block_pow
conf['general']['use_bootstrap_list'] = False
if input("Use bootstrap list? y/n").lower() == 'y':
conf['general']['use_bootstrap_list'] = True
conf['log']['file']['remove_on_exit'] = False
conf['ui']['animated_background'] = False
if input('Stat reporting? y/n') == 'y':
conf['statistics']['i_dont_want_privacy'] = True
conf['statistics']['server'] = input('Statistics server')
conf['runtests']['skip_slow'] = True
json.dump(conf, open('static-data/default_config.json', 'w'), sort_keys=True, indent=4)

33
scripts/floodfill-network-visualizer.py

@ -1,33 +0,0 @@
import networkx as nx
import matplotlib.pyplot as plt
import sys
import os
import subprocess
import base64
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
from streamfill import identify_neighbors
G = nx.Graph()
size = 1000
onions = []
p = subprocess.Popen(["scripts/generate-onions.py", str(size)],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
for line in iter(p.stdout.readline, b''):
line = line.decode().strip()
onions.append(line)
G.add_node(line[:6])
for onion in onions:
neighbors = identify_neighbors(onion, onions, 0.15 * size)
for neighbor in neighbors:
G.add_edge(onion[:6], neighbor[:6])
#nx.draw(G, with_labels=True, font_weight='bold')
#nx.draw_shell(G, with_labels=True)
#nx.draw_random(G, with_labels=True)
nx.draw_kamada_kawai(G)
plt.savefig("graph.png")

47
scripts/generate-onions.py

@ -2,40 +2,21 @@
import sys
import os
import stem
from stem import process
from stem.control import Controller
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
from base64 import b32encode
from hashlib import sha3_256
try:
sys.argv[1]
amount = int(sys.argv[1])
except IndexError:
sys.exit(1)
amount = 1
tor_process = process.launch_tor_with_config(
completion_percent=0,
config = {
'ControlPort': '2778',
'DisableNetwork': '1',
'Log': [
'NOTICE stdout',
'ERR file /tmp/tor_error_log',
],
},
)
with Controller.from_port('127.0.0.1', 2778) as controller:
controller.authenticate()
for i in range(1024, 1024 + int(sys.argv[1])):
hs = controller.create_ephemeral_hidden_service(
{80: i},
key_type='NEW',
key_content='ED25519-V3',
await_publication=False,
detached=True)
print(hs.service_id + ".onion")
controller.remove_ephemeral_hidden_service(hs.service_id)
tor_process.kill()
version = int(3).to_bytes(1, "little")
for i in range(amount):
pubkey = os.urandom(32)
#digest = sha3_256(b".onion checksum" + pubkey + version).digest()[:2]
digest = sha3_256()
digest.update(b".onion checksum")
digest.update(pubkey)
digest.update(version)
digest = digest.digest()[:2]
print(b32encode(pubkey + digest + version).decode().lower() + ".onion")

2
scripts/show-blocks.py

@ -6,7 +6,7 @@ if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
from coredb.blockmetadb import get_block_list
from onionrblocks.onionrblockapi import Block
from oldblocks.onionrblockapi import Block
for bl in get_block_list():
bl_obj = Block(bl, decrypt=False)

4
scripts/testblock.py

@ -5,8 +5,8 @@ import os
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
import onionrblocks
import oldblocks
expire = 600
print(onionrblocks.insert(data=os.urandom(32), expire=expire))
print(oldblocks.insert(data=os.urandom(32), expire=expire))

3
src/__init__.py

@ -70,7 +70,6 @@ createdirs.create_dirs()
import bigbrother # noqa
from onionrcommands import parser # noqa
from onionrplugins import onionrevents as events # noqa
from onionrblocks.deleteplaintext import delete_plaintext_no_blacklist # noqa
setup.setup_config()
@ -84,8 +83,6 @@ if config.get('advanced.security_auditing', True):
except onionrexceptions.PythonVersion:
pass
if not config.get('general.store_plaintext_blocks', True):
delete_plaintext_no_blacklist()
setup.setup_default_plugins()

24
src/anonvdf-block-creator.py

@ -0,0 +1,24 @@
#!/usr/bin/env python
from base64 import b85decode
import sys
import os
import ujson as json
from onionrblocks import blockcreator
# This script creates a block without storing it. it is written to stdout
# It is used instead of in the main process to avoid GIL locking/slow down
metadata = json.loads(sys.argv[1])
block_type = sys.argv[2]
ttl = int(sys.argv[3])
data = b85decode(sys.stdin.read())
with os.fdopen(sys.stdout.fileno(), 'wb') as stdout:
bl = blockcreator.create_anonvdf_block(data, block_type, ttl, **metadata)
try:
stdout.write(bl.id + bl.get_packed())
except BrokenPipeError:
pass

38
src/anonvdf-block-validator.py

@ -0,0 +1,38 @@
#!/usr/bin/env python
# This is a subprocess because block validation is somewhat CPU intensive
from base64 import b85decode, b85encode
import os
from sys import argv, stdin, stderr, stdout, exit
from kasten import Kasten
from kasten.exceptions import InvalidID
from onionrblocks.exceptions import BlockExpired
from onionrblocks.generators import AnonVDFGenerator
block_hash = b85decode(argv[1])
block_bytes = b85decode(stdin.read())
try:
Kasten(
block_hash, block_bytes,
AnonVDFGenerator, auto_check_generator=True)
except InvalidID:
stderr.write(
"Invalid block ID for " +
b85encode(block_hash).decode('utf-8'))
except ValueError as e:
# Supposed to be if rounds are not specified in the block
stderr.write(e.message)
except BlockExpired:
stderr.write(
b85encode(block_hash).decode('utf-8') + " is expired")
else:
with os.fdopen(stdout.fileno(), 'wb') as std:
std.write(b"valid")
exit(0)
stderr.flush()
exit(1)

1
src/apiservers/README.md

@ -6,4 +6,3 @@ Contains the WSGI servers Onionr uses for remote peer communication and local da
* \_\_init\_\_.py: Exposes the server classes
* private: Contains the client API (the server used to interact with the local Onionr daemon, and view the web UI)
* public: Contains the public API (the server used by remote peers to talk to our daemon)

3
src/apiservers/__init__.py

@ -4,7 +4,6 @@ Public is net-facing server meant for other nodes
Private is meant for controlling and accessing this node
"""
from . import public, private
from . import private
PublicAPI = public.PublicAPI
ClientAPI = private.PrivateAPI

44
src/apiservers/private/__init__.py

@ -2,6 +2,7 @@
This file handles all incoming http requests to the client, using Flask
"""
import http
from typing import Dict
import hmac
@ -16,20 +17,19 @@ import logger
from etc import waitforsetvar
from . import register_private_blueprints
import config
from .. import public
"""
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/>.
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/>.
"""
@ -50,7 +50,7 @@ class PrivateAPI:
self.startTime = epoch.get_epoch()
app = flask.Flask(__name__)
bind_port = int(config.get('client.client.port', 59496))
self.bindPort = bind_port
@ -68,7 +68,7 @@ class PrivateAPI:
self.httpServer = ''
self.queueResponse = {}
self.get_block_data = httpapi.apiutils.GetBlockData(self)
register_private_blueprints.register_private_blueprints(self, app)
httpapi.load_plugin_blueprints(app)
self.app = app
@ -77,17 +77,12 @@ class PrivateAPI:
"""Start client gevent API web server with flask client app."""
waitforsetvar.wait_for_set_var(self, "_too_many")
fd_handler = httpapi.fdsafehandler.FDSafeHandler
self.publicAPI = self._too_many.get( # pylint: disable=E1101
public.PublicAPI)
self._too_many.add(httpapi.wrappedfunctions.SubProcVDFGenerator(self._too_many))
self.httpServer = WSGIServer((self.host, self.bindPort),
self.app, log=None,
handler_class=fd_handler)
self.httpServer.serve_forever()
def setPublicAPIInstance(self, inst):
"""Dynamically set public API instance."""
self.publicAPI = inst
def validateToken(self, token):
"""Validate that the client token matches the given token.
@ -110,10 +105,3 @@ class PrivateAPI:
# Don't error on race condition with startup
pass
def getBlockData(self, bHash, decrypt=False, raw=False,
headerOnly=False) -> bytes:
"""Returns block data bytes."""
return self.get_block_data.get_block_data(bHash,
decrypt=decrypt,
raw=raw,
headerOnly=headerOnly)

38
src/apiservers/private/register_private_blueprints.py

@ -5,25 +5,25 @@ This file registers blueprints for the private api server
from threading import Thread
from gevent import sleep
from httpapi import security, friendsapi, configapi, insertblock
from httpapi import miscclientapi, onionrsitesapi, apiutils
from httpapi import security, configapi
from httpapi import miscclientapi, apiutils
from httpapi import themeapi
from httpapi import fileoffsetreader
from httpapi.sse.private import private_sse_blueprint
from httpapi.serializedapi import serialized_api_bp
"""
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/>.
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/>.
"""
@ -31,19 +31,15 @@ def register_private_blueprints(private_api, app):
"""Register private API plask blueprints."""
app.register_blueprint(security.client.ClientAPISecurity(
private_api).client_api_security_bp)
app.register_blueprint(friendsapi.friends)
app.register_blueprint(configapi.config_BP)
app.register_blueprint(insertblock.ib)
app.register_blueprint(miscclientapi.getblocks.client_get_blocks)
app.register_blueprint(miscclientapi.endpoints.PrivateEndpoints(
private_api).private_endpoints_bp)
app.register_blueprint(miscclientapi.motd.bp)
app.register_blueprint(onionrsitesapi.site_api)
app.register_blueprint(apiutils.shutdown.shutdown_bp)
app.register_blueprint(miscclientapi.staticfiles.static_files_bp)
app.register_blueprint(themeapi.theme_blueprint)
app.register_blueprint(private_sse_blueprint)
app.register_blueprint(fileoffsetreader.offset_reader_api)
app.register_blueprint(serialized_api_bp)
def _add_events_bp():
while True:
@ -55,6 +51,6 @@ def register_private_blueprints(private_api, app):
app.register_blueprint(
private_api._too_many.get_by_string('DaemonEventsBP').flask_bp)
Thread(target=_add_events_bp).start()
Thread(target=_add_events_bp, name='Private blueprints adder').start()
return app

76
src/apiservers/public/__init__.py

@ -1,76 +0,0 @@
"""Onionr - Private P2P Communication.
This file handles all incoming http requests
to the public api server, using Flask
"""
import time
import threading
import flask
from gevent.pywsgi import WSGIServer
from httpapi import apiutils, security, fdsafehandler, miscpublicapi
import logger
import config
import filepaths
from utils import gettransports
from etc import onionrvalues, waitforsetvar
"""
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 _get_tor_adder(pub_api):
transports = []
while len(transports) == 0:
transports = gettransports.get()
time.sleep(0.3)
pub_api.torAdder = transports[0]
class PublicAPI:
"""The new client api server, isolated from the public api."""
def __init__(self):
"""Setup the public api app."""
app = flask.Flask('PublicAPI')
app.config['MAX_CONTENT_LENGTH'] = 5 * 1024 * 1024
self.i2pEnabled = config.get('i2p.host', False)
self.hideBlocks = [] # Blocks to be denied sharing
self.host = apiutils.setbindip.set_bind_IP(
filepaths.public_API_host_file)
threading.Thread(target=_get_tor_adder,
args=[self], daemon=True).start()
self.torAdder = ""
self.bindPort = config.get('client.public.port')
self.lastRequest = 0
# total rec requests to public api since server started
self.hitCount = 0
self.config = config
self.API_VERSION = onionrvalues.API_VERSION
logger.info('Running public api on %s:%s' % (self.host, self.bindPort))
app.register_blueprint(
security.public.PublicAPISecurity(self).public_api_security_bp)
app.register_blueprint(
miscpublicapi.endpoints.PublicEndpoints(self).public_endpoints_bp)
self.app = app
def start(self):
"""Start the Public API server."""
waitforsetvar.wait_for_set_var(self, "_too_many")
self.httpServer = WSGIServer((self.host, self.bindPort),
self.app, log=None,
handler_class=fdsafehandler.FDSafeHandler)
self.httpServer.serve_forever()

3
src/bigbrother/ministry/ofcommunication.py

@ -35,6 +35,9 @@ def detect_socket_leaks(socket_event):
try:
ip_address = ipaddress.ip_address(ip_address)
except ValueError:
if ip_address == "/":
# unix socket
return
logger.warn(f'Conn made to {ip_address} outside of Tor/similar')
raise \
NetworkLeak('Conn to host/non local IP, this is a privacy issue!')

26
src/bigbrother/ministry/ofexec.py

@ -3,11 +3,12 @@
Prevent eval/exec/os.system and log it
"""
import base64
import platform
from os import read
import logger
from utils import identifyhome
from onionrexceptions import ArbitraryCodeExec
from utils import readstatic
"""
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
@ -36,6 +37,7 @@ def block_exec(event, info):
# because libraries have stupid amounts of compile/exec/eval,
# We have to use a whitelist where it can be tolerated
# Generally better than nothing, not a silver bullet
return
whitelisted_code = [
'netrc.py',
'shlex.py',
@ -56,14 +58,30 @@ def block_exec(event, info):
'stem/response/mapaddress.py',
'stem/response/protocolinfo.py',
'apport/__init__.py',
'apport/report.py'
'apport/report.py',
'gevent/pool.py',
'gevent/queue.py',
'gevent/lock.py',
'gevent/monkey.py',
'gevent/_semaphore.py',
'gevent/_imap.py'
]
whitelisted_source = []
home = identifyhome.identify_home()
try:
whitelisted_source = readstatic.read_static(
'base64-code-whitelist.txt')
whitelisted_source = whitelisted_source.splitlines()
except FileNotFoundError:
logger.warn("Failed to read whitelisted code for bigbrother")
whitelisted_source = []
code_b64 = base64.b64encode(info[0].co_code).decode()
if code_b64 in whitelisted_source:
return
#uncomment when you want to build on the whitelist
else:
with open("../static-data/base64-code-whitelist.txt", "a") as f:
f.write(code_b64 + "\n")
return
for source in whitelisted_code:
if info[0].co_filename.endswith(source):

83
src/blockcreatorqueue/__init__.py

@ -0,0 +1,83 @@
"""Onionr - Private P2P Communication.
BlockCreatorQueue, generate anonvdf blocks in a queue
"""
from typing import Callable
from threading import Thread
from hashlib import sha3_224
from os import cpu_count
import time
import blockio
"""
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/>.
"""
class AlreadyGenerating(Exception): pass # noqa
class PassToSafeDB:
def __init__(self, db: 'SafeDB'):
self.db = db
self.block_creator_queue = BlockCreatorQueue(self.store_kasten)
def store_kasten(self, kasten_object):
self.db.put(kasten_object.id, kasten_object.get_packed())
def queue_then_store(self, block_data, block_type, ttl, **block_metadata):
self.block_creator_queue.queue_block(block_data, block_type, ttl, **block_metadata)
class BlockCreatorQueue:
def __init__(
self, callback_func: Callable, *additional_callback_func_args,
**additional_callback_func_kwargs):
self.callback_func = callback_func
self.queued = set()
self.max_parallel = cpu_count()
self.additional_callback_func_args = additional_callback_func_args
self.additional_callback_func_kwargs = additional_callback_func_kwargs
def block_data_in_queue(self, block_data: bytes) -> bool:
if sha3_224(block_data).digest() in self.queued:
return True
return False
def queue_block(
self, block_data, block_type, ttl: int, **block_metadata) -> bytes:
"""Spawn a thread to make a subprocess to generate a block
if queue is not full, else wait"""
digest = sha3_224(block_data).digest()
def _do_create():
if digest in self.queued:
raise AlreadyGenerating()
self.queued.add(digest)
while len(self.queued) >= self.max_parallel:
time.sleep(1)
result = blockio.subprocgenerate.vdf_block(
block_data, block_type, ttl, **block_metadata)
self.queued.remove(digest)
self.callback_func(
result,
*self.additional_callback_func_args,
**self.additional_callback_func_kwargs)
Thread(
target=_do_create, daemon=True,
name="BlockCreatorQueue block creation").start()
return digest

23
src/blockio/__init__.py

@ -0,0 +1,23 @@
"""Onionr - Private P2P Communication.
Wrap safedb for storing and fetching blocks
"""
from .store import store_block
from .load import load_block, list_blocks_by_type, list_all_blocks
from .clean import clean_expired_blocks, clean_block_list_entries
from . import subprocgenerate
from . import subprocvalidate
"""
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/>.
"""

2
src/blockio/clean/__init__.py

@ -0,0 +1,2 @@
from .cleanexpired import clean_expired_blocks
from .cleanblocklistentries import clean_block_list_entries

33
src/blockio/clean/cleanblocklistentries.py

@ -0,0 +1,33 @@
"""Onionr - Private P2P Communication.
Delete block type lists that are empty
"""
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from safedb import SafeDB
"""
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 clean_block_list_entries(db: 'SafeDB'):
key = db.db_conn.firstkey()
delete_keys = []
while key:
if key.startswith(b'bl-'):
if not db.get(key):
delete_keys.append(key)
key = db.db_conn.nextkey(key)
for key in delete_keys:
del db.db_conn[key]

48
src/blockio/clean/cleanexpired.py

@ -0,0 +1,48 @@
"""Onionr - Private P2P Communication.
clean expired blocks
"""
from typing import TYPE_CHECKING
from kasten import Kasten
from onionrblocks.generators.anonvdf import AnonVDFGenerator
from onionrblocks.exceptions import BlockExpired
if TYPE_CHECKING:
from safedb import SafeDB
"""
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 clean_expired_blocks(db: 'SafeDB'):
key = db.db_conn.firstkey()
delete_list = set()
# Scan all database keys and check kasten objs if they are a hash
while key:
try:
if key.startswith(b'bl-') or key.startswith(b'enc'):
key = db.db_conn.nextkey(key)
continue
Kasten(key, db.get(key), AnonVDFGenerator)