Last active
May 4, 2023 06:37
-
-
Save kristopolous/fd3100e2f6d785cb5e5b5c3bde606c4c to your computer and use it in GitHub Desktop.
Well well, I've never actually run this ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# nmap -sn subnet > scan | |
netmask=255.255.254.0 | |
gw=172.19.248.1 | |
cat > try.awk << ENDL | |
{ | |
switch(NR % 3) { | |
case 0: | |
mac=\$3 | |
print ip" "mac | |
break | |
case 1: | |
ip=\$5 | |
break | |
} | |
} | |
ENDL | |
awk -F ' ' -f try.awk scan | sort | uniq > /tmp/hostlist | |
shuf /tmp/hostlist | while read ip mac; do | |
sudo ifconfig wlan0 down | |
sudo ifconfig wlan0 hw ether $mac | |
sudo ifconfig wlan0 $ip | |
sudo ifconfig wlan0 netmask $netmask | |
sudo ifconfig wlan0 up | |
sudo route delete default | |
sudo route add default gw $gw | |
sleep 1 | |
curl example.com | |
echo $ip $mac | |
sleep 4 | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment