Skip to content

Instantly share code, notes, and snippets.

@Rosenstein
Last active April 22, 2020 21:21
Show Gist options
  • Save Rosenstein/d724715da3162ddcca7d9a5bbf432a80 to your computer and use it in GitHub Desktop.
Save Rosenstein/d724715da3162ddcca7d9a5bbf432a80 to your computer and use it in GitHub Desktop.
Quickly reboot Cisco / Technicolor EPC3925 router from windows shortcut or Task Scheduler. Edit config parameters first. You will need curl.exe in the same folder as this batch file.
@echo off
color 0A
@SETLOCAL
:START
@REM ###CONFIG########
@SET IP=192.168.0.1
@SET USER=admin
@SET PASS=pass
if exist cookie.txt del cookie.txt
@REM ###CONFIG########
title CISCO - TECHNICOLOR Reboot
echo ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
echo Ý Þ
echo Ý CISCO / TECHNICOLOR EPC3925 Rebooter by Rosenstein Þ
echo Ý (EPC3925 EuroDocsis 3.0 2-PORT Voice Gateway) Þ
echo Ý Þ
echo Ý Þ
echo Ý https://github.com/Rosenstein/ Þ
echo Ý Þ
echo ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
curl -s -L -c cookie.txt --referer http://%IP%/ -d "username_login=%USER%" -d "password_login=%PASS%" -d "LanguageSelect=en" -d "Language_Submit=0" -d "login=Log+In" http://%IP%/goform/Docsis_system > html.txt
for /F "delims=" %%G in ('findstr /r "\<[0-9][0-9]*\>" html.txt') do set regexptoken=%%G
for /f "tokens=7 delims== " %%A in ("%regexptoken%") do set token=%%A
For /F "Tokens=4 delims=<>" %%I in ('curl -s -b cookie.txt --referer http://%IP%/Devicerestart.asp -d "devicerestrat_Password_check=%PASS%" -d "mtenRestore=Device+Restart" -d "devicerestart=1" -d "devicerestrat_getUsercheck=true" -d "webToken=%token%" http://%IP%/goform/Devicerestart') Do Set log=%%I
for /F "usebackq tokens=1,2 delims==" %%I in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%I.'=='.LocalDateTime.' set ldt=%%J
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2% %ldt:~8,2%:%ldt:~10,2%:%ldt:~12,2%
echo:
echo [%ldt%] %log%
echo [%ldt%] %log% >> log.txt
if exist html.txt del html.txt
pause
rem goto :start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment