mirror of
https://github.com/hak5/bashbunny-payloads.git
synced 2025-10-29 16:58:25 +00:00
Added debug extension (#155)
This commit is contained in:
parent
f8a442e66d
commit
650772e9e4
40
payloads/extensions/debug.sh
Normal file
40
payloads/extensions/debug.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Allow Debugging messages written to: "/root/udisk/debug/[session].txt"
|
||||
# on the BashBunny
|
||||
#
|
||||
# How this works?
|
||||
# 1) Example Command: DEBUG "switch-1-debug" "Hello from debug extension!"
|
||||
# 2) After bashing, text can be read at: "/root/udisk/debug/[session].txt"
|
||||
# on the BashBunny
|
||||
################################################################################
|
||||
|
||||
function DEBUG() {
|
||||
session = $1
|
||||
message = $2
|
||||
|
||||
init_debug
|
||||
debug_log
|
||||
|
||||
timestamp () {
|
||||
echo "$(date +"%Y-%m-%d_%H-%M-%S")"
|
||||
}
|
||||
|
||||
init_debug () {
|
||||
DEBUG_FILE="/root/udisk/debug/$(session).txt"
|
||||
if [ ! -d "/root/udisk/debug/" ]; then
|
||||
mkdir /root/udisk/debug/
|
||||
fi
|
||||
if [ ! -f "/root/udisk/debug/${DEBUG_FILE}" ]; then
|
||||
touch "${DEBUG_FILE}"
|
||||
echo "$(timestamp): DEBUG STARTED" >> "${DEBUG_FILE}"
|
||||
fi
|
||||
}
|
||||
|
||||
debug_log () {
|
||||
echo "$(timestamp): $(message)" >> "${DEBUG_FILE}"
|
||||
}
|
||||
}
|
||||
|
||||
export -f DEBUG
|
||||
Loading…
x
Reference in New Issue
Block a user