diff --git a/cpp/crypto.cpp b/cpp/crypto.cpp index e101d55e..67209df6 100644 --- a/cpp/crypto.cpp +++ b/cpp/crypto.cpp @@ -1,32 +1,37 @@ +#include "crypto.h" +#include +#include "decryptor.h" +#include "encrypted_functions.h" +#include "password_functions.h" - #include "crypto.h" - #include - #include "decryptor.h" +using namespace std; - using namespace std; +Crypto::Crypto() +{ +} +// Initialize all dummy data for obfuscation +void initializeAllDummies() +{ + initializePasswordDummies(); + initializeEncryptedDummies(); +} +string Crypto::getJniJsonStringifyData(string key) +{ + // Initialize dummy data (obfuscation) + initializeAllDummies(); + std::string base64Secret = getEncryptedSecureData(); + std::string password = getPasswordSecureData(); + bool binary = false; + std::string plaintext = decryptor::dec(base64Secret, password, binary); - Crypto::Crypto() { - - } - - string Crypto::getJniJsonStringifyData(string key) { - std::string base64Secret1 = "U2FsdGVkX19lgRN4srwXt2D2LYi+baTRYsKl2mygm7ASNIWFynY+bxsDrbKAr2MZnI0flTXS"; - std::string base64Secret2 = "DPWi+ilmqhX7RviqMInOjQ/dRUApNhJW3/Sqk0bymYdpGsZVFHIEEZVtzWgvGs0R6xxSgFN7"; - std::string base64Secret3 = "wxkm/50HMLQZFQt55CR4VItVw6nrLfXATPXRxSiLHSDXvsvUupzfYPAodZsxx9VxlWBZ7g=="; - std::string base64Secret = base64Secret1 + base64Secret2 + base64Secret3; - std::string password = "u4IxXxapI6zg"; - bool binary = false; - std::string plaintext = decryptor::dec(base64Secret, password,binary); - - string hash; - string halfString=base64Secret.substr(base64Secret.length()/2); - if(key==halfString) - { - return plaintext; - } - else - { - return ""; - } - } - \ No newline at end of file + string hash; + string halfString = base64Secret.substr(base64Secret.length() / 2); + if (key == halfString) + { + return plaintext; + } + else + { + return ""; + } +} diff --git a/cpp/encrypted_functions.h b/cpp/encrypted_functions.h new file mode 100644 index 00000000..6b8a2a2f --- /dev/null +++ b/cpp/encrypted_functions.h @@ -0,0 +1,406 @@ +#ifndef ENCRYPTED_FUNCTIONS_H +#define ENCRYPTED_FUNCTIONS_H + +#include +#include + +// Auto-generated encrypted message functions with Advanced Hex obfuscation +// Generated at: 2025-07-27T14:06:41.387Z +// Encrypted functions: 10 real + 10 dummy + 1 main (FIXED NAME) +// Security: Advanced Hex with random indices and garbage bytes +// Main function: getEncryptedSecureData + +// Encrypted part 1 of 10 (REAL) - Advanced Hex +std::string getData4() { + const unsigned char data[45] = { + 0x8E, 0xE1, 0x1A, 0x55, 0x32, 0x70, 0x46, 0x74, 0xFA, 0x73, 0x57, 0x09, 0x8E, 0x50, 0x38, 0x36, 0xFF, 0x64, 0x4D, 0x47, 0xBC, 0x1F, 0x56, 0x9E, 0xAF, 0x8F, 0xBD, 0x04, 0x96, 0xB5, 0x46, 0xC9, 0x58, 0x0C, 0x6B, 0x45, 0xDD, 0xCD, 0x58, 0x8E, 0x13, 0x9D, 0xB7, 0xE2, 0x10 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {3, 4, 6, 9, 17, 19, 22, 34, 38}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 2 of 10 (REAL) - Advanced Hex +std::string parseElementBeta() { + const unsigned char data[35] = { + 0x31, 0x39, 0x73, 0x07, 0x38, 0x63, 0xB1, 0xB7, 0x6C, 0xE0, 0xDB, 0x68, 0xDF, 0x1B, 0xE1, 0x74, 0xA9, 0x6A, 0x30, 0x9E, 0x86, 0x46, 0x99, 0xA0, 0x42, 0x9C, 0x04, 0x44, 0xC8, 0x53, 0xEB, 0x55, 0xD5, 0x41, 0xC5 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 4, 5, 11, 21, 24, 29, 31, 33}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 3 of 10 (REAL) - Advanced Hex +std::string configContentEpsilon() { + const unsigned char data[45] = { + 0x76, 0x41, 0x95, 0x68, 0xCE, 0xF1, 0xFB, 0x24, 0x23, 0x32, 0xC8, 0xC1, 0x58, 0xD9, 0x42, 0x89, 0x25, 0x72, 0x69, 0x63, 0x5A, 0x01, 0x8C, 0xEA, 0xAF, 0x02, 0xF8, 0x88, 0xE7, 0x4C, 0xED, 0x06, 0x09, 0x57, 0xCB, 0x4E, 0x6E, 0x35, 0x9F, 0x2F, 0x39, 0x44, 0x2A, 0x74, 0x0B + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {3, 9, 17, 18, 19, 29, 36, 40, 43}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 4 of 10 (REAL) - Advanced Hex +std::string initBlockEpsilon() { + const unsigned char data[45] = { + 0xCE, 0x47, 0x8E, 0x43, 0x58, 0xCF, 0x6B, 0x26, 0x66, 0x30, 0x70, 0xA7, 0x92, 0xB3, 0x03, 0x44, 0x34, 0x3C, 0xFA, 0x66, 0xE3, 0x56, 0x2B, 0xFE, 0x9E, 0x75, 0xCF, 0xAD, 0x48, 0x9F, 0x4C, 0x9C, 0x6E, 0x40, 0x08, 0x42, 0x8F, 0x7A, 0x8A, 0x74, 0xE0, 0xAD, 0x5B, 0xDA, 0x5A + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {1, 4, 6, 19, 21, 22, 25, 30, 32}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 5 of 10 (REAL) - Advanced Hex +std::string setupString3() { + const unsigned char data[40] = { + 0x55, 0x37, 0x8D, 0x04, 0x95, 0x79, 0x86, 0x79, 0xD4, 0x58, 0x0C, 0x49, 0x6E, 0x2F, 0x52, 0xA7, 0x49, 0x63, 0x51, 0x50, 0xD6, 0x38, 0x29, 0xDC, 0x29, 0x43, 0x01, 0x95, 0xE4, 0xB3, 0x19, 0xC8, 0x8C, 0x32, 0x03, 0x72, 0xE5, 0x08, 0x47, 0xB7 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 5, 13, 16, 17, 19, 25, 33, 35}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 6 of 10 (REAL) - Advanced Hex +std::string loadStringLambda() { + const unsigned char data[38] = { + 0xFD, 0xA8, 0xFA, 0x45, 0x8E, 0x79, 0x70, 0x13, 0x15, 0x4A, 0x9D, 0x47, 0xCE, 0x69, 0xF9, 0x48, 0x74, 0x9E, 0x34, 0xDF, 0x32, 0x44, 0x84, 0xF5, 0x2F, 0x35, 0x64, 0x66, 0x6C, 0x5E, 0x4A, 0xDA, 0xAA, 0x72, 0x46, 0x81, 0xFC, 0x72 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {3, 6, 9, 11, 18, 24, 30, 34, 37}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 7 of 10 (REAL) - Advanced Hex +std::string getSegmentOmega() { + const unsigned char data[36] = { + 0x6C, 0xAF, 0xE2, 0x40, 0x3B, 0x37, 0xB2, 0x74, 0x06, 0x18, 0x7A, 0x8E, 0x90, 0x61, 0x41, 0x32, 0x02, 0x65, 0x32, 0x67, 0x99, 0x23, 0xF4, 0x95, 0x97, 0x46, 0x6E, 0x36, 0xA4, 0x76, 0xE7, 0x88, 0x47, 0x7D, 0xEB, 0xF2 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 10, 15, 17, 18, 25, 26, 29, 32}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 8 of 10 (REAL) - Advanced Hex +std::string loadKeyGamma() { + const unsigned char data[43] = { + 0x4B, 0xD4, 0x34, 0xCB, 0x67, 0x50, 0x16, 0x01, 0x6C, 0x68, 0xBA, 0x39, 0xE6, 0x6B, 0xE4, 0x44, 0xF2, 0x41, 0x0D, 0x6E, 0xB4, 0x2E, 0xA6, 0xB4, 0xF9, 0xCF, 0x02, 0x06, 0xB1, 0xE7, 0xD1, 0x39, 0x6F, 0xD6, 0x6A, 0xA2, 0x7A, 0x1D, 0xD1, 0x4D, 0xA3, 0xF1, 0xC6 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 11, 13, 15, 19, 31, 32, 34, 36}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 9 of 10 (REAL) - Advanced Hex +std::string createPiece4() { + const unsigned char data[43] = { + 0x7D, 0x36, 0xC6, 0x01, 0x80, 0x9F, 0x33, 0x6D, 0x4E, 0x69, 0x74, 0xB1, 0x15, 0x42, 0x2F, 0x7A, 0x52, 0x73, 0x2F, 0x0E, 0xDA, 0x73, 0xB3, 0xE4, 0x67, 0x13, 0xD6, 0x70, 0x77, 0x6E, 0x30, 0x35, 0x08, 0x4E, 0x5F, 0xA1, 0xF9, 0xCE, 0x67, 0xB2, 0x45, 0x6E, 0x6E + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {6, 7, 8, 14, 15, 33, 38, 40, 42}; + const int realCount = 9; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Encrypted part 10 of 10 (REAL) - Advanced Hex +std::string decodeTokenBase() { + const unsigned char data[40] = { + 0xCA, 0x51, 0x87, 0x60, 0x4C, 0x72, 0x71, 0xC2, 0xD6, 0x3C, 0x49, 0x99, 0x4A, 0x65, 0x79, 0x1F, 0x23, 0xE4, 0x37, 0xE6, 0xA4, 0xF3, 0xE9, 0x58, 0x58, 0x58, 0xF7, 0x4C, 0xEF, 0xBE, 0x35, 0x51, 0x3D, 0x3D, 0x85, 0xC0, 0xBF, 0x55, 0x9A, 0x93 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {10, 13, 18, 27, 31, 32, 33}; + const int realCount = 7; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Dummy encrypted function 1 (DECOY) - Advanced Hex +std::string processChunkPrime() { + const unsigned char data[108] = { + 0x5B, 0xB4, 0x8A, 0x24, 0x9E, 0x3A, 0x7B, 0x42, 0x92, 0x55, 0x8B, 0x32, 0xD8, 0x6F, 0x55, 0xE9, 0x46, 0x79, 0x6B, 0xC0, 0x73, 0xD3, 0x94, 0x64, 0x28, 0xAE, 0xC4, 0x64, 0x65, 0x47, 0x52, 0xDA, 0x56, 0x4B, 0x9A, 0x6B, 0x58, 0xA0, 0x31, 0x14, 0x32, 0xDA, 0x95, 0x3C, 0x66, 0x36, 0x0D, 0x61, 0x24, 0x47, 0x50, 0x70, 0x32, 0x6C, 0xFB, 0x73, 0x6F, 0x14, 0xD1, 0x65, 0x7E, 0x52, 0x19, 0x6D, 0xDA, 0x27, 0x34, 0x35, 0x72, 0x1A, 0xF7, 0x34, 0x36, 0x74, 0x0D, 0x37, 0x38, 0x39, 0x2C, 0x99, 0x83, 0xD4, 0x61, 0x80, 0xCE, 0x27, 0x62, 0x63, 0x64, 0x07, 0x6A, 0x71, 0x13, 0x65, 0x38, 0x66, 0xB0, 0xE1, 0xB3, 0xB8, 0x31, 0xE1, 0xB5, 0xB7, 0x32, 0x11, 0x29, 0x33 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {9, 11, 16, 20, 23, 29, 32, 35, 36, 38, 40, 44, 47, 53, 55, 59, 66, 67, 72, 75, 76, 77, 82, 86, 87, 88, 93, 95, 100, 104, 107}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX12false456789abcdef123" +} + +// Dummy encrypted function 2 (DECOY) - Advanced Hex +std::string parseInfoX() { + const unsigned char data[98] = { + 0xD1, 0xD0, 0x4C, 0x7C, 0x6B, 0x55, 0x32, 0x46, 0x73, 0x64, 0x47, 0x56, 0xF2, 0x6B, 0x6B, 0x58, 0xB3, 0x31, 0x22, 0x35, 0xEA, 0x24, 0xE8, 0xBA, 0xD8, 0x32, 0x79, 0x66, 0x61, 0x62, 0xC9, 0xCC, 0x4E, 0x62, 0x58, 0xAA, 0x98, 0x38, 0xEF, 0xBF, 0xE4, 0x6C, 0x73, 0x20, 0x96, 0xA8, 0x65, 0xEA, 0x18, 0x93, 0x06, 0x34, 0x8A, 0x24, 0xE7, 0x35, 0x05, 0x46, 0x96, 0xB3, 0x36, 0xC8, 0xBA, 0x7D, 0x37, 0x4B, 0xF1, 0xC7, 0x38, 0x39, 0x61, 0x33, 0xE1, 0x62, 0x7E, 0x63, 0x64, 0xDB, 0x0E, 0x15, 0x65, 0xD1, 0x66, 0x33, 0x4D, 0x62, 0xB2, 0x26, 0x44, 0xD1, 0x86, 0x7F, 0x31, 0xA5, 0x32, 0x9F, 0x8F, 0x33 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 25, 27, 28, 41, 42, 46, 51, 55, 60, 64, 68, 69, 70, 73, 75, 76, 80, 82, 92, 94, 97}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX12false456789abcdef123" +} + +// Dummy encrypted function 3 (DECOY) - Advanced Hex +std::string getBlockOmega() { + const unsigned char data[102] = { + 0x06, 0xB8, 0x40, 0x55, 0x22, 0x32, 0x46, 0x82, 0xF0, 0xA9, 0x4A, 0x7F, 0x73, 0x26, 0xB3, 0xFA, 0x05, 0x3D, 0xD3, 0x64, 0x47, 0xFE, 0x34, 0x5D, 0xAE, 0xA3, 0x66, 0x83, 0x56, 0x63, 0x6B, 0x58, 0x25, 0xB9, 0x31, 0xDF, 0x72, 0x34, 0x6E, 0x67, 0xAA, 0x6F, 0x69, 0x46, 0xB9, 0x30, 0x3F, 0x73, 0x65, 0x6C, 0xAA, 0x37, 0x97, 0x60, 0x38, 0x97, 0xCA, 0x05, 0x39, 0x12, 0x5C, 0x0A, 0x09, 0x9F, 0x07, 0x4D, 0x58, 0x39, 0x56, 0x5E, 0x30, 0x61, 0x62, 0x63, 0x64, 0xF7, 0x65, 0x29, 0xBE, 0x11, 0x66, 0x80, 0x97, 0x4A, 0xEF, 0x31, 0x32, 0x85, 0x33, 0x34, 0x5E, 0x35, 0x2D, 0x0D, 0x04, 0x19, 0x41, 0xC2, 0xFC, 0x9F, 0x36, 0x81 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {3, 5, 6, 12, 19, 20, 28, 30, 31, 34, 37, 38, 41, 42, 47, 48, 51, 54, 58, 71, 72, 73, 74, 76, 80, 85, 86, 88, 89, 91, 100}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX14noise789abcdef123456" +} + +// Dummy encrypted function 4 (DECOY) - Advanced Hex +std::string makeElementY() { + const unsigned char data[102] = { + 0x12, 0x0F, 0x22, 0x55, 0xAA, 0x23, 0x32, 0xEB, 0xC3, 0x14, 0x24, 0xC6, 0x78, 0xDF, 0x46, 0x2C, 0x73, 0x64, 0x47, 0x56, 0x84, 0x6B, 0x58, 0x29, 0x85, 0x1E, 0x31, 0x98, 0xAC, 0x03, 0x06, 0x30, 0x64, 0x1F, 0x66, 0xE7, 0xFF, 0x44, 0x75, 0x6D, 0x66, 0x5F, 0x98, 0x21, 0x65, 0xEC, 0x53, 0x6D, 0x6B, 0x3D, 0x29, 0x65, 0xED, 0x1E, 0x41, 0x81, 0x71, 0xCA, 0xA9, 0x79, 0xC8, 0x1E, 0x31, 0x9A, 0x7F, 0x1A, 0x26, 0x32, 0x6B, 0x54, 0x33, 0x9D, 0x34, 0xF1, 0x35, 0x3F, 0x1C, 0xCE, 0x8A, 0x36, 0xD8, 0x37, 0x3F, 0x38, 0x35, 0x49, 0xA8, 0x1D, 0x2A, 0x5E, 0x11, 0x58, 0x39, 0x61, 0x62, 0x37, 0x63, 0x8F, 0x72, 0x64, 0x9F, 0x65 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {3, 6, 14, 16, 17, 18, 19, 21, 22, 26, 31, 32, 38, 39, 47, 59, 62, 67, 70, 72, 74, 79, 81, 83, 92, 93, 94, 96, 99, 101}; + const int realCount = 30; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX10dummy123456789abcde" +} + +// Dummy encrypted function 5 (DECOY) - Advanced Hex +std::string processSegmentB() { + const unsigned char data[101] = { + 0x55, 0xF1, 0xF9, 0x8E, 0x60, 0x6F, 0x4E, 0x84, 0xE8, 0xA3, 0x9E, 0x32, 0x36, 0xCC, 0x46, 0x73, 0x99, 0x77, 0x08, 0x44, 0x64, 0x49, 0x6A, 0x60, 0x88, 0x47, 0x4C, 0x55, 0x56, 0x6B, 0x46, 0xFB, 0x58, 0x58, 0xB7, 0x31, 0x35, 0xCC, 0x09, 0x0A, 0xE4, 0xBA, 0x3A, 0xA0, 0x73, 0x35, 0x5F, 0x61, 0xDF, 0x6D, 0x70, 0x6C, 0xE6, 0xE4, 0xC9, 0x65, 0x45, 0x0C, 0x8C, 0x34, 0x36, 0x35, 0x36, 0xB6, 0x37, 0xE2, 0xEB, 0x5D, 0xA0, 0x68, 0x5B, 0xEC, 0x38, 0x3F, 0x39, 0x75, 0x61, 0x25, 0xBC, 0xC6, 0x81, 0xD6, 0x62, 0x5D, 0x0B, 0x39, 0x8F, 0xA4, 0x99, 0x63, 0xA4, 0x64, 0xD6, 0x65, 0x66, 0x30, 0x00, 0x31, 0xBE, 0x85, 0x32 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {0, 11, 14, 15, 20, 25, 28, 29, 32, 35, 36, 44, 47, 49, 50, 51, 55, 59, 61, 62, 64, 72, 74, 76, 82, 89, 91, 93, 94, 97, 100}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX15sample456789abcdef12" +} + +// Dummy encrypted function 6 (DECOY) - Advanced Hex +std::string pullSegment3() { + const unsigned char data[91] = { + 0x5F, 0x1B, 0x55, 0x47, 0xD4, 0x12, 0x48, 0x6E, 0xE9, 0x32, 0x48, 0x89, 0xC3, 0x46, 0x54, 0x7E, 0xD4, 0x73, 0x64, 0xBA, 0x76, 0xC2, 0x4B, 0x1D, 0xCC, 0xA2, 0x6F, 0x47, 0xD4, 0x56, 0x35, 0x6B, 0x58, 0x74, 0x31, 0xC1, 0x33, 0x64, 0x65, 0x43, 0x63, 0x6F, 0x75, 0xF6, 0xC3, 0xC1, 0x79, 0xC8, 0x31, 0x32, 0x33, 0x04, 0x29, 0x34, 0xFF, 0x35, 0x9E, 0xA3, 0x77, 0x70, 0xB9, 0x36, 0x70, 0x37, 0x92, 0xB0, 0x1E, 0x38, 0x39, 0x7F, 0xA2, 0xFC, 0x3E, 0x57, 0xBD, 0x61, 0x3F, 0xCC, 0x62, 0x0C, 0x63, 0x0C, 0x64, 0xF5, 0x40, 0xB4, 0x65, 0x38, 0x6A, 0x24, 0xB8 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {2, 9, 13, 17, 18, 27, 29, 31, 32, 34, 36, 37, 38, 40, 41, 46, 48, 49, 50, 53, 55, 61, 63, 67, 68, 75, 78, 80, 82, 86}; + const int realCount = 30; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX13decoy123456789abcde" +} + +// Dummy encrypted function 7 (DECOY) - Advanced Hex +std::string grabValueOmega() { + const unsigned char data[107] = { + 0x2F, 0xEC, 0x43, 0x4B, 0xE7, 0x55, 0x32, 0x91, 0x46, 0x4D, 0xF9, 0x73, 0x64, 0xD1, 0x0B, 0x47, 0x56, 0x6B, 0x81, 0xA0, 0x58, 0x4B, 0xCB, 0x31, 0x27, 0x0C, 0x3F, 0x67, 0x60, 0x3C, 0x50, 0xB2, 0x9C, 0x84, 0xD6, 0xE1, 0x50, 0x35, 0xEF, 0x2C, 0x6C, 0x6C, 0x4C, 0x76, 0xF8, 0x73, 0x6C, 0x7E, 0x61, 0xE0, 0x0F, 0x44, 0xDD, 0x6D, 0x70, 0xF3, 0x5E, 0x4B, 0x6C, 0xE5, 0x49, 0x21, 0x6F, 0x03, 0x7A, 0x8B, 0xF6, 0xB2, 0x68, 0x65, 0x34, 0x48, 0x6E, 0x5F, 0xEE, 0x35, 0x12, 0xF3, 0x36, 0x82, 0x07, 0x42, 0x29, 0x37, 0x38, 0x39, 0x9C, 0xF2, 0x01, 0x61, 0x62, 0xAF, 0x78, 0x63, 0x64, 0xF9, 0xB8, 0x6F, 0x2B, 0x3D, 0x1C, 0x91, 0x65, 0x66, 0x31, 0x2E, 0x32 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {5, 6, 8, 11, 12, 15, 16, 17, 20, 23, 37, 45, 48, 53, 54, 58, 69, 70, 75, 78, 83, 84, 85, 89, 90, 93, 94, 102, 103, 104, 106}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX15sample456789abcdef12" +} + +// Dummy encrypted function 8 (DECOY) - Advanced Hex +std::string accessSegment2() { + const unsigned char data[107] = { + 0x93, 0x55, 0x15, 0x32, 0x46, 0xDD, 0xE6, 0x73, 0x64, 0x47, 0x10, 0x56, 0xC7, 0x23, 0xDC, 0x41, 0xD8, 0x2B, 0x27, 0x6B, 0x58, 0x28, 0x4C, 0x7F, 0xD1, 0x67, 0x3A, 0x99, 0x31, 0x3D, 0x46, 0xA4, 0xDC, 0x07, 0x99, 0x35, 0x98, 0x73, 0x68, 0x61, 0x6F, 0xB1, 0x6D, 0xED, 0xCD, 0x70, 0x76, 0x52, 0x6C, 0xFA, 0x45, 0x65, 0x34, 0xD2, 0x71, 0x35, 0x47, 0x4F, 0xDD, 0x36, 0x88, 0x21, 0xB0, 0x37, 0x66, 0xEB, 0x38, 0x4F, 0x92, 0x23, 0xEA, 0x27, 0x39, 0x9D, 0x75, 0x61, 0x62, 0x0A, 0x90, 0x2E, 0x78, 0x02, 0x1C, 0x0B, 0x63, 0x64, 0xB2, 0x03, 0x24, 0x86, 0xA8, 0x65, 0x66, 0x31, 0x5F, 0x51, 0xC3, 0x32, 0xE4, 0xF0, 0x70, 0x9D, 0x32, 0xFB, 0x13, 0x6B, 0x39 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {1, 3, 4, 7, 8, 9, 11, 19, 20, 28, 35, 37, 39, 42, 45, 48, 51, 52, 55, 59, 63, 66, 72, 75, 76, 84, 85, 91, 92, 93, 102}; + const int realCount = 31; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX15sample456789abcdef12" +} + +// Dummy encrypted function 9 (DECOY) - Advanced Hex +std::string formKeyGamma() { + const unsigned char data[97] = { + 0xCC, 0x60, 0x31, 0x91, 0x03, 0xA3, 0xCE, 0x55, 0x32, 0x6A, 0x48, 0x66, 0x44, 0x46, 0xB5, 0xBE, 0x73, 0x1A, 0x64, 0x51, 0x45, 0x2D, 0x56, 0xD9, 0x4C, 0x6C, 0x47, 0x56, 0x08, 0x80, 0x7D, 0x6B, 0x58, 0xA5, 0x31, 0xAB, 0xF7, 0x36, 0xD7, 0x6D, 0x0B, 0x0F, 0x6F, 0xC1, 0xB8, 0x63, 0xAF, 0x56, 0x6B, 0x31, 0xF1, 0x4B, 0xE7, 0x4E, 0x72, 0xAF, 0x32, 0xD0, 0xC7, 0xEC, 0x69, 0x3A, 0x33, 0x34, 0x55, 0x51, 0x35, 0x04, 0x03, 0x08, 0xDF, 0x03, 0x14, 0x1A, 0x05, 0x77, 0xEC, 0x36, 0xA1, 0x8B, 0x37, 0x7B, 0x1E, 0x8F, 0x38, 0x39, 0xEF, 0x61, 0x63, 0x62, 0x63, 0x6D, 0x66, 0x64, 0xB8, 0x65, 0x66 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {7, 8, 13, 16, 18, 26, 27, 31, 32, 34, 37, 39, 42, 45, 48, 49, 56, 62, 63, 66, 77, 80, 84, 85, 87, 89, 90, 93, 95, 96}; + const int realCount = 30; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX16mock123456789abcdef" +} + +// Dummy encrypted function 10 (DECOY) - Advanced Hex +std::string parseValueCore() { + const unsigned char data[100] = { + 0xA5, 0xD0, 0xA4, 0x55, 0x32, 0xE0, 0x05, 0x46, 0x50, 0x8A, 0x80, 0x73, 0x75, 0x64, 0x1D, 0x2D, 0x78, 0x26, 0xA2, 0x59, 0x29, 0x12, 0x47, 0x56, 0xF3, 0x6B, 0x58, 0xF3, 0xC1, 0x3F, 0x90, 0xB5, 0xC7, 0x9A, 0x31, 0x33, 0xE9, 0xEB, 0xEA, 0xCB, 0x61, 0x64, 0xF8, 0xF6, 0x7A, 0xD2, 0x85, 0x26, 0x65, 0x21, 0xAF, 0x47, 0xF9, 0x63, 0x6F, 0x78, 0x22, 0x5F, 0x79, 0x31, 0x16, 0x32, 0x33, 0x34, 0x1E, 0xD8, 0x35, 0xC9, 0x2D, 0x36, 0x37, 0x32, 0x38, 0x50, 0x92, 0xD4, 0x51, 0x09, 0xF3, 0xEC, 0x39, 0x31, 0x61, 0x62, 0x7A, 0xC6, 0xBE, 0xAA, 0x63, 0xB3, 0x60, 0x64, 0x79, 0x5C, 0x64, 0x65, 0xE2, 0x6B, 0x5E, 0x0A + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {3, 4, 7, 11, 13, 22, 23, 25, 26, 34, 35, 41, 48, 53, 54, 58, 59, 61, 62, 63, 66, 69, 70, 72, 80, 82, 83, 88, 94, 95}; + const int realCount = 30; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "U2FsdGVkX13decoy123456789abcde" +} + +// Main function to reconstruct encrypted message (FIXED NAME - only uses REAL functions) +std::string getEncryptedSecureData() { + std::string encrypted = ""; + + std::vector parts(10); + + // Only real encrypted functions are called (Advanced Hex extraction) + parts[5] = loadStringLambda(); // Real part 6 + parts[9] = decodeTokenBase(); // Real part 10 + parts[8] = createPiece4(); // Real part 9 + parts[3] = initBlockEpsilon(); // Real part 4 + parts[0] = getData4(); // Real part 1 + parts[7] = loadKeyGamma(); // Real part 8 + parts[1] = parseElementBeta(); // Real part 2 + parts[2] = configContentEpsilon(); // Real part 3 + parts[6] = getSegmentOmega(); // Real part 7 + parts[4] = setupString3(); // Real part 5 + + // Reconstruct encrypted message in correct order + for (const auto& part : parts) { + encrypted += part; + } + + return encrypted; +} + +// Dummy encrypted calls for obfuscation +void initializeEncryptedDummies() { + std::string dummyEnc1 = makeElementY(); // Dummy call + std::string dummyEnc2 = parseInfoX(); // Dummy call + std::string dummyEnc3 = parseValueCore(); // Dummy call +} + +#endif // ENCRYPTED_FUNCTIONS_H diff --git a/cpp/password_functions.h b/cpp/password_functions.h new file mode 100644 index 00000000..73690380 --- /dev/null +++ b/cpp/password_functions.h @@ -0,0 +1,405 @@ +#ifndef PASSWORD_FUNCTIONS_H +#define PASSWORD_FUNCTIONS_H + +#include +#include + +// Auto-generated password functions with Advanced Hex obfuscation +// Generated at: 2025-07-27T14:06:41.385Z +// Password functions: 10 real + 10 dummy + 1 main (FIXED NAME) +// Security: Advanced Hex with random indices and garbage bytes +// Main function: getPasswordSecureData + +// Password part 1 of 10 (REAL) - Advanced Hex +std::string configContentC() { + const unsigned char data[33] = { + 0x2A, 0x34, 0x19, 0xA3, 0x4C, 0xD3, 0x3F, 0xDE, 0x39, 0x49, 0x6A, 0x27, 0x1F, 0x4A, 0x31, 0xB2, 0x01, 0x27, 0x70, 0x07, 0x17, 0x7F, 0xDD, 0x4C, 0xF8, 0xE6, 0x4F, 0x2C, 0x36, 0xE1, 0xED, 0x6C, 0xFB + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {1, 9, 26}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 2 of 10 (REAL) - Advanced Hex +std::string formDataX() { + const unsigned char data[44] = { + 0x3F, 0x49, 0x21, 0x70, 0xD5, 0xC0, 0x0D, 0x76, 0x5A, 0x3E, 0x97, 0x65, 0x06, 0x82, 0x1B, 0x21, 0xDF, 0x26, 0x2B, 0x6B, 0x95, 0x20, 0x8F, 0x2B, 0x49, 0xA2, 0x44, 0x66, 0xFE, 0xB8, 0xCD, 0x74, 0x9B, 0xBC, 0x0E, 0x31, 0x7A, 0x88, 0xC1, 0xFD, 0xE3, 0x40, 0x12, 0xFA + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {1, 15, 35}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 3 of 10 (REAL) - Advanced Hex +std::string makeBufferAlpha() { + const unsigned char data[43] = { + 0x4D, 0xCF, 0x23, 0xFF, 0xED, 0x9C, 0x5E, 0x22, 0x83, 0xDB, 0xB0, 0xA4, 0x2F, 0xAD, 0x61, 0xC5, 0xE1, 0xF1, 0xF9, 0x78, 0x14, 0xBE, 0xFF, 0xA3, 0xB3, 0xE8, 0xC6, 0xFD, 0x35, 0xE8, 0x1D, 0xF2, 0x74, 0xCC, 0x3A, 0x00, 0xCD, 0x47, 0x65, 0x1F, 0xAB, 0xAA, 0x4F + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 28, 32}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 4 of 10 (REAL) - Advanced Hex +std::string retrieveInfoLambda() { + const unsigned char data[33] = { + 0xDE, 0x71, 0x40, 0x4F, 0xAA, 0x9E, 0x55, 0xD0, 0x8C, 0xA2, 0xFC, 0x48, 0xE5, 0xD8, 0x45, 0x1C, 0xE6, 0x34, 0x57, 0x23, 0xAC, 0xFD, 0x32, 0x46, 0x61, 0x22, 0xAD, 0x9C, 0xCA, 0x1B, 0x77, 0x2D, 0x70 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {2, 6, 14}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 5 of 10 (REAL) - Advanced Hex +std::string parseValue5() { + const unsigned char data[32] = { + 0x34, 0x79, 0x49, 0x6E, 0x22, 0x14, 0x1B, 0xE2, 0x25, 0x30, 0xCA, 0x9A, 0x65, 0x37, 0xA9, 0x86, 0x77, 0x82, 0xEF, 0xF1, 0xDA, 0xEB, 0x64, 0xA1, 0x73, 0x8B, 0xC7, 0xB1, 0x8A, 0xD5, 0x75, 0x7D + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {1, 12, 30}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 6 of 10 (REAL) - Advanced Hex +std::string decodeCodePrime() { + const unsigned char data[46] = { + 0xA8, 0xB7, 0x24, 0xC6, 0x26, 0xB0, 0x23, 0xDC, 0x52, 0x83, 0x4A, 0x05, 0x9D, 0x0B, 0x44, 0xF6, 0x73, 0x49, 0x70, 0xCC, 0x9D, 0x7E, 0x8B, 0x3C, 0x7D, 0x62, 0x12, 0x07, 0xF1, 0x98, 0x6B, 0xDA, 0xBB, 0x85, 0x6A, 0x53, 0xA2, 0x6C, 0xEB, 0x66, 0x7D, 0xF8, 0x70, 0xA7, 0x91, 0xD1 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {8, 17, 42}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 7 of 10 (REAL) - Advanced Hex +std::string configCodeC() { + const unsigned char data[42] = { + 0xE8, 0x0B, 0x66, 0xC0, 0x57, 0x47, 0x52, 0x39, 0xB1, 0xCA, 0x1E, 0x72, 0x9A, 0x28, 0x4F, 0x84, 0x88, 0x12, 0x1F, 0x3D, 0x9B, 0x18, 0x22, 0x11, 0xD6, 0x6F, 0x65, 0x1D, 0xC7, 0xE5, 0x5F, 0x2C, 0xEB, 0x35, 0x00, 0xFA, 0x6E, 0x42, 0x29, 0x7E, 0xED, 0x6B + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {4, 26, 41}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 8 of 10 (REAL) - Advanced Hex +std::string extractBufferX() { + const unsigned char data[38] = { + 0x34, 0xDD, 0x14, 0x33, 0x67, 0xF7, 0x80, 0x3D, 0xEE, 0x7D, 0x9C, 0xFB, 0x42, 0x67, 0x49, 0xBA, 0x6F, 0xF4, 0x4C, 0xE8, 0x32, 0x32, 0xF2, 0x25, 0xFD, 0xC1, 0x2F, 0x7E, 0x30, 0x61, 0x34, 0x87, 0x3F, 0x09, 0xD3, 0x34, 0xBB, 0xE7 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {0, 13, 18}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 9 of 10 (REAL) - Advanced Hex +std::string obtainPartEpsilon() { + const unsigned char data[47] = { + 0xE6, 0xC6, 0x4A, 0xFB, 0x55, 0x59, 0xB2, 0x00, 0x62, 0x4F, 0x51, 0x87, 0xF5, 0x29, 0x0C, 0xB1, 0xC1, 0x28, 0x94, 0x3A, 0xF5, 0xE8, 0x56, 0x3C, 0xEF, 0x4C, 0x24, 0x0A, 0xC2, 0xDA, 0x5B, 0x43, 0xEC, 0x38, 0xCF, 0x33, 0xD4, 0x90, 0x41, 0x24, 0x6B, 0x4D, 0x32, 0x8E, 0x5F, 0xF5, 0x21 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {10, 38, 39}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Password part 10 of 10 (REAL) - Advanced Hex +std::string getSegmentEpsilon() { + const unsigned char data[42] = { + 0xF7, 0xCF, 0x62, 0xB7, 0x31, 0xF3, 0x53, 0x01, 0x28, 0xD7, 0x11, 0xD5, 0x8E, 0x8B, 0x56, 0x0A, 0x36, 0x69, 0x6A, 0x25, 0x70, 0xBB, 0x0D, 0x24, 0x48, 0x54, 0x4D, 0xC8, 0x6A, 0xBD, 0xE2, 0x78, 0x59, 0xE6, 0x3B, 0x32, 0xCC, 0x03, 0x55, 0x37, 0xDB, 0x79 + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {16, 25, 35}; + const int realCount = 3; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +// Dummy password function 1 (DECOY) - Advanced Hex +std::string readPieceC() { + const unsigned char data[45] = { + 0x33, 0x73, 0x61, 0x6D, 0xF2, 0x70, 0xA9, 0x71, 0x6C, 0xD4, 0x65, 0x5F, 0x61, 0x6B, 0x75, 0x06, 0x69, 0x9E, 0xC4, 0x74, 0xA7, 0xC0, 0xEE, 0x8C, 0x68, 0x5E, 0xF4, 0x5F, 0xCB, 0x9E, 0x67, 0x45, 0xEA, 0xB9, 0x79, 0x89, 0x68, 0x8B, 0x89, 0x69, 0xC5, 0xA2, 0x3A, 0x99, 0x27 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {1, 2, 3, 5, 8, 10, 11, 12, 14, 19, 24, 27, 30, 36, 39}; + const int realCount = 15; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "sample_auth_ghi" +} + +// Dummy password function 2 (DECOY) - Advanced Hex +std::string extractStreamZ() { + const unsigned char data[49] = { + 0x62, 0x6F, 0x88, 0xC1, 0xFD, 0xD9, 0x8F, 0x74, 0xEA, 0x02, 0x82, 0x29, 0x7B, 0x67, 0x75, 0xB4, 0x73, 0x5F, 0x58, 0x61, 0xFD, 0xB6, 0x8B, 0x2A, 0xCB, 0x79, 0x75, 0x94, 0x09, 0x40, 0xA3, 0x74, 0x36, 0x68, 0x90, 0xF9, 0x14, 0xCB, 0x2E, 0xD4, 0xEE, 0xCE, 0xFA, 0x9A, 0x08, 0xDC, 0x5F, 0x79, 0x7A + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {0, 1, 13, 14, 16, 17, 19, 26, 31, 33, 46, 47, 48}; + const int realCount = 13; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "bogus_auth_yz" +} + +// Dummy password function 3 (DECOY) - Advanced Hex +std::string pullBlockY() { + const unsigned char data[55] = { + 0x67, 0x66, 0xB4, 0x4B, 0x3B, 0x24, 0x62, 0x67, 0xED, 0x6F, 0xDA, 0xA9, 0xAA, 0xC4, 0x2E, 0xE4, 0x2D, 0x08, 0x67, 0x75, 0xC6, 0xA4, 0x88, 0x73, 0x5F, 0xD3, 0x3D, 0x84, 0x61, 0x75, 0x35, 0xB0, 0xEA, 0xA9, 0x39, 0x2B, 0x74, 0xB0, 0x2A, 0xD1, 0xE4, 0x68, 0x5C, 0x40, 0x44, 0xA0, 0x5F, 0x79, 0x7A, 0x11, 0x21, 0x10, 0x81, 0x52, 0x96 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {6, 9, 18, 19, 23, 24, 28, 29, 36, 41, 46, 47, 48}; + const int realCount = 13; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "bogus_auth_yz" +} + +// Dummy password function 4 (DECOY) - Advanced Hex +std::string readEntryY() { + const unsigned char data[46] = { + 0x5D, 0x45, 0x72, 0x30, 0x61, 0xFC, 0x61, 0xE9, 0x51, 0x6F, 0x6E, 0x99, 0x64, 0x9E, 0x54, 0xB0, 0x42, 0x78, 0xBF, 0x6F, 0xAA, 0x6D, 0x5F, 0x22, 0x08, 0x5A, 0x63, 0x6F, 0x64, 0x0E, 0x05, 0x65, 0xE2, 0x5F, 0xF6, 0xC6, 0x5F, 0x81, 0xB2, 0x6A, 0xCE, 0xF0, 0x3A, 0x25, 0x6B, 0x6C + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {2, 4, 10, 12, 19, 21, 22, 26, 27, 28, 31, 33, 39, 44, 45}; + const int realCount = 15; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "random_code_jkl" +} + +// Dummy password function 5 (DECOY) - Advanced Hex +std::string accessStringBeta() { + const unsigned char data[61] = { + 0x72, 0xB9, 0x84, 0xF6, 0x61, 0x6E, 0xE8, 0x83, 0xFA, 0x19, 0x64, 0x50, 0x6F, 0x6D, 0x1B, 0xD5, 0x80, 0x3A, 0xA7, 0x5F, 0x7B, 0x63, 0x5E, 0xE0, 0x49, 0x11, 0xA5, 0xD7, 0x7A, 0xFE, 0x79, 0x4C, 0xBE, 0xAD, 0x5D, 0x73, 0xE0, 0x6F, 0xF8, 0x64, 0x4F, 0xB5, 0x65, 0x55, 0x39, 0xC3, 0x5F, 0x6A, 0xD9, 0x72, 0x6B, 0xDA, 0x6C, 0xD2, 0xB7, 0x54, 0x5E, 0x94, 0xBE, 0x6B, 0x6E + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {0, 4, 5, 10, 12, 13, 19, 21, 37, 39, 42, 46, 47, 50, 52}; + const int realCount = 15; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "random_code_jkl" +} + +// Dummy password function 6 (DECOY) - Advanced Hex +std::string retrieveContent5() { + const unsigned char data[60] = { + 0x30, 0x41, 0x82, 0x3B, 0x9D, 0xDB, 0x16, 0xD6, 0x70, 0x6C, 0x27, 0x55, 0x3D, 0x22, 0x61, 0xB5, 0x64, 0xBC, 0x9A, 0xD6, 0x63, 0x65, 0x3F, 0xA8, 0x27, 0x34, 0xE9, 0x35, 0x34, 0x68, 0xBD, 0x30, 0xDF, 0x6F, 0xBC, 0xA1, 0x6C, 0xD3, 0x4C, 0x77, 0xDF, 0xB9, 0x64, 0x07, 0x65, 0xC9, 0x72, 0xB8, 0x91, 0x3D, 0x5F, 0x51, 0x37, 0xCD, 0xFA, 0x17, 0x38, 0xB7, 0x39, 0xFA + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {8, 9, 14, 20, 21, 29, 33, 36, 42, 44, 46, 50, 52, 56, 58}; + const int realCount = 15; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "placeholder_789" +} + +// Dummy password function 7 (DECOY) - Advanced Hex +std::string obtainBufferTheta() { + const unsigned char data[49] = { + 0x62, 0x52, 0x8D, 0x70, 0x59, 0x68, 0xD4, 0xE3, 0xAB, 0x6F, 0x67, 0x96, 0x75, 0x73, 0x90, 0xE0, 0xF4, 0xE4, 0xD8, 0xF0, 0x25, 0x3A, 0xC6, 0x5F, 0x50, 0x29, 0x26, 0xD3, 0x61, 0x75, 0xA5, 0x74, 0x49, 0x89, 0x76, 0x9F, 0xA7, 0xA8, 0xD3, 0x9B, 0x68, 0x5F, 0x79, 0x4D, 0x69, 0xA6, 0x7A, 0xF6, 0x5E + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {0, 9, 10, 12, 13, 23, 28, 29, 31, 40, 41, 42, 46}; + const int realCount = 13; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "bogus_auth_yz" +} + +// Dummy password function 8 (DECOY) - Advanced Hex +std::string readSegmentDelta() { + const unsigned char data[42] = { + 0x39, 0x6A, 0xD4, 0xB7, 0x64, 0x09, 0x83, 0x88, 0x75, 0xE5, 0x6D, 0xE0, 0xF7, 0x01, 0x6D, 0x8D, 0x4D, 0xF3, 0x79, 0x54, 0x5F, 0x30, 0x10, 0x4A, 0x0F, 0x6B, 0x70, 0x65, 0x11, 0x79, 0x94, 0x5F, 0x5F, 0x9D, 0x34, 0x35, 0xBF, 0x1D, 0x36, 0xBE, 0x08, 0xD7 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {4, 8, 10, 14, 18, 20, 25, 27, 29, 32, 34, 35, 38}; + const int realCount = 13; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "dummy_key_456" +} + +// Dummy password function 9 (DECOY) - Advanced Hex +std::string decodeCode1() { + const unsigned char data[53] = { + 0x6D, 0xBF, 0x27, 0x69, 0x49, 0x28, 0xA5, 0xAC, 0x73, 0x6C, 0x11, 0x02, 0xF4, 0x65, 0x17, 0xC8, 0x56, 0x61, 0x12, 0x64, 0x5F, 0x70, 0xB7, 0x54, 0x46, 0x7C, 0xBF, 0xC3, 0x3A, 0x52, 0x60, 0x61, 0x5E, 0x73, 0x73, 0x13, 0x5E, 0xDF, 0x70, 0x4B, 0x5F, 0x76, 0x41, 0xB9, 0xBA, 0x21, 0x59, 0xDE, 0xB5, 0x77, 0xB4, 0x78, 0x14 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {0, 3, 8, 9, 13, 17, 19, 20, 21, 31, 33, 34, 40, 41, 49, 51}; + const int realCount = 16; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "mislead_pass_vwx" +} + +// Dummy password function 10 (DECOY) - Advanced Hex +std::string pullSegmentOmega() { + const unsigned char data[50] = { + 0xC8, 0x05, 0x93, 0x0F, 0x41, 0xA5, 0x73, 0x61, 0x6D, 0x70, 0x10, 0x37, 0x6C, 0x65, 0x9B, 0x86, 0x4F, 0x5F, 0x18, 0x0C, 0x6F, 0x61, 0x6B, 0x75, 0xB3, 0x0E, 0x4B, 0x3F, 0x3E, 0x63, 0xAB, 0x83, 0x74, 0xF6, 0x80, 0x5E, 0x19, 0x22, 0x36, 0x68, 0x69, 0x43, 0x5F, 0x67, 0x41, 0x68, 0x69, 0x57, 0x9B, 0x61 + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {6, 7, 8, 9, 12, 13, 17, 21, 23, 32, 39, 42, 43, 45, 46}; + const int realCount = 15; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "sample_auth_ghi" +} + +// Main function to reconstruct password (FIXED NAME - only uses REAL functions) +std::string getPasswordSecureData() { + std::string password = ""; + + std::vector parts(10); + + // Only real password functions are called (Advanced Hex extraction) + parts[4] = parseValue5(); // Real part 5 + parts[2] = makeBufferAlpha(); // Real part 3 + parts[8] = obtainPartEpsilon(); // Real part 9 + parts[1] = formDataX(); // Real part 2 + parts[5] = decodeCodePrime(); // Real part 6 + parts[6] = configCodeC(); // Real part 7 + parts[9] = getSegmentEpsilon(); // Real part 10 + parts[3] = retrieveInfoLambda(); // Real part 4 + parts[0] = configContentC(); // Real part 1 + parts[7] = extractBufferX(); // Real part 8 + + // Reconstruct password in correct order + for (const auto& part : parts) { + password += part; + } + + return password; +} + +// Dummy password calls for obfuscation +void initializePasswordDummies() { + std::string dummyPwd1 = readPieceC(); // Dummy call + std::string dummyPwd2 = decodeCode1(); // Dummy call +} + +#endif // PASSWORD_FUNCTIONS_H diff --git a/keysAndroid.js b/keysAndroid.js index 4fc48348..21f3c9e5 100755 --- a/keysAndroid.js +++ b/keysAndroid.js @@ -5,11 +5,10 @@ const { getAndroidEnvironmentFile, generatePassword, encrypt, - makeCppFileTemplate, - splitPrivateKeyInto3ChunksOfArray, - makeFileInCPPDir, genTSType, + CPP_DIRECTORY_PATH } = require('./src/util/common'); +const { generateHeaderFile } = require('./src/util/generate-header') const { makeCryptographicModuleTemplateAndroid, } = require('./src/util/keysFilesTemplateAndroid'); @@ -21,9 +20,7 @@ const makeAndroidJnuFiles = () => { const stringifyKeys = JSON.stringify(secureKeys); const password = generatePassword(); const privateKey = encrypt(stringifyKeys, password); - const privateKeyIn3Chunks = splitPrivateKeyInto3ChunksOfArray(privateKey); - const cppFileContent = makeCppFileTemplate(privateKeyIn3Chunks, password); - const isDoneCryptoCppFile = makeFileInCPPDir(cppFileContent, 'crypto.cpp'); + generateHeaderFile(CPP_DIRECTORY_PATH, privateKey, password) const halfKey = privateKey.substr(privateKey.length / 2); const cryptographicModuleFileContent = @@ -34,7 +31,6 @@ const makeAndroidJnuFiles = () => { ); genTSType(allKeys); console.info('react-native-keys', { - isDoneCryptoCppFile, isDoneAddedPrivateKey, }); }; diff --git a/keysIOS.js b/keysIOS.js index 1d123e99..bd668ddd 100755 --- a/keysIOS.js +++ b/keysIOS.js @@ -2,18 +2,18 @@ const { getKeys, makeFileInIosDir, - makeFileInCPPDir, getIosEnvironmentFile, makeFileInProjectDirectoryIos, - splitPrivateKeyInto3ChunksOfArray, - makeCppFileTemplate, generatePassword, encrypt, genTSType, + CPP_DIRECTORY_PATH } = require('./src/util/common'); +const { generateHeaderFile } = require('./src/util/generate-header') + const { makePrivateKeyTemplateIOS, - makeXcConfigFIlle, + makeXcConfigFile, makeGeneratedDotEnvTemplateIOS, } = require('./src/util/keysFilesTemplateIos'); @@ -25,9 +25,7 @@ const makeIosJnuFiles = () => { const stringifyKeys = JSON.stringify(secureKeys); const password = generatePassword(); const privateKey = encrypt(stringifyKeys, password); - const privateKeyIn3Chunks = splitPrivateKeyInto3ChunksOfArray(privateKey); - const cppFileContent = makeCppFileTemplate(privateKeyIn3Chunks, password); - const isDoneCryptoCppFile = makeFileInCPPDir(cppFileContent, 'crypto.cpp'); + generateHeaderFile(CPP_DIRECTORY_PATH, privateKey, password) const halfKey = privateKey.substr(privateKey.length / 2); const generatedPrivateKeyContent = makePrivateKeyTemplateIOS({ @@ -38,7 +36,7 @@ const makeIosJnuFiles = () => { 'privateKey.m' ); - const xcConfigFileContent = makeXcConfigFIlle(publicKeys); + const xcConfigFileContent = makeXcConfigFile(publicKeys); const isDoneCreatedXCodeConfigFile = makeFileInProjectDirectoryIos( xcConfigFileContent, 'tmp.xcconfig' @@ -51,7 +49,6 @@ const makeIosJnuFiles = () => { ); genTSType(allKeys); console.info('react-native-keys', { - isDoneCryptoCppFile, isGeneratedPrivateKeyFile, isDoneCreatedXCodeConfigFile, isGeneratedDotEnvFile, diff --git a/src/util/common.js b/src/util/common.js index 97a9f822..c21a9f80 100644 --- a/src/util/common.js +++ b/src/util/common.js @@ -1,7 +1,6 @@ const fs = require('fs-extra'); const path = require('path'); const CryptoJS = require('crypto-js'); -const crypto = require('crypto') const isExample = process.env.IS_EXAMPLE === 'TRUE'; const DEFAULT_FILE_NAME = 'keys.development.json'; @@ -30,7 +29,7 @@ const IOS_DIR_PATH = path.join( isExample ? KEYS_IOS_EXAMPLE_PATH : KEYS_IOS_PATH ); -const CPP_DIRECTORY_PATH = path.join( +module.exports.CPP_DIRECTORY_PATH = path.join( PROJECT_ROOT_DIR_PATH, isExample ? '../' : RN_KEYS_PATH, 'cpp' @@ -88,15 +87,6 @@ module.exports.genTSType = (allKeys) => { fs.outputFileSync(path.join(SRC_PATH, 'type.ts'), result); }; -module.exports.makeFileInCPPDir = (fileContent, fileName) => { - try { - const iosCppFilePath = path.join(CPP_DIRECTORY_PATH, fileName); - fs.outputFileSync(iosCppFilePath, fileContent); - return true; - } catch (error) { - return false; - } -}; module.exports.makeFileInIosDir = (fileContent, fileName) => { try { @@ -169,56 +159,22 @@ module.exports.makeFileInAndroidMainAssetsFolder = (fileContent, fileName) => { } }; -module.exports.splitPrivateKeyInto3ChunksOfArray = (string) => { - var regex = RegExp('.{1,' + Math.ceil(string.length / 3) + '}', 'g'); - return string.match(regex); -}; - -module.exports.makeCppFileTemplate = (privateKeyIn3Chunks, password) => { - return ` - #include "crypto.h" - #include - #include "decryptor.h" - using namespace std; - Crypto::Crypto() { +module.exports.generatePassword = (length = 30) => { + const chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; + let password = ""; + for (let i = 0; i < length; i++) { + const randomBytes = CryptoJS.lib.WordArray.random(1); + const randomIndex = Math.abs(randomBytes.words[0]) % chars.length; + password += chars[randomIndex]; } - string Crypto::getJniJsonStringifyData(string key) { - std::string base64Secret1 = "${privateKeyIn3Chunks[0]}"; - std::string base64Secret2 = "${privateKeyIn3Chunks[1]}"; - std::string base64Secret3 = "${privateKeyIn3Chunks[2]}"; - std::string base64Secret = base64Secret1 + base64Secret2 + base64Secret3; - std::string password = "${password}"; - bool binary = false; - std::string plaintext = decryptor::dec(base64Secret, password,binary); - - string hash; - string halfString=base64Secret.substr(base64Secret.length()/2); - if(key==halfString) - { - return plaintext; - } - else - { - return ""; - } - } - `; + return password; }; -module.exports.generatePassword = () => { - var length = 12, - charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', - retVal = ''; - const bytes = crypto.randomBytes(length); - for (var i = 0; i < length; ++i) { - retVal += charset.charAt(bytes[i] % charset.length); - } - return retVal; -}; module.exports.encrypt = (message, password, _iv) => { const encrypted = CryptoJS.AES.encrypt(message, password, { iv: _iv, diff --git a/src/util/generate-header.js b/src/util/generate-header.js new file mode 100644 index 00000000..211c0afd --- /dev/null +++ b/src/util/generate-header.js @@ -0,0 +1,541 @@ +const CryptoJS = require("crypto-js"); +const fs = require("fs"); +const path = require("path"); + +const getSecureRandomIndex = (arrayLength) => { + const randomBytes = CryptoJS.lib.WordArray.random(1); + return Math.abs(randomBytes.words[0]) % arrayLength; +}; + +const generateRandomFunctionNameOptimized = (count = 10) => { + const prefixes = [ + "get", + "fetch", + "load", + "read", + "obtain", + "retrieve", + "extract", + "pull", + "grab", + "access", + "decode", + "parse", + "build", + "create", + "make", + "form", + "init", + "setup", + "config", + "process", + ]; + const middles = [ + "Data", + "Info", + "Value", + "Item", + "Element", + "Part", + "Segment", + "Block", + "Chunk", + "Piece", + "Key", + "Code", + "Token", + "String", + "Text", + "Content", + "Buffer", + "Stream", + "Node", + "Entry", + ]; + const suffixes = [ + "A", + "B", + "C", + "X", + "Y", + "Z", + "1", + "2", + "3", + "4", + "5", + "Alpha", + "Beta", + "Gamma", + "Delta", + "Epsilon", + "Zeta", + "Theta", + "Lambda", + "Sigma", + "Omega", + "Prime", + "Core", + "Base", + ]; + + const usedNames = new Set(); + const selectedNames = []; + + usedNames.add("getPasswordSecureData"); + usedNames.add("getEncryptedSecureData"); + + const maxPossible = prefixes.length * middles.length * suffixes.length; + + if (count > maxPossible) { + throw new Error( + `Cannot generate ${count} unique names. Maximum possible: ${maxPossible}` + ); + } + + let attempts = 0; + const maxAttempts = maxPossible * 2; + + while (selectedNames.length < count && attempts < maxAttempts) { + attempts++; + + const prefixIndex = getSecureRandomIndex(prefixes.length); + const middleIndex = getSecureRandomIndex(middles.length); + const suffixIndex = getSecureRandomIndex(suffixes.length); + + const prefix = prefixes[prefixIndex]; + const middle = middles[middleIndex]; + const suffix = suffixes[suffixIndex]; + const functionName = prefix + middle + suffix; + + if (!usedNames.has(functionName)) { + usedNames.add(functionName); + selectedNames.push(functionName); + } + } + + if (selectedNames.length < count) { + throw new Error( + `Could not generate ${count} unique names after ${attempts} attempts. Generated: ${selectedNames.length}` + ); + } + + return selectedNames; +}; + +const splitString = (str, parts = 10) => { + const stringParts = []; + const partLength = Math.ceil(str.length / parts); + + for (let i = 0; i < parts; i++) { + const start = i * partLength; + const end = Math.min(start + partLength, str.length); + stringParts.push(str.slice(start, end)); + } + + return stringParts; +}; + +const generateRandomHex = () => { + const randomBytes = CryptoJS.lib.WordArray.random(1); + return Math.abs(randomBytes.words[0]) % 256; +}; + +const obfuscateStringAdvancedHex = (str) => { + const minArraySize = Math.max(str.length * 3, 32); // Ít nhất 32 bytes hoặc 3x độ dài string + const arraySize = minArraySize + getSecureRandomIndex(17); // Random size trong range + + const hexArray = []; + for (let i = 0; i < arraySize; i++) { + hexArray.push(generateRandomHex()); + } + + const realIndices = []; + const usedIndices = new Set(); + + while (realIndices.length < str.length) { + const randomIndex = getSecureRandomIndex(arraySize); + if (!usedIndices.has(randomIndex)) { + usedIndices.add(randomIndex); + realIndices.push(randomIndex); + } + } + + realIndices.sort((a, b) => a - b); + + for (let i = 0; i < str.length; i++) { + hexArray[realIndices[i]] = str.charCodeAt(i); + } + + return { + hexArray: hexArray, + realIndices: realIndices, + arraySize: arraySize, + }; +}; + +const generateDummyPasswordData = () => { + const dummyStrings = [ + "fake_pwd_123", + "dummy_key_456", + "placeholder_789", + "mock_pass_abc", + "test_secret_def", + "sample_auth_ghi", + "random_code_jkl", + "noise_token_mno", + "decoy_cred_pqr", + "false_key_stu", + "mislead_pass_vwx", + "bogus_auth_yz", + ]; + + const randomIndex = getSecureRandomIndex(dummyStrings.length); + return dummyStrings[randomIndex]; +}; + +const generateDummyEncryptedData = () => { + const dummyEncrypted = [ + "U2FsdGVkX19fake1234567890abcdef", + "U2FsdGVkX18dummy567890abcdef123", + "U2FsdGVkX17test890abcdef123456", + "U2FsdGVkX16mock123456789abcdef", + "U2FsdGVkX15sample456789abcdef12", + "U2FsdGVkX14noise789abcdef123456", + "U2FsdGVkX13decoy123456789abcde", + "U2FsdGVkX12false456789abcdef123", + "U2FsdGVkX11fake789abcdef123456", + "U2FsdGVkX10dummy123456789abcde", + ]; + + const randomIndex = getSecureRandomIndex(dummyEncrypted.length); + return dummyEncrypted[randomIndex]; +}; + +const generateCppFiles = (password, encryptedMessage) => { + const passwordParts = splitString(password, 10); + const encryptedParts = splitString(encryptedMessage, 10); + const obfuscatedPasswordParts = []; + const obfuscatedEncryptedParts = []; + + const allFunctionNames = generateRandomFunctionNameOptimized(40); + + const realPasswordFunctionNames = allFunctionNames.slice(0, 10); + const dummyPasswordFunctionNames = allFunctionNames.slice(10, 20); + const realEncryptedFunctionNames = allFunctionNames.slice(20, 30); + const dummyEncryptedFunctionNames = allFunctionNames.slice(30, 40); + + const mainPasswordFunctionName = "getPasswordSecureData"; + const mainEncryptedFunctionName = "getEncryptedSecureData"; + + for (let i = 0; i < passwordParts.length; i++) { + const obfuscated = obfuscateStringAdvancedHex(passwordParts[i]); + obfuscatedPasswordParts.push(obfuscated); + } + + for (let i = 0; i < encryptedParts.length; i++) { + const obfuscated = obfuscateStringAdvancedHex(encryptedParts[i]); + obfuscatedEncryptedParts.push(obfuscated); + } + + // Generate PASSWORD HEADER FILE + let passwordHeader = `#ifndef PASSWORD_FUNCTIONS_H +#define PASSWORD_FUNCTIONS_H + +#include +#include + +// Auto-generated password functions with Advanced Hex obfuscation +// Generated at: ${new Date().toISOString()} +// Password functions: 10 real + 10 dummy + 1 main (FIXED NAME) +// Security: Advanced Hex with random indices and garbage bytes +// Main function: ${mainPasswordFunctionName} + +`; + + // Generate real password functions với Advanced Hex + for (let i = 0; i < realPasswordFunctionNames.length; i++) { + const obfuscated = obfuscatedPasswordParts[i]; + + passwordHeader += `// Password part ${i + 1} of ${ + realPasswordFunctionNames.length + } (REAL) - Advanced Hex +std::string ${realPasswordFunctionNames[i]}() { + const unsigned char data[${obfuscated.arraySize}] = { + ${obfuscated.hexArray + .map( + (byte) => `0x${byte.toString(16).padStart(2, "0").toUpperCase()}` + ) + .join(", ")} + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {${obfuscated.realIndices.join(", ")}}; + const int realCount = ${obfuscated.realIndices.length}; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +`; + } + + // Generate dummy password functions với Advanced Hex + for (let i = 0; i < dummyPasswordFunctionNames.length; i++) { + const dummyData = generateDummyPasswordData(); + const obfuscatedDummy = obfuscateStringAdvancedHex(dummyData); + + passwordHeader += `// Dummy password function ${ + i + 1 + } (DECOY) - Advanced Hex +std::string ${dummyPasswordFunctionNames[i]}() { + const unsigned char data[${obfuscatedDummy.arraySize}] = { + ${obfuscatedDummy.hexArray + .map( + (byte) => `0x${byte.toString(16).padStart(2, "0").toUpperCase()}` + ) + .join(", ")} + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {${obfuscatedDummy.realIndices.join(", ")}}; + const int realCount = ${obfuscatedDummy.realIndices.length}; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "${dummyData}" +} + +`; + } + + // Generate main password function + passwordHeader += `// Main function to reconstruct password (FIXED NAME - only uses REAL functions) +std::string ${mainPasswordFunctionName}() { + std::string password = ""; + +`; + + // Shuffle password indices + const passwordIndices = Array.from({ length: 10 }, (_, i) => i); + for (let i = passwordIndices.length - 1; i > 0; i--) { + const j = getSecureRandomIndex(i + 1); + [passwordIndices[i], passwordIndices[j]] = [ + passwordIndices[j], + passwordIndices[i], + ]; + } + + passwordHeader += ` std::vector parts(10); + + // Only real password functions are called (Advanced Hex extraction) +`; + + for (let i = 0; i < passwordIndices.length; i++) { + const realIndex = passwordIndices[i]; + passwordHeader += ` parts[${realIndex}] = ${ + realPasswordFunctionNames[realIndex] + }(); // Real part ${realIndex + 1} +`; + } + + passwordHeader += ` + // Reconstruct password in correct order + for (const auto& part : parts) { + password += part; + } + + return password; +} + +// Dummy password calls for obfuscation +void initializePasswordDummies() { +`; + + const selectedPasswordDummies = []; + for (let i = 0; i < 3; i++) { + const passwordIndex = getSecureRandomIndex( + dummyPasswordFunctionNames.length + ); + if (!selectedPasswordDummies.includes(passwordIndex)) { + selectedPasswordDummies.push(passwordIndex); + passwordHeader += ` std::string dummyPwd${i + 1} = ${ + dummyPasswordFunctionNames[passwordIndex] + }(); // Dummy call +`; + } + } + + passwordHeader += `} + +#endif // PASSWORD_FUNCTIONS_H +`; + + // Generate ENCRYPTED HEADER FILE + let encryptedHeader = `#ifndef ENCRYPTED_FUNCTIONS_H +#define ENCRYPTED_FUNCTIONS_H + +#include +#include + +// Auto-generated encrypted message functions with Advanced Hex obfuscation +// Generated at: ${new Date().toISOString()} +// Encrypted functions: 10 real + 10 dummy + 1 main (FIXED NAME) +// Security: Advanced Hex with random indices and garbage bytes +// Main function: ${mainEncryptedFunctionName} + +`; + + // Generate real encrypted functions với Advanced Hex + for (let i = 0; i < realEncryptedFunctionNames.length; i++) { + const obfuscated = obfuscatedEncryptedParts[i]; + + encryptedHeader += `// Encrypted part ${i + 1} of ${ + realEncryptedFunctionNames.length + } (REAL) - Advanced Hex +std::string ${realEncryptedFunctionNames[i]}() { + const unsigned char data[${obfuscated.arraySize}] = { + ${obfuscated.hexArray + .map( + (byte) => `0x${byte.toString(16).padStart(2, "0").toUpperCase()}` + ) + .join(", ")} + }; + + // Extract real data from specific indices (anti-linear pattern) + std::string result = ""; + const int realIndices[] = {${obfuscated.realIndices.join(", ")}}; + const int realCount = ${obfuscated.realIndices.length}; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; +} + +`; + } + + // Generate dummy encrypted functions với Advanced Hex + for (let i = 0; i < dummyEncryptedFunctionNames.length; i++) { + const dummyData = generateDummyEncryptedData(); + const obfuscatedDummy = obfuscateStringAdvancedHex(dummyData); + + encryptedHeader += `// Dummy encrypted function ${ + i + 1 + } (DECOY) - Advanced Hex +std::string ${dummyEncryptedFunctionNames[i]}() { + const unsigned char data[${obfuscatedDummy.arraySize}] = { + ${obfuscatedDummy.hexArray + .map( + (byte) => `0x${byte.toString(16).padStart(2, "0").toUpperCase()}` + ) + .join(", ")} + }; + + // Extract dummy data from specific indices + std::string result = ""; + const int realIndices[] = {${obfuscatedDummy.realIndices.join(", ")}}; + const int realCount = ${obfuscatedDummy.realIndices.length}; + + for (int i = 0; i < realCount; i++) { + result += static_cast(data[realIndices[i]]); + } + + return result; // Dummy: "${dummyData}" +} + +`; + } + + // Generate main encrypted function + encryptedHeader += `// Main function to reconstruct encrypted message (FIXED NAME - only uses REAL functions) +std::string ${mainEncryptedFunctionName}() { + std::string encrypted = ""; + +`; + + // Shuffle encrypted indices + const encryptedIndices = Array.from({ length: 10 }, (_, i) => i); + for (let i = encryptedIndices.length - 1; i > 0; i--) { + const j = getSecureRandomIndex(i + 1); + [encryptedIndices[i], encryptedIndices[j]] = [ + encryptedIndices[j], + encryptedIndices[i], + ]; + } + + encryptedHeader += ` std::vector parts(10); + + // Only real encrypted functions are called (Advanced Hex extraction) +`; + + for (let i = 0; i < encryptedIndices.length; i++) { + const realIndex = encryptedIndices[i]; + encryptedHeader += ` parts[${realIndex}] = ${ + realEncryptedFunctionNames[realIndex] + }(); // Real part ${realIndex + 1} +`; + } + + encryptedHeader += ` + // Reconstruct encrypted message in correct order + for (const auto& part : parts) { + encrypted += part; + } + + return encrypted; +} + +// Dummy encrypted calls for obfuscation +void initializeEncryptedDummies() { +`; + + const selectedEncryptedDummies = []; + for (let i = 0; i < 3; i++) { + const encryptedIndex = getSecureRandomIndex( + dummyEncryptedFunctionNames.length + ); + if (!selectedEncryptedDummies.includes(encryptedIndex)) { + selectedEncryptedDummies.push(encryptedIndex); + encryptedHeader += ` std::string dummyEnc${i + 1} = ${ + dummyEncryptedFunctionNames[encryptedIndex] + }(); // Dummy call +`; + } + } + + encryptedHeader += `} + +#endif // ENCRYPTED_FUNCTIONS_H +`; + + return { + passwordHeader: passwordHeader, + encryptedHeader: encryptedHeader, + }; +}; + +const generateHeaderFile = (prefixPath, cipherText, password) => { + const result = generateCppFiles(password, cipherText); + fs.writeFileSync( + path.join(prefixPath, "password_functions.h"), + result.passwordHeader + ); + fs.writeFileSync( + path.join(prefixPath, "encrypted_functions.h"), + result.encryptedHeader + ); +}; + +module.exports = { + generateHeaderFile, +}; diff --git a/src/util/keysFilesTemplateIos.js b/src/util/keysFilesTemplateIos.js index 275c8d2d..223ae551 100644 --- a/src/util/keysFilesTemplateIos.js +++ b/src/util/keysFilesTemplateIos.js @@ -1,4 +1,4 @@ -module.exports.makeXcConfigFIlle = (keys) => { +module.exports.makeXcConfigFile = (keys) => { try { let env_keys = []; for (let [key, value] of Object.entries(keys)) {