30 lines
869 B
Bash
30 lines
869 B
Bash
#!/bin/bash
|
|
#Wrapper for various items which play traffic.
|
|
#tcpreplay,tomahawk,isic suite
|
|
#Check for presence of eth0 in passed arguments and abort/alert
|
|
|
|
OPTIONS="$@"
|
|
|
|
function ABORT()
|
|
{
|
|
#red bg 0;41
|
|
#white text 1;37
|
|
chmod 400 $0.real
|
|
chmod 400 $0
|
|
|
|
MESSAGE="You have attempted to execute an action which will result in harm to the system. The system is now terminating all shell sessions on this host and alerting support personnel. You will lose any unsaved work."
|
|
echo -e "\e[0;41m$MESSAGE\e[1;37"
|
|
mailsend -q -smtp RELAYHOST -t PAGEREMAIL -f ALERTFROMEMAIL -sub "$0 using eth0 activity on $(hostname)" -M "$(hostname) attempted to play traffic using $0 out of eth0 at $(date)."
|
|
killall -g -9 bash
|
|
}
|
|
|
|
ETH0_CHECK=$(echo $OPTIONS | grep eth0 -c)
|
|
|
|
if [ $ETH0_CHECK -gt 0 ];
|
|
then
|
|
ABORT
|
|
fi
|
|
|
|
#If all checks pass, go ahead and execute the invoking program
|
|
$0.real $OPTIONS
|