Skip to content

Instantly share code, notes, and snippets.

@cra0kalo
Created September 11, 2015 15:40
Show Gist options
  • Save cra0kalo/5182b010a552c94c266b to your computer and use it in GitHub Desktop.
Save cra0kalo/5182b010a552c94c266b to your computer and use it in GitHub Desktop.
CSGO Decrypt Overwatch
char __thiscall sub_104E1A10(int this, const char *a2, int a3, int a4)
{
int v4; // eax@1
int v5; // edx@2
int v6; // ecx@2
int v7; // eax@5
void *v8; // esp@8
signed int v9; // esi@9
unsigned __int32 v10; // eax@11
int v11; // esi@11
int v12; // esi@13
int v13; // ecx@13
int v14; // eax@15
int v15; // ecx@16
int v16; // ecx@16
unsigned int v17; // eax@16
unsigned int v18; // edx@16
char result; // al@17
unsigned int v20; // ecx@18
int v21; // eax@20
int v22; // [sp-10h] [bp-1E4h]@8
int v23; // [sp-Ch] [bp-1E0h]@8
int v24; // [sp-8h] [bp-1DCh]@5
char *v25; // [sp-4h] [bp-1D8h]@5
char v26; // [sp+8h] [bp-1CCh]@5
char key; // [sp+Dh] [bp-1C7h]@5
int v28; // [sp+110h] [bp-C4h]@10
unsigned int v29; // [sp+118h] [bp-BCh]@9
char v30; // [sp+11Ch] [bp-B8h]@12
char v31; // [sp+198h] [bp-3Ch]@12
int v32; // [sp+1A0h] [bp-34h]@13
int v33; // [sp+1A4h] [bp-30h]@14
int v34; // [sp+1A8h] [bp-2Ch]@15
char v35; // [sp+1B8h] [bp-1Ch]@8
char ice; // [sp+1C0h] [bp-14h]@8
int v37; // [sp+1CCh] [bp-8h]@1
int v38; // [sp+1E0h] [bp+Ch]@11
v4 = *(_DWORD *)(this + 4);
v37 = this;
if ( !v4 )
goto LABEL_28;
v5 = *(_DWORD *)(v4 + 8);
v6 = *(_DWORD *)(v4 + 12);
if ( !*(_QWORD *)(v4 + 8) || !a4 || *(_DWORD *)(a4 + 8) != 128 )
goto LABEL_28;
v25 = *(char **)(v4 + 12);
v24 = v5;
sub_101BAC10((int)&v26, "%016llX", v5, v6);
v7 = strcmp(&key, a2);
if ( v7 )
v7 = -(v7 < 0) | 1;
if ( !v7 )
{
IceKey::IceKey(&ice, 2);
IceKey::set((int)&ice, (int)&key);
v8 = alloca(16);
_mm_storel_epi64((__m128i *)&v22, 0i64);
LOBYTE(v24) = 0;
v25 = *(char **)(*(int (__stdcall **)(char *, int, int, int, char *))(*(_DWORD *)dword_14A4D850 + 8))(
&v35,
v22,
v23,
v24,
v25);
sub_106CA8A0((int)&v22, 9, "OVRWTCH1%08X");
if ( sub_106C9D70(8) )
goto LABEL_29;
LOBYTE(v29) = 0;
memset((char *)&v29 + 1, 0, 0x7Fu);
v9 = 1;
do
{
sub_10659710(&ice, v9 * 8 + a3, (int)((char *)&v28 + v9 * 8));// IceKey::decrypt
++v9;
}
while ( v9 < 15 );
v10 = _byteswap_ulong(v29);
v11 = v10 - 4;
v38 = v10 - 4;
if ( v10 - 4 > 0x78 )
{
LABEL_29:
sub_106594E0((int)&ice);
result = 0;
}
else
{
sub_1013C6B0(&v31);
if ( (unsigned __int8)sub_1077CDF0(&v30, v11)
&& (v12 = v37, v13 = *(_DWORD *)(v37 + 4), v32 == *(_DWORD *)(v13 + 8))
&& v33 == *(_DWORD *)(v13 + 12)
&& (v25 = &v35, v14 = (*(int (__stdcall **)(char *))(*(_DWORD *)dword_14A4D850 + 8))(&v35),
v34 == *(_DWORD *)v14) )
{
*(_DWORD *)(a4 + 8) = 8 * ((unsigned int)(v38 + 11) >> 3) + 8;
v15 = *(_DWORD *)(v12 + 4);
*(_DWORD *)a4 = *(_DWORD *)(v15 + 8);
*(_DWORD *)(a4 + 4) = *(_DWORD *)(v15 + 12);
*(_DWORD *)(a4 + 12) = *(_DWORD *)(*(_DWORD *)(v12 + 4) + 32);
*(_BYTE *)(a4 + 16) = 1;
v16 = *(_DWORD *)(v12 + 4);
v17 = *(_DWORD *)(v16 + 40);
v18 = *(_DWORD *)(v16 + 44);
if ( v17 > v18 )
{
v20 = *(_DWORD *)(v16 + 36);
if ( v20 )
{
v21 = v17 - v18;
if ( v20 < v21 )
{
*(_DWORD *)(a4 + 20) = v20;
*(_DWORD *)(a4 + 24) = v20 + *(_DWORD *)(*(_DWORD *)(v12 + 4) + 44);
sub_1013C730(&v31);
sub_106594E0((int)&ice);
result = 1;
}
else
{
*(_DWORD *)(a4 + 20) = v21;
*(_DWORD *)(a4 + 24) = -1;
sub_1013C730(&v31);
sub_106594E0((int)&ice);
result = 1;
}
}
else
{
*(_DWORD *)(a4 + 20) = 0;
*(_DWORD *)(a4 + 24) = *(_DWORD *)(*(_DWORD *)(v12 + 4) + 44);
sub_1013C730(&v31);
sub_106594E0((int)&ice);
result = 1;
}
}
else
{
*(_DWORD *)(a4 + 20) = 0;
*(_DWORD *)(a4 + 24) = -1;
sub_1013C730(&v31);
sub_106594E0((int)&ice);
result = 1;
}
}
else
{
sub_1013C730(&v31);
sub_106594E0((int)&ice);
result = 0;
}
}
}
else
{
LABEL_28:
result = 0;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment