// // sub_BA92E0 from 0xba92e0 to 0xba9c48 (2408 bytes) // // 2 xrefs: // > sub_BA9C48 @ 0xba9c7c // > sub_BA9C48 @ 0xba9c84 // // 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 // __int64 __fastcall sub_BA92E0(__int64 a1) { __int64 v1; // x20 int v2; // w23 unsigned int v4; // w22 __int64 v5; // x25 unsigned int v6; // w19 int v7; // w4 unsigned int v8; // w26 __int64 result; // x0 __int64 v10; // x1 const char **v11; // x0 const char *v12; // x2 bool v13; // zf __int64 v14; // x0 __int64 v15; // x0 char *v16; // x28 __int64 v17; // x27 size_t v18; // x6 __int64 v19; // x2 unsigned int v20; // w0 __int64 v21; // x26 __int64 v22; // x27 size_t v23; // x19 _BOOL4 v24; // w28 const char *v25; // x2 __int64 v26; // x0 __int64 v27; // x0 unsigned int v28; // w4 __int64 v29; // x0 __int64 v30; // x0 const char **v31; // x1 const char *v32; // x2 const char *v33; // x2 unsigned __int64 v34; // x3 int v35; // w0 int v36; // w0 unsigned int v37; // w19 const char *v38; // x2 const char *v39; // x2 size_t v40; // x26 unsigned __int8 *v41; // x0 int v42; // w1 unsigned __int8 *v43; // x1 __int64 v44; // x19 unsigned __int8 *v45; // x6 char v46; // w4 int v47; // t1 unsigned __int8 *v48; // d11 int v49; // w0 unsigned int v50; // w19 __int64 v51; // [xsp+88h] [xbp+88h] size_t v52; // [xsp+88h] [xbp+88h] unsigned __int64 v53; // [xsp+88h] [xbp+88h] unsigned int v54; // [xsp+9Ch] [xbp+9Ch] BYREF __int64 v55; // [xsp+A0h] [xbp+A0h] BYREF __int64 v56; // [xsp+A8h] [xbp+A8h] BYREF v1 = a1 + 1560; v2 = *(_DWORD *)(a1 + 1672); v55 = 0; v4 = *(_DWORD *)(a1 + 608); v5 = *(_QWORD *)a1; if ( v2 != 5 ) { if ( *(_QWORD *)(a1 + 1608) ) return sub_BAAA28(v1); v6 = sub_BAA6B8(v4, v1, &v54, &v55); if ( v6 ) return v6; while ( 1 ) { v7 = *(_DWORD *)(v1 + 112); if ( v7 == 12 ) break; v8 = v54; if ( v54 == 1 ) { v28 = v7 - 1; if ( v28 <= 0xA ) __asm { BR X0 } LABEL_8: *(_DWORD *)(v1 + 112) = 0; return 0; } *(_DWORD *)(v5 + 36200) = v54; if ( !v8 ) return 0; switch ( v7 ) { case 1: if ( v8 - 200 > 0x63 ) { sub_B7B690(*(_QWORD *)a1, "Got unexpected smtp-server response: %d", v8); return 8; } v33 = *(const char **)(v1 + 120); *(_DWORD *)(v1 + 140) = 0; *(_DWORD *)(v1 + 148) = 0; *(_BYTE *)(v1 + 160) = 0; *(_BYTE *)(v1 + 162) = 0; result = sub_BAA4B0(v1, "EHLO %s", v33); if ( (_DWORD)result ) return result; goto LABEL_73; case 2: v22 = *(_QWORD *)a1; v23 = strlen((const char *)(*(_QWORD *)a1 + 2824LL)); v24 = v8 != 1; if ( v8 - 200 > 0x63 && v8 != 1 ) { if ( *(_DWORD *)(v22 + 1584) > 1u && !*(_BYTE *)(a1 + 664) ) { sub_B7B690(v22, "Remote access denied: %d", v8); return 9; } v25 = *(const char **)(v1 + 120); *(_DWORD *)(v1 + 148) = 0; result = sub_BAA4B0(v1, "HELO %s", v25); if ( (_DWORD)result ) return result; *(_DWORD *)(v1 + 112) = 3; goto LABEL_48; } v34 = v23 - 4; if ( v23 - 4 <= 7 ) { if ( v34 <= 3 ) goto LABEL_77; } else { v35 = memcmp((const void *)(v22 + 2828), "STARTTLS", 8u); v34 = v23 - 4; if ( !v35 ) { *(_BYTE *)(v1 + 160) = 1; goto LABEL_77; } } v53 = v34; if ( !memcmp((const void *)(v22 + 2828), "SIZE", 4u) ) { *(_BYTE *)(v1 + 161) = 1; } else if ( v53 > 4 && !memcmp((const void *)(v22 + 2828), "AUTH ", 5u) ) { v40 = v23 - 9; *(_BYTE *)(v1 + 162) = 1; if ( v23 != 9 ) { v41 = (unsigned __int8 *)(v22 + 2833); do { while ( 1 ) { v42 = *v41; if ( v42 != 13 && v42 != 32 && (unsigned __int8)(v42 - 9) > 1u ) break; --v40; ++v41; if ( !v40 ) goto LABEL_77; } if ( v40 ) { v43 = v41 + 1; v44 = 0; do { if ( ++v44 == v40 ) { v48 = &v41[v44]; goto LABEL_125; } v45 = v43; v47 = *v43++; v46 = v47; } while ( v47 != 13 && v47 != 32 && (unsigned __int8)(v46 - 9) > 1u ); v48 = v45; } else { v48 = v41; v44 = 0; } LABEL_125: v49 = sub_BAE6FC(v41); if ( v49 && v44 == v56 ) *(_DWORD *)(v1 + 140) |= v49; v40 -= v44; v41 = v48; } while ( v40 ); } } LABEL_77: if ( !v24 ) goto LABEL_47; v36 = *(_DWORD *)(v22 + 1584); if ( !v36 || *(_BYTE *)(a1 + 664) ) { LABEL_83: if ( *(_BYTE *)(v1 + 162) && (unsigned __int8)sub_BAE9D0(a1 + 1688, a1) ) { v6 = sub_BAE9F0(a1 + 1688, a1, 0, &v56); if ( v6 ) return v6; goto LABEL_94; } LABEL_84: *(_DWORD *)(v1 + 112) = 0; LABEL_47: if ( !*(_DWORD *)(v1 + 112) ) return 0; goto LABEL_48; } v37 = *(unsigned __int8 *)(v1 + 160); if ( !*(_BYTE *)(v1 + 160) ) { if ( v36 != 1 ) { sub_B7B690(v22, "STARTTLS not supported."); return 64; } if ( !*(_BYTE *)(v1 + 162) || !(unsigned __int8)sub_BAE9D0(a1 + 1688, a1) ) goto LABEL_84; v50 = sub_BAE9F0(a1 + 1688, a1, v37, &v56); if ( v50 ) return v50; LABEL_94: if ( (_DWORD)v56 != 1 ) { sub_B7B528(*(_QWORD *)a1, "No known authentication mechanisms supported!\n"); return 67; } *(_DWORD *)(v1 + 112) = 6; goto LABEL_47; } result = sub_BAA4B0(v1, "%s", "STARTTLS"); if ( (_DWORD)result ) return result; *(_DWORD *)(v1 + 112) = 4; LABEL_48: if ( !(unsigned __int8)sub_BAAB00(v1) ) return 0; v6 = sub_BAA6B8(v4, v1, &v54, &v55); if ( v6 ) return v6; break; case 3: if ( v8 - 200 <= 0x63 ) goto LABEL_8; sub_B7B690(*(_QWORD *)a1, "Remote access denied: %d", v8); return 9; case 4: v26 = *(_QWORD *)a1; if ( v8 == 220 ) { result = sub_BB9FA4(a1, 0, a1 + 1676); if ( (_DWORD)result ) return result; if ( *(_DWORD *)(v1 + 112) != 5 ) *(_DWORD *)(v1 + 112) = 5; if ( *(_BYTE *)(v1 + 116) ) { *(_QWORD *)(a1 + 1024) = &off_111CC40; *(_BYTE *)(a1 + 952) = 1; v38 = *(const char **)(v1 + 120); *(_DWORD *)(v1 + 140) = 0; *(_DWORD *)(v1 + 148) = 0; *(_BYTE *)(v1 + 160) = 0; *(_BYTE *)(v1 + 162) = 0; result = sub_BAA4B0(v1, "EHLO %s", v38); if ( (_DWORD)result ) return result; LABEL_73: *(_DWORD *)(v1 + 112) = 2; } goto LABEL_48; } if ( *(_DWORD *)(v26 + 1584) != 1 ) { sub_B7B690(v26, "STARTTLS denied. %c", v8); return 64; } goto LABEL_83; case 6: v21 = *(_QWORD *)a1; v6 = sub_BAEE2C(a1 + 1688, a1); if ( v6 ) return v6; if ( !(_DWORD)v56 ) { sub_B7B690(v21, "Authentication cancelled"); return 67; } if ( (_DWORD)v56 == 2 ) *(_DWORD *)(v1 + 112) = 0; goto LABEL_47; case 7: v51 = *(_QWORD *)a1; v16 = (char *)(*(_QWORD *)a1 + 2824LL); v17 = *(_QWORD *)(*(_QWORD *)a1 + 536LL); v18 = strlen(v16); v19 = *(_QWORD *)(v17 + 16); v20 = v8 - 200; if ( v19 ) { if ( v20 <= 0x63 || v8 == 553 ) goto LABEL_59; } else if ( v20 <= 0x63 ) { goto LABEL_59; } if ( v8 != 1 ) { sub_B7B690(v51, "Command failed: %d", v8); return 56; } LABEL_59: if ( *(_BYTE *)(v51 + 1568) ) { if ( v8 == 1 ) goto LABEL_48; } else { v16[v18] = 10; v52 = v18; v6 = sub_B7C1F0(a1, 1, v16, v18 + 1); v16[v52] = 0; if ( v8 == 1 ) goto LABEL_46; v19 = *(_QWORD *)(v17 + 16); } if ( !v19 ) { *(_DWORD *)(v1 + 112) = 0; LABEL_46: if ( v6 ) return v6; goto LABEL_47; } v29 = *(_QWORD *)(v19 + 8); *(_QWORD *)(v17 + 16) = v29; if ( !v29 ) { *(_DWORD *)(v1 + 112) = 0; goto LABEL_46; } v30 = *(_QWORD *)(*(_QWORD *)a1 + 536LL); v31 = *(const char ***)(v30 + 16); v32 = *(const char **)(v30 + 8); if ( v31 ) { if ( !v32 || !*v32 ) v32 = "VRFY"; result = sub_BAA4B0(v1, "%s %s", v32, *v31); } else { if ( !v32 || !*v32 ) v32 = "HELP"; result = sub_BAA4B0(v1, "%s", v32); } if ( (_DWORD)result ) return result; *(_DWORD *)(v1 + 112) = 7; goto LABEL_48; case 8: v15 = *(_QWORD *)a1; if ( v8 - 200 > 0x63 ) { sub_B7B690(v15, "MAIL failed: %d", v8); return 55; } v12 = **(const char ***)(*(_QWORD *)(v15 + 536) + 16LL); v14 = v1; if ( *v12 == 60 ) goto LABEL_71; goto LABEL_15; case 9: v10 = *(_QWORD *)(*(_QWORD *)a1 + 536LL); if ( v8 - 200 > 0x63 ) { sub_B7B690(*(_QWORD *)a1, "RCPT failed: %d", v8); return 55; } v11 = *(const char ***)(*(_QWORD *)(v10 + 16) + 8LL); *(_QWORD *)(v10 + 16) = v11; if ( v11 ) { v12 = *v11; v13 = **v11 == 60; v14 = v1; if ( v13 ) LABEL_71: result = sub_BAA4B0(v14, "RCPT TO:%s", v12); else LABEL_15: result = sub_BAA4B0(v14, "RCPT TO:<%s>", v12); if ( (_DWORD)result ) return result; *(_DWORD *)(v1 + 112) = 9; } else { result = sub_BAA4B0(v1, "%s", "DATA"); if ( (_DWORD)result ) return result; *(_DWORD *)(v1 + 112) = 10; } goto LABEL_48; case 10: v27 = *(_QWORD *)a1; if ( v8 != 354 ) { sub_B7B690(v27, "DATA failed: %d", v8); return 55; } sub_B72460(v27, *(_QWORD *)(v27 + 36088)); sub_B94394(a1, -1, -1, 0, 0, 0, 0); *(_DWORD *)(v1 + 112) = 0; return 0; case 11: if ( v8 == 250 ) v6 = 0; else v6 = 56; *(_DWORD *)(v1 + 112) = 0; goto LABEL_46; default: goto LABEL_8; } } if ( v54 ) *(_DWORD *)(v1 + 112) = 0; return 0; } result = sub_BB9FA4(a1, 0, a1 + 1676); if ( !(_DWORD)result ) { if ( *(_DWORD *)(v1 + 112) != 5 ) *(_DWORD *)(v1 + 112) = 5; if ( !*(_BYTE *)(v1 + 116) ) return 0; *(_BYTE *)(a1 + 952) = 1; *(_QWORD *)(a1 + 1024) = &off_111CC40; *(_DWORD *)(v1 + 140) = 0; v39 = *(const char **)(v1 + 120); *(_DWORD *)(v1 + 148) = 0; *(_BYTE *)(v1 + 160) = 0; *(_BYTE *)(v1 + 162) = 0; result = sub_BAA4B0(v1, "EHLO %s", v39); if ( !(_DWORD)result ) *(_DWORD *)(v1 + 112) = 2; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source