elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
23 Mayo 2012, 07:44  


Tema destacado: Suscripción al boletín mensual de elhacker.net

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Análisis y Diseño de Malware (Moderadores: Karcrack, [Zero])
| | |-+  intentando hacer hook a USB
0 Usuarios y 2 Visitantes están viendo este tema.
Páginas: 1 [2] Ir Abajo Respuesta Imprimir
Autor Tema: intentando hacer hook a USB  (Leído 2,771 veces)
Karcrack
Moderador
***
Desconectado Desconectado

Mensajes: 2.189


Se siente observado ¬¬'


Ver Perfil
Re: intentando hacer hook a USB
« Respuesta #15 en: 7 Febrero 2010, 22:44 »

jeje gracias por contestar Sr.Karcrack
De nada ;)

Ya me cuentas si consigues que vaya :)
En línea

Zzombi

Desconectado Desconectado

Mensajes: 171



Ver Perfil WWW
Re: intentando hacer hook a USB
« Respuesta #16 en: 8 Febrero 2010, 01:28 »

aquí dejo el código por si alguien mas le sirve.. de seguro que si  :xD

compilado en Dev C++

Código
#include <windows.h>
#include <Dbt.h>
 
 
/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
 
LRESULT CALLBACK WindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam){
 
  if (uMsg == WM_DEVICECHANGE)
  {
           if(wParam == DBT_DEVICEARRIVAL)
           {
                     MessageBox(0,"se conecto dispositivo","dispositivo",0);
                     return TRUE;
           }
  }
 
  return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
 
/*  Make the class name into a global variable  */
char szClassName[ ] = "WindowsApp";
 
int WINAPI WinMain (HINSTANCE hThisInstance,
                   HINSTANCE hPrevInstance,
                   LPSTR lpszArgument,
                   int nFunsterStil)
 
{
   HWND hwnd;               /* This is the handle for our window */
   MSG messages;            /* Here messages to the application are saved */
   WNDCLASSEX wincl;        /* Data structure for the windowclass */
 
   /* The Window structure */
   wincl.hInstance = hThisInstance;
   wincl.lpszClassName = szClassName;
   wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
   wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
   wincl.cbSize = sizeof (WNDCLASSEX);
 
   /* Use default icon and mouse-pointer */
   wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
   wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
   wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
   wincl.lpszMenuName = NULL;                 /* No menu */
   wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
   wincl.cbWndExtra = 0;                      /* structure or the window instance */
   /* Use Windows's default color as the background of the window */
   wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
 
   /* Register the window class, and if it fails quit the program */
   if (!RegisterClassEx (&wincl))
       return 0;
 
   /* The class is registered, let's create the program*/
   hwnd = CreateWindowEx (
          0,                   /* Extended possibilites for variation */
          szClassName,         /* Classname */
          "Windows App",       /* Title Text */
          WS_OVERLAPPEDWINDOW, /* default window */
          CW_USEDEFAULT,       /* Windows decides the position */
          CW_USEDEFAULT,       /* where the window ends up on the screen */
          544,                 /* The programs width */
          375,                 /* and height in pixels */
          HWND_DESKTOP,        /* The window is a child-window to desktop */
          NULL,                /* No menu */
          hThisInstance,       /* Program Instance handler */
          NULL                 /* No Window Creation data */
          );
 
   /* Make the window visible on the screen */
   ShowWindow (hwnd, nFunsterStil);
 
   LONG hook = SetWindowLong(hwnd,GWL_WNDPROC,(LONG)WindowProc);
   /* Run the message loop. It will run until GetMessage() returns 0 */
   while (GetMessage (&messages, NULL, 0, 0))
   {
       /* Translate virtual-key messages into character messages */
       TranslateMessage(&messages);
       /* Send message to WindowProcedure */
       DispatchMessage(&messages);
   }
 
   /* The program return-value is 0 - The value that PostQuitMessage() gave */
   return messages.wParam;
}
 
 
/*  This function is called by the Windows function DispatchMessage()  */
 
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   switch (message)                  /* handle the messages */
   {
       case WM_DESTROY:
           PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
           break;
       default:                      /* for messages that we don't deal with */
           return DefWindowProc (hwnd, message, wParam, lParam);
   }
 
   return 0;
}
también dejo un link de msdn que me sirvio para entender mas el asunto

http://msdn.microsoft.com/en-us/library/aa363480%28VS.85%29.aspx

por cierto Karcrack cuando probe
HWND hwnd = CreateWindowEx(0, "STATIC",NULL,0,0,0,0,0,0,0,GetModuleHandle(NULL),0);
no me resulto asi que tube que colocar todo el codigo de la ventana  :xD


saludos
« Última modificación: 8 Febrero 2010, 01:55 por Zzombi » En línea
Karcrack
Moderador
***
Desconectado Desconectado

Mensajes: 2.189


Se siente observado ¬¬'


Ver Perfil
Re: intentando hacer hook a USB
« Respuesta #17 en: 8 Febrero 2010, 08:17 »

La llamada a CreateWindow deberia ser asi: :rolleyes:
Código:
CreateWindow("STATIC", 0, 0, 0, 0, 0, 0, 0, 0, GetModuleHandle(0), 0);
Deberua funcionar :-\
En línea

Zzombi

Desconectado Desconectado

Mensajes: 171



Ver Perfil WWW
Re: intentando hacer hook a USB
« Respuesta #18 en: 8 Febrero 2010, 14:17 »

probe nuevamente y no funciono Sr.Karcrack   :-\

en el main

Código
int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nFunsterStil)
{
   HWND hwnd = CreateWindow("STATIC", 0, 0, 0, 0, 0, 0, 0, 0, GetModuleHandle(0), 0);
   LONG hook = SetWindowLong(hwnd,GWL_WNDPROC,(LONG)WindowProc);
   system("pause");
}
En línea
Páginas: 1 [2] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Intentando hacer shellcode 64 bits
Bugs y Exploits
tuket 9 1,471 Último mensaje 28 Julio 2011, 14:25
por tuket
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines