cpp-crypter
A Node.js package to encrypt and run a C++ program using XOR encryption.
Features
- Encrypt any C++ executable file.
- Decrypt and run the encrypted executable file.
- Handles large files efficiently using buffers.
Installation
Install the package globally or locally using npm:
npm install -g cpp-crypter
or
npm install cpp-crypter
Usage
Encrypting a C++ Program
To encrypt a C++ executable file, use the encrypt command:
npx cpp-crypter encrypt <input_file> <output_file> <key>
Example:
npx cpp-crypter encrypt ./hello ./hello.enc mysecretkey
This command encrypts the hello executable and outputs the encrypted file as hello.enc using the key mysecretkey.
Decrypting and Running the Program
To decrypt and run the encrypted executable file, use the main script index.js:
node index.js <encrypted_file> <key>
Example:
node index.js ./hello.enc mysecretkey
This command decrypts the hello.enc file using the key mysecretkey and runs the decrypted executable.
Creating a Test C++ Program
To create a simple "Hello, World!" C++ program, follow these steps:
-
Create a C++ source file hello.cpp:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
-
Compile the C++ program:
g++ hello.cpp -o hello
-
Encrypt the executable:
npx cpp-crypter encrypt ./hello ./hello.enc mysecretkey
-
Decrypt and run the executable:
node index.js ./hello.enc mysecretkey
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
LNodesL