#include <stdio.h> #include <string.h> #include <stdlib.h> #define LOBYTE(x) (*((char*)&(x))) #define HIBYTE(x) (*((char*)&(x)+1)) int sub_258C(char* result, int a2, char* a3, char* a4, unsigned int a5, int a6) { char* v6; // r7 unsigned int v7; // r4 v6 = result; if ( a2 ) { v7 = 0; do { result = (*((unsigned char*)a4 + v7 % a5)) ^ (*((unsigned char*)a3 + v7) - a6); *(char *)(v6 + v7++) = result; } while ( a2 != v7 ); } return result; } char* sub_254C(char *result, int a2, unsigned char *a3, char* a4, int a5, char a6) { unsigned int v6; // r3 unsigned int v7; // t1 if ( a2 ) { v6 = a3[a2 - 1]; do { v7 = *a3++; --a2; *result++ = ((char)v7 << a6) | (v6 >> (8 - a6)); v6 = v7; } while ( a2 ); } return result; } int sub_239C(char *a1, int a2, char *a3, char* a4, unsigned int a5) { char *v5; // r11 char *v6; // r10 int v7; // r5 int v8; // r0 unsigned int v9; // r7 int v10; // r6 int v11; // r8 int result; // r0 int v13; // r1 char v14; // r1 int v15; // r1 int v16; // r0 char v17; // r2 char v18; // t1 char v19[256]; // [sp+8h] [bp-128h] short v20; // [sp+108h] [bp-28h] v5 = a1; v6 = a3; v7 = a2; v8 = 0; do { v19[v8] = v8; ++v8; } while ( v8 != 256 ); v9 = 0; v10 = 0; v20 = 0; do { v11 = (unsigned char)v19[v9]; result = *(unsigned char *)(a4 + v9 % a5) + v11; v13 = (unsigned char)(result + v10); v19[v9] = v19[v13]; v19[v13] = v11; ++v9; v10 += result; } while ( v9 != 256 ); if ( v7 ) { LOBYTE(result) = HIBYTE(v20); v14 = v20; do { LOBYTE(v15) = v14 + 1; --v7; LOBYTE(v20) = v15; v15 = (unsigned char)v15; LOBYTE(v16) = result + v19[(unsigned char)v15]; HIBYTE(v20) = v16; v16 = (unsigned char)v16; v17 = v19[(unsigned char)v15]; v19[v15] = v19[(unsigned char)v16]; v19[v16] = v17; v14 = v20; result = HIBYTE(v20); v18 = *v6++; *v5++ = v19[(unsigned char)(v19[HIBYTE(v20)] + v19[(unsigned char)v20])] ^ v18; } while ( v7 ); } return result; } int sub_24F4(char* result, int a2, unsigned char* a3, unsigned char* a4, unsigned int a5, int a6) { char* v6; // r7 unsigned int v7; // r4 v6 = result; if ( a2 ) { v7 = 0; do { result = (*(unsigned char*)(a3 + v7) ^ a6) - *(unsigned char *)(a4 + v7 % a5); *(char* *)(v6 + v7++) = result; } while ( a2 != v7 ); } return result; } int main() { unsigned char unk_44FC[1] = {0x00}; char unk_62D7[128] = {0}; unsigned char unk_4509[7] = {0x58,0x71,0x10,0x7E,0x63,0x8D,0x00}; sub_24F4(unk_62D7, 6, unk_4509, "9HbB", 4u, 197); printf("v0:%s\n",(char*)unk_62D7); char unk_62EF[128]; unsigned char unk_448B[8] = {0x01,0x49,0x34,0x72,0x03,0x4E,0xB8,0x00}; unsigned char unk_4488[3] = {0x6D,0x37,0x00}; sub_24F4(unk_62EF, 7, unk_448B, unk_4488, 2u, 213); printf("dword_6294:%s\n",(char*)unk_62EF); char unk_630C[128] = {0}; unsigned char unk_44F3[9] = {0xE6,0xCF,0xCF,0x89,0xBB,0x16,0x65,0x71,0x00}; sub_239C(unk_630C, 8, unk_44F3, "LNAt", 4u); printf("dword_6298:%s\n",(char*)unk_630C); char unk_62DD[128] ={0}; unsigned char unk_44AC[7] = {0x30,0xB4,0x7D,0x77,0x9C,0xA5,0x00}; sub_239C(unk_62DD, 6, unk_44AC, "cOXt", 4u); printf("dword_629C:%s\n",(char*)unk_62DD); char unk_62E3[128]; unsigned char unk_4481[7] = {0xA9,0xB5,0xB8,0xB7,0xC1,0x55,0x00}; sub_24F4(unk_62E3, 6, unk_4481, "BMT", 3u, 1); printf("dword_62A0 :%s\n",(char*)unk_62E3); char unk_62F6[128] ={0}; unsigned char unk_44C4[8] = {0x45,0xEB,0x5A,0x11,0x75,0x7E,0x4E,0x00}; unsigned char unk_44C1[3] = {0x47,0x21,0x00}; sub_239C(unk_62F6, 7, unk_44C4, unk_44C1,2u); printf("dword_62A4:%s\n",(char*)unk_62F6); char unk_62FD[128]; unsigned char unk_44CC[8] = {0xB9,0xB9,0xB1,0x30,0x37,0x33,0x80,0x00}; sub_254C(unk_62FD, 7, unk_44CC, unk_44FC, 0, 1); printf("dword_62A8:%s\n",(char*)unk_62FD); char unk_62CC[128]; unsigned char unk_44A1[6] = {0xB5,0x34,0x36,0x36,0x80,0x00}; sub_254C(unk_62CC, 5, unk_44A1, unk_44FC, 0, 1); printf("dword_62AC:%s\n",(char*)unk_62CC); unsigned char unk_44FD[7] = {0x39,0xB6,0xB2,0x32,0x38,0x80,0x00}; char unk_62E9[128]; sub_254C(unk_62E9, 6, unk_44FD, unk_44FC, 0, 1); printf("dword_62B0:%s\n",(char*)unk_62E9); char unk_633A[128]; sub_258C(unk_633A, 15, "3:*8(-&\x1B\"@%%7)B", "BMAE", 4u, 1); printf("dword_62B4:%s\n",(char*)unk_633A); char unk_631C[128]; unsigned char unk_44E4[10] = {0x23,0x18,0xCA,0x21,0x14,0xDF,0x1D,0x14,0x3C,0x00}; unsigned char unk_44E0[4] = {0x37,0x3F,0x73,0x00}; sub_258C(unk_631C, 9, unk_44E4, unk_44E0, 3u, 201); printf("dword_62B8:%s\n",(char*)unk_631C); char unk_632F[128]; unsigned char unk_44D4[12] = {0xB1,0xB0,0x31,0xB4,0x32,0x33,0xB6,0xBA,0x39,0x34,0x80,0x00}; sub_254C(unk_632F, 11, unk_44D4, unk_44FC, 0, 1); printf("dword_62BC:%s\n",(char*)unk_632F); char unk_6314[128]; unsigned char unk_44B8[9] = {0xFD,0xFF,0xC1,0xDA,0x05,0xBD,0x1A,0x2C,0x00}; sub_258C(unk_6314, 8, unk_44B8, ".6gq", 4u, 187); printf("dword_62C0:%s\n",(char*)unk_6314); return 0; }