diff --git a/scripts/README.md b/scripts/README.md index 8175b75c..39563dfd 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,7 +1 @@ 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 -block-spammer.py: attack tool for spamming blocks -announce-attack.py: flood a node with false nodes -run-unit-test-by-name: runs a unit test (no browser, runtime or intgegration test) by name \ No newline at end of file diff --git a/scripts/client-api-request-crafter.py b/scripts/client-api-request-crafter.py deleted file mode 100644 index a5780fb0..00000000 --- a/scripts/client-api-request-crafter.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 - -"""Craft and send requests to the local client API""" - - -import sys -import os -if not os.path.exists('onionr.sh'): - os.chdir('../') -sys.path.append("src/") - -import atexit -import readline - -histfile = os.path.join(os.path.expanduser("~"), ".onionr_history") -try: - readline.read_history_file(histfile) - # default history len is -1 (infinite), which may grow unruly - readline.set_history_length(1000) -except FileNotFoundError: - pass - -atexit.register(readline.write_history_file, histfile) -from onionrutils.localcommand import local_command -from onionrutils.localcommand import get_hostname - -try: - print('API file found, probably running on ' + get_hostname()) -except TypeError: - print('Onionr not running') - sys.exit(1) -print('1. get request (default)') -print('2. post request') -choice = input(">").lower().strip() -post = False -post_data = {} -json = False -endpoint = input("URL Endpoint: ") -data = input("Data url param: ") -if choice in ("2", "post", "post request"): - post = True - print("Enter post data") - post_data = input() - if post_data: - print("Is this JSON?") - json = input("y/n").lower().strip() - if json == "y": - json = True - -ret = local_command(endpoint, data=data, post=post, post_data=post_data, is_json=json) -print("Response: \n", ret) diff --git a/scripts/generate-onions.py b/scripts/generate-onions.py deleted file mode 100755 index 414e9c89..00000000 --- a/scripts/generate-onions.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 - -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/") - -try: - sys.argv[1] -except IndexError: - sys.exit(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() \ No newline at end of file diff --git a/scripts/show-blocks.py b/scripts/show-blocks.py deleted file mode 100644 index cfb3f5e3..00000000 --- a/scripts/show-blocks.py +++ /dev/null @@ -1,16 +0,0 @@ -import sys -import os -import stem - -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 - -for bl in get_block_list(): - bl_obj = Block(bl, decrypt=False) - b_type = bl_obj.getType() - if not b_type: - b_type = "encrypted" - print(bl + " - " + str(bl_obj.date) + " - " + b_type) diff --git a/scripts/sybil-attack.py b/scripts/sybil-attack.py deleted file mode 100644 index 0914f311..00000000 --- a/scripts/sybil-attack.py +++ /dev/null @@ -1,40 +0,0 @@ -import sys -import os -import stem - -if not os.path.exists('onionr.sh'): - os.chdir('../') -sys.path.append("src/") -from onionrutils import stringvalidators -from onionrutils import basicrequests - -from stem.control import Controller - -onionr_ip = input("onionr ip address: ") -onionr_port = int(input("Enter onionr public api port: ")) - -controller = Controller.from_port('127.0.0.1', int(input("Enter tor controller port: "))) -controller.authenticate() - -node = input("Enter node to attack. Note that you legally must use your own, and even that might lead to technical or legal issues: ") -assert stringvalidators.validate_transport(node) - -socks = input("Socks:") - -adders = set([]) -for i in range(int(input("Sybil addresses: "))): - response = controller.create_ephemeral_hidden_service({80: f'{onionr_ip}:{onionr_port}'}, await_publication=True) - #print(i, response.service_id) - adders.add(response.service_id) - - -for x in adders: - x += '.onion' - print(f"Introducing {x} to {node}") - basicrequests.do_post_request( - f'http://{node}/announce', - data = {'node': x}, - port=socks) - - - diff --git a/scripts/testblock.py b/scripts/testblock.py deleted file mode 100755 index f0085641..00000000 --- a/scripts/testblock.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import os -if not os.path.exists('onionr.sh'): - os.chdir('../') -sys.path.append("src/") -import onionrblocks - -expire = 600 -print(onionrblocks.insert(data=os.urandom(32), expire=expire)) -