Skip to content

Instantly share code, notes, and snippets.

@coenraadhuman
Created April 29, 2017 10:18
Show Gist options
  • Save coenraadhuman/7f04835589b03a90e7486e795b70c466 to your computer and use it in GitHub Desktop.
Save coenraadhuman/7f04835589b03a90e7486e795b70c466 to your computer and use it in GitHub Desktop.
MAC Spoofing script for Ubuntu 16.04
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
exec sudo "$0" "$@"
fi
change_mac() {
echo -n "Choose network interface. (enp4s0f2): "
read nic
ifconfig $nic down
ifconfig $nic hw ether $1
ifconfig $nic up
dhclient $nic
}
echo -n "Have you used this MAC address before? (yes/no): "
read method
if [ $method = yes ]; then
cat -n name.txt
echo -n "Please choose PC based on its corresponding number: "
read old_mac_select
old_mac=$(sed -n "${old_mac_select}p" ./mac.txt)
echo "Selected MAC: $old_mac"
change_mac $old_mac
else
echo -n "Please enter name of PC for later use for MAC Spoofing: "
read new_name
echo $new_name >> ./name.txt
echo -n "Please enter MAC address. (aa:bb:cc:11:22:33): "
read new_mac
echo $new_mac >> ./mac.txt
change_mac $new_mac
fi
ping -c 5 8.8.8.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment