diff --git a/.circleci/config.yml b/.circleci/config.yml index 2883d1d..3d10426 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,41 +2,57 @@ # See: https://circleci.com/docs/2.0/configuration-reference version: 2.1 -# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# Orbs are reusable packages of CircleCI configuration that you may share across +# projects, enabling you to create encapsulated, parameterized commands, jobs, +# and executors that can be used across multiple projects. # See: https://circleci.com/docs/2.0/orb-intro/ orbs: - # The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files + # The python orb contains a set of prepackaged CircleCI configuration you can + # use repeatedly in your configuration files # Orb commands and jobs help you with common scripting around a language/tool # so you dont have to copy and paste it everywhere. - # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python + # See the orb documentation here: + # https://circleci.com/developer/orbs/orb/circleci/python python: circleci/python@1.5.0 # Define a job to be invoked later in a workflow. # See: https://circleci.com/docs/2.0/configuration-reference/#jobs jobs: - build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do! - # These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/ - # You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub - # A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python - # The executor is the environment in which the steps below will be executed - below will use a python 3.10.2 container + build-and-test: # This is the name of the job, feel free to change it to + # better match what you're trying to do! + # These next lines defines a Docker executors: + # https://circleci.com/docs/2.0/executor-types/ + # You can specify an image from Dockerhub or use one of the convenience + # images from CircleCI's Developer Hub + # A list of available CircleCI Docker convenience images are available here: + # https://circleci.com/developer/images/image/cimg/python + # The executor is the environment in which the steps below will be executed + # - below will use a python 3.10.2 container # Change the version below to your required version of python docker: - image: cimg/python:3.10.2 # Checkout the code as the first step. This is a dedicated CircleCI step. - # The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default. - # Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt. + # The python orb's install-packages step will install the dependencies from + # a Pipfile via Pipenv by default. + # Here we're making sure we use just use the system-wide pip. By default, it + # uses the project root's requirements.txt. # Then run your tests! # CircleCI will report the results back to your VCS provider. steps: - checkout - python/install-packages: pkg-manager: pip - # app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory. - # pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements. + # app-dir: ~/project/package-directory/ # If you're requirements.txt + # isn't in the root directory. + # pip-dependency-file: test-requirements.txt # if you have a + # different name for your requirements file, maybe one that combines + # your runtime and test requirements. - run: name: Run tests # This assumes pytest is installed via the install-package step above - command: pytest + command: | + cd autocompliance/src + coverage run -m pytest --durations=0 -vv -x --log-level=debug # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows diff --git a/.github/workflows/codeql-analysis-sprint.yml b/.github/workflows/codeql-analysis-sprint.yml index bf1e7e7..86f3270 100644 --- a/.github/workflows/codeql-analysis-sprint.yml +++ b/.github/workflows/codeql-analysis-sprint.yml @@ -13,10 +13,10 @@ name: "CodeQL - Sprint" on: push: - branches: [ sprint6 ] + branches: [ sprint7 ] pull_request: # The branches below must be a subset of the branches above - branches: [ sprint6 ] + branches: [ sprint7 ] schedule: - cron: '34 22 * * 4' diff --git a/.github/workflows/python-app-develop.yml b/.github/workflows/python-app-develop.yml index 14325fd..c76ff0c 100644 --- a/.github/workflows/python-app-develop.yml +++ b/.github/workflows/python-app-develop.yml @@ -33,4 +33,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + cd autocompliance/src + coverage run -m pytest --durations=0 -vv -x --log-level=debug diff --git a/.github/workflows/python-app-feature.yml b/.github/workflows/python-app-feature.yml index 59a0305..4ea0eae 100644 --- a/.github/workflows/python-app-feature.yml +++ b/.github/workflows/python-app-feature.yml @@ -33,4 +33,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + cd autocompliance/src + coverage run -m pytest --durations=0 -vv -x --log-level=debug diff --git a/.github/workflows/python-app-main.yml b/.github/workflows/python-app-main.yml index a6332bb..efa0505 100644 --- a/.github/workflows/python-app-main.yml +++ b/.github/workflows/python-app-main.yml @@ -33,4 +33,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + cd autocompliance/src + coverage run -m pytest --durations=0 -vv -x --log-level=debug diff --git a/.github/workflows/python-app-sprint.yml b/.github/workflows/python-app-sprint.yml index 7f9b1d4..3206f53 100644 --- a/.github/workflows/python-app-sprint.yml +++ b/.github/workflows/python-app-sprint.yml @@ -5,9 +5,9 @@ name: Python Application - Sprint on: push: - branches: [ sprint6 ] + branches: [ sprint7 ] pull_request: - branches: [ sprint6 ] + branches: [ sprint7 ] jobs: build: @@ -33,4 +33,5 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest + cd autocompliance/src + coverage run -m pytest --durations=0 -vv -x --log-level=debug diff --git a/SECURITY.md b/SECURITY.md index 2e8ebd0..970a6f0 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,12 +2,21 @@ ## Supported Versions -| Version | Supported | -| ------- | ------------------ | -| 0.2.0 | :x: | -| 0.1.0 | :x: | -| 0.0.1 | :x: | - +| Version | Supported | +|---------|-----------| +| 0.4.0 | :x: | +| 0.3.0 | :x: | +| 0.2.0 | :x: | +| 0.1.0 | :x: | +| 0.0.1 | :x: | ## Reporting a Vulnerability -Report as a bug, but format the title with "SECURITY: " at the beggining, try to include a CVE code and link to resources if you can. +Report as a bug, but format the title with "SECURITY: " at the beginning, try +to include a CVE code and link to resources if you can. + +## Contributing +Be sure to check codeql reports from GitHub actions and CodeFactor reports for +any vulnerabilities, or security defects. Also be sure to use the latest +versions of any dependencies and libraries, check for conflicts in functionality +and update accordingly if this occurs. All contributions are to be reviewed by +the main repository contributors (as of now that is just me) \ No newline at end of file diff --git a/autocompliance/data/icons/hicolor/scalable/apps/org.example.App.svg b/autocompliance/data/icons/hicolor/scalable/apps/org.example.App.svg index a74c4df..3f04c7c 100644 --- a/autocompliance/data/icons/hicolor/scalable/apps/org.example.App.svg +++ b/autocompliance/data/icons/hicolor/scalable/apps/org.example.App.svg @@ -1,130 +1 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - application-x-executable - - - - - - - - - - - - - - - - +application-x-executable \ No newline at end of file diff --git a/autocompliance/src/blockchain.py b/autocompliance/src/blockchain.py index 35f6d4d..89a6c4e 100644 --- a/autocompliance/src/blockchain.py +++ b/autocompliance/src/blockchain.py @@ -49,12 +49,12 @@ def get_previous_block(self): return last_block def set_speaker_timeout(self): - self.speaker_timeout = pow(2, self.chain.index(self.validator) + 1) * \ + self.speaker_timeout = pow(2, len(self.chain) * self.validator + 1) * \ self.speaker_timeout def set_validator(self): - self.validator = (self.chain.__len__() - - self.chain.index(self.validator)) % \ + # TODO: Revise this. Seems incorrect. + self.validator = (len(self.chain) - len(self.chain) * self.validator) % \ self.number_of_validators def initialise_consensus_information(self): diff --git a/autocompliance/src/blockchain_functions.py b/autocompliance/src/blockchain_functions.py index cc18faa..1662671 100644 --- a/autocompliance/src/blockchain_functions.py +++ b/autocompliance/src/blockchain_functions.py @@ -7,7 +7,7 @@ # Using flask to send messages to postman. from flask import Flask, jsonify # Importing blockchain for the blockchain object -import autocompliance.src.blockchain as blockchain +import blockchain # Importing json to encode information as JSON. import json # Hashlib for the hashing of blockchain blocks. diff --git a/autocompliance/src/demo.py b/autocompliance/src/demo.py index 30eea2b..1ec78a1 100755 --- a/autocompliance/src/demo.py +++ b/autocompliance/src/demo.py @@ -3,15 +3,15 @@ # Author: @andrewk10 # Importing demo_functions for demo specific functionality. -import autocompliance.src.demo_functions as demo_functions +import demo_functions # Importing file for working with files. -import autocompliance.src.file as file +import file # Importing logging to safely log sensitive, error or debug info. import logging # Importing net_propagation for propagating across the network. -import autocompliance.src.net_propagation as net_propagation +import net_propagation # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings # Importing sys to handle arguments import sys diff --git a/autocompliance/src/demo_functions.py b/autocompliance/src/demo_functions.py index 197c544..835c9a9 100644 --- a/autocompliance/src/demo_functions.py +++ b/autocompliance/src/demo_functions.py @@ -5,13 +5,13 @@ # Importing argparse for command-line option parsing import argparse # Importing file for file based functionality -import autocompliance.src.file as file +import file # Importing logging to safely log sensitive, error or debug info. import logging # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings # Importing strings_functions for string building functions. -import autocompliance.src.strings_functions as strings_functions +import strings_functions class DemoFunctions: diff --git a/autocompliance/src/file.py b/autocompliance/src/file.py index 4c6573a..da9150e 100644 --- a/autocompliance/src/file.py +++ b/autocompliance/src/file.py @@ -3,17 +3,17 @@ # Author: @andrewk10 # Importing demo_functions for the demo specific functionality. -import autocompliance.src.demo_functions as demo_functions +import demo_functions # Importing logging to safely log sensitive, error or debug info. import logging # For net_propagation related functionality. -import autocompliance.src.net_propagation as net_propagation +import net_propagation # Import os for path checking. import os # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings # Importing strings_functions for string building functions. -import autocompliance.src.strings_functions as strings_functions +import strings_functions # Importing subprocess for running commands. import subprocess diff --git a/autocompliance/src/net_propagation.py b/autocompliance/src/net_propagation.py index 507564d..c286548 100755 --- a/autocompliance/src/net_propagation.py +++ b/autocompliance/src/net_propagation.py @@ -22,9 +22,9 @@ # Importing requests for web based operations. import requests # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings # Importing strings_functions for string building functions. -import autocompliance.src.strings_functions as strings_functions +import strings_functions class NetPropagation: diff --git a/autocompliance/src/strings.py b/autocompliance/src/strings.py index 1595f68..0337e01 100644 --- a/autocompliance/src/strings.py +++ b/autocompliance/src/strings.py @@ -65,11 +65,14 @@ # request. CONSENSUS_MESSAGE_RECOVERY_REQUEST = "Recovery Request" +# The demo script +DEMO_SCRIPT = "./demo.py" + # The demo filename DEMO_SCRIPT_FILENAME = "demo.py" # The demo script path. -DEMO_SCRIPT_PATH = "./demo.py" +DEMO_SCRIPT_PATH = "demo.py" # This is the program description for the cli help menu. DESCRIPTION = "Automating the Implementation of a " \ @@ -104,9 +107,8 @@ # Prompts the user that their fetching the local interface list. FETCHING_LOCAL_INTERFACE_LIST = "Fetching local interface list..." -# Name of the test text file, prepended with autocompliance/src/ for Pytest to -# work. -FILE = "autocompliance/src/test_files/file.txt" +# Name of the test text file. +FILE = "test_files/file.txt" # Lets the user know a file doesn't exist. FILE_DOES_NOT_EXIST = "A specified file does not exist" @@ -177,13 +179,11 @@ # Letting the user know a specified IP file could not be found. IP_FILENAME_NOT_FOUND = "Could not find the specified IP file" -# Name of the test IP list file, prepended with autocompliance/src/ for Pytest -# to work. -IP_LIST = "autocompliance/src/test_files/ip_list.txt" +# Name of the test IP list file. +IP_LIST = "test_files/ip_list.txt" -# Name of the short test IP list file, prepended with autocompliance/src/ for -# Pytest to work. -IP_LIST_SHORT = "autocompliance/src/test_files/ip_list_short.txt" +# Name of the short test IP list file. +IP_LIST_SHORT = "test_files/ip_list_short.txt" # Let the user know that we're checking to see if the IP address is reachable. IS_IP_REACHABLE = "Checking if the following ip address is reachable:" @@ -258,9 +258,9 @@ # Netcat writer with a 3-second timeout time, command. NETCAT_WRITER_COMMAND = "nc -w 3" -# The name of the net propagation script, prepended with autocompliance/src/ +# The name of the net propagation script. # for tests to work. -NET_PROPAGATION = "autocompliance/src/net_propagation.py" +NET_PROPAGATION = "net_propagation.py" # Newline character, mostly used to mimic an enter key press. NEWLINE = "\n" @@ -294,11 +294,11 @@ # Help text for the password file option. PW_FILE_HELP = "Filename for a file containing a list of passwords" -# List of dummy passwords, prepended with autocompliance/src/ -PWDS_LIST = "autocompliance/src/test_files/passwords_list.txt" +# List of dummy passwords +PWDS_LIST = "test_files/passwords_list.txt" -# Shorter list of dummy passwords, prepended with autocompliance/src/ -PWDS_LIST_SHORT = "autocompliance/src/test_files/passwords_list_short.txt" +# Shorter list of dummy passwords +PWDS_LIST_SHORT = "test_files/passwords_list_short.txt" # Parameters string for help test. PARAMETERS = "Parameters:" @@ -729,11 +729,11 @@ def help_output(): LAN_OPT_SHORT + SPACE + ARROW + SPACE + \ LOCAL_SCAN_STRING_HELP + NEWLINE_TAB + PROP_OPT_SHORT + SPACE + \ ARROW + SPACE + HELP_STRING_PROPAGATION + NEWLINE + EXAMPLE_USAGE + \ - NEWLINE_TAB + DEMO_SCRIPT_PATH + SPACE + \ + NEWLINE_TAB + DEMO_SCRIPT + SPACE + \ IP_FILE_OPT_SHORT + SPACE + IP_LIST + SPACE + \ PORT_OPT_SHORT + SPACE + ALL_PORTS + SPACE + USERNAME_OPT_SHORT + \ SPACE + ADMIN + SPACE + PW_FILE_OPT_SHORT + SPACE + PWDS_LIST + \ - NEWLINE_NEWLINE_TAB + DEMO_SCRIPT_PATH + \ + NEWLINE_NEWLINE_TAB + DEMO_SCRIPT + \ IP_FILE_OPT_SHORT + SPACE + IP_LIST + SPACE + \ PORT_OPT_SHORT + SPACE + SSH_PORT + SPACE + USERNAME_OPT_SHORT + \ SPACE + ROOT + SPACE + PW_FILE_OPT_SHORT + SPACE + PWDS_LIST diff --git a/autocompliance/src/strings_functions.py b/autocompliance/src/strings_functions.py index 68d3947..fbfd7aa 100644 --- a/autocompliance/src/strings_functions.py +++ b/autocompliance/src/strings_functions.py @@ -3,7 +3,7 @@ # Author: @andrewk10 # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings def adding_address_to_interface(specific_address, interface): @@ -104,14 +104,14 @@ def help_output(): strings.LOCAL_SCAN_STRING_HELP + strings.NEWLINE_TAB + \ strings.PROP_OPT_SHORT + strings.SPACE + strings.ARROW + \ strings.SPACE + strings.HELP_STRING_PROPAGATION + strings.NEWLINE + \ - strings.EXAMPLE_USAGE + strings.NEWLINE_TAB + strings.MAIN_SCRIPT + \ + strings.EXAMPLE_USAGE + strings.NEWLINE_TAB + strings.DEMO_SCRIPT + \ strings.SPACE + strings.IP_FILE_OPT_SHORT + \ strings.SPACE + strings.IP_LIST + strings.SPACE + \ strings.PORT_OPT_SHORT + strings.SPACE + strings.ALL_PORTS + \ strings.SPACE + strings.USERNAME_OPT_SHORT + strings.SPACE + \ strings.ADMIN + strings.SPACE + strings.PW_FILE_OPT_SHORT + \ strings.SPACE + strings.PWDS_LIST + strings.NEWLINE_NEWLINE_TAB + \ - strings.MAIN_SCRIPT + strings.IP_FILE_OPT_SHORT + \ + strings.DEMO_SCRIPT + strings.IP_FILE_OPT_SHORT + \ strings.SPACE + strings.IP_LIST + strings.SPACE + \ strings.PORT_OPT_SHORT + strings.SPACE + strings.SSH_PORT + \ strings.SPACE + strings.USERNAME_OPT_SHORT + strings.SPACE + \ diff --git a/autocompliance/src/test_blockchain.py b/autocompliance/src/test_blockchain.py index 4395e9b..8779e96 100644 --- a/autocompliance/src/test_blockchain.py +++ b/autocompliance/src/test_blockchain.py @@ -2,16 +2,18 @@ # Author: @andrewk10 -# Importing blockchain for blockchain based functionality -import autocompliance.src.blockchain as blockchain +# Importing autocompliance_blockchain for blockchain based functionality +import blockchain +# Importing logging to safely log sensitive, error or debug info. +import logging def test_create_blockchain(): """ - This function tests the create_blockchain function in the blockchain - script. It uses example arguments to do this stored in strings.py, but - before it does that the bad path is checked by passing in a single argument - with no value to get a runtime error. + This function tests the create_blockchain function in the blockchain script. + It uses example arguments to do this stored in strings.py, but before it does that the + bad path is checked by passing in a single argument with no value to get a runtime + error. """ # Creating blockchain itself. test_blockchain = blockchain.Blockchain() @@ -20,3 +22,40 @@ def test_create_blockchain(): assert test_blockchain.get_previous_block()["timestamp"] is not None assert test_blockchain.get_previous_block()["proof"] == 1 assert test_blockchain.get_previous_block()["previous_hash"] == "0" + + +def test_set_speaker_timeout(): + """ + This function tests the set_speaker_timeout function in the blockchain script. + """ + # Creating blockchain itself. + test_blockchain = blockchain.Blockchain() + test_blockchain.validator = 5 + test_blockchain.speaker_timeout = 5 + test_blockchain.set_speaker_timeout() + assert test_blockchain.speaker_timeout == 320 + + +def test_set_validator(): + """ + This function tests the set_validator function in the blockchain script. All it does + really is provide coverage on the function itself. + TODO: This test could be more robust. try to add random values to the equation. + """ + test_blockchain = blockchain.Blockchain() + test_blockchain.validator = 1 + test_blockchain.number_of_validators = 1 + test_blockchain.set_validator() + assert test_blockchain.validator == 0 + + +def test_initialise_consensus_information(): + """ + This function tests the set_validator function in the blockchain script. It does this + by changing the blockchain's values for number of validators to some abstract value. + TODO: Make this number random to avoid coincidences. + """ + test_blockchain = blockchain.Blockchain() + test_blockchain.number_of_validators = 25 + test_blockchain.initialise_consensus_information() + assert test_blockchain.consensus_context == 17 diff --git a/autocompliance/src/test_demo_functions.py b/autocompliance/src/test_demo_functions.py index 843c165..ce3ff6a 100644 --- a/autocompliance/src/test_demo_functions.py +++ b/autocompliance/src/test_demo_functions.py @@ -3,11 +3,11 @@ # Author: @andrewk10 # Import demo_functions to test the demo specific functionality. -import autocompliance.src.demo_functions as demo_functions +import demo_functions # Importing strings for use of the external strings resources. -import autocompliance.src.strings as strings +import strings # Importing strings_functions for string building functions. -import autocompliance.src.strings_functions as strings_functions +import strings_functions def test_assigning_values(): diff --git a/autocompliance/src/test_file.py b/autocompliance/src/test_file.py index f8f8ccd..e59dda5 100644 --- a/autocompliance/src/test_file.py +++ b/autocompliance/src/test_file.py @@ -3,13 +3,13 @@ # Author: @andrewk10 # Importing file for file based functionality -import autocompliance.src.file as file +import file # Importing strings for common string resources. -import autocompliance.src.strings as strings +import strings # Importing strings_functions for dynamic string functionality. -import autocompliance.src.strings_functions as strings_functions +import strings_functions # Importing demo functions for the parsing of arguments. -import autocompliance.src.demo_functions as demo_functions +import demo_functions def test_append_lines_from_file_to_list(): diff --git a/autocompliance/src/test_net_propagation.py b/autocompliance/src/test_net_propagation.py index e1f56e8..0495d2a 100644 --- a/autocompliance/src/test_net_propagation.py +++ b/autocompliance/src/test_net_propagation.py @@ -3,15 +3,15 @@ # Author: @andrewk10 # Importing demo_functions for demo specific functionality. -import autocompliance.src.demo_functions as demo_functions +import demo_functions # Importing file for file based functionality -import autocompliance.src.file as file +import file # Importing logging to log the ping command fails import logging # Importing net_propagation for testing -import autocompliance.src.net_propagation as net_propagation +import net_propagation # Importing strings for common string resources -import autocompliance.src.strings as strings +import strings # Importing subprocess to run the ping command where needed import subprocess diff --git a/autocompliance/src/test_strings_functions.py b/autocompliance/src/test_strings_functions.py index d3779d4..ebf01e0 100644 --- a/autocompliance/src/test_strings_functions.py +++ b/autocompliance/src/test_strings_functions.py @@ -3,9 +3,9 @@ # Author: @andrewk10 # Importing strings_functions.py for testing. -import autocompliance.src.strings_functions as strings_functions +import strings_functions # Importing strings for the use of predefined test strings. -import autocompliance.src.strings as strings +import strings def test_adding_address_to_interface(capfd): diff --git a/autocompliance/src/window.py b/autocompliance/src/window.py index 896c92c..b1f8765 100644 --- a/autocompliance/src/window.py +++ b/autocompliance/src/window.py @@ -26,10 +26,10 @@ class AutocomplianceWindow(Gtk.ApplicationWindow): def __init__(self, **kwargs): super().__init__(**kwargs) - self.set_title("AutoCompliance") + #self.set_title("AutoCompliance") - box = Gtk.VBox() - self.set_child(box) + #box = Gtk.VBox() + #self.set_child(box) resource_limiting_btn = Gtk.Button(label='Resource Limiting') resource_limiting_btn.connect('clicked', lambda x: self.close()) @@ -55,7 +55,7 @@ class AboutDialog(Gtk.AboutDialog): def __init__(self, parent): Gtk.AboutDialog.__init__(self) self.props.program_name = 'autocompliance' - self.props.version = "0.1.0" + self.props.version = "0.5.0" self.props.authors = ['Andrew'] self.props.copyright = '2022 Andrew' self.props.logo_icon_name = 'org.example.App' diff --git a/demo.sh b/demo.sh index ac35cd2..07c038e 100755 --- a/demo.sh +++ b/demo.sh @@ -3,22 +3,23 @@ # Running the propagation script across numerous services (SSH, Web) echo "Running the propagation script across numerous services (SSH, Web)" -./autocompliance/src/demo.py -t src/test_files/ip_list_short.txt -p 22,25,80 -u admin -f \ -src/test_files/passwords_list_short.txt +sudo ./autocompliance/src/demo.py -t autocompliance/src/test_files/ip_list_short.txt -p \ +22,25,80 -u admin -f autocompliance/src/test_files/passwords_list_short.txt # Running the propagation script just across SSH echo "Running the propagation script just across SSH" -./autocompliance/src/demo.py -t src/test_files/ip_list_short.txt -p 22 -u root -f \ -src/test_files/passwords_list_short.txt +sudo ./autocompliance/src/demo.py -t autocompliance/src/test_files/ip_list_short.txt -p \ +22 -u root -f autocompliance/src/test_files/passwords_list_short.txt # Running the propagation script just across SSH and spreading a specific file. -echo "Running the propagation script just across SSH and spreading a \ -specific file" -./autocompliance/src/demo.py -t src/test_files/ip_list_short.txt -p 22 -u root -f \ -src/test_files/passwords_list_short.txt -d src/test_files/file.txt +echo "Running the propagation script just across SSH and spreading a specific file" +sudo ./autocompliance/src/demo.py -t autocompliance/src/test_files/ip_list_short.txt -p \ +22 -u root -f autocompliance/src/test_files/passwords_list_short.txt -d \ +autocompliance/src/test_files/file.txt # Running the propagation script across SSH but acquiring IPs through a local # scan and then subsequently self propagating. echo "Running the propagation script across SSH but acquiring IPs through a \ local scan and then subsequently self propagating." -./autocompliance/src/demo.py -L -p 22 -u root -f src/test_files/passwords_list_short.txt -P +sudo ./autocompliance/src/demo.py -L -p 22 -u root -f autocompliance/src/test_files/\ +passwords_list_short.txt -P diff --git a/docs/research/proposal/assets/Figure1_1Edited.png b/docs/research/proposal/assets/Figure1_1Edited.png index e52c4d9..537899c 100644 Binary files a/docs/research/proposal/assets/Figure1_1Edited.png and b/docs/research/proposal/assets/Figure1_1Edited.png differ diff --git a/docs/wiki/usage/index.md b/docs/wiki/usage/index.md index 0421169..99d200f 100644 --- a/docs/wiki/usage/index.md +++ b/docs/wiki/usage/index.md @@ -22,17 +22,15 @@ The script will take in the following parameters: | -L | Perform scan on local networks | | -P | Propagate the script itself and password file | -Example usage would look like this: -``` +Example usage of the demo script would look like this: # Running the propagation script across numerous services (SSH, Telnet, Web) -./main.py -t src/test_files/ip_list.txt -p 22,23,25,80 -u admin -f src/test_files/passwords_list.txt +./demo.py -t src/test_files/ip_list.txt -p 22,23,25,80 -u admin -f src/test_files/passwords_list.txt # Running the propagation script just across SSH -./main.py -t src/test_files/ip_list.txt -p 22 -u root -f src/test_files/passwords_list.txt +./demo.py -t src/test_files/ip_list.txt -p 22 -u root -f src/test_files/passwords_list.txt # Running the propagation script just across SSH and spreading a specific file. -./main.py -t src/test_files/ip_list.txt -p 22 -u root -f src/test_files/passwords_list.txt -d src/test_files/file.txt +./demo.py -t src/test_files/ip_list.txt -p 22 -u root -f src/test_files/passwords_list.txt -d src/test_files/file.txt # Running the propagation script across SSH and Telnet but acquiring IPs through a local scan and then subsequently self propagating. -./main.py -L -p 22,23 -u root -f src/test_files/passwords_list.txt -P -``` \ No newline at end of file +./demo.py -L -p 22,23 -u root -f src/test_files/passwords_list.txt -P \ No newline at end of file diff --git a/setup.sh b/setup.sh index 81c9a12..b722b00 100755 --- a/setup.sh +++ b/setup.sh @@ -1,3 +1,6 @@ #!/usr/bin/env bash # Linux setup for running the scripts locally, mostly needed for demos. +# TODO: Need to figure out why Paramiko has to be installed natively too, and Scapy +# sudo dnf install python3-paramiko pytest + python3 -m pip install --upgrade pip ipykernel paramiko scapy pytest requests coverage diff --git a/tests.sh b/tests.sh index 3f6cd75..1063d2f 100755 --- a/tests.sh +++ b/tests.sh @@ -1,17 +1,18 @@ #!/usr/bin/env bash # Pytest local run with coverage and a report exported to HTML # See; https://coverage.readthedocs.io/en/6.3.2/ -coverage run -m pytest --durations=0 -vv -x --log-level=debug +cd autocompliance/src +coverage run -m pytest --durations=0 -vv --log-level=debug coverage report coverage html # To test individual test files and check test speeds for pruning see and # uncomment the following. -#pytest --durations=0 -vv -x --log-level=debug src/test_blockchain.py -#pytest --durations=0 -vv -x --log-level=debug src/test_blockchain_delegate.py -#pytest --durations=0 -vv -x --log-level=debug src/test_blockchain_functions.py -#pytest --durations=0 -vv -x --log-level=debug src/test_blockchain_speaker.py -#pytest --durations=0 -vv -x --log-level=debug src/test_demo_functions.py -#pytest --durations=0 -vv -x --log-level=debug src/test_file.py -#pytest --durations=0 -vv -x --log-level=debug src/test_net_propagation.py -#pytest --durations=0 -vv -x --log-level=debug src/test_strings_functions.py \ No newline at end of file +#pytest --durations=0 -vv --log-level=debug test_blockchain.py +#pytest --durations=0 -vv --log-level=debug test_blockchain_delegate.py +#pytest --durations=0 -vv --log-level=debug test_blockchain_functions.py +#pytest --durations=0 -vv --log-level=debug test_blockchain_speaker.py +#pytest --durations=0 -vv --log-level=debug test_demo_functions.py +#pytest --durations=0 -vv --log-level=debug test_file.py +#pytest --durations=0 -vv --log-level=debug test_net_propagation.py +#pytest --durations=0 -vv --log-level=debug test_strings_functions.py \ No newline at end of file