commentary

master
zeus 2021-06-18 13:48:12 +02:00
parent c707bf31a6
commit 35b0936813
1 changed files with 3 additions and 0 deletions

View File

@ -3,12 +3,15 @@
# if their connection has dropped. this one simply reboots the stick via api. # if their connection has dropped. this one simply reboots the stick via api.
# Api Documentation: https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html # Api Documentation: https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html
# edit as needed
AUTH_URL="http://192.168.8.1/api/webserver/SesTokInfo" AUTH_URL="http://192.168.8.1/api/webserver/SesTokInfo"
# get respone and token from device
curl -s $AUTH_URL > /tmp/huawei_token curl -s $AUTH_URL > /tmp/huawei_token
RESPONSE=`grep -oP "<SesInfo>(.*)</SesInfo>" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1` RESPONSE=`grep -oP "<SesInfo>(.*)</SesInfo>" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1`
TOKEN=`grep -oP "<TokInfo>(.*)</TokInfo>" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1` TOKEN=`grep -oP "<TokInfo>(.*)</TokInfo>" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1`
#echo $RESPONSE #echo $RESPONSE
# trigger reboot
curl -X POST http://192.168.8.1/api/device/control -H "Cookie: $RESPONSE" -H "__RequestVerificationToken: $TOKEN" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><Control>1</Control></request>" curl -X POST http://192.168.8.1/api/device/control -H "Cookie: $RESPONSE" -H "__RequestVerificationToken: $TOKEN" --data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><request><Control>1</Control></request>"