// // sub_B74D20 from 0xb74d20 to 0xb75bb0 (3728 bytes) // // 4 xrefs: // > sub_B75BB0 @ 0xb75d3c // > sub_B7A0E0 @ 0xb7b3d8 // > sub_B839AC @ 0xb87280 // > sub_B839AC @ 0xb87324 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // _QWORD *__fastcall sub_B74D20(__int64 a1, __int64 a2, unsigned __int8 a3, char *a4, const char *a5, const char *a6) { int v10; // w20 time_t v12; // d12 _QWORD *result; // x0 _QWORD *v14; // x19 char *v15; // x0 char *v16; // x0 char *v17; // x20 int v18; // w22 unsigned int v19; // w23 char *v20; // x0 char *v21; // x0 const char *v22; // x0 char *v23; // x0 char *v24; // x0 char *(__fastcall *v25)(const char *); // x1 char *v26; // x0 char *v27; // x0 time_t v28; // x0 _QWORD *v29; // x20 time_t v30; // x23 _QWORD *v31; // x0 _QWORD *v32; // x25 time_t v33; // x1 _QWORD *v34; // x22 __int64 v35; // x1 __int64 v36; // x0 __int64 v37; // x0 __int64 v38; // x1 __int64 v39; // x3 void (__fastcall *v40)(void *); // x1 __int64 v41; // x3 __int64 v42; // x3 __int64 v43; // x3 __int64 v44; // x3 __int64 v45; // x3 _QWORD *v46; // x0 char *v47; // x27 char *v48; // x26 int v49; // w0 int v50; // t1 int v51; // s9 size_t v52; // x25 size_t v53; // x0 char *v54; // x2 _BOOL4 v55; // w24 int v56; // w1 size_t v57; // x6 int v58; // w1 size_t v59; // x1 int v60; // w2 int v61; // w0 const char *v62; // x28 int v63; // w1 int v64; // t1 const char *v65; // x0 char *v66; // x0 int v67; // w0 int v68; // w6 int v69; // t1 const char *v70; // x0 __int64 v71; // x0 char *v72; // x0 char *v73; // x2 _BYTE *v74; // x0 signed __int64 v75; // x0 size_t v76; // x20 void *v77; // x0 char *v78; // x0 char *v79; // x0 char *v80; // x2 int v81; // w1 int v82; // t1 const char *v83; // x5 _BOOL4 v84; // w24 size_t v85; // x0 char *v86; // x6 char *v87; // x0 char *v88; // x0 char *v89; // x0 __int64 v90; // x0 __int64 v91; // x0 const char *v92; // x0 char *v93; // x0 char *v94; // x0 char *v95; // x0 char *v96; // x0 char *v97; // [xsp+A8h] [xbp+A8h] size_t v98; // [xsp+B0h] [xbp+B0h] char *cp; // [xsp+B8h] [xbp+B8h] char *cpa; // [xsp+B8h] [xbp+B8h] char *cpb; // [xsp+B8h] [xbp+B8h] char *buf; // [xsp+C0h] [xbp+C0h] BYREF char v103[16]; // [xsp+C8h] [xbp+C8h] BYREF char v104[1024]; // [xsp+D8h] [xbp+D8h] BYREF v10 = a3; v12 = time(nullptr); result = off_1231020(1u, 0x60u); v14 = result; if ( !result ) return result; if ( v10 ) { v47 = (char *)off_1231000(0x1388u); if ( !v47 ) { LABEL_204: off_1231008(v14); return nullptr; } v48 = strchr(a4, 59); v49 = (unsigned __int8)*a4; if ( *a4 ) { do { if ( v49 != 9 && v49 != 32 ) break; v50 = (unsigned __int8)*++a4; v49 = v50; } while ( v50 ); } v51 = 0; while ( 1 ) { *v47 = 0; v104[0] = 0; if ( sscanf(a4, "%1023[^;\r\n=] =%4999[^;\r\n]", v104, v47) <= 0 ) goto LABEL_106; v52 = strlen(v47); v53 = strlen(v104); v54 = &a4[v53]; v55 = a4[v53] == 61; if ( v53 ) { v56 = (unsigned __int8)*(v54 - 1); if ( v56 == 9 || v56 == 32 ) { v80 = v54 - 1; do { v82 = (unsigned __int8)*--v80; v81 = v82; --v53; } while ( v82 && (v81 == 9 || v81 == 32) && v53 ); v104[v53] = 0; } } if ( !v52 ) goto LABEL_93; v57 = v52 - 1; v58 = (unsigned __int8)v47[v52 - 1]; if ( v58 != 9 && v58 != 32 ) { v57 = v52; goto LABEL_94; } v47[v57] = 0; if ( v52 == 1 ) { LABEL_93: v57 = 0; } else { while ( 1 ) { v59 = v57 - 1; v60 = (unsigned __int8)v47[v57 - 1]; if ( v60 != 9 && v60 != 32 ) break; --v57; v47[v59] = 0; if ( !v59 ) goto LABEL_93; } } LABEL_94: v61 = (unsigned __int8)*v47; v62 = v47; if ( *v47 && (v61 == 9 || v61 == 32) ) { do { v64 = *(unsigned __int8 *)++v62; v63 = v64; } while ( v64 && (v63 == 9 || v63 == 32) ); } if ( v55 && !v14[1] ) { v14[1] = off_1231018(v104); v79 = off_1231018(v62); v14[2] = v79; if ( !v79 || !v14[1] ) { LABEL_137: v70 = (const char *)v14[10]; v51 = 1; goto LABEL_117; } } else if ( !v57 ) { if ( (unsigned int)sub_B944E4("secure", v104) ) { *((_BYTE *)v14 + 88) = 1; goto LABEL_106; } if ( (unsigned int)sub_B944E4("httponly", v104) ) { *((_BYTE *)v14 + 90) = 1; goto LABEL_106; } if ( !v55 ) goto LABEL_106; } if ( (unsigned int)sub_B944E4("path", v104) ) { off_1231008((void *)v14[3]); v65 = off_1231018(v62); v14[3] = v65; if ( !v65 ) goto LABEL_137; v66 = sub_B74C00(v65); v14[4] = v66; if ( !v66 ) goto LABEL_137; goto LABEL_106; } if ( !(unsigned int)sub_B944E4("domain", v104) ) { if ( (unsigned int)sub_B944E4("version", v104) ) { off_1231008((void *)v14[9]); v94 = off_1231018(v62); v14[9] = v94; if ( !v94 ) goto LABEL_137; } else if ( (unsigned int)sub_B944E4("max-age", v104) ) { off_1231008((void *)v14[10]); v89 = off_1231018(v62); v14[10] = v89; if ( !v89 ) { v51 = 1; goto LABEL_176; } } else if ( (unsigned int)sub_B944E4("expires", v104) ) { off_1231008((void *)v14[7]); v96 = off_1231018(v62); v14[7] = v96; if ( !v96 ) goto LABEL_137; } goto LABEL_106; } if ( *v62 == 46 ) ++v62; if ( a5 ) v83 = a5; else v83 = v62; cp = (char *)v83; if ( inet_pton(2, v83, &buf) ) { if ( !strchr(v62, 46) ) { a5 = ":"; goto LABEL_166; } v84 = 1; } else { v84 = inet_pton(10, cp, v103) != 0; if ( !strchr(v62, 46) ) { a5 = ":"; if ( !v84 ) { LABEL_159: cpa = (char *)strlen(v62); v85 = strlen(a5); v86 = cpa; if ( (unsigned __int64)cpa <= v85 ) { v98 = v85; v97 = cpa; cpb = (char *)&a5[v85 - (_QWORD)cpa]; if ( (unsigned int)sub_B944E4(v62, &a5[v85 - (_QWORD)v86]) ) { if ( v97 == (char *)v98 || *(cpb - 1) == 46 ) { off_1231008((void *)v14[5]); v95 = off_1231018(v62); v14[5] = v95; if ( !v95 ) goto LABEL_137; LABEL_163: *((_BYTE *)v14 + 64) = 1; goto LABEL_106; } } } LABEL_160: v51 = 1; sub_B7B528(a1, "skipped cookie with bad tailmatch domain: %s\n", v62); goto LABEL_106; } goto LABEL_166; } } if ( !a5 ) { off_1231008((void *)v14[5]); v87 = off_1231018(v62); v14[5] = v87; if ( !v87 ) goto LABEL_137; if ( !v84 ) goto LABEL_163; goto LABEL_106; } if ( !v84 ) goto LABEL_159; LABEL_166: if ( strcmp(v62, a5) ) goto LABEL_160; off_1231008((void *)v14[5]); v88 = off_1231018(v62); v14[5] = v88; if ( !v88 ) goto LABEL_137; LABEL_106: if ( !v48 || !*v48 ) { LABEL_116: v70 = (const char *)v14[10]; goto LABEL_117; } v67 = (unsigned __int8)v48[1]; a4 = v48 + 1; if ( !v48[1] ) goto LABEL_144; if ( v67 == 9 || v67 == 32 ) { while ( 1 ) { v69 = (unsigned __int8)*++a4; v68 = v69; if ( !v69 ) break; if ( v68 != 9 && v68 != 32 ) goto LABEL_114; } LABEL_144: v48 = strchr(a4, 59); if ( !v48 ) { v70 = (const char *)v14[10]; LABEL_117: if ( v70 ) { if ( *v70 == 34 ) ++v70; v71 = strtol(v70, nullptr, 10); v14[6] = v71; if ( v71 <= 0x7FFFFFFFFFFFFFFFLL - v12 ) { v14[6] = v12 + v71; goto LABEL_122; } v14[6] = 0x7FFFFFFFFFFFFFFFLL; if ( v51 ) { LABEL_187: off_1231008(v47); sub_B74A90((void **)v14); return nullptr; } } else { LABEL_176: v90 = v14[7]; if ( v90 ) { v91 = sub_B9F7FC(v90, 0); if ( v91 ) { if ( v91 < 0 ) v91 = 0; v14[6] = v91; } else { v14[6] = 1; } } LABEL_122: if ( v51 ) goto LABEL_187; } if ( !a5 || v14[5] || (v72 = off_1231018(a5), (v14[5] = v72) != 0) ) { if ( !a6 || v14[3] ) goto LABEL_133; v73 = strchr(a6, 63); v74 = v73 ? memrchr(a6, 47, v73 - a6) : strrchr(a6, 47); if ( !v74 ) goto LABEL_133; v75 = v74 - a6; v76 = v75 + 1; v77 = off_1231000(v75 + 2); v14[3] = v77; if ( v77 ) { memcpy(v77, a6, v76); *(_BYTE *)(v14[3] + v76) = 0; v78 = sub_B74C00((const char *)v14[3]); v14[4] = v78; if ( v78 ) { LABEL_133: off_1231008(v47); if ( !v14[1] ) goto LABEL_21; goto LABEL_34; } } } goto LABEL_187; } } else { LABEL_114: v48 = strchr(a4, 59); if ( !v48 ) { v48 = strchr(a4, 0); if ( !v48 ) goto LABEL_116; } } } } buf = nullptr; if ( !strncmp(a4, "#HttpOnly_", 0xAu) ) { a4 += 10; *((_BYTE *)v14 + 90) = 1; } if ( *a4 == 35 ) goto LABEL_204; v15 = strchr(a4, 13); if ( v15 ) *v15 = 0; v16 = strchr(a4, 10); if ( v16 ) *v16 = 0; v17 = strtok_r(a4, "\t", &buf); if ( !v17 ) goto LABEL_21; v18 = 0; while ( 2 ) { switch ( v18 ) { case 0: if ( *v17 == 46 ) v22 = v17 + 1; else v22 = v17; v23 = off_1231018(v22); v14[5] = v23; v19 = v23 == nullptr; v17 = strtok_r(nullptr, "\t", &buf); if ( (v17 != nullptr) > v19 ) goto LABEL_27; v18 = 1; goto LABEL_20; case 1: LABEL_27: *((_BYTE *)v14 + 64) = (unsigned int)sub_B944E4(v17, "TRUE") != 0; v17 = strtok_r(nullptr, "\t", &buf); if ( v17 ) goto LABEL_28; v18 = 2; v19 = 0; goto LABEL_20; case 2: LABEL_28: if ( !strcmp("TRUE", v17) || !strcmp("FALSE", v17) ) { v24 = off_1231018((const char *)&word_F2A0A8); v25 = off_1231018; v19 = v24 == nullptr; v14[3] = v24; v26 = v25((const char *)&word_F2A0A8); v14[4] = v26; if ( !v26 ) v19 = 1; } else { v92 = off_1231018(v17); v14[3] = v92; if ( !v92 ) { v18 = 3; v19 = 1; strtok_r(nullptr, "\t", &buf); goto LABEL_20; } v93 = sub_B74C00(v92); v14[4] = v93; v19 = v93 == nullptr; v17 = strtok_r(nullptr, "\t", &buf); if ( (v17 != nullptr) <= v19 ) { v18 = 3; goto LABEL_20; } v19 = 0; } LABEL_14: *((_BYTE *)v14 + 88) = (unsigned int)sub_B944E4(v17, "TRUE") != 0; v17 = strtok_r(nullptr, "\t", &buf); if ( (v17 != nullptr) > v19 ) { LABEL_15: v14[6] = strtol(v17, nullptr, 10); v17 = strtok_r(nullptr, "\t", &buf); if ( !v17 ) { v18 = 5; v19 = 0; LABEL_20: if ( (v18 != 7) > v19 ) goto LABEL_21; goto LABEL_33; } LABEL_16: v20 = off_1231018(v17); v14[1] = v20; v19 = v20 == nullptr; v17 = strtok_r(nullptr, "\t", &buf); if ( (v17 != nullptr) <= v19 ) goto LABEL_32; LABEL_17: v18 = 7; v21 = off_1231018(v17); v14[2] = v21; v19 = v21 == nullptr; if ( (strtok_r(nullptr, "\t", &buf) != nullptr) <= v19 ) goto LABEL_20; LABEL_18: ++v18; v17 = strtok_r(nullptr, "\t", &buf); if ( !v17 ) { v19 = 0; if ( v18 == 6 ) { LABEL_32: v27 = off_1231018(&byte_F288A0); v14[2] = v27; if ( !v27 ) goto LABEL_21; goto LABEL_33; } goto LABEL_20; } continue; } if ( !v19 ) goto LABEL_21; LABEL_33: if ( v19 ) goto LABEL_21; LABEL_34: if ( !*(_BYTE *)(a2 + 16) && *(_BYTE *)(a2 + 32) && !v14[6] ) goto LABEL_21; *((_BYTE *)v14 + 89) = *(_BYTE *)(a2 + 16); v28 = time(nullptr); v29 = *(_QWORD **)a2; v30 = v28; if ( !*(_QWORD *)a2 ) goto LABEL_69; v31 = *(_QWORD **)a2; v32 = nullptr; do { while ( 1 ) { v33 = v31[6]; v34 = (_QWORD *)*v31; if ( v30 > v33 ) { if ( v33 ) break; } v32 = v31; v31 = (_QWORD *)*v31; if ( !v34 ) goto LABEL_45; } if ( v31 == v29 ) *(_QWORD *)a2 = v34; else *v32 = v34; --*(_QWORD *)(a2 + 24); sub_B74A90((void **)v31); v29 = *(_QWORD **)a2; v31 = v34; } while ( v34 ); LABEL_45: if ( !v29 ) { LABEL_69: if ( !*(_BYTE *)(a2 + 16) ) goto LABEL_71; LABEL_70: sub_B7B528( a1, "%s cookie %s=\"%s\" for domain %s, path %s, expire %ld\n", "Added", (const char *)v14[1], (const char *)v14[2], (const char *)v14[5], (const char *)v14[3], v14[6]); if ( v29 ) LABEL_67: *v29 = v14; else LABEL_71: *(_QWORD *)a2 = v14; ++*(_QWORD *)(a2 + 24); return v14; } while ( 2 ) { if ( !(unsigned int)sub_B944E4(v29[1], v14[1]) ) goto LABEL_50; v36 = v29[5]; if ( !v36 ) { if ( !v14[5] ) goto LABEL_55; goto LABEL_50; } v35 = v14[5]; if ( !v35 || !(unsigned int)sub_B944E4(v36, v35) || *((unsigned __int8 *)v29 + 64) != *((unsigned __int8 *)v14 + 64) ) { goto LABEL_50; } LABEL_55: v37 = v29[4]; if ( !v37 ) { if ( !v14[4] ) break; goto LABEL_50; } v38 = v14[4]; if ( !v38 || !(unsigned int)sub_B944E4(v37, v38) ) { LABEL_50: if ( !*v29 ) { if ( *(_BYTE *)(a2 + 16) ) goto LABEL_70; goto LABEL_67; } v29 = (_QWORD *)*v29; continue; } break; } if ( *((_BYTE *)v14 + 89) || !*((_BYTE *)v29 + 89) ) { *v14 = *v29; off_1231008((void *)v29[1]); off_1231008((void *)v29[2]); off_1231008((void *)v29[5]); off_1231008((void *)v29[3]); off_1231008((void *)v29[4]); off_1231008((void *)v29[7]); off_1231008((void *)v29[9]); off_1231008((void *)v29[10]); v39 = v14[1]; v40 = off_1231008; *v29 = *v14; v29[1] = v39; v41 = v14[3]; v29[2] = v14[2]; v29[3] = v41; v42 = v14[5]; v29[4] = v14[4]; v29[5] = v42; v43 = v14[7]; v29[6] = v14[6]; v29[7] = v43; v44 = v14[9]; v29[8] = v14[8]; v29[9] = v44; v45 = v14[11]; v29[10] = v14[10]; v29[11] = v45; v40(v14); v46 = v29; do v46 = (_QWORD *)*v46; while ( v46 ); if ( *(_BYTE *)(a2 + 16) ) sub_B7B528( a1, "%s cookie %s=\"%s\" for domain %s, path %s, expire %ld\n", "Replaced", (const char *)v29[1], (const char *)v29[2], (const char *)v29[5], (const char *)v29[3], v29[6]); return v29; } LABEL_21: sub_B74A90((void **)v14); return nullptr; case 3: v19 = 0; goto LABEL_14; case 4: goto LABEL_15; case 5: goto LABEL_16; case 6: goto LABEL_17; default: goto LABEL_18; } } }
GD Web Decomp Icon

GD Web Decomp

Raw Source