Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(0);
- /**
- * Eka Syahwan
- */
- class WifiController
- {
- public function ngecurl($url , $post=null , $header=null){
- unlink("cookies.txt");
- $ch = curl_init($url);
- if($post != null) {
- curl_setopt($ch, CURLOPT_POST, true);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
- }
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Linux; Android 4.4.2; GT-I9100 Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36");
- curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd()."/cookies.txt");
- curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd()."/cookies.txt");
- curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
- if($header != null) {
- curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
- }
- curl_setopt($ch, CURLOPT_COOKIESESSION, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT ,0);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- return curl_exec($ch) ;
- curl_close($ch);
- }
- public function getData($data){
- preg_match_all('/&client_mac=(.*?)&/', $data, $mac);
- preg_match_all('/\?gw_id=(.*?)&/', $data, $gwid);
- preg_match_all('/URL=(.*?)\?/', $data , $url);
- $repons = $this->ngecurl($url[1][0] ,null , null);
- preg_match_all('/&ipc=(.*?)&/', $repons, $ipc);
- return array('mac' => $mac[1][0],'gwid' => $gwid[1][0] ,'url' => $url[1][0] , 'ipc' => $ipc[1][0]);
- }
- public function login($mac,$gwid,$url,$ipc){
- //$mac = "50:B7:C3:E2:C4:01";
- $header = array(
- 'Host:welcome2.wifi.id',
- 'Origin:http://welcome2.wifi.id',
- 'X-Requested-With:XMLHttpRequest',
- 'Connection:keep-alive',
- 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8'
- );
- $post = $this->ngecurl("http://welcome2.wifi.id/authnew/login-free/check_login.php?ipc=".$ipc."&gw_id=".$gwid."&mac=".$mac,"username_=mcent&username=mcent".time().".mcent%40event&password=mcent&landURL=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.mcent.app%26referrer%3Dutm_source%253Dwifi.id%2526utm_content%253DMEpKdGNaSW1XOFRZKzRIZi9MOUo1VHBqUlBGeDl5aVdZeWVyYU41SEpMYmpuMkJWZGFTeUt2MTVuYmpIUHJuNCtvRUZCZSsyZnJJaWxsaDhwUmdEaUI0K3kydy94QnIxL1FnVzFqdGhyc1k3TlVFTUNOVGZRa0JtdGs2T2h5N2VWUVhYdnN5WVEzY3U3RHNxOUY1QzRRPT0_" , $header);
- $result = json_decode($post,true);
- $post1 = $this->ngecurl("http://welcome2.wifi.id/authnew/login-free/check_login.php?ipc=".$ipc."&gw_id=".$gwid."&mac=".$mac,"username=".$mac."@freeMS.pass&password=".time() , $header);
- $result1 = json_decode($post,true);
- if($result[result]){
- echo "[WIFI] Status Login : ".$result[message]."\r\n";
- $this->ping();
- }else{
- echo "[WIFI] Status Login : ".$result[message]."\r\n";
- }
- if($result1[result]){
- echo "[WIFI] Status Login : ".$result1[message]."\r\n";
- $this->ping();
- }else{
- echo "[WIFI] Status Login : ".$result1[message]."\r\n";
- }
- $this->login($mac,$gwid,$url,$ipc);
- }
- function formatSizeUnits($bytes)
- {
- if ($bytes >= 1073741824)
- {
- $bytes = number_format($bytes / 1073741824, 2) . ' GB';
- }
- elseif ($bytes >= 1048576)
- {
- $bytes = number_format($bytes / 1048576, 2) . ' MB';
- }
- elseif ($bytes >= 1024)
- {
- $bytes = number_format($bytes / 1024, 2) . ' kB';
- }
- elseif ($bytes > 1)
- {
- $bytes = $bytes . ' bytes';
- }
- elseif ($bytes == 1)
- {
- $bytes = $bytes . ' byte';
- }
- else
- {
- $bytes = '0 bytes';
- }
- return $bytes;
- }
- public function mac(){
- return implode(':',str_split(str_pad(base_convert(mt_rand(0,0xffffff),10,16).base_convert(mt_rand(0,0xffffff),10,16),12),2));
- }
- public function ping(){
- $ch = curl_init("http://i.imgur.com/72udZx0.gif");
- curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
- curl_setopt($ch,CURLOPT_HEADER,0);
- curl_setopt($ch,CURLOPT_NOBODY,true);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- $response = curl_exec($ch);
- $info = curl_getinfo($ch);
- if($info['http_code'] == "200"){
- echo "[AutoLogin] Terhubung (".$this->formatSizeUnits($info[header_size]).")\r\n";
- $this->ping();
- }else{
- echo "[AutoLogin] Terputus\r\n";
- $this->login();
- }
- }
- public function run(){
- $repons = $this->ngecurl("http://go.microsoft.com/fwlink/?LinkID=219472&clcid=0x409" ,null , null);
- preg_match_all('/berita/', $repons, $res);
- if($res[0][0]){
- echo "[WIFI] Sudah terhubung\r\n";
- $this->ping();
- }else{
- echo "[WIFI] Sedang mengambil data \r\n";
- $data = $this->getData($repons);
- if($data[mac]){
- echo "[WIFI] MAC : ".$data[mac]." | GWID : ".$data[gwid]." | IPC : ".$data[ipc]."\r\n";
- $this->login($data[mac] , $data[gwid] , $data[url] , $data[ipc]);
- }else{
- $this->run();
- }
- }
- }
- }
- $wifi = new WifiController;
- $wifi->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement