Skip to content

Instantly share code, notes, and snippets.

@BKirev
Created November 16, 2018 21:43
Show Gist options
  • Save BKirev/5210cf0cd5dd6c05e6e4bf898f6488cd to your computer and use it in GitHub Desktop.
Save BKirev/5210cf0cd5dd6c05e6e4bf898f6488cd to your computer and use it in GitHub Desktop.
Batch script for Huawei E3372H reboot
@echo off
set AUTH_URL="http://192.168.8.1/api/webserver/SesTokInfo"
curl %AUTH_URL% > temp.txt
set /p $RESPONSE = < temp.txt
for /f "tokens=2 delims=^<^>" %%a in (temp.txt) do (
set "$session_id=%%a"
goto:next)
:next
for /f "skip=3 tokens=2 delims=^<^>" %%a in (temp.txt) do (
set "$token=%%a"
goto:end)
:end
curl -X POST http://192.168.8.1/api/device/control -H "Cookie: %$session_id%" -H "__RequestVerificationToken: %$token%" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><Control>1</Control></request>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment