LogicGuard is a lightweight, header-only C++ library designed to protect sensitive data (passwords, API keys, tokens) from memory dumping attacks and runtime inspection tools like Cheat Engine.
Unlike standard std::string or std::cin which leave plaintext traces in RAM and Console History, LogicGuard ensures your data is encrypted, obfuscated, and wiped instantly.
In standard C++:
std::string s = "Secret";-> Stored as Plaintext in.rdatasection (Visible in Hex Editors).std::cin >> s;-> Leaves traces in Console Input History and RAM.- Result: Any script kiddie with Cheat Engine can steal your data in seconds.
LogicGuard solves this by providing:
- Compile-Time Obfuscation: Hides hardcoded strings from binary analysis.
- Secure Runtime Input: Bypasses console buffer and encrypts keystrokes instantly.
- Automatic Wiping: Uses
volatiledestructors to zero-out memory upon scope exit.
- 🔒 Zero-Trace Input: Reads directly from keyboard (no buffer residue).
- 🎭 Polymorphic Encryption: Every variable gets a unique random key at runtime.
- 👻 Compile-Time Obfuscation: Use the
_S()macro to hide string literals from the.exe. - 🧹 Secure Erasure: Auto-wipes memory to prevent cold-boot attacks or dumps.
- 📦 Header-Only: No complex build systems. Just
#include "LogicGuard.h".
Just copy LogicGuard.h to your project folder. That's it!
#include "LogicGuard.h"- Protecting User Input (Runtime) Don't use std::cin for passwords!
C++
#include "LogicGuard.h"
int main() {
std::cout << "Enter Password: ";
// Reads input as *****, encrypts it in RAM, wipes traces
LG::String pass = LG::Input();
// Use it when needed (decrypted only during usage)
std::cout << "Your secure pass: " << pass << std::endl;
return 0;
}
2. Hiding Hardcoded Strings (Compile-Time)
Hide Admin keys or API Tokens from strings command or Hex Editors.C++
// The string "SUPER_SECRET" will NOT exist in the compiled .exe
LG::String api_key = _S("SUPER_SECRET_KEY_123");I challenge you to hack this library!
Build the project in Release Mode.
Run the executable directly (not from IDE).
Try to search for your password using Cheat Engine or Process Hacker.
Result: You will find NOTHING. (0 Results).
This project is licensed under the MIT License - see the LICENSE file for details.
Created with ❤️ and C++ by [Ahmed Sameh]