Everything is done as root.
The classic one is using "ifconfig".
I do an example with wlan0.
Stop interface:
systemctl stop NetworkManagerChange the MAC:
ifconfig wlan0 hw ether XX:XX:XX:XX:XX:XXwhere XX:XX:XX:XX:XX:XX is your desidered MAC
Start interface:
systemctl start NetworkManagerNow you will connect using NetworkManager (as usually) with XX:XX:XX:XX:XX:XX as MAC.
Every reboot it's reset to the original one.
Another useful tool is "macchanger".
Usage: macchanger [options] deviceTo do the same work as above:
-h, --help Print this help
-V, --version Print version and exit
-s, --show Print the MAC address and exit
-e, --endding Don't change the vendor bytes
-a, --another Set random vendor MAC of the same kind
-A Set random vendor MAC of any kind
-r, --random Set fully random MAC
-l, --list[=keyword] Print known vendors
-m, --mac=XX:XX:XX:XX:XX:XX Set the MAC XX:XX:XX:XX:XX:XX
systemctl stop NetworkManager
macchanger --mac=XX:XX:XX:XX:XX:XX wlan0
systemctl start NetworkManager
This can even set random vendor MAC of the same kind:
systemctl stop NetworkManager
macchanger -a wlan0
systemctl start NetworkManager
Take the script below and add your preferences
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
read -p "Choose the interface: " iface | |
echo "Which MAC on $iface do you want?" | |
echo "1 - Set random vendor MAC of the same kind" | |
echo "2 - Set number1 MAC" | |
echo "3 - Set number2 MAC" | |
echo "0 - User defined MAC" | |
read -p "Do your choice: " choice | |
systemctl stop NetworkManager | |
case $choice in | |
[0]* ) read -p "Set the MAC XX:XX:XX:XX:XX:XX : " mac | |
macchanger --mac=$mac $iface;; | |
[1]* ) macchanger -a $iface;; | |
[2]* ) macchanger --mac=YY:YY:YY:YY:YY:YY $iface;; | |
[3]* ) macchanger --mac=YY:YY:YY:YY:YY:YY $iface;; | |
* ) echo "Please do a valid choice";; | |
esac | |
systemctl start NetworkManager |
Copy and paste in a new text file, save it with some name (p.e. nmac);
make it executable (chmod +x nmac);
copy it in "/usr/bin" (cp nmac /usr/bin/nmac);
now you can simply use it from the superuser (su) console.
Don't use it for any illegal purpose, and use it at your own risk.
No comments:
Post a Comment