mprinfo Posté(e) le 15 avril 2020 Signaler Posté(e) le 15 avril 2020 ce topic fais suite a celui ci qui est fermer : Mon objectif est de pouvoir envoyer des sms via mon routeur 4g pour le moment avec Curl voici un lien de l'api de mon routeur https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html Je viens de trouver ce site très intéressanthttps://www.mrt-prodz.com/blog/view/2015/05/huawei-modem-api-and-data-plan-monitor Mise a jour du firmware : https://mega.nz/folder/fUYB3LiQ#lS35ocsbiJy4aT7aXd-U-Q/folder/KEhXDKqA Volia ou j'en suis avec le CURL j'arrive a faire du get temps qu'il ne faut pas une authentification Je sais que le password et de type 4 en base64 aprés je bloc voila ce qui fonctionne : ---------------------------------------------------------------------------------------------------------------------- -- Pour faire des GET ---------------------------------------------------------------------------------------------------------------------- RESPONSE=`curl -s -X GET http://$modem_ip/api/webserver/SesTokInfo` COOKIE=`echo "$RESPONSE"| grep SessionID=| cut -b 10-147` TOKEN=`echo "$RESPONSE"| grep TokInfo| cut -b 10-41` echo $RESPONSE echo $COOKIE echo $TOKEN --------------------------------------------------------------------- -- Liste des GET qui fonctionnent -- https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html --------------------------------------------------------------------- curl -s -b $COOKIE "http://$modem_ip/api/device/signal" curl -s -b $COOKIE "http://$modem_ip/config/global/config.xml" curl -s -b $COOKIE "http://$modem_ip/config/global/net-type.xml" curl -s -b $COOKIE "http://$modem_ip/config/pcassistant/config.xml" curl -s -b $COOKIE "http://$modem_ip/config/deviceinformation/config.xml" curl -s -b $COOKIE "http://$modem_ip/api/cradle/status-info" curl -s -b $COOKIE "http://$modem_ip/api/device/autorun-version" curl -s -b $COOKIE "http://$modem_ip/api/device/basic_information" curl -s -b $COOKIE "http://$modem_ip/api/device/device-feature-switch" curl -s -b $COOKIE "http://$modem_ip/api/device/information" - il faut une authentification curl -s -b $COOKIE "http://$modem_ip/api/device/signal" curl -s -b $COOKIE "http://$modem_ip/api/dialup/connection" curl -s -b $COOKIE "http://$modem_ip/api/dialup/mobile-dataswitch" curl -s -b $COOKIE "http://$modem_ip/api/global/module-switch" curl -s -b $COOKIE "http://$modem_ip/api/language/current-language" curl -s -b $COOKIE "http://$modem_ip/api/monitoring/check-notifications" curl -s -b $COOKIE "http://$modem_ip/api/monitoring/converged-status" curl -s -b $COOKIE "http://$modem_ip/api/monitoring/status" curl -s -b $COOKIE "http://$modem_ip/api/monitoring/traffic-statistics" curl -s -b $COOKIE "http://$modem_ip/api/net/current-plmn" curl -s -b $COOKIE "http://$modem_ip/api/online-update/upgrade-messagebox" curl -s -b $COOKIE "http://$modem_ip/api/pin/status" curl -s -b $COOKIE "http://$modem_ip/api/redirection/homepage" curl -s -b $COOKIE "http://$modem_ip/api/security/upnp" - il faut une authentification curl -s -b $COOKIE "http://$modem_ip/api/sms/sms-list" curl -s -b $COOKIE "http://$modem_ip/api/user/login" curl -s -b $COOKIE "http://$modem_ip/api/user/remind" curl -s -b $COOKIE "http://$modem_ip/api/user/session" curl -s -b $COOKIE "http://$modem_ip/api/user/state-login" curl -s -b $COOKIE "http://$modem_ip/api/wlan/basic-settings" curl -s -b $COOKIE "http://$modem_ip/api/wlan/multi-switch-settings" curl -s -b $COOKIE "http://$modem_ip/api/wlan/wifi-feature-switch" curl -s -b $COOKIE "http://$modem_ip/api/net/net-mode" Pour l'envoi de sms j'ai trouver cela mais ca fonctionne pas RESPONSE=`curl -s -X GET http://192.168.8.1/api/webserver/SesTokInfo` COOKIE=`echo "$RESPONSE"| grep SessionID=| cut -b 10-147` TOKEN=`echo "$RESPONSE"| grep TokInfo| cut -b 10-41` NUMBER=$1 SMS=$2 DATA="<?xml version='1.0' encoding='UTF-8'?><request><Index>-1</Index><Phones><Phone>$NUMBER</Phone></Phones><Sca></Sca><Content>$SMS</Content><Length>11</Length><Reserved>1</Reserved><Date>-1</Date></request>" curl -v http://192.168.8.1/api/sms/send-sms \ -H "Cookie: $COOKIE" -H "__RequestVerificationToken: $TOKEN" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \ --data $DATA Par contre j'ai trouvé cela pour windows est cela fonctionne très bien Site de référence Telechargement
mprinfo Posté(e) le 15 avril 2020 Auteur Signaler Posté(e) le 15 avril 2020 sur le github j'ai trouver cela https://github.com/gallinapassus/huawei-e5186 https://github.com/NextBlaubeere/E5186-NetworkSwitch https://github.com/epalzeolithe/Huawei_E5186_API_adapted_for_B525 https://github.com/DevExpress-Examples/how-to-display-appointments-in-agenda-view-by-using-the-gridcontrol-component-e5186 https://github.com/dandjo/huigate-scripts celui la est intéressant https://github.com/arska/e3372/issues/1 https://routeur4g.fr/discussions/discussion/2384/tuto-envoyer-des-sms-en-ligne-de-commande
mprinfo Posté(e) le 15 avril 2020 Auteur Signaler Posté(e) le 15 avril 2020 Huawei toolbox v0.9 https://techvorace.com/4g-lte/huawei-toolbox-v0-9/
mprinfo Posté(e) le 15 avril 2020 Auteur Signaler Posté(e) le 15 avril 2020 La on peut faire cela sur un synology https://oga83.github.io/HuaweiMonitor/#faqRunOnSyno
mprinfo Posté(e) le 15 avril 2020 Auteur Signaler Posté(e) le 15 avril 2020 voila un script qui pourrait être interessant pour le moment ca fonctionne pas #!/bin/sh # Written by oga83 # Check command line parameters if [ "$#" -ne 5 ]; then printf "Syntax: %s <IP> <Username> <Password> <PhoneNumber> <Message>\n" $0 exit 0 fi ROUTER_IP=$1 ROUTER_USERNAME=$2 ROUTER_PASSWORD=$3 SMS_NUMBER=$4 SMS_TEXT=$5 TMP_HEADER_FILE=/tmp/headers.tmp CURL_OPT=--silent ProcessRouterResponseHeader() { # Get token from header NEWTOKEN=`cat $TMP_HEADER_FILE | grep "__RequestVerificationTokenone: " | awk -F' ' '{print $2}'` if [ ! -z "$NEWTOKEN" ]; then TOKEN=$NEWTOKEN; fi NEWTOKEN=`cat $TMP_HEADER_FILE | grep "__RequestVerificationToken: " | awk -F' ' '{print $2}'` if [ ! -z "$NEWTOKEN" ]; then TOKEN=$NEWTOKEN; fi NEWSESSIONID=`cat $TMP_HEADER_FILE | grep "Set-Cookie: SessionID=" | awk -F' ' '{print $2}' | cut -b 1-138` if [ ! -z "$NEWSESSIONID" ]; then SESSIONID=$NEWSESSIONID; fi echo $NEWTOKEN } GetRouterData() # Param1: Relative URL { #echo "GET on http://$ROUTER_IP$1" RESPONSE=`curl $CURL_OPT --request GET http://$ROUTER_IP$1 \ --dump-header $TMP_HEADER_FILE \ -H "Cookie: $SESSIONID" -H "__RequestVerificationToken: $TOKEN" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \ ` ProcessRouterResponseHeader } GetSessionToken() # No parameters { # Get SessionID and RequestVerificationToken GetRouterData '/api/webserver/SesTokInfo' SESSIONID="SessionID="`echo "$RESPONSE"| grep -oPm1 "(?<=<SesInfo>)[^<]+"` TOKEN=`echo "$RESPONSE"| grep -oPm1 "(?<=<TokInfo>)[^<]+"` } PostRouterData() # Param1: RelativeUrl, Param2: Data, Param3:bAskNewToken { # Get new token if necessary if [ ! -z $3 ]; then GetSessionToken fi #echo "POST on http://$ROUTER_IP$1 :" $2 RESPONSE=`curl $CURL_OPT --request POST http://$ROUTER_IP$1 \ --dump-header $TMP_HEADER_FILE \ -H "Cookie: $SESSIONID" -H "__RequestVerificationToken: $TOKEN" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" \ --data "$2"` ProcessRouterResponseHeader } # Get initial SessionID and RequestVerificationToken GetSessionToken # Login CREDENTIALS=`printf $ROUTER_PASSWORD | sha256sum | head -c64 | base64 -w0` CREDENTIALS=`printf "%s%s%s" $ROUTER_USERNAME $CREDENTIALS $TOKEN | sha256sum | head -c64 | base64 -w0` DATA=`printf "<request><Username>%s</Username><Password>%s</Password><password_type>4</password_type></request>" $ROUTER_USERNAME $CREDENTIALS` PostRouterData "/api/user/login" "$DATA" # Send SMS DATA="<?xml version='1.0' encoding='UTF-8'?><request><Index>-1</Index><Phones><Phone>$SMS_NUMBER</Phone></Phones><Sca></Sca><Content>$SMS_TEXT</Content><Length>${#SMS_TEXT}</Length><Reserved>1</Reserved><Date>`date +'%F %T'`</Date></request>" PostRouterData "/api/sms/send-sms" "$DATA" 1 # Logout PostRouterData "/api/user/logout" "<request><Logout>1</Logout></request>"
Nico Posté(e) le 15 avril 2020 Signaler Posté(e) le 15 avril 2020 Pascal, j'ai testé le moniteur, mais cela ne passe pas, login impossible. Par contre il arrive à récupérer le statut tout de même. Cela passe chez toi ? Ou tu as utilisé le firmware ?
mprinfo Posté(e) le 16 avril 2020 Auteur Signaler Posté(e) le 16 avril 2020 @nico tu parles de quel programme de monitoring ?Car j'en ai donné plusieurs ? Tu as quel version de routeur 4g ?Chez moi tout fonctionne sur mon e5186Même le monitoring sur Android Envoyé de mon BLA-L29 en utilisant Tapatalk
Nico Posté(e) le 16 avril 2020 Signaler Posté(e) le 16 avril 2020 Celui du poste ci dessus, Huawei Monitor v2.92. En route je suis sur le B2***** je ne sais plus combien.
Messages recommandés