Skip to content

Commit

Permalink
Removed unnecessary conditional to check for cleanup arg
Browse files Browse the repository at this point in the history
  • Loading branch information
l50 committed Sep 7, 2023
1 parent 69db929 commit d92f389
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 76 deletions.
12 changes: 5 additions & 7 deletions ttps/cloud/aws/iam/enumerate-iam/enumerate-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Uninstalling Python packages..."
cd {{ .Args.eiam_path }} && pip3 uninstall -y -r requirements.txt
if [[ -d "{{ .Args.eiam_path }}" ]]; then
echo "Cleaning up enumerate-iam repository..."
rm -rf {{ .Args.eiam_path }}
fi
echo "Uninstalling Python packages..."
cd {{ .Args.eiam_path }} && pip3 uninstall -y -r requirements.txt
if [[ -d "{{ .Args.eiam_path }}" ]]; then
echo "Cleaning up enumerate-iam repository..."
rm -rf {{ .Args.eiam_path }}
fi
- name: check-detection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ steps:
name: cleanup
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
# Remove the user from the group
aws iam remove-user-from-group --user-name {{ .Args.user }} \
--group-name {{ .Args.group }}
fi
# Remove the user from the group
aws iam remove-user-from-group --user-name {{ .Args.user }} \
--group-name {{ .Args.group }}
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ steps:
USER="{{ .Args.user }}"
new_key_id=$(create_key $USER)
if [[ "{{ .Args.cleanup }}" == true ]]; then
cleanup:
name: cleanup
inline: |
set -e
delete_key $USER $new_key_id
fi
- name: check-detection
inline: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Deleting pillaged secrets"
rm -rf artifacts
fi
echo "Deleting pillaged secrets"
rm -rf artifacts
- name: check-detection
inline: |
Expand Down
8 changes: 3 additions & 5 deletions ttps/cred-and-key-mgmt/macos/copykeychain/copykeychain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Sleeping for 10 seconds and then removing the copied keychain from the /tmp directory..."
sleep 10
rm /tmp/keychain-copied
fi
echo "Sleeping for 10 seconds and then removing the copied keychain from the /tmp directory..."
sleep 10
rm /tmp/keychain-copied
- name: check-detection
inline: |
Expand Down
6 changes: 2 additions & 4 deletions ttps/cred-and-key-mgmt/macos/keysearch/keysearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ steps:
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Deleting the compiled binary..."
rm -f keysearch
fi
echo "Deleting the compiled binary..."
rm -f keysearch
4 changes: 1 addition & 3 deletions ttps/cred-and-key-mgmt/macos/prompt-cli/prompt-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ steps:
cleanup:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
rm -f $HOME/prompt_execution.log
fi
rm -f $HOME/prompt_execution.log
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,5 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Deleting the compiled binary..."
rm -f check
fi
echo "Deleting the compiled binary..."
rm -f check
12 changes: 5 additions & 7 deletions ttps/defense-evasion/macos/injectdylib/injectdylib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ steps:
echo "TTP Done!"
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Removing the compiled calc.dylib binary..."
rm calc.dylib injectdylib
echo "Closing the Calculator app and paper tape..."
osascript -e 'tell application "Calculator" to quit'
echo "Cleanup Finished!"
fi
echo "Removing the compiled calc.dylib binary..."
rm calc.dylib injectdylib
echo "Closing the Calculator app and paper tape..."
osascript -e 'tell application "Calculator" to quit'
echo "Cleanup Finished!"
12 changes: 5 additions & 7 deletions ttps/defense-evasion/macos/run-dylib/run-dylib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ steps:
fi
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Removing the compiled calc.dylib binary as well as the compiled rundylib file..."
rm calc.dylib rundylib
echo "Closing the Calculator app and paper tape..."
osascript -e 'tell application "Calculator" to quit'
echo "Cleanup Finished!"
fi
echo "Removing the compiled calc.dylib binary as well as the compiled rundylib file..."
rm calc.dylib rundylib
echo "Closing the Calculator app and paper tape..."
osascript -e 'tell application "Calculator" to quit'
echo "Cleanup Finished!"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ steps:
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Cleaning up the compiled SwiftSpy binary..."
rm -f swiftspy
echo "Cleanup DONE!"
fi
echo "Cleaning up the compiled SwiftSpy binary..."
rm -f swiftspy
echo "Cleanup DONE!"
16 changes: 7 additions & 9 deletions ttps/persistence/macos/launchagent/launchagent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ steps:
echo "TTP Done!"
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Sleeping for 15 seconds and then removing the mechanism..."
sleep 15
launchctl unload -w ~/Library/LaunchAgents/com.ttpforge.plist
rm -f "{{ .Args.command_or_path }}"
rm -f ~/Library/LaunchAgents/com.ttpforge.plist
rm -f launchagent
echo "Cleanup Finished!"
fi
echo "Sleeping for 15 seconds and then removing the mechanism..."
sleep 15
launchctl unload -w ~/Library/LaunchAgents/com.ttpforge.plist
rm -f "{{ .Args.command_or_path }}"
rm -f ~/Library/LaunchAgents/com.ttpforge.plist
rm -f launchagent
echo "Cleanup Finished!"
6 changes: 2 additions & 4 deletions ttps/persistence/macos/loginitem/loginitem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ steps:
echo "TTP Done!"
cleanup:
inline: |
if [[ "{{ .Args.cleanup }}" == "true" ]]; then
rm -f loginitem
echo "Cleanup Finished!"
fi
rm -f loginitem
echo "Cleanup Finished!"
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
mv "{{ .Args.ssh_authorized_keys }}.bak" "{{ .Args.ssh_authorized_keys }}"
fi
mv "{{ .Args.ssh_authorized_keys }}.bak" "{{ .Args.ssh_authorized_keys }}"
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ steps:
inline: |
set -e
if [[ "{{ .Args.cleanup }}" == true ]]; then
echo "Uninstalling Python packages..."
cd {{ .Args.lazagne_path }} && pip3 uninstall -y -r requirements.txt
echo "Uninstalling Python packages..."
cd {{ .Args.lazagne_path }} && pip3 uninstall -y -r requirements.txt
if [[ -d "{{ .Args.lazagne_path }}" ]]; then
echo "Cleaning up LaZagne repository..."
rm -rf {{ .Args.lazagne_path }}
fi
if [[ -d "{{ .Args.lazagne_path }}" ]]; then
echo "Cleaning up LaZagne repository..."
rm -rf {{ .Args.lazagne_path }}
fi

0 comments on commit d92f389

Please sign in to comment.