mirror of
https://github.com/hak5/bashbunny-payloads.git
synced 2025-10-29 16:58:25 +00:00
Update wait.sh
This commit is contained in:
parent
27332a9f14
commit
3e3979221f
@ -1,9 +1,8 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# WAIT v1 by @Hak5Darren
|
||||
# Waits blocks the payload from continuing until the switch position has changed
|
||||
# Pauses payload until the switch position has changed
|
||||
# Usage: WAIT
|
||||
|
||||
function WAIT() {
|
||||
GET SWITCH_POSITION
|
||||
TEST=$SWITCH_POSITION
|
||||
@ -13,5 +12,43 @@ function WAIT() {
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
export -f WAIT
|
||||
|
||||
|
||||
# WAIT_FOR_LOOT v1 by Korben
|
||||
# WAIT_FOR_LOOT <file_path> (optional)<refresh interval in seconds>
|
||||
#
|
||||
# Example: WAIT_FOR_LOOT /root/loot/captured_keys.txt
|
||||
# Will return once /root/loot/captured_keys.txt exists
|
||||
# OR IF FILE ALREADY EXISTS
|
||||
# Will return once the file line count has increased
|
||||
|
||||
function WAIT_FOR_LOOT() {
|
||||
# Check for refresh interval override
|
||||
if [ -z "${2}" ]; then
|
||||
REFRESH_INTERVAL=1
|
||||
else
|
||||
REFRESH_INTERVAL=$2
|
||||
fi
|
||||
|
||||
if [ -f "${1}" ]; then
|
||||
# If file already exists wait for it to change size
|
||||
start_count=$(cat $1|wc -l)
|
||||
while [ $(cat $1|wc -l) -eq $start_count ]; do
|
||||
sleep $REFRESH_INTERVAL
|
||||
done
|
||||
else
|
||||
# File doesn't exist, wait for it to be created
|
||||
while [ ! -f "${1}" ]; do
|
||||
sleep $REFRESH_INTERVAL
|
||||
done
|
||||
fi
|
||||
}
|
||||
export -f WAIT_FOR_LOOT
|
||||
|
||||
# WAIT_FOR_TARGET_IP v1 by Hak5Darren
|
||||
# Pauses payload until target receives IP address
|
||||
function WAIT_FOR_TARGET_IP() {
|
||||
until [ ! -z $(cat /var/lib/dhcp/dhcpd.leases | grep ^lease | awk '{ print $2 }' | sort | uniq) ]; do sleep 1; done
|
||||
}
|
||||
export -f WAIT_FOR_TARGET_IP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user