Keylogger
Keylogger copied to clipboard
"Invisible" Window feature not working (FindWindowA returns null?)
Describe the bug
Setting the "invisible" macro does not correctly hide the console window. i.e. the ShowWindow(FindWindowA("ConsoleWindowClass", NULL), 0)
call on line 161 of klog_main.cpp doesn't seem to have any effect.
To Reproduce Steps to reproduce the behavior:
- Create a new VS 2019 command-line CPP project
- Paste the entire code of klog_main.cpp
- Change
#define visible
to#define invisible
- Command-line window showing Keylogger still remains open after compiling/running successfully.
Expected behavior
We expect the command-line window to be hidden, but it seems the call to FindWindowA("ConsoleWindowClass", NULL)
returns null, which means the subsequent call to ShowWindow has no effect.
There exist HWND WINAPI GetConsoleWindow(void); to get the console window of the keylogger, it works, although, windows defender might flag the build as a Trojan/Keylogger
.
I added the FreeConsole();
call after ShowWindow(FindWindowA("ConsoleWindowClass", NULL), 0); // invisible
window which resolves this concern.
I submitted a pull request with the change. Hopefully it is accepted as a solution.
Fixed in e931864230ae37b49b036634cb4843f0a1f4fa3e