Skip to content

Instantly share code, notes, and snippets.

@kristopolous
Last active May 4, 2023 06:37
Show Gist options
  • Save kristopolous/fd3100e2f6d785cb5e5b5c3bde606c4c to your computer and use it in GitHub Desktop.
Save kristopolous/fd3100e2f6d785cb5e5b5c3bde606c4c to your computer and use it in GitHub Desktop.
Well well, I've never actually run this ...
#!/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