ShadowArch/Admin/wifiboot

14 lines
431 B
Plaintext
Raw Normal View History

2017-10-25 23:50:52 -05:00
#!/bin/bash
MAC="34:f6:4b:36:12:8f"
interface=`ip link list | grep -B 1 "$MAC" | head -n 1 | cut -f 2 -d ':' | cut -f 2 -d ' '`
ip link set "$interface" up
for i in `iwlist "$interface" scanning | grep ESSID | cut -f 2 -d \" | tr '[:upper:]' '[:lower:]'`; do
if [ -f /etc/wpa_supplicant/"$i".conf ]; then
/root/bin/wifi "$i" "$interface"
if [ $? -eq 0 ]; then
exit 0;
fi
fi
done