Forked from sn1p3r46/TP-Link_TD-W8960N_Reboot.sh
Last active
January 11, 2019 01:17
-
-
Save pablen/9f8fa57155032d08738e58d232f8d258 to your computer and use it in GitHub Desktop.
This bash script reboots TP-Link routers
This file contains hidden or 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 | |
# This software comes without any kind of warranty or license, use it at your own risk. | |
# | |
# Author: Andrea Galloni | |
# E-mail: andreagalloni92[at]gmail{dot}com | |
# | |
# Works on TP-Link 300M Wireless N ADSL2+ Modem Router TD-W8960N | |
# Firmware Version: 1.3.6 Build 100825 Rel.68770n | |
# | |
# Parameters setup | |
username='username' | |
password='password' | |
uri_containing_sessionKey='192.168.1.1/resetrouter.html' | |
baseURI='192.168.1.1/rebootinfo.cgi?' | |
# takes the sessionKey from the router rebooting web page (192.168.1.1/resetrouter.html) | |
sessionKey=$(curl -ks --user $username:$password $uri_containing_sessionKey | awk '/sessionKey/{ match($3, /[0-9]+/); print substr($3, RSTART, RLENGTH); exit}') | |
echo $sessionKey | |
echo 'REBOOTING' | |
# performs the get request to reboot the router and flush away the output | |
curl -ks --user $username:$password $baseURI$sessionKey > /dev/null | |
echo 'REBOOTED' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment