From 13fd46a809d0eaf96571547e8db63a46d8b0927a Mon Sep 17 00:00:00 2001 From: azazelm3dj3d <56496067+azazelm3dj3d@users.noreply.github.com> Date: Thu, 6 Jul 2023 21:01:40 -0500 Subject: [PATCH 01/14] Working on some major improvements --- .gitignore | 2 +- CONTRIBUTING.md | 2 +- Cargo.toml | 6 +- Makefile | 34 ++ README.md | 2 +- build.rs | 2 +- build_modules.sh | 90 +++++ catherine.json | 7 + catherine_install | 53 --- modules.json | 55 ++++ requirements.txt | 9 + server/README.md | 3 + server/public/README.md | 3 +- server/public/index.html | 4 +- src/catherine.rs | 46 +-- src/core/commands.rs | 72 ++-- src/main.rs | 2 +- src/modules/db/README.md | 11 + src/modules/db/redis.py | 164 ++++++++++ src/modules/formats/README.md | 10 + src/modules/formats/exe/win_exe_dump.py | 56 ++++ src/modules/formats/hex/c_hex_dump.c | 64 ++++ src/modules/formats/hex/mod.rs | 7 + .../hex/rs_hex_dump.rs} | 19 +- src/modules/formats/mod.rs | 7 + src/modules/mercy/README.md | 15 + src/modules/mercy/extension.py | 69 ++++ src/modules/mod.rs | 2 +- src/modules/net/README.md | 9 + .../net/netscan/src/cmds/cli/commands.go | 309 ++++++++++++++++++ src/modules/net/netscan/src/go.mod | 10 + src/modules/net/netscan/src/go.sum | 12 + src/modules/net/netscan/src/main.go | 15 + src/modules/web/README.md | 9 + src/modules/web/parsers/links.py | 123 +++++++ src/ui/controller.rs | 24 +- src/ui/mod.rs | 2 +- tauri.conf.json | 123 ++++--- 38 files changed, 1239 insertions(+), 213 deletions(-) create mode 100644 Makefile create mode 100755 build_modules.sh create mode 100644 catherine.json delete mode 100755 catherine_install create mode 100644 modules.json create mode 100644 requirements.txt create mode 100644 server/README.md create mode 100644 src/modules/db/README.md create mode 100644 src/modules/db/redis.py create mode 100644 src/modules/formats/README.md create mode 100644 src/modules/formats/exe/win_exe_dump.py create mode 100644 src/modules/formats/hex/c_hex_dump.c create mode 100644 src/modules/formats/hex/mod.rs rename src/modules/{rust_hex_dump.rs => formats/hex/rs_hex_dump.rs} (73%) create mode 100644 src/modules/formats/mod.rs create mode 100644 src/modules/mercy/README.md create mode 100644 src/modules/mercy/extension.py create mode 100644 src/modules/net/README.md create mode 100644 src/modules/net/netscan/src/cmds/cli/commands.go create mode 100644 src/modules/net/netscan/src/go.mod create mode 100644 src/modules/net/netscan/src/go.sum create mode 100644 src/modules/net/netscan/src/main.go create mode 100644 src/modules/web/README.md create mode 100644 src/modules/web/parsers/links.py diff --git a/.gitignore b/.gitignore index 0668415..2e3f602 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ Cargo.lock build/ __MACOSX/ __pycache__/ -.DS_Store \ No newline at end of file +.DS_Store diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9004a30..d3b2cf9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,4 +10,4 @@ git checkout -b BRANCH_NAME 2. A pull request will need to be created and no merge conflicts should be present. -For anyone looking to contribute, please do not hesitate to fix or improve anything in the repository. \ No newline at end of file +For anyone looking to contribute, please do not hesitate to fix or improve anything in the repository. diff --git a/Cargo.toml b/Cargo.toml index c68e074..935e15c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "catherine" description = "The Catherine Framework is a general-purpose cybersecurity framework built to aggregate, validate, decode, decrypt, and maintain data." -version = "0.5.0" +version = "0.6.0" authors = ["azazelm3dj3d"] license = "BSD-2-Clause" categories = ["cryptography", "command-line-utilities", "encoding"] @@ -20,7 +20,7 @@ serde = "1.0" serde_json = "1.0" libloading = "0.7" prettytable-rs = "0.10.0" -mercy = "1.2.22" +mercy = "2.0.0" rand = "0.7.2" tauri = { version = "1.2.4", features = [] } @@ -29,4 +29,4 @@ ipconfig = "0.3.0" [features] default = [ "custom-protocol" ] -custom-protocol = [ "tauri/custom-protocol" ] \ No newline at end of file +custom-protocol = [ "tauri/custom-protocol" ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..31e06ab --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +# Project: Catherine Framework (https://github.com/azazelm3dj3d/catherine) +# Author: azazelm3dj3d (https://github.com/azazelm3dj3d) +# License: BSD 2-Clause + +NAME=catherine +PROJ_VERSION=0.6.0 + +run: + @echo "Building $(NAME) v$(PROJ_VERSION)" + make setup_env + make build + make modules + +setup_env: + sudo mkdir -p /opt/catherine/modules + sudo mkdir -p /opt/catherine/modules/db + sudo mkdir -p /opt/catherine/modules/formats/exe + sudo mkdir -p /opt/catherine/modules/formats/hex + sudo mkdir -p /opt/catherine/modules/mercy + sudo mkdir -p /opt/catherine/modules/net/netscan + sudo mkdir -p /opt/catherine/modules/web/parsers + pip3 install -r requirements.txt + +build: + cargo check && cargo build + +modules: + chmod +x build_modules.sh && sudo ./build_modules.sh + + @echo "[+] Configuring Hex 'C' module..." + sudo cc src/modules/formats/hex/c_hex_dump.c -Wall -shared -o /opt/catherine/modules/formats/hex/hex.so + + # Cleanup spec files from pyinstaller + sudo rm *.spec diff --git a/README.md b/README.md index cbfbc3e..e8521b8 100644 --- a/README.md +++ b/README.md @@ -61,4 +61,4 @@ If a GUI is more your style, there is a simple version available with the majori NOTE: I am still working on making the GUI a little nicer looking, but a basic version is currently available for testing. -If a bug or issue is found, please report it [here](https://github.com/azazelm3dj3d/catherine/issues). \ No newline at end of file +If a bug or issue is found, please report it [here](https://github.com/azazelm3dj3d/catherine/issues). diff --git a/build.rs b/build.rs index 3b92901..dbd46db 100644 --- a/build.rs +++ b/build.rs @@ -6,4 +6,4 @@ fn main() { tauri_build::build() -} \ No newline at end of file +} diff --git a/build_modules.sh b/build_modules.sh new file mode 100755 index 0000000..62625cd --- /dev/null +++ b/build_modules.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +# Project: Catherine Framework (https://github.com/azazelm3dj3d/catherine) +# Author: azazelm3dj3d (https://github.com/azazelm3dj3d) +# License: BSD 2-Clause + +# NetScan +# function netscan() { +# cd src/modules/net/netscan/src +# echo "[+] Configuring NetScan module..." + +# go build -o netscan + +# if [ -f "netscan" ] +# then +# echo "[+] NetScan successfully built" +# else +# echo "[-] NetScan was not built properly" +# fi + +# echo "" + +# mv netscan /opt/catherine/modules/ +# } + +# Web parsers +function parsers() { + # Link parser + echo "[+] Configuring Link Parser module..." + pyinstaller src/modules/web/parsers/links.py --onefile --clean -n links --distpath /opt/catherine/modules/web/parsers/ 2>/dev/null + + if [ -f "/opt/catherine/modules/web/parsers/links" ] + then + echo "[+] Link Parser module successfully built" + else + echo "[-] Link Parser module was not built properly" + fi + + echo "" +} + +# Exec Dump +function exec_dump() { + echo "[+] Configuring Windows Exe Dump module..." + pyinstaller src/modules/formats/exe/win_exe_dump.py --onefile --clean -n win_exe_dump --distpath /opt/catherine/modules/formats/exe/ 2>/dev/null + + if [ -f "/opt/catherine/modules/formats/exe/win_exe_dump" ] + then + echo "[+] Windows Exe Dump module successfully built" + else + echo "[-] Windows Exe Dump module was not built properly" + fi + + echo "" +} + +# Redis +function db_redis() { + echo "[+] Configuring Redis Database module..." + pyinstaller src/modules/db/redis.py --onefile --clean -n redis --distpath /opt/catherine/modules/db/ 2>/dev/null + + if [ -f "/opt/catherine/modules/db/redis" ] + then + echo "[+] Redis Database module successfully built" + else + echo "[-] Redis Database module was not built properly" + fi + + echo "" +} + +# Mercy Extension +function mercy_ext() { + echo "[+] Configuring Mercy Extension module..." + pyinstaller src/modules/mercy/extension.py --onefile --clean -n extension --distpath /opt/catherine/modules/mercy/ 2>/dev/null + + if [ -f "/opt/catherine/modules/mercy/extension" ] + then + echo "[+] Mercy Extension module successfully built" + else + echo "[-] Mercy Extension module was not built properly" + fi + + echo "" +} + +parsers +exec_dump +db_redis +mercy_ext diff --git a/catherine.json b/catherine.json new file mode 100644 index 0000000..da7bcf4 --- /dev/null +++ b/catherine.json @@ -0,0 +1,7 @@ +{ + "api_keys": [ + { + "inquest": "", + } + ] +} diff --git a/catherine_install b/catherine_install deleted file mode 100755 index 7202e36..0000000 --- a/catherine_install +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# Project: Catherine Framework (https://github.com/azazelm3dj3d/catherine) -# Author: azazelm3dj3d (https://github.com/azazelm3dj3d) -# License: BSD 2-Clause - -# Created directory for Catherine -catherine_dir="/opt/catherine" - -# Installs Catherine -function install_catherine() { - if [[ ! -d "$catherine_dir" ]]; then - mkdir $catherine_dir - echo "[+] Created Catherine cache successfully" - fi - - if ! catherine_installed="$(type -p "catherine")" || [[ -z $catherine_installed ]]; then - cargo install catherine - echo "[+] Catherine installed successfully" - fi -} - -install_catherine - -function install_modules() { - cd $catherine_dir - - if [[ -d "$catherine_dir/modules" ]]; then - rm -r "$catherine_dir/modules" - git clone https://github.com/azazelm3dj3d/catherine-modules.git - mv "$catherine_dir/catherine-modules" "$catherine_dir/modules" - - echo "[+] Catherine modules installed successfully" - else - git clone https://github.com/azazelm3dj3d/catherine-modules.git - mv "$catherine_dir/catherine-modules" "$catherine_dir/modules" - - if [[ -d "$catherine_dir/modules" ]]; then - echo "[+] Catherine modules installed successfully" - fi - fi -} - -install_modules - -function installation_complete() { - echo "" - echo "Catherine should now be installed!" - echo "You can start the framework by running 'catherine' in your terminal" - exit -} - -installation_complete \ No newline at end of file diff --git a/modules.json b/modules.json new file mode 100644 index 0000000..e68040a --- /dev/null +++ b/modules.json @@ -0,0 +1,55 @@ +{ + "author": "azazelm3dj3d", + "version": "0.1.26", + "numOfModules": "6", + "ModulesList": [ + { + "id": 1, + "name": "NetScan", + "description": "Collects publicly available network information about a host", + "version": "1.0.9", + "source_path": "net/netscan/src/*", + "dist_path": "net/netscan/dist/netscan" + }, + { + "id": 2, + "name": "links", + "description": "Parses web content, extracting external and internal links", + "version": "0.2.14", + "source_path": "web/parsers/links.py", + "dist_path": "web/parsers/dist/links" + }, + { + "id": 3, + "name": "Mercy Extension", + "description": "Suite of methods for decryption and decoding data, extends the Mercy Rust crate", + "version": "1.4.15", + "source_path": "mercy/extenstion.py", + "dist_path": "mercy/dist/extenstion" + }, + { + "id": 4, + "name": ["c_hex_dump", "rust_hex_dump"], + "description": "Dumps hexadecimal information for most file types (.exe, .toml, .c, etc.)", + "version": "0.1.11", + "source_path": ["data/hex/c/c_hex_dump.c", "data/hex/rust/rust_hex_dump.rs"], + "dist_path": ["data/hex/c/dist/hex.so", "data/hex/rust/rust_hex_dump.rs"] + }, + { + "id": 5, + "name": "redis_analysis", + "description": "Real-time Redis database analysis and monitoring", + "version": "1.3.36", + "source_path": "db/redis/redis_analysis.py", + "dist_path": "db/redis/dist/redis_analysis" + }, + { + "id": 6, + "name": "exec_dump_win", + "description": "Multi-format parser built to extract various data points from Windows executables, object binaries, DLLs and more (32-bit & 64-bit)", + "version": "0.1.10", + "source_path": "data/exe/exec_dump_win.py", + "dist_path": "data/exe/dist/exec_dump_win" + } + ] +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..12961c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +requests +bs4 +colorama +redis +prettytable +cryptography +pyjwt +pefile +pyinstaller \ No newline at end of file diff --git a/server/README.md b/server/README.md new file mode 100644 index 0000000..777b68a --- /dev/null +++ b/server/README.md @@ -0,0 +1,3 @@ +# Server Directory + +This server directory contains everything relevant to using the HTTP server functionality. diff --git a/server/public/README.md b/server/public/README.md index 06c20ad..14c9e6c 100644 --- a/server/public/README.md +++ b/server/public/README.md @@ -1,2 +1,3 @@ # Public Directory -This public directory is available for rendering HTML content when using the `start_server` command. \ No newline at end of file + +This public directory is available for rendering HTML content when using the `start_server` command. diff --git a/server/public/index.html b/server/public/index.html index 427493e..a05cbe3 100644 --- a/server/public/index.html +++ b/server/public/index.html @@ -13,6 +13,6 @@