|
|
|
void detect_client_and_set_flag |
|
(int bitfield,uint clientmod_id,undefined4 js_context,HeapStr *strs,int totalStrs) |
|
|
|
{ |
|
bool bVar1; |
|
uint size; |
|
uint key_0; |
|
int iVar2; |
|
int remaining; |
|
byte *pbVar3; |
|
uint uVar4; |
|
uint status_value; |
|
uint local_14; |
|
astruct decoded_str; |
|
uint key; |
|
|
|
/* 24 for BD */ |
|
remaining = totalStrs << 3; |
|
do { |
|
if (remaining == 0) { |
|
/* 2 for BD */ |
|
pbVar3 = (byte *)(bitfield + (clientmod_id >> 3)); |
|
uVar4 = (clientmod_id ^ 0xffffffff) & 7; |
|
*pbVar3 = *pbVar3 & ((byte)(-2 << uVar4) | (byte)(0xfffffffe >> 0x20 - uVar4)); |
|
return; |
|
} |
|
decode_hex_xor73(&decoded_str,strs->ptr,strs->len); |
|
size = decoded_str.size; |
|
key_0 = new_string(decoded_str.size,decoded_str.dest_0); |
|
key = key_0; |
|
js_get_property_checked(&status_value,js_context,&key); |
|
uVar4 = local_14; |
|
if ((status_value & 1) == 0) { |
|
iVar2 = isUndefined(local_14); |
|
bVar1 = iVar2 == 1; |
|
} |
|
else { |
|
bVar1 = true; |
|
} |
|
if (0x83 < uVar4) { |
|
drop_js_handle(uVar4); |
|
} |
|
if (0x83 < key_0) { |
|
drop_js_handle(key_0); |
|
} |
|
if (decoded_str.dest != 0) { |
|
dlmalloc::validate_size(size,decoded_str.dest,1); |
|
} |
|
strs = strs + 1; |
|
remaining = remaining + -8; |
|
} while (bVar1); |
|
pbVar3 = (byte *)(bitfield + (clientmod_id >> 3)); |
|
*pbVar3 = *pbVar3 | (byte)(1 << ((clientmod_id ^ 0xffffffff) & 7)); |
|
return; |
|
} |
|
|
|
|
|
uint export::generateLaunchSignature(undefined4 globalVar) |
|
|
|
{ |
|
uint uVar1; |
|
ulonglong uVar2; |
|
ulonglong uVar3; |
|
uint uVar4; |
|
uint finalUuid; |
|
uint someMem; |
|
int iVar5; |
|
undefined8 local_b8; |
|
undefined1 local_b0; |
|
undefined1 local_af; |
|
undefined1 local_ae; |
|
undefined1 local_ad; |
|
undefined1 local_ac; |
|
undefined1 uStack_ab; |
|
undefined1 uStack_aa; |
|
undefined1 uStack_a9; |
|
undefined1 local_a8; |
|
undefined1 uStack_a7; |
|
undefined1 uStack_a6; |
|
undefined1 uStack_a5; |
|
undefined4 local_a4; |
|
undefined8 random_values; |
|
undefined8 local_98; |
|
uint local_88; |
|
uint local_84; |
|
uint local_80; |
|
uint local_7c; |
|
uint jsContext; |
|
ulonglong bitfield; |
|
ulonglong local_68; |
|
byte jqueryStr2; |
|
byte local_5f; |
|
byte local_5e; |
|
byte local_5d; |
|
byte local_5c; |
|
byte local_5b; |
|
byte local_5a; |
|
byte local_59; |
|
byte local_58; |
|
byte local_57; |
|
byte local_56; |
|
byte local_55; |
|
byte local_54; |
|
byte local_53; |
|
byte local_52; |
|
byte local_51; |
|
astruct jqueryStr; |
|
astruct dollarStr; |
|
astruct *targetStrLen; |
|
undefined *targeStrRaw; |
|
undefined8 local_2c; |
|
uint local_24; |
|
uint local_20; |
|
astruct fnStr [2]; |
|
|
|
someMem = unnamed_function_210(); |
|
*(undefined4 *)((ulonglong)someMem * 4 + 0x100000000) = globalVar; |
|
local_98 = 0; |
|
random_values = 0; |
|
jsContext = someMem; |
|
import::./libdiscore_wasm_bg.js::__wbg_getRandomValues_38097e921c2494c3(&random_values,0x10); |
|
uVar1 = DAT_ram_0012c014._4_4_; |
|
/* previous state */ |
|
iVar5 = (int)DAT_ram_0012c014; |
|
DAT_ram_0012c014 = 0; |
|
if (iVar5 == 1) { |
|
if (0x83 < uVar1) { |
|
drop_js_handle(uVar1); |
|
} |
|
local_a4 = &PTR_s_/root/.cargo/registry/src/index._ram_001016ef_ram_00103530; |
|
local_a8 = 0x28; |
|
uStack_a7 = 0; |
|
uStack_a6 = 0; |
|
uStack_a5 = 0; |
|
local_ac = 8; |
|
uStack_ab = 0x35; |
|
uStack_aa = 0x10; |
|
uStack_a9 = 0; |
|
local_b8 = 0x2800103508; |
|
unnamed_function_380 |
|
(&local_b8,&DAT_ram_0012964c, |
|
&PTR_s_/root/.cargo/registry/src/index._ram_001016ef_ram_00103530,1,0); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
local_68 = random_values << 0x38 | (random_values & 0xff00) << 0x28 | |
|
(random_values & 0xff0000) << 0x18 | (random_values & 0xff000000) << 8 | |
|
random_values >> 8 & 0xff000000 | random_values >> 0x18 & 0xff0000 | |
|
random_values >> 0x28 & 0xff00 | |
|
(random_values & 0x3f00000000000000 | 0x8000000000000000) >> 0x38; |
|
bitfield = local_98 << 0x38 | (local_98 & 0xf00 | 0x4000) << 0x28 | |
|
(local_98 & 0xff0000) << 0x18 | (local_98 & 0xff000000) << 8 | |
|
local_98 >> 8 & 0xff000000 | local_98 >> 0x18 & 0xff0000 | |
|
local_98 >> 0x28 & 0xff00 | local_98 >> 0x38; |
|
decode_hex_xor73(&jqueryStr,jquery_hex_obf,0xc); |
|
decode_hex_xor73(&dollarStr,dollar_hex_ofb,2); |
|
decode_hex_xor73(fnStr,fn_hex_obf,4); |
|
decode_hex_xor73((astruct *)&jqueryStr2,jquery_hex_obf_2,0xc); |
|
local_20 = _local_58; |
|
uVar1 = _local_5c; |
|
local_24 = _local_5c; |
|
uVar4 = fnStr[0].size; |
|
local_2c = CONCAT44(fnStr[0].dest_0,fnStr[0].size); |
|
targeStrRaw = (undefined *)jqueryStr.dest_0; |
|
targetStrLen = (astruct *)jqueryStr.size; |
|
unnamed_function_308(&local_80,someMem,&targetStrLen); |
|
if ((local_80 & 1) == 0) { |
|
code_r0x80064b52: |
|
finalUuid = dollarStr.size; |
|
local_20 = _local_58; |
|
local_24 = uVar1; |
|
local_2c = CONCAT44(fnStr[0].dest_0,uVar4); |
|
targeStrRaw = (undefined *)dollarStr.dest_0; |
|
targetStrLen = (astruct *)dollarStr.size; |
|
unnamed_function_308(&local_88,someMem,&targetStrLen); |
|
if ((local_88 & 1) != 0) { |
|
iVar5 = unnamed_function_1028(local_84); |
|
if ((iVar5 != 1) && (iVar5 = isUndefined(local_84), iVar5 != 1)) { |
|
if (0x83 < local_84) { |
|
drop_js_handle(local_84); |
|
} |
|
goto code_r0x80064c44; |
|
} |
|
if (0x83 < local_84) { |
|
drop_js_handle(local_84); |
|
} |
|
} |
|
if (_jqueryStr2 != 0) { |
|
dlmalloc::validate_size(uVar1,_jqueryStr2,1); |
|
} |
|
if (fnStr[0].dest != 0) { |
|
dlmalloc::validate_size(uVar4,fnStr[0].dest,1); |
|
} |
|
if (dollarStr.dest != 0) { |
|
dlmalloc::validate_size(finalUuid,dollarStr.dest,1); |
|
} |
|
if (jqueryStr.dest != 0) { |
|
dlmalloc::validate_size(jqueryStr.size,jqueryStr.dest,1); |
|
} |
|
bitfield = bitfield & 0xffffffffffff7fff; |
|
} |
|
else { |
|
iVar5 = unnamed_function_1028(local_7c); |
|
if ((iVar5 == 1) || (iVar5 = isUndefined(local_7c), iVar5 == 1)) { |
|
if (0x83 < local_7c) { |
|
drop_js_handle(local_7c); |
|
} |
|
goto code_r0x80064b52; |
|
} |
|
if (0x83 < local_7c) { |
|
drop_js_handle(local_7c); |
|
} |
|
code_r0x80064c44: |
|
if (_jqueryStr2 != 0) { |
|
dlmalloc::validate_size(uVar1,_jqueryStr2,1); |
|
} |
|
if (fnStr[0].dest != 0) { |
|
dlmalloc::validate_size(uVar4,fnStr[0].dest,1); |
|
} |
|
if (dollarStr.dest != 0) { |
|
dlmalloc::validate_size(dollarStr.size,dollarStr.dest,1); |
|
} |
|
if (jqueryStr.dest != 0) { |
|
dlmalloc::validate_size(jqueryStr.size,jqueryStr.dest,1); |
|
} |
|
bitfield = bitfield | 0x8000; |
|
} |
|
detect_client_and_set_flag(&bitfield,0b00010011,&jsContext,BetterDiscordStrs,3); |
|
detect_client_and_set_flag(&bitfield,0b00011011,&jsContext,RamboxStrs,1); |
|
detect_client_and_set_flag(&bitfield,0b00100100,&jsContext,RevengeStrs,4); |
|
detect_client_and_set_flag(&bitfield,0b00101011,&jsContext,VencordStrs,4); |
|
detect_client_and_set_flag(&bitfield,0b00110100,&jsContext,RepluggedStrs,2); |
|
detect_client_and_set_flag(&bitfield,0b01000010,&jsContext,LegcordStrs,2); |
|
detect_client_and_set_flag(&bitfield,0b01001000,&jsContext,DorionStrs,3); |
|
detect_client_and_set_flag(&bitfield,0b01001111,&jsContext,GCDPStrs,1); |
|
detect_client_and_set_flag(&bitfield,0b01011001,&jsContext,OpenasarStrs,1); |
|
detect_client_and_set_flag(&bitfield,0b01100111,&jsContext,ShelterStrs,1); |
|
detect_client_and_set_flag(&bitfield,0b01110100,&jsContext,MoonlightStrs,2); |
|
_local_58 = local_68; |
|
uVar3 = _local_58; |
|
_jqueryStr2 = bitfield; |
|
uVar2 = _jqueryStr2; |
|
fnStr[0].dest_0 = 0; |
|
fnStr[0].dest = 0; |
|
fnStr[0].size = 1; |
|
targeStrRaw = &DAT_ram_00102a54; |
|
local_2c = 0x60000020; |
|
targetStrLen = fnStr; |
|
local_ac = 0x2d; |
|
uStack_a7 = 0x2d; |
|
jqueryStr2 = (byte)bitfield; |
|
local_b8._0_5_ = CONCAT14((&DAT_ram_001034e8)[jqueryStr2 >> 4],(undefined4)local_b8); |
|
local_5f = (byte)(bitfield >> 8); |
|
local_b8 = CONCAT17((&DAT_ram_001034e8)[local_5f & 0xf], |
|
CONCAT16((&DAT_ram_001034e8)[local_5f >> 4], |
|
CONCAT15((&DAT_ram_001034e8)[jqueryStr2 & 0xf],(undefined5)local_b8)) |
|
); |
|
local_5e = (byte)(bitfield >> 0x10); |
|
local_af = (&DAT_ram_001034e8)[local_5e & 0xf]; |
|
local_b0 = (&DAT_ram_001034e8)[local_5e >> 4]; |
|
local_5d = (byte)(bitfield >> 0x18); |
|
local_ad = (&DAT_ram_001034e8)[local_5d & 0xf]; |
|
local_ae = (&DAT_ram_001034e8)[local_5d >> 4]; |
|
local_5c = (byte)(bitfield >> 0x20); |
|
uStack_aa = (&DAT_ram_001034e8)[local_5c & 0xf]; |
|
uStack_ab = (&DAT_ram_001034e8)[local_5c >> 4]; |
|
local_5b = (byte)(bitfield >> 0x28); |
|
local_a8 = (&DAT_ram_001034e8)[local_5b & 0xf]; |
|
uStack_a9 = (&DAT_ram_001034e8)[local_5b >> 4]; |
|
local_5a = (byte)(bitfield >> 0x30); |
|
uStack_a6 = (&DAT_ram_001034e8)[local_5a >> 4]; |
|
uStack_a5 = (&DAT_ram_001034e8)[local_5a & 0xf]; |
|
local_59 = (byte)(bitfield >> 0x38); |
|
local_a4 = (undefined **) |
|
CONCAT22(0x2d,CONCAT11((&DAT_ram_001034e8)[local_59 & 0xf], |
|
(&DAT_ram_001034e8)[local_59 >> 4])); |
|
local_58 = (byte)local_68; |
|
local_a4 = (undefined **)CONCAT13((&DAT_ram_001034e8)[local_58 >> 4],(undefined3)local_a4); |
|
local_57 = (byte)(local_68 >> 8); |
|
random_values._0_3_ = |
|
CONCAT12((&DAT_ram_001034e8)[local_57 & 0xf], |
|
CONCAT11((&DAT_ram_001034e8)[local_57 >> 4],(&DAT_ram_001034e8)[local_58 & 0xf])); |
|
local_56 = (byte)(local_68 >> 0x10); |
|
random_values._0_5_ = |
|
CONCAT14((&DAT_ram_001034e8)[local_56 >> 4],CONCAT13(0x2d,(undefined3)random_values)); |
|
local_55 = (byte)(local_68 >> 0x18); |
|
random_values = |
|
CONCAT17((&DAT_ram_001034e8)[local_55 & 0xf], |
|
CONCAT16((&DAT_ram_001034e8)[local_55 >> 4], |
|
CONCAT15((&DAT_ram_001034e8)[local_56 & 0xf],(undefined5)random_values))); |
|
local_54 = (byte)(local_68 >> 0x20); |
|
local_53 = (byte)(local_68 >> 0x28); |
|
local_52 = (byte)(local_68 >> 0x30); |
|
local_51 = (byte)(local_68 >> 0x38); |
|
local_98 = CONCAT17((&DAT_ram_001034e8)[local_51 & 0xf], |
|
CONCAT16((&DAT_ram_001034e8)[local_51 >> 4], |
|
CONCAT15((&DAT_ram_001034e8)[local_52 & 0xf], |
|
CONCAT14((&DAT_ram_001034e8)[local_52 >> 4], |
|
CONCAT13((&DAT_ram_001034e8)[local_53 & 0xf], |
|
CONCAT12((&DAT_ram_001034e8) |
|
[local_53 >> 4], |
|
CONCAT11((&DAT_ram_001034e8) |
|
[local_54 & 0xf], |
|
(&DAT_ram_001034e8) |
|
[local_54 >> 4]))))))); |
|
_jqueryStr2 = uVar2; |
|
_local_58 = uVar3; |
|
iVar5 = unnamed_function_864(&targetStrLen,(int)&local_b8 + 4,0x24); |
|
uVar1 = fnStr[0].dest_0; |
|
if (iVar5 != 0) { |
|
unnamed_function_524 |
|
(s_a_Display_implementation_returne_ram_00102a7c,0x37,&dollarStr,&DAT_ram_00102a6c, |
|
&PTR_s_/nix/store/lmp2ykgvp9m441iwxcjs8_ram_00101741_ram_00102ab4); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
finalUuid = fnStr[0].size; |
|
uVar4 = fnStr[0].dest; |
|
if (0x83 < someMem) { |
|
drop_js_handle(someMem); |
|
} |
|
if (uVar1 < uVar4) { |
|
if (uVar1 == 0) { |
|
dlmalloc::validate_size(finalUuid,uVar4,1); |
|
finalUuid = 1; |
|
} |
|
else { |
|
finalUuid = dlmalloc::realloc(finalUuid,uVar4,1,uVar1); |
|
if (finalUuid == 0) { |
|
panic_capacity_overflow(1,uVar1); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
} |
|
} |
|
return finalUuid; |
|
} |
|
|
|
|
|
void decode_hex_xor73(astruct *ret_data,int hex_str,uint hex_str_len) |
|
|
|
{ |
|
int iVar1; |
|
undefined2 uVar2; |
|
undefined1 uVar3; |
|
uint size; |
|
uint uVar4; |
|
byte *pbVar5; |
|
uint uVar6; |
|
uint uVar7; |
|
uint uVar8; |
|
int local_4c; |
|
uint local_48; |
|
uint local_44; |
|
int local_40; |
|
uint local_3c; |
|
undefined8 local_38; |
|
int local_30; |
|
uint local_2c; |
|
int local_24; |
|
uint local_18; |
|
int local_14; |
|
uint local_10; |
|
uint local_c; |
|
int str_0; |
|
uint dst_0; |
|
uint dst; |
|
int src; |
|
|
|
dst = 0; |
|
local_4c = 1; |
|
if ((hex_str_len & 1) == 0) { |
|
size = hex_str_len >> 1; |
|
if ((hex_str_len != 0) && (local_4c = unnamed_function_955(size,1), local_4c == 0)) { |
|
panic_capacity_overflow(1,size); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
local_10 = 0; |
|
local_18 = size; |
|
uVar4 = 0; |
|
for (; local_14 = local_4c, hex_str_len != size; size = size + 1) { |
|
if (uVar4 + 1 < hex_str_len) { |
|
if (hex_str_len < uVar4 + 2) { |
|
assert_fail(uVar4,uVar4 + 2,hex_str_len, |
|
&PTR_s_wasm/src/launch_signature.rs_ram_00101889_ram_00102788); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
uVar8 = (uint)(*(char *)(hex_str + uVar4) == '+'); |
|
pbVar5 = (byte *)(hex_str + uVar4 + uVar8); |
|
uVar6 = (uint)*pbVar5; |
|
uVar7 = (uVar6 - 0x41 & 0xffffffdf) + 10; |
|
if (uVar6 < 0x3a) { |
|
uVar7 = uVar6 - 0x30; |
|
} |
|
if (uVar7 < 0x10) { |
|
if (uVar8 == 0) { |
|
uVar8 = (uint)pbVar5[1]; |
|
uVar6 = (uVar8 - 0x41 & 0xffffffdf) + 10; |
|
if (uVar8 < 0x3a) { |
|
uVar6 = uVar8 - 0x30; |
|
} |
|
if (0xf < uVar6) goto code_r0x8004190e; |
|
uVar7 = uVar7 << 4 | uVar6; |
|
} |
|
if (local_18 == dst) { |
|
unnamed_function_502(&local_18); |
|
} |
|
*(byte *)(local_14 + dst) = (byte)uVar7 ^ 0x73; |
|
dst = dst + 1; |
|
local_10 = dst; |
|
} |
|
} |
|
code_r0x8004190e: |
|
uVar4 = uVar4 + 2; |
|
local_4c = local_14; |
|
} |
|
uVar4 = 0; |
|
local_48 = dst; |
|
unnamed_function_217(&local_30,&local_4c); |
|
size = local_2c; |
|
src = local_30; |
|
uVar7 = local_3c; |
|
if (local_30 == 0) { |
|
dst_0 = 0; |
|
local_c = 0x80000000; |
|
str_0 = 1; |
|
} |
|
else if (local_24 == 0) { |
|
dst_0 = local_2c; |
|
local_c = 0x80000000; |
|
str_0 = local_30; |
|
} |
|
else { |
|
if (dst == 0) { |
|
local_40 = 1; |
|
} |
|
else { |
|
local_40 = unnamed_function_955(dst,1); |
|
if (local_40 == 0) { |
|
panic_capacity_overflow(1,dst); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
} |
|
local_3c = 0; |
|
local_44 = dst; |
|
if (dst < size) { |
|
unnamed_function_449(&local_44,0,size); |
|
uVar4 = local_3c; |
|
} |
|
if (size != 0) { |
|
memory_copy(0,0,size,src,local_40 + uVar4); |
|
} |
|
local_3c = size + uVar4; |
|
if (local_44 - local_3c < 3) { |
|
unnamed_function_449(&local_44,local_3c,3); |
|
} |
|
uVar2 = DAT_ram_0012a3ec; |
|
*(undefined2 *)(local_3c + local_40) = DAT_ram_0012a3ec; |
|
uVar3 = DAT_ram_0012a3ee; |
|
*(undefined1 *)((undefined2 *)(local_3c + local_40) + 1) = DAT_ram_0012a3ee; |
|
size = local_3c + 3; |
|
local_38 = CONCAT44(local_48,local_4c); |
|
local_3c = size; |
|
unnamed_function_217(&local_30,&local_38); |
|
dst_0 = local_3c; |
|
src = local_30; |
|
dst = local_2c; |
|
iVar1 = local_24; |
|
while (local_3c = size, uVar7 = dst_0, local_c = local_44, str_0 = local_40, src != 0) { |
|
local_30 = src; |
|
local_2c = dst; |
|
local_24 = iVar1; |
|
if (local_44 - local_3c < dst) { |
|
size = local_3c; |
|
local_3c = dst_0; |
|
unnamed_function_449(&local_44,size,dst); |
|
} |
|
if (dst != 0) { |
|
memory_copy(0,0,dst,src,local_3c + local_40); |
|
} |
|
size = local_3c + dst; |
|
if (iVar1 != 0) { |
|
if (local_44 - size < 3) { |
|
local_3c = size; |
|
unnamed_function_449(&local_44,size,3); |
|
size = local_3c; |
|
} |
|
*(undefined2 *)(size + local_40) = uVar2; |
|
*(undefined1 *)((undefined2 *)(size + local_40) + 1) = uVar3; |
|
size = size + 3; |
|
} |
|
local_3c = size; |
|
unnamed_function_217(&local_30,&local_38); |
|
dst_0 = local_3c; |
|
src = local_30; |
|
dst = local_2c; |
|
iVar1 = local_24; |
|
} |
|
} |
|
local_3c = uVar7; |
|
dst = dst_0; |
|
src = str_0; |
|
if (dst_0 == 0) { |
|
size = 1; |
|
} |
|
else { |
|
size = unnamed_function_955(dst_0,1); |
|
if (size == 0) { |
|
panic_capacity_overflow(1,dst); |
|
do { |
|
halt_trap(); |
|
} while( true ); |
|
} |
|
} |
|
if (dst != 0) { |
|
memory_copy(0,0,dst,src,size); |
|
} |
|
ret_data->dest_0 = dst; |
|
ret_data->size = size; |
|
ret_data->dest = dst; |
|
if ((local_c | 0x80000000) != 0x80000000) { |
|
dlmalloc::validate_size(src,local_c,1); |
|
} |
|
if (local_18 != 0) { |
|
dlmalloc::validate_size(local_14,local_18,1); |
|
} |
|
} |
|
else { |
|
ret_data->dest_0 = 0; |
|
ret_data->dest = 0; |
|
ret_data->size = 1; |
|
} |
|
return; |
|
} |
|
|
1774679912252823000