-
Notifications
You must be signed in to change notification settings - Fork 6
/
mac-change.sh
35 lines (32 loc) · 1.12 KB
/
mac-change.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh /etc/rc.common
#By krabelize | cryptsus.com
#MAC address changer script
#MAKE SURE the OUI of the MAC address matches a client side wireless NIC vendor
#Place this script in /etc/init.d/
START=94
STOP=20
start() {
interface="wlan0"
current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
new_mac=$(dd if=/dev/random bs=1 count=3 2>/dev/null | hexdump -C | head -1 | cut -d' ' -f2- | awk '{ print "34:36:3b:"$1":"$2":"$3 }')
if [ $? -eq 0 ]; then
ifconfig $interface down
ifconfig $interface hw ether $new_mac
ifconfig $interface up
if [ $? -eq 0 ]; then
logger "MAC address successfully changed for $interface from $current_mac to $new_mac"
current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
logger "New MAC address: $current_mac"
exit 0
else
logger "MAC address changing scriped failed"
exit 1
fi
else
logger "Failed to generate MAC address. Perhaps you are missing certain system utilities"
exit 1
fi
}
stop() {
echo "Stopping MAC changer script.."
}