-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvault_core.cpp
More file actions
65 lines (53 loc) · 1.98 KB
/
vault_core.cpp
File metadata and controls
65 lines (53 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <unistd.h>
using namespace std;
void derive_key(const string& password, unsigned char* key) {
SHA256((unsigned char*)password.c_str(), password.length(), key);
}
// Ye function data ko image ke peeche chhupayega
void inject_to_image(string img_path, string secret_path, string out_path, unsigned char* key) {
ifstream img(img_path, ios::binary);
ifstream secret(secret_path, ios::binary);
ofstream out(out_path, ios::binary);
// 1. Pehle asli image ko copy karo
out << img.rdbuf();
// 2. Ek Secret Marker dalo (Ye hamara signature hai)
string marker = "---VOID-GHOST---";
out.write(marker.c_str(), marker.length());
// 3. Ab encrypted data dalo
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
unsigned char iv[16] = {0};
EVP_CipherInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv, 1);
unsigned char in_buf[4096], out_buf[4096 + 16];
int out_len;
while (secret.read((char*)in_buf, 4096) || secret.gcount() > 0) {
EVP_CipherUpdate(ctx, out_buf, &out_len, in_buf, secret.gcount());
out.write((char*)out_buf, out_len);
}
EVP_CipherFinal_ex(ctx, out_buf, &out_len);
out.write((char*)out_buf, out_len);
EVP_CIPHER_CTX_free(ctx);
cout << "[+] GOD-LEVEL: Data hidden inside " << out_path << " successfully!" << endl;
}
int main(int argc, char* argv[]) {
if (argc < 5) {
cout << "Usage: ./vault <inject/extract> <image.jpg> <secret_file> <output.jpg>" << endl;
return 1;
}
string mode = argv[1];
string password = getpass("Enter God-Level Password: ");
unsigned char key[32];
derive_key(password, key);
if (mode == "inject") {
inject_to_image(argv[2], argv[3], argv[4], key);
} else {
// Extraction logic yahan aayega (Same concept, reverse math)
cout << "[*] Extracting from the shadows..." << endl;
}
return 0;
}