Guest User

Free Mobile : nouvelle authentification

a guest
Feb 22nd, 2012
4,835
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // 23/02/2012 by ToYonos
  4.  
  5. $url = 'https://mobile.free.fr/moncompte/';
  6. $urlConso = 'https://mobile.free.fr/moncompte/index.php?page=suiviconso';
  7. $fields = array('login_abo'=>'???', 'pwd_abo'=>'???'); // A remplir évidemment
  8.  
  9. // 1° On récupère la page pour la décrypter
  10.  
  11. $ch = curl_init();
  12. curl_setopt($ch,CURLOPT_URL, $url);
  13. curl_setopt($ch, CURLOPT_COOKIEJAR, 'c:\cookiefile.txt');
  14. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
  15. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  16. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  17.  
  18. $content = curl_exec($ch);
  19.  
  20. curl_close($ch);
  21.  
  22. $chiffres = array();
  23. preg_match_all("#ident_addNumber\(([0-9]), ([0-9])\)#" , $content, $matches); //<img onclick="ident_addNumber(2, 0)" src="chiffre.php?pos=0" class="ident_chiffre_img pointer" alt="chiffre" />
  24. for ($i = 0; $i < 10; $i++) $chiffres[$matches[1][$i]] = $matches[2][$i];
  25. $login = '';
  26. for($i = 0; $i < strlen($fields['login_abo']); $i++) $login .= $chiffres[$fields['login_abo'][$i]];
  27. $fields['login_abo'] = $login;
  28.        
  29. // 2° Authentification
  30.        
  31. $fields_string = '';
  32. foreach($fields as $key=>$value) { $fields_string .= $key.'='.urlencode($value).'&'; }
  33. rtrim($fields_string,'&');
  34.  
  35. $ch = curl_init();
  36. curl_setopt($ch,CURLOPT_URL,$url);
  37. curl_setopt($ch, CURLOPT_COOKIEFILE, 'c:\cookiefile.txt');
  38. curl_setopt($ch, CURLOPT_COOKIEJAR, 'c:\cookiefile.txt');
  39. curl_setopt($ch,CURLOPT_POST,count($fields));
  40. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
  41. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  42. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  43. curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
  44.  
  45. curl_exec($ch);
  46.  
  47. curl_close($ch);
  48.  
  49. // 3° Récupération de la consommation
  50.  
  51. $ch = curl_init();
  52. curl_setopt($ch,CURLOPT_URL, $urlConso);
  53. curl_setopt($ch, CURLOPT_COOKIEFILE, 'c:\cookiefile.txt');
  54. curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
  55. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  56. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
  57.  
  58. echo curl_exec($ch); // A parser
  59.  
  60. curl_close($ch);
  61.  
  62. ?>
RAW Paste Data