Skip to content

Latest commit

 

History

History
111 lines (77 loc) · 2.94 KB

mac_spoofing.md

File metadata and controls

111 lines (77 loc) · 2.94 KB

Post Boot

IP Route

The IP route ip command is able to change interfaces mac address, by following these steps

ip link set dev [INT] down
ip link set dev [INT] address [XX:XX:XX:XX:XX:XX]
ip link set dev [INT] up

MAC Changer

CLI

The macchanger tool allow the user to spoof his physical MAC address on any interface whether wireless or wired, this can be done by:

  • Specifying a custom MAC -m
  • Randomly generated MAC -r
  • Reset the permanent MAC -p
  • Pretend to be "Burned-In Address" --bia or -b

Troubleshooting

In case you're facing issues with NetworkManager reverting the custom MAC to the vendor one, check the NetworkManager.md page in this library.

Systemd-Networkd

Create a file called 00-default.link under /etc/systemd/network/ with the following content

[Match]
MACAddress=original MAC

[Link]
MACAddress=spoofed MAC
NamePolicy=kernel database onboard slot path

Pre Boot

Macchanger Systemd Unit

Create a file named macspoof@[INTERFACE].service at /etc/systemd/system/ directory with the content, This method allow for specifying a random mac address since macchanger has support for that with the -r flag.

[Unit]
Description=macchanger on %I
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
ExecStart=/usr/bin/macchanger -e %I
Type=oneshot

[Install]
WantedBy=multi-user.target

IP Route Systemd Unit

The ip command can also be used to do spoof the mac address, however this way the mac address will be static meaning each time the system boots it will have the same mac address.

[Unit]
Description=MAC Address Change %I
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
ExecStart=/usr/bin/ip link set dev %i address 36:aa:88:c8:75:3a
ExecStart=/usr/bin/ip link set dev %i up

[Install]
WantedBy=multi-user.target

Android

In android you have root access such as with Magisk, install the termux terminal emulator then pkg install root and pkg install unstable to add these repositories to be able to install macchanger with pkg install macchanger.

Wireless Connection

su
ip link set wlan0 down
macchanger -r wlan0
ip link set wlan0 up

Wireless Hotspot

The Hotspot mac spoofing is quite a bit difficult to do in android since, it seem that android resets the mac address each time the HS is brought up, however this is not consistent meaning there might by some conditions where it doesn't get reseted ( Must look into it)

It seems that the HS must be ON from the android interface before attempting to change it's mac else macchanger will through an error message.

su
ip link set swlan0 down
macchanger -r swlan0
ip link set wlan0 up

At this point the HS will no turn back on by it self, so turn it back up from the android interface.