#!/bin/bash # Clean up, for good measure. service hostapd stop killall hostapd # Make sure that ctrl+c exits our script properly trap exit SIGINT SIGTERM # Configs MAC_FILE=/etc/hostapd/mac_nintendozone # dataset STREETPASS_REFRESH=28800 # 8 hours CONFIG_FILE=/dev/shm/nintendozone.conf # temporary AP config in RAM # Keep repeating the list of MACs forever while true ; do # The dataset might change so let's calculate within the loop. LINE_COUNT=$(wc -l < $MAC_FILE) SLEEP_TIME=$(($STREETPASS_REFRESH/$LINE_COUNT)) # Loop through each line in random order sort -R $MAC_FILE | while read MAC SSID; do # Run hostapd with a conf file that we generate on the fly # Do not tab this next section in, or you will have a broken config file cat > $CONFIG_FILE <<_EOF_ interface=wlan0 ssid=$SSID bssid=$MAC channel=1 #bridge=br0 macaddr_acl=0 #auth_algs=1 ignore_broadcast_ssid=0 wpa=0 driver=rtl871xdrv ieee80211n=0 wmm_enabled=0 hw_mode=g device_name=RTL8192CU manufacturer=Realtek _EOF_ echo "===========================================" echo "SSID:" $SSID " - BSSID:" $MAC echo "Time before next change:" $SLEEP_TIME "seconds" echo "Current time:" $(date) echo "===========================================" # Launch the AP with the new settings timeout $SLEEP_TIME hostapd $CONFIG_FILE echo "" echo "" done # We have looped through the entire dataset. Let's do it again. echo "~~~~Looping Back to Beginning~~~~" done
Comments
0 B
|0 👍
/0 👎
0 B
|0 👍
/0 👎