- Taking inspiration from CS456, I made this simple MAC Address Changer for your device.
- I would suggest downloading and running this script in a virtual machine
- You would also need to use root permissions to run this script
make clean
make
sudo ./altermac eth0- The above command changes the MAC address of your
eth0interface - Looking at the
eth0interface by runningifconfig, you should be able to see that the MAC address underetherhas changed
strace -f ifconfig eth0 hw ether <NEW MAC ADDR> 2> output.txt-
You can use the above command to take a look at the functions and libraries called and undrestand how the command works
-
Although the above command changes the MAC address, this project mimics the behind the scenes working of the above command
-
A sample output is provided in the
output.txtfile -
Specifically, you would see that the following command was responsible for changing the MAC address:
ioctl(4, SIOCSIFHWADDR, {ifr_name="eth0", ifr_hwaddr={sa_family=ARPHRD_ETHER, sa_data=<New-MAC>}}) = 0