revamping upkeep script

This commit is contained in:
Tyler Bean 2018-11-02 04:22:35 -05:00
parent 7c568c7859
commit fcb0978862
2 changed files with 76 additions and 13 deletions

1
wirelesslogin/passwd Normal file
View File

@ -0,0 +1 @@
802-11-wireless-security.psk:bearlovesluna

View File

@ -2,21 +2,83 @@
set -x
ping -c 1 -W 1 google.com > /dev/null
if [[ $? == 1 ]]
then
atwireless=7dd282dc-49fa-4c33-9e3c-68c57862338e
esaconnect=e60e73c7-0650-4626-b364-e0a2688dd3e2
function pingcheck {
ping -c 1 -W 1 google.com > /dev/null
if [[ $? == 0 ]]; then
echo "All good! Nothing to do."
else
echo "No connectivity! Let's fix it."
fixit
fi
}
#eval "{ sleep 1; echo o0beaner; sleep 1; echo d0ubl3h1gh\!\!; sleep 1; echo 'reboot'; sleep 2; }" | telnet router.asus.com
eval "{ sleep 1; echo o0beaner; sleep 1; echo d0ubl3h1gh\!\!; sleep 1; echo 'reboot'; sleep 2; }" | telnet 172.16.0.163
nmcli c down $atwireless
nmcli connection modify --temporary $esaconnect 802-11-wireless.cloned-mac-address 30:85:A9:6B:C6:F8
nmcli c up $esaconnect
function am_i_connected {
check=$(nmcli -f NAME,DEVICE c | sift '@Wireless' | wc -l)
if [[ $check != 0 ]]; then
echo true
fi
}
function am_i_connected_to_something {
check=$(nmcli -f NAME,DEVICE c | sift wlp9s0 | wc -l)
if [[ $check != 0 ]]; then
echo true
fi
}
function bring_it_down {
UUID=$(nmcli -f DEVICE,UUID c show --active | sift wlp9s0 | awk '{print $2}')
nmcli c down $UUID
}
function bring_it_up {
UUID=$(nmcli -f NAME,UUID c | sift '@Wireless' | awk '{print $2}')
nmcli c up $UUID passwd-file $passwd
}
function spoofy_doof {
UUID=$(nmcli -f NAME,UUID,DEVICE c show | sift -e 'ESAconnect' | awk '{print $2}')
nmcli c modify --temporary $UUID 802-11-wireless.cloned-mac-address 30:85:A9:6B:C6:F8
sleep 3
nmcli c up $UUID
curl https://esaconnect.extendedstayamerica.com/?param=cGlkPTk4MjgmZGV2aWNlSVA9MTcyLjE2LjAuOTEmZGV2aWNlTUFDPUIwMzU5RjJCQzVBMCZwcm9wZXJ0eVR5cGU9Tm9ybWFs
curl https://esaconnect.extendedstayamerica.com//wificonfirmlanding?param=cGlkPTk4MjgmZGV2aWNlSVA9MTcyLjE2LjAuOTEmZGV2aWNlTUFDPUIwMzU5RjJCQzVBMCZwcm9wZXJ0eVR5cGU9Tm9ybWFs
nmcli c down $esaconnect
echo bearlovesluna | nmcli -a c up $atwirelessecho "success"
fi
bring_it_down
}
function reboot_router {
eval "{ sleep 1; echo o0beaner; sleep 1; echo d0ubl3h1gh\!\!; sleep 1; echo 'reboot'; sleep 2; }" | telnet 172.16.0.224
}
function fixit {
MY_PATH="`dirname \"$0\"`"
MY_PATH="`( cd \"$MY_PATH\" && pwd )`"
passwd=$MY_PATH/passwd
if [[ $(am_i_connected) != true ]]; then
if [[ $(am_i_connected_to_something) == true ]]; then
bring_it_down
fi
bring_it_up
fi
reboot_router
bring_it_down
spoofy_doof
bring_it_up
if [[ $(am_i_connected) != true ]]; then
i=0
until [ $i == 20 ]; do
if [[ $(am_i_connected == true) ]]; then
continue
else
sleep 5
bring_it_up
((i++))
fi
done
fi
}
pingcheck