Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #Calculate the number of MACs in the list
- MAXLINE=$(/bin/sed -n '$=' /home/pi/maclist.txt)
- #Generate a random line number to read the MAC from
- LINE=$(/usr/bin/shuf -i 1-${MAXLINE} -n 1)
- #Get the MAC from the specified line number
- MAC=$(/bin/sed -n ${LINE}p /home/pi/maclist.txt)
- #Stop the AP and DHCP services
- /usr/bin/sudo /usr/sbin/service hostapd stop
- /usr/bin/sudo /usr/sbin/service isc-dhcp-server stop
- #Take the wireless interface down and change the MAC to our new one
- /usr/bin/sudo /sbin/ifconfig wlan0 down
- /usr/bin/sudo /sbin/ifconfig wlan0 hw ether $MAC
- /usr/bin/sudo /sbin/ifconfig wlan0 up
- #Give the WiFi drivers a few seconds to start up before starting the AP, otherwise the DHCP service might not start
- /bin/sleep 10
- /usr/bin/sudo /usr/sbin/service hostapd start
- #Wait a few seconds for the AP service to start up, otherwise the DHCP service might not bind correctly
- /bin/sleep 5
- /usr/bin/sudo /usr/sbin/service isc-dhcp-server start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement