Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 29 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis-sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/python-app-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/workflows/python-app-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion .github/workflows/python-app-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions .github/workflows/python-app-sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Python Application - Sprint

on:
push:
branches: [ sprint6 ]
branches: [ sprint7 ]
pull_request:
branches: [ sprint6 ]
branches: [ sprint7 ]

jobs:
build:
Expand All @@ -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
23 changes: 16 additions & 7 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
131 changes: 1 addition & 130 deletions autocompliance/data/icons/hicolor/scalable/apps/org.example.App.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions autocompliance/src/blockchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion autocompliance/src/blockchain_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions autocompliance/src/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions autocompliance/src/demo_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions autocompliance/src/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions autocompliance/src/net_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 18 additions & 18 deletions autocompliance/src/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 " \
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions autocompliance/src/strings_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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 + \
Expand Down
Loading