Last active
April 29, 2020 16:57
-
-
Save rileyschuit/abd94f592376beeb2ab28e67d4fd4b6d to your computer and use it in GitHub Desktop.
Reboot my Frontier m400 modem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: script_name modem_ip password | |
webSecurityKey=$(curl -s -k \ | |
-u admin:$2 \ | |
https://$1/htmlV/adv_advanced_menuMain.asp | \ | |
sed -n -e 's/^.*webSecurityKey \=\"//p' | \ | |
sed -e 's/\(\"<\/SCRIPT>\)*$//g' \ | |
); | |
# echo $webSecurityKey; | |
# echo $2; | |
curl -k -X POST \ | |
-H "Host: $1" \ | |
-H "Connection: keep-alive" \ | |
-H "Cache-Control: max-age=0" \ | |
-H "Authorization: Digest username="admin", realm="NETGEAR", nonce="53875f3f2f368e1e47e262f14f8f3735", uri="/goform/EventForm", algorithm=MD5, response="f6be4a92f0b1e6a47efd18fe28566f28", opaque="5ccc069c403ebaf9f0171e9517f40e41", qop=auth, nc=000002ad, cnonce="5bd7d22e43de64da"" -H "Upgrade-Insecure-Requests: 1" -H "Origin: https://$1" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \ | |
-H "Sec-Fetch-Site: same-origin" \ | |
-H "Sec-Fetch-Mode: navigate" \ | |
-H "Sec-Fetch-User: admin" \ | |
-H "Sec-Fetch-Dest: document" \ | |
-H "Referer: https://$1/htmlV/restart.asp" \ | |
-H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.9" \ | |
-d "next_page=%2FhtmlV%2Freset.asp%3Frestart%3DTRUE&RebootEvent=noreset&webSecurityKey=$webSecurityKey" \ | |
https://$1/goform/EventForm; | |
# echo done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment