-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 9473c8c Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 16:15:17 2024 -0500 Update changelog commit f2734e8 Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 16:15:07 2024 -0500 Add path triggers for release workflow commit 4abaa6c Author: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue Feb 6 20:42:50 2024 +0000 Bump version number to match release '0.1.8' commit 8f311b0 Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 15:14:36 2024 -0500 Bump Fedora version and refactor Dockerfile commit c69eb25 Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 15:14:07 2024 -0500 Remove libssp from Windows link arg commit f367c7a Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 15:13:21 2024 -0500 CI formatting commit b0d1686 Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 15:12:36 2024 -0500 Modify CI linting for Mythic code commit 33b936d Author: Matt Ehrnschwender <[email protected]> Date: Tue Feb 6 15:11:38 2024 -0500 Add sync.sh ignore
- Loading branch information
Showing
24 changed files
with
283 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
#!/bin/bash | ||
|
||
THANATOS_PATH="" | ||
MYTHIC_CODE="thanatos/mythic/agent_functions" | ||
AGENT_CODE="thanatos/agent_code" | ||
|
||
CARGO_VARS=$(cat <<EOF | ||
RUSTFLAGS='--cfg http' | ||
UUID='' | ||
AESPSK='' | ||
callback_host='' | ||
callback_interval='' | ||
callback_jitter='' | ||
callback_port='' | ||
connection_retries='' | ||
encrypted_exchange_check='' | ||
get_uri='' | ||
headers='' | ||
post_uri='' | ||
working_hours='' | ||
EOF | ||
) | ||
|
||
# Populates the 'THANATOS_PATH' variable with the path to the thanatos payload base directory | ||
populate_thanatos_path() { | ||
# Get the path to the directory containing this script | ||
local _script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
|
||
# Traverse up to the base of the git repository | ||
local _repo_base=${_script_dir}/../.. | ||
|
||
# Ensure that the repo base contains the '.git' directory | ||
if [ ! -d "${_repo_base}/.git" ]; then | ||
echo "Could not find git repository base" | ||
exit 1 | ||
fi | ||
|
||
# Set the THANATOS_PATH variable to the base of the payload | ||
THANATOS_PATH="$(realpath ${_repo_base}/Payload_Type/thanatos)" | ||
} | ||
|
||
# Check that python3, python3-pylint, python3-black, cargo, cargo-fmt, and cargo-clippy exist | ||
check_requirements() { | ||
# Ensure python3 exists | ||
python3 --version &> /dev/null | ||
|
||
# Ensure python3-pylint exists | ||
python3 -m pylint --version &> /dev/null | ||
|
||
# Ensure python3-black exists | ||
python3 -m black --version &> /dev/null | ||
|
||
# Ensure cargo exists | ||
cargo -V &> /dev/null | ||
|
||
# Ensure cargo fmt exists | ||
cargo fmt --version &> /dev/null | ||
|
||
# Ensure cargo clippy exists | ||
cargo fmt --version &> /dev/null | ||
} | ||
|
||
# Run syntax checking | ||
syntax_check() { | ||
echo "[*] Running syntax checks" | ||
|
||
local _cmd="python3 -m pylint --rcfile pylintrc -f colorized --errors-only main.py ${MYTHIC_CODE}/*.py" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $_cmd" | ||
eval $_cmd | ||
|
||
pushd $AGENT_CODE &> /dev/null | ||
local _cmd="env ${CARGO_VARS} cargo check --color always --all-targets --all-features" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $(echo $_cmd | tr '\n' ' ')" | ||
eval $_cmd | ||
popd &> /dev/null | ||
} | ||
|
||
# Run code format checking | ||
format_check() { | ||
echo "[*] Running code format checks" | ||
|
||
local _cmd="python3 -m black --color --diff --check main.py ${MYTHIC_CODE}/*.py" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $_cmd" | ||
eval $_cmd | ||
|
||
pushd $AGENT_CODE &> /dev/null | ||
local _cmd="env ${CARGO_VARS} cargo fmt -- --color always --check" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $(echo $_cmd | tr '\n' ' ')" | ||
eval $_cmd | ||
popd &> /dev/null | ||
} | ||
|
||
# Run lint checks | ||
lint_check() { | ||
echo "[*] Running lint checks" | ||
|
||
local _cmd="python3 -m pylint --rcfile pylintrc -f colorized main.py ${MYTHIC_CODE}/*.py" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $_cmd" | ||
eval $_cmd | ||
|
||
pushd $AGENT_CODE &> /dev/null | ||
|
||
local _cmd="env ${CARGO_VARS} cargo clippy --color always --all-targets --all-features -- -D warnings" | ||
echo "[*] current directory: $PWD" | ||
echo "[*] command: $(echo $_cmd | tr '\n' ' ')" | ||
eval $_cmd | ||
popd &> /dev/null | ||
} | ||
|
||
set -e | ||
|
||
populate_thanatos_path | ||
check_requirements | ||
|
||
pushd $THANATOS_PATH &> /dev/null | ||
syntax_check | ||
echo "" | ||
|
||
format_check | ||
echo "" | ||
|
||
lint_check | ||
echo "" | ||
|
||
popd &> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# Mac OS metadata file | ||
.DS_Store | ||
|
||
/sync.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
agent_code/target | ||
thanatos/agent_code/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# Pull in the thanatos docker image | ||
FROM ghcr.io/mythicagents/thanatos:v0.1.7 | ||
FROM ghcr.io/mythicagents/thanatos:v0.1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
[project] | ||
name = "thanatos" | ||
|
||
[tool.black] | ||
line-length = 100 | ||
line-length = 90 | ||
target-version = ['py311'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pycodestyle] | ||
max-line-length = 90 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.