From dfb0da1a96197e1e0fdd01be58be60d4e25a4d7c Mon Sep 17 00:00:00 2001 From: zeus Date: Fri, 22 Jan 2021 09:46:55 +0100 Subject: [PATCH] huawei restart-script --- almost_oneliners/huawei_restart | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 almost_oneliners/huawei_restart diff --git a/almost_oneliners/huawei_restart b/almost_oneliners/huawei_restart new file mode 100644 index 0000000..16b185b --- /dev/null +++ b/almost_oneliners/huawei_restart @@ -0,0 +1,14 @@ +#!/bin/bash +# huawei surfsticks (E3372H and others) tend not to be able to recognize, +# 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 + +AUTH_URL="http://192.168.8.1/api/webserver/SesTokInfo" + +curl -s $AUTH_URL > /tmp/huawei_token +RESPONSE=`grep -oP "(.*)" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1` +TOKEN=`grep -oP "(.*)" temp.txt | cut -d ">" -f 2 | cut -d "<" -f 1` +#echo $RESPONSE + +curl -X POST http://192.168.8.1/api/device/control -H "Cookie: $RESPONSE" -H "__RequestVerificationToken: $TOKEN" --data "1" +