Página 1 de 1

Gathor 0.5

Publicado: 24 Ago 2013, 02:02
por WarZ0n3
Después de tanto tiempo ocupado hoy vengo a traerles una herramienta que hace
tiempo tenia pensado....

Se trata de un gathering fusionado con una viewbot que había hecho hace algún tiempo
(también hice un tutorial de como programar uno, buscarlo en la sección delphi).

Obviamente este versión esta mejorada y se le han agregado mas características, por ejemplo

los métodos http tales como options, head, get, post, etc... por si desean hacer algún

deface una información extra no viene mal...
también aumenta las vistas de un vídeo(todavía no le agregado los proxys, espero para la próxima entrega),
lectura de un archivo, y descarga de .txt

Lo programe en delphi 7 por si desean compilarlo por su cuenta(también dejare algunas
imagenes con ejemplos de los parámetros usados y demás).

Descarga : [Enlace externo eliminado para invitados]
El .rar no tiene contraseña.
program Gathor;

(*********************************************)
(* Software : Gathor 0.5                     *)
(* Autor    : WarZone                        *)
(* Fecha    : 23/8/13                        *)
(*********************************************)
(* Explicacion:                              *)
(* Un gathering de informacion web el cual   *)
(* tiene caracteristicas                     *)
(* como leer el source de la pagina(index),  *)
(* ver el servidor en que se esta corriendo, *)
(* fecha, version del protocolo, contenido,  *)
(* opciones de metodos usados <posiblemente  *)
(* permitiendo un Defacement>, leectura de un*)
(* fichero y descarga, viewbot para aumentar *)
(* visitas(por ejemplo a un video en youtube),*)
(* etc...                                    *)
(*********************************************)
(*********************************************)
(*    -Opciones de uso / Caracteristicas-    *)
(*                                           *)
(* Los siguientes comandos permiten hacer    *)
(* peticiones HTTP por distintas opciones,   *)
(* GET, POST, HEAD, ETC... y version del     *)
(* protocolo respectivamente 1.0 o 1.1       *)
(*                                           *)
(* get_proto_0 -> metodo GET por HTTP/1.0    *)
(* get_proto_1 -> GET por HTTP/1.1           *)
(* post_proto_0 -> POST por HTTP/1.0         *)
(* post_proto_1 -> POST por HTTP/1.1         *)
(* options_proto_0 -> OPTIONS por HTTP/1.0   *)
(* options_proto_1 -> OPTIONS por HTTP/1.1   *)
(* head_proto_0 -> HEAD por HTTP/1.0         *)
(* head_proto_1 -> HEAD por HTTP/1.1         *)
(* Parametros + Ejemplo :                    *)
(*********************************************)
(* con parametro -g                          *)
(* <sitio_web> <puerto> <opcion>             *)
(* -g http://www.google.com 80 get_proto_0          *)
(*********************************************)
(* con parametro -b                          *)
(* <sitio/video_a_aumentar><intervalo_segs>  *)
(* -b http://www.youtube.com/video_a_aumentar 1     *)
(*********************************************)
(* con parametro -r                          *)
(* <sitio><nombre_archivo_a_leer>            *)
(* -r http://www.sitio.com/robots.txt               *)
(*********************************************)
(* con parametro -d                          *)
(* <sitio><ruta+nombre_archivo_a_guardar>    *)
(* -d http://www.sitio.com/robots.txt C:/OUTPUT.TXT *)
(*********************************************)
(* con parametro -h y -m                     *)
(* Desplega la ayuda                         *)
(*********************************************)

(*
      Puedes encontrarme en foro.elhacker.net e
      indetectables.net por cualquier duda.
      
      Todos los desensamblados como las funciones
      escritas en ASM fueron echas por WarZ0n3,
      si las incluyes en tu proyecto te pido que
      me des los creditos correspondientes...
      NO ME HAGO RESPONSABLE DEL MAL USO QUE LE
      PUEDAN DAR.
                    Atte : Warz0n3
*)

{$APPTYPE CONSOLE}

 uses
  SysUtils,
  Windows,
  WinInet,
  WinSock;

 type
  PTcpData    = ^TcpData;

  TcpData     = record
    SendDataBuffer      : array[$00000000..GETEXTENDEDTEXTMETRICS] of Char;
    RecvDataBuffer      : array[$00000000..(GETEXTENDEDTEXTMETRICS*2)] of AnsiChar;
  end;

      // configuracion del viewbot
 const
  INTERNET_OPEN_TYPE_PRECONFIG        = $00000000; (* Usa la configuracion del registro(por defecto) *)
  INTERNET_OPEN_TYPE_DIRECT           = $00000001;  (* Acceso directo a la red *)
  INTERNET_OPEN_TYPE_PROXY            = $00000003; (* Acceso via proxy *)
  INTERNET_SERVICE_HTTP               = $00000003;

  {$DEFINE INTERNET_FLAG_RELOAD}
  {$DEFINE INTERNET_FLAG_NO_COOKIES}
  {$DEFINE INTERNET_FLAGS_MASK}
  INTERNET_FLAGS_MASK                 = INTERNET_FLAG_RELOAD  or
                                        INTERNET_FLAG_NO_COOKIES;

  HASHKEY                             = 55; //$00000028; // 40d
  HTTP                                = 'http://';
  // ******************************************

  { Config }
  BL         = #13#10;

  { HTTP Methods }
  POST        = 'POST';
  GET         = 'GET';
  OPTIONS     = 'OPTIONS';
  HEAD        = 'HEAD';

  { Version }
  HTTP0       = ' HTTP/1.0';
  HTTP1       = ' HTTP/1.1';
  STP         = ' /';

  { Octetos }
  ZERO        = $00000000;
  BSIZE       = $00001024;
  BUFFSIZE    = $00000041; // 65d //$000000FF;
  BUFFDATA    = $00001000;
  INADDRSIZE  = $0000000A;

 var
 {$DEFINE Host}
  Host        : string;
 {$DEFINE Port}
  Port        : Uint;

  WSData      : WsaData;
  TcpSocket   : tSocket;
  sAddr       : sockaddr_in;
  pIp         : string;
  I           : Integer;

  (*
  00408450  /$ 55             PUSH EBP       
  00408451  |. 8BEC           MOV EBP,ESP
  00408453  |. 6A 00          PUSH 0
  00408455  |. 53             PUSH EBX
  00408456  |. 33C0           XOR EAX,EAX
  00408458  |. 55             PUSH EBP
  00408459  |. 68 BA844000    PUSH Project2.004084BA
  0040845E  |. 64:FF30        PUSH DWORD PTR FS:[EAX]
  00408461  |. 64:8920        MOV DWORD PTR FS:[EAX],ESP
  00408464  |. 68 9C374100    PUSH Project2.0041379C                   ; /pWSAData = Project2.0041379C
  00408469  |. 6A 01          PUSH 1                                   ; |RequestedVersion = 1 (1.0.)
  0040846B  |. E8 98FFFFFF    CALL <JMP.&wsock32.WSAStartup>           ; \WSAStartup
  00408470  |. 90             NOP
  00408471  |. 90             NOP
  00408472  |. 90             NOP
  00408473  |. 8D55 FC        LEA EDX,DWORD PTR SS:[EBP-4]
  00408476  |. B8 01000000    MOV EAX,1
  0040847B  |. E8 88A3FFFF    CALL Project2.00402808
  00408480  |. 8B45 FC        MOV EAX,DWORD PTR SS:[EBP-4]
  00408483  |. E8 A4BBFFFF    CALL Project2.0040402C
  00408488  |. 50             PUSH EAX                                 ; /Name
  00408489  |. E8 72FFFFFF    CALL <JMP.&wsock32.gethostbyname>        ; \gethostbyname
  0040848E  |. 8B40 0C        MOV EAX,DWORD PTR DS:[EAX+C]
  00408491  |. 33D2           XOR EDX,EDX
  00408493  |. 8B0490         MOV EAX,DWORD PTR DS:[EAX+EDX*4]
  00408496  |. FF30           PUSH DWORD PTR DS:[EAX]
  00408498  |. E8 3BFFFFFF    CALL <JMP.&wsock32.inet_ntoa>
  0040849D  |. 8BD8           MOV EBX,EAX
  0040849F  |. E8 6CFFFFFF    CALL <JMP.&wsock32.WSACleanup>           ; [WSACleanup
  004084A4  |. 33C0           XOR EAX,EAX
  004084A6  |. 5A             POP EDX
  004084A7  |. 59             POP ECX
  004084A8  |. 59             POP ECX
  004084A9  |. 64:8910        MOV DWORD PTR FS:[EAX],EDX
  004084AC  |. 68 C1844000    PUSH Project2.004084C1
  004084B1  |> 8D45 FC        LEA EAX,DWORD PTR SS:[EBP-4]
  004084B4  |. E8 83B7FFFF    CALL Project2.00403C3C
  004084B9  \. C3             RETN
  *)

 function                    // Host contiene la IP
  __call_ix86_getIP(): PChar; assembler;
 asm
    PUSH EBX
    ADD ESP, 0FFFFFE70h
    PUSH ESP
    PUSH $1
    CALL WSASTARTUP
    NOP
    PUSH Host // 04081B4h
    CALL GetHostByName
    MOV EAX, [EAX+0Ch]
    XOR EDX, EDX
    NOP
    MOV EAX, [EAX+EDX*4]
    PUSH DWORD PTR [EAX]
    CALL INET_NTOA
    MOV EBX, EAX
    CALL WSACleanup
    MOV EAX, EBX
    ADD ESP, 0190h
    POP EBX
    RETN
 end;

 procedure
  __call_ix86_configureHost; assembler;
 asm
  MOV EDX, OFFSET Host
  MOV EAX, $2  // nparam
  CALL PARAMSTR
 end;
 procedure
  __call_ix86_configurePort; assembler;
 asm
  LEA EDX, [EBP-04h]
  MOV EAX, $3
  CALL PARAMSTR
  MOV EAX, [EBP-04h]
  CALL STRTOINT
  MOV DWORD PTR DS:[PORT], EAX  (* configuracion del host y el puerto*)
 end;

 function
 (*00408818  /$ 53             PUSH EBX
00408819  |. 33DB           XOR EBX,EBX
0040881B  |. 6A 74          PUSH 74                                  ; /Key = VK_F5
0040881D  |. E8 3AC7FFFF    CALL <JMP.&user32.GetAsyncKeyState>      ; \GetAsyncKeyState
00408822  |. 66:85C0        TEST AX,AX
00408825  |. 74 03          JE SHORT Project2.0040882A
00408827  |. 83CB FF        OR EBX,FFFFFFFF
0040882A  |> 8BC3           MOV EAX,EBX
0040882C  |. 5B             POP EBX
0040882D  \. C3             RETN
*)
  __call_ix86_interceptF5() :  BOOL; assembler;
 asm
  PUSH EBX
  XOR EBX, EBX
  PUSH $74     // F5
  CALL GETASYNCKEYSTATE
  TEST AX, AX
  JE @A0040882D   // label relativo
  OR EBX, $FFFFFFFF
  @A0040882D:
  MOV EAX, EBX
  POP EBX
  RETN
 end;


 (*                                                  // Configuracion del host y puerto
 004084B7  |. BA 9C374100    MOV EDX, .0041379C
 004084BC  |. B8 01000000    MOV EAX,1
 004084C1  |. E8 42A3FFFF    CALL  .00402808

 004084C3  |. 8D55 FC        LEA EDX,DWORD PTR SS:[EBP-4]
 004084C6  |. B8 02000000    MOV EAX,2
 004084CB  |. E8 38A3FFFF    CALL .00402808
                                                   // configuracion de los sockets
 004084C6  |. 68 A0374100    PUSH  .004137A0                          ; /pWSAData = Project2.004137A0
 004084CB  |. 6A 01          PUSH 1                                   ; |RequestedVersion = 1 (1.0.)
 004084CD  |. E8 36FFFFFF    CALL <JMP.&wsock32.WSAStartup>           ; \WSAStartup

 004084D4  |. 6A 00          PUSH 0                                   ; /Protocol = IPPROTO_IP
 004084D6  |. 6A 01          PUSH 1                                   ; |Type
 004084D8  |. 6A 02          PUSH 2                                   ; |Family = AF_INET
 004084DA  |. E8 19FFFFFF    CALL <JMP.&wsock32.socket>               ; \socket
 004084DF  |. A3 A0374100    MOV DWORD PTR DS:[4137A0],EAX
 *)
 procedure InitGathering();
 var
  TcpData           : PTcpData; // puntero a tcpdata
  nOpc              : integer;
 begin
 {$IFDEF Host}
    __call_ix86_configureHost;  // inicio la configuracion de parametros
 {$ENDIF}
 {$IFDEF Port}
    __call_ix86_configurePort;
 {$ENDIF}
  ASM
  PUSH EBX
  ADD ESP, 0FFFFFE70h
  PUSH ESP
  PUSH $1                 // version
  CALL WSAStartup         //WSAStartUp($1, WSData);
  PUSH $0
  PUSH $1
  PUSH $2
  CALL SOCKET
  MOV DWORD PTR DS:[TcpSocket], EAX  // Puntero a tcpsocket  //TcpSocket:= Socket (AF_INET, SOCK_STREAM, ZERO);
  END;
  New(TcpData); // reservamos memoria para la estructura

  sAddr.sin_family:= af_inet;
  sAddr.sin_addr.s_addr:= inet_addr(__call_ix86_getip()); //INET_ADDR('173.194.42.209');
  sAddr.sin_port:= htons(Port); //htons( StrToInt(ParamStr(2)) );

  nOpc:= 4;
  // Opcion por default
  if (ParamStr(nOpc)<' ') then
    TcpData^.SendDataBuffer:= 'OPTIONS /index.html HTTP/1.0'+BL+BL;
  // Gathering automatico 
  if (ParamStr(nOpc)>' ') then
  begin
    if (ParamStr(nOpc)='get_proto_0') then
      TcpData^.SendDataBuffer:= GET+STP+HTTP0+BL+BL;
    if (ParamStr(nOpc)='get_proto_1') then
      TcpData^.SendDataBuffer:= GET+STP+HTTP1+BL+BL;
    if (ParamStr(nOpc)='post_proto_0') then
      TcpData^.SendDataBuffer:= POST+STP+HTTP0+BL+BL;
    if (ParamStr(nOpc)='post_proto_1') then
      TcpData^.SendDataBuffer:= POST+STP+HTTP1+BL+BL;
    if (ParamStr(nOpc)='options_proto_0') then
      TcpData^.SendDataBuffer:= OPTIONS+STP+HTTP0+BL+BL;
    if (ParamStr(nOpc)='options_proto_1') then
      TcpData^.SendDataBuffer:= OPTIONS+STP+HTTP1+BL+BL;
    if (ParamStr(nOpc)='head_proto_0') then
      TcpData^.SendDataBuffer:= HEAD+STP+HTTP0+BL+BL;
    if (ParamStr(nOpc)='head_proto_1') then
      TcpData^.SendDataBuffer:= HEAD+STP+HTTP1+BL+BL;
  end;

  try
    WriteLn('[Conectando al servidor]: ', __call_ix86_getip());

    Winsock.Connect(TcpSocket, sAddr, sizeof(sAddr));
    WriteLn('[Parametro]: ', TcpData^.SendDataBuffer );
    Winsock.Send(TcpSocket, TcpData^.SendDataBuffer, StrLen(TcpData^.SendDataBuffer), MSG_DONTROUTE);
    Winsock.Recv(TcpSocket, TcpData^.RecvDataBuffer, BSIZE, SD_RECEIVE);
    WriteLn(TcpData^.RecvDataBuffer);
  finally
    Dispose(TcpData);
    Shutdown(TcpSocket, SD_BOTH);
    CloseSocket(TcpSocket);
    WSACleanUp();
  end;

 end;

 function
  RandomHashes(LenDict:integer):string;
 const
  BuffHash    : Array[0..BUFFSIZE] of Char= (
    'a', 'b', 'c', 'd', 'e', 'f', 'g',
    'h', 'i', 'j', 'k', 'l', 'm', 'n',
    'o', 'p', 'q', 'r', 's', 't', 'u',
    'u', 'v', 'w', 'x', 'y', 'z', 'A',
    'B', 'C', 'D', 'E', 'F', 'G', 'H',
    'I', 'J', 'K', 'L', 'M', 'N', 'O',
    'P', 'Q', 'R', 'S', 'T', 'U', 'V',
    'W', 'X', 'Y', 'Z', '0', '1', '2',
    '3', '4', '5', '6', '7', '8', '9',
    '=', '?', '-'
  );
 var
  iHash         : Integer;
  PBuffHash     : Char;
 begin
  iHash:= Length(BuffHash)-LenDict;
  repeat
    Randomize;
    PBuffHash:= BuffHash[Random(Length(BuffHash))];
    asm
      @@StartUp:
        DEC(iHash);
    end;
    Result:= Result+PBuffHash;
  until (iHash<ZERO);
  Result:= Result;

  ZeroMemory(Addr(iHash), SizeOf(iHash));
  ZeroMemory(Addr(PBuffHash), SizeOf(PBuffHash));
 end;

 function
  DownloadInetFile(urlhandle:HInternet; const nfile:string): string;
 var
  Buffer          : array [0..1024] of char;
  bytesRead       : DWORD;
  txtFile         : TextFile;
 begin
 Result:= '';
 {$I-}
  if nfile>'' then begin
    {$DEFINE CONFIGURE_INTERNET_FILE}
    assignfile(txtFile, nfile);
    rewrite(txtfile);
  end;
  {$I+}
    {$IFDEF CONFIGURE_INTERNET_FILE}
      fillchar(buffer, sizeof(buffer), ZERO); // inicializamos el buffer

      repeat
        result:= result+buffer;

        internetreadFile(urlhandle, @buffer, sizeof(buffer), bytesread);
        {$I-}if nfile>'' then write(txtfile, buffer);{$I+}

        writeln(buffer);
      until bytesread=0;
    {$ENDIF}
    {$UNDEF CONFIGURE_INTERNET_FILE}
  {$I-}closefile(txtfile);{$I+}
 end;

 function
  OpenINet(url, nFile :string; HashLen, Secs, Opc: integer ) : BOOL;
 var
  hInet,
  hUrl        : hInternet;
  NHash       : PChar;
  Init        : BOOL;
 begin
  NHash:= PChar( RandomHashes(HashLen) );
  hInet:= InternetOpen(NHash, INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, ZERO);
  if assigned(hInet) then
  begin
    hUrl:= InternetOpenUrl(hInet, PChar(HTTP+url), nil, INTERNET_FLAG_NO_COOKIES,
                            INTERNET_FLAG_RELOAD, INTERNET_SERVICE_HTTP);
    if assigned(hUrl) then begin
      if Opc=$02 then begin
        DownloadInetFile(hUrl, nFile); end
      else if Opc=$03 then begin
        DownloadInetFile(hUrl, ''); end
      else begin
        Result:= true;
        WriteLn('[Hash generado]: '+ NHash);
      end;
    end
    else begin
      WriteLn('Se ha producido un error en la conexion... ');
      Result:= false;
    end;
  end; // assigned
  Sleep(Secs*1000);

  InternetCloseHandle(hInet);
  InternetCloseHandle(hUrl);
  FreeMemory(NHash);
 end;

 procedure
  CALLBACK_DownloadInetFile(nFile:string; HashLen, Secs:integer);
 begin
  {$IFDEF Host}
    __call_ix86_configureHost; // configura el primer parametro como Host
  {$ENDIF}
  OpenInet(Host, nFile , HashLen, Secs, $02 );
 end;

 procedure
  InitIrb;
 var
  Init        : BOOL;
  cIrb        : integer;
 begin
  Init:= true;
  {$IFDEF Host}
    __call_ix86_configureHost;
  {$ENDIF}
  WriteLn('Apreta (F5) para salir del bot.');
  while Init do begin
    if OpenInet( Host, '' , HASHKEY, StrToInt( ParamStr(3) ), ZERO ) then
    begin
      inc(cirb);
      writeLn(
        '[Servidor visitado]: ', ParamStr(2),
        #13#10 +'[Ip]: ', __call_ix86_getip(), #13#10+'[Numero de veces]: ', cirb,
        #13#10 +'============================'
      );
    end
    else begin
      writeLn(#13#10+'Ha surgido un problema en la conexion...'); end;
      
    if __call_ix86_interceptF5() then begin
      Init:= false;
      WriteLn(#13#10+'Opcion salida por el usuario.');
    end;
  end;
  ZeroMemory(Addr(cirb), sizeof(cirb));
 end;

var
  Input       : integer;
  Output      : string;
  Opc         : array[1..2] of Byte = ($01, $02);
begin
  {$O+}

  writeln   (
  ' _____       _   _' ,  #13#10,
  '|  __ \     | | | |' , #13#10,
  '| |  \/ __ _| |_| |__   ___  _ __ '  , #13#10 ,
  '| | __ / _` | __|  _ \ / _ \|  __|' , #13#10 ,
  '| |_\ \ (_| | |_| | | | (_) | |   '  ,  #13#10 ,
  ' \____/\__,_|\__|_| |_|\___/|_|   ' , #13#10 ,
  #9#9,'-==0.5 by - WarZ0n3==-' , #13#10#9, 'Happy Hacking...', #13#10
  );

  try
  
      if pos('-h', ParamStr(1))<>0 then
        writeln(#13#10, #9,
            '-m     = metodos http usados para gathering(-g)', #13#10#9,
            '-h     = me estas viendo bebe.', #13#10#9,
            '-d     = descarga archivo : <www.sitio><nombre_archivo_a_guardar>', #13#10#9,
            '-b     = modo bot(spam-sitio) : <www.sitio><intervalo_en_segundos>', #13#10#9,
            '-g     = modo gathering : <www.sitio><puerto><metodo_http>', #13#10#9,
            '-r     = lee un archivo de un sitio web : <www.sitio/archivo.ext>'
            );

      if pos('-m', ParamStr(1))<>0 then
        writeln( #13#10#9,
          'Los siguientes comandos permiten hacer', #13#10#9,
          'peticiones HTTP por distintas opciones,', #13#10#9,
          'GET, POST, HEAD, ETC... y version del', #13#10#9,
          'protocolo respectivamente 1.0 o 1.1', #13#10 , #13#10#9,
          'get_proto_0 -> metodo GET por HTTP/1.0' , #13#10#9,
          'get_proto_1 -> GET por HTTP/1.1', #13#10#9,
          'post_proto_0 -> POST por HTTP/1.0', #13#10#9,
          'post_proto_1 -> POST por HTTP/1.1', #13#10#9,
          'options_proto_0 -> OPTIONS por HTTP/1.0' , #13#10#9,
          'options_proto_1 -> OPTIONS por HTTP/1.1', #13#10#9,
          'head_proto_0 -> HEAD por HTTP/1.0' , #13#10#9,
          'head_proto_1 -> HEAD por HTTP/1.1', #13#10#9#13#10#9,
          'Ejemplo del gathor : -g http://www.facebook.com 80 get_proto_1', #13#10
            );

      if pos('-d', ParamStr(1))<>0 then begin
        if ParamCount=3 then
          CALLBACK_DownloadInetFile(ParamStr(3), 55, 1)
        else
          Write(#13#10, 'Parametros: <opcion><www.sitio><ruta+nombre_archivo_a_guardar>');
      end;
      if pos('-b', ParamStr(1))<>0 then begin
        if ParamCount=3 then
          InitIrb()
        else
          Write(#13#10, 'Parametros: <opcion><www.sitio/video_a_aumentar><intervalo_en_segundos>');
      end;
      if pos('-g', ParamStr(1))<>0 then begin
        if ParamCount=4 then
          InitGathering()
        else
          Write(#13#10, 'Parametros: <www.sitio><puerto><metodo_http>');
      end;
      if pos('-r', ParamStr(1))<>0 then begin
        if ParamCount=2 then begin
        {$IFDEF Host} __call_ix86_configureHost; {$ENDIF}
        OpenINet(Host, '', 55, 1, 3 ); end
        else begin Write(#13#10, 'Parametros: <www.sitio/archivo.ext>'); end;
      end;
      
  except end;
  {$O-}

end.
gathor con parametro -r
Imagen


gathor con parametro -d
Imagen


gathor con parametro -h y -m
Imagen


gathor con parametro -g por medio del metodo get
Imagen


gathor con parametro -g por medio del metodo post
Imagen


gathor con parametro -g por medio del metodo head
Imagen


gathor con parametro -g por medio del metodo options
Imagen

Re: Gathor 0.5

Publicado: 25 Ago 2013, 05:01
por Pink
Implecable WarZ0n3 Gracias por el código.
Bonita código con asm en linea.
Interesante.

saludos.

Re: Gathor 0.5

Publicado: 26 Ago 2013, 02:32
por Flight embedded
Y aparte funciona bien. Lo he probado.
!Gracias por compartir!