Hi
Can somebody write MAC (and BSSID) randomiser script for me?
I am total noob in programming, I only know how to use SSH.
I need script that will randomise my MAC each reboot. Not necessary to be GUI one. Just script to put into init.d will be enough.
I want to change only MAC (and BSSID) on all visible interfaces, not IMEI, nor other information.
I will be extremely pleased if someone will help me with this.
My device E750(v2)
Hi,
step 0: install macchanger
This will change your mac address (while keeping the GL.iNet vendor prefix “00:60:2F”):
[…]
mac=$(hexdump -n3 -e’/3 “00:60:2F” 3/1 “:%02X”’ /dev/random)
ip link set dev apclix0 down
macchanger --mac=“$mac” apclix0
ip link set dev apclix0 up
[…]
Hope this helps.
Marcus
Why should I keep prefix? It can potentially cause attacker to know my platform to perform targeted attack. As it is travel router it can be tracked or attacked by bad actors using MAC.
Where should I put this script?
Found this one (link) (uploaded to Proton Drive)
Found here
Needs to be tested by somebody. As I see it should be just run anywhere.
I will NOT recommend to use anything until someone from support or community will confirm that this works or no
Can anyone test please? (Do only if you know what you are doing)
admon
May 15, 2024, 2:39pm
5
I doubt that this will work. Seems to be designed for client systems instead of routers.
Do you have any working one?
admon
May 15, 2024, 2:51pm
7
No, sorry. Maybe I will write some script in future, but can’t promise so far.
No worries. I will wait
Maybe somebody have)
P.S: How many times can MAC be changed? Isn’t this wearing off some chip?
admon
May 15, 2024, 3:11pm
9
The MAC address is not written back to the chip mostly, it’s only a variable inside the OS.
Akotto
May 15, 2024, 8:20pm
10
Found this one on soma chat
#!/bin/sh /etc/rc.common
START=98
STOP=15
logit() {
echo "$@" | tee -a /var/log/mac_change.log
logger -t mac_change "$@"
}
generate_random_mac() {
printf "02:%02x:%02x:%02x:%02x:%02x" \
$((RANDOM % 256)) \
$((RANDOM % 256)) \
$((RANDOM % 256)) \
$((RANDOM % 256)) \
$((RANDOM % 256))
}
change_mac_address() {
local iface=$1
local mac=$(generate_random_mac)
if ifconfig | grep -q "$iface"; then
logit "Changing MAC address of $iface to $mac"
ifconfig "$iface" down
ifconfig "$iface" hw ether "$mac"
ifconfig "$iface" up
else
logit "Interface $iface does not exist."
fi
}
start() {
logit "Starting MAC address changer..."
interfaces=$(ls /sys/class/net)
for iface in $interfaces; do
change_mac_address "$iface"
done
logit "MAC addresses changed successfully."
}
stop() {
logit "Stopping MAC address changer..."
}
Or this?
#!/bin/sh /etc/rc.common
START=99
start() {
config_load networking
config_foreach change_mac_interface setup_interface
}
setup_interface() {
local interface="$1"
if [ "$interface"!= "lo" ]; then
macchanger -r "$interface"
fi
}
Maybe this will help?