產品介紹
拍賣平台價格約 1300 ,有區分有無天線以及有無 SD 卡支援版本,選擇有天線以及買一根天線比較不會後悔
--
本次主要知識點來源
- HUAWEI toolbox V0.9 – Techvorace
- Huawei-E5186-API
- Sending SMS messages via bash script using a Huawei E8372 hilink
- How to connect and disconnect Huawei E3372 with Web API #1
--
程式流程說明
- 使用 http://192.168.8.1/api/webserver/SesTokInfo 取得第一次需要的 Session ID 和 Cookie
- 準備 admin 登入密碼加密編碼
- 將 SesTokInfo 以及加密密碼套用到 http://192.168.8.1/api/user/login 內
- 取得 /api/user/login 回傳 Header 的 __requestverificationtokenone 和 set-cookie 值
- 整理發送簡訊 XML
- 將簡訊 XML 以及 /api/user/login 回傳套用到 http://192.168.8.1/api/sms/send-sms 即可
以上版本為:
- Software version: 21.200.05.01.639
- Web UI version: 17.100.09.01.639
--
PHP 範例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
<?php ini_set('date.timezone','Asia/Taipei'); $cookie_txt = 'p:\bin\php56\sms.txt'; $curl = curl_init('http://192.168.8.1/api/webserver/SesTokInfo'); curl_setopt($curl, CURLOPT_COOKIEJAR, $cookie_txt); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $r = curl_exec($curl); curl_close($curl); $xml = simplexml_load_string($r); $token = $xml->TokInfo; $session = $xml->SesInfo; $username = 'admin'; $password = 'admin'; $data = '<?xml version "1.0" encoding="UTF-8"?><request><Username>admin</Username><Password>'.base64_encode(hash('sha256', $username.base64_encode(hash('sha256', $password, false)).$token, false)).'</Password><password_type>4</password_type></request>'; $curl = curl_init('http://192.168.8.1/api/user/login'); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'Cookie: '. $session, '__requestverificationtoken: '. $token, 'x-requested-with: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded' ]); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$headers) { $len = strlen($header); $header = explode(':', $header, 2); if (count($header) < 2) // ignore invalid headers return $len; $headers[strtolower(trim($header[0]))][] = trim($header[1]); return $len; } ); curl_setopt($curl, CURLINFO_HEADER_OUT, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); $content ="hello"; $lengContent = strlen($content); $dateTime = date("Y-m-d H:i:s"); $data =<<<XML <request> <Index>-1</Index> <Phones> <Phone>0926756749</Phone> </Phones> <Sca></Sca> <Content>$content</Content> <Length>$lengContent</Length> <Reserved>1</Reserved> <Date>$dateTime</Date> </request> XML; //connect with cURL $curl = curl_init('http://192.168.8.1/api/sms/send-sms'); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'Cookie: '. $headers['set-cookie'][0], '__requestverificationtoken: '. $headers['__requestverificationtokenone'][0], 'x-requested-with: XMLHttpRequest', 'Content-Type: application/x-www-form-urlencoded' ]); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); curl_setopt($curl, CURLINFO_HEADER_OUT, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($curl); $info = curl_getinfo($curl); print_r($content); curl_close($curl); |
--
CLI 變數傳遞
1 |
> php sms.php 0912345678 "hello SMS" |
--
僅供參考用
- Huawei E5186 AJAX API
- How to connect and disconnect Huawei E3372 with Web API #1
- Sending SMS messages via bash script using a Huawei E8372 hilink
- Hacking Huawei E3372 HiLink.
--
1 2 3 4 5 6 7 8 9 10 |
_error_codes = { "100002": "No support", # Huawei branded 404 "100003": "Access denied", # 直接拿 SesTokInfo Cookie & Token 套用到需要登入 api "100004": "Busy", "108001": "Wrong username", "108002": "Wrong password", "108003": "Already logged in", "120001": "Voice busy", "125001": "Wrong __RequestVerificationToken header" "125002": # 回傳資訊不匹配或不完整 |
--
隨插即用
插入點擊光碟開啟 192.168.8.1 網站
帳號 admin
密碼 admin
--
簡訊 SMS
URL : http://192.168.8.1/api/sms/send-sms
POST
1 2 3 4 5 6 7 8 9 10 11 12 |
<?xml version: "1.0" encoding="UTF-8"?> <request> <Index>-1</Index> <Phones> <Phone>0926756749</Phone> </Phones> <Sca></Sca> <Content>aaa</Content> <Length>3</Length> <Reserved>1</Reserved> <Date>2020-06-04 08:36:09</Date> </request> |
--
第二次使用
從「網路連線」觀察,當 Remote NDIS based Internet Sharing Device 網路介面就緒時,就會開啟網站
--
1,839 total views, 1 views today