this is how it works right ¯\_(ツ)_/¯

pull/3/head
Rick Farina (Zero_Chaos) 2019-12-27 22:15:11 -05:00
parent 93a23d1eb9
commit d82bac8ed9
No known key found for this signature in database
GPG Key ID: A5DD1427DD11F94A
2 changed files with 35 additions and 37 deletions

34
usr/bin/execute_payload Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
LOG="logger -t Shark [*]"
$LOG "Executing PAYLOAD"
if [ ! -d /root/loot ]; then
mkdir -p /root/loot;
fi
payload_path="/root/payload"
payload=$(ls $payload_path/payload* 2>/dev/null | tail -n1)
extension_path="/root/payload/extensions/"
if [ -d "${extension_path}" ] && [ -n "$(ls -A ${extension_path})" ]; then
for extension in ${extension_path}*; do
source "${extension}"
done
eval "$(declare -F | sed -e 's/-f /-fx /')"
fi
case $(basename "${payload}") in
"payload.py")
python "${payload}" &> /dev/null
;;
"payload.php")
php-cli "${payload}" &> /dev/null
;;
"payload" | "payload.sh" | "payload.txt")
sed -i 's/\r//g' $payload
bash -C "${payload}" &> /dev/null
;;
*)
/usr/bin/LED FAIL
;;
esac

View File

@ -106,42 +106,6 @@ function wait_for_link() {
LED SETUP
}
function source_extensions() {
if [ -d "/root/payload/extensions" ] && [ -n "$(ls -A /root/payload/extensions/)" ]; then
for extension in /root/payloads/extensions/*; do
source "${extension}"
done
fi
}
function execute_payload() {
$LOG "Executing PAYLOAD"
if [ ! -d /root/loot ]; then
mkdir -p /root/loot;
fi
payload_path="/root/payload"
payload=$(ls $payload_path/payload* 2>/dev/null | tail -n1)
source_extensions
case $(basename $payload) in
"payload.py")
echo "python $payload &> /dev/null" | at now
;;
"payload.php")
echo "php-cli $payload &> /dev/null" | at now
;;
"payload" | "payload.sh" | "payload.txt")
sed -i 's/\r//g' $payload
echo "bash -C '$payload'" | at now
;;
*)
/usr/bin/LED FAIL
;;
esac
}
function configure_network() {
cp "/usr/lib/hak5/shark/config/${SWITCH_POSITION}/network" /etc/config/network
/etc/init.d/network restart
@ -173,7 +137,7 @@ function enter_attack_mode() {
stop_ssh
wait_for_link
execute_payload
echo "execute_payload" | at now
enter_idle_mode
}