// // sub_845000 from 0x845000 to 0x8453da (986 bytes) // // 1 xrefs: // > sub_831254 @ 0x8312e4 // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 12:02:23 +0000 // int __fastcall sub_845000(const char *a1, char *a2, int a3, int a4, size_t *a5) { size_t v8; // r6 int v9; // r10 _BOOL4 v10; // r5 size_t v11; // r3 int result; // r0 const char *v13; // r2 _BYTE *v14; // r3 size_t v15; // r0 size_t v16; // r7 size_t v17; // r3 const char *v18; // r9 size_t v19; // r12 size_t v20; // r0 _BOOL4 v21; // r7 size_t v22; // r7 char *v23; // r9 int v24; // r0 int v25; // r2 char *v26; // r3 int v27; // r0 int v28; // r0 const char *v29; // r7 const char *v30; // r2 int v31; // [sp+10h] [bp-15Ch] int i; // [sp+10h] [bp-15Ch] int v33; // [sp+10h] [bp-15Ch] int v34; // [sp+14h] [bp-158h] size_t v35; // [sp+14h] [bp-158h] char *v36; // [sp+1Ch] [bp-150h] BYREF ssize_t buf[16]; // [sp+20h] [bp-14Ch] BYREF char v38; // [sp+60h] [bp-10Ch] BYREF unsigned __int8 v39; // [sp+61h] [bp-10Bh] char v40; // [sp+62h] [bp-10Ah] char v41; // [sp+63h] [bp-109h] unsigned __int8 v42; // [sp+64h] [bp-108h] unsigned __int8 v43; // [sp+65h] [bp-107h] unsigned __int8 v44; // [sp+66h] [bp-106h] unsigned __int8 v45; // [sp+67h] [bp-105h] char v46; // [sp+68h] [bp-104h] BYREF unsigned __int8 v47; // [sp+69h] [bp-103h] v8 = *a5; v9 = a5[a4 + 104]; v10 = a5[54] == 6; if ( sub_83D604((_DWORD *)*a5, nullptr, 1) < 0 ) { sub_828178(v8, "Connection time-out"); return 28; } if ( *((_BYTE *)a5 + 618) ) { if ( v10 ) v13 = "a"; else v13 = &byte_BF4ECA; sub_8280FC(*a5, "SOCKS4%s: connecting to HTTP proxy %s port %d\n", v13, a2, a3); } sub_8461C8(v9, 0); sub_8280FC(v8, "SOCKS4 communication to %s:%d\n", a2, a3); v38 = 4; v41 = a3; v39 = 1; v40 = BYTE1(a3); if ( !v10 ) { if ( sub_8202A4((int *)a5, a2, a3, (const char **)&v36) == -1 ) return 5; if ( v36 && *(_DWORD *)v36 ) { v34 = *(_DWORD *)v36; sub_820040(*(_DWORD *)v36, (char *)buf, 64); if ( *(_DWORD *)(v34 + 4) == 2 ) { v14 = *(_BYTE **)(v34 + 24); v42 = v14[4]; v43 = v14[5]; v44 = v14[6]; v45 = v14[7]; sub_8280FC(v8, "SOCKS4 connect to IPv4 %s (locally resolved)\n", (const char *)buf); sub_8205A4(v8, v36); v46 = 0; if ( a1 ) { v15 = strlen(a1); if ( v15 > 0xFD ) goto LABEL_6; v35 = v15; memcpy(&v46, a1, v15 + 1); v16 = 0; v17 = v35 + 9; v18 = (const char *)(v35 + 9); } else { v17 = 9; v16 = 0; v18 = byte_9; } goto LABEL_22; } sub_828178(v8, "SOCKS4 connection to %s not supported\n", (const char *)buf); sub_8205A4(v8, v36); } sub_828178(v8, "Failed to resolve \"%s\" for SOCKS4 connect.", a2); return 6; } v46 = 0; if ( a1 ) { v11 = strlen(a1); if ( v11 > 0xFD ) { LABEL_6: sub_828178(v8, "Too long SOCKS proxy name, can't use!\n"); return 7; } v33 = v11 + 9; memcpy(&v46, a1, v11 + 1); v19 = v33; } else { v19 = strlen(&v46) + 9; } v31 = v19; v42 = 0; v43 = 0; v44 = 0; v45 = 1; v20 = strlen(a2); v16 = v20 + 1; v18 = (const char *)(v31 + v20 + 1); if ( (int)v18 <= 262 ) { memcpy(&v38 + v31, a2, v20 + 1); v17 = (size_t)v18; } else { v17 = v31; v18 = (const char *)v31; v16 = 0; } LABEL_22: if ( sub_828470((int *)a5, v9, &v38, v17, (ssize_t *)&v36) || v36 != v18 || (!v16 ? (v21 = v10) : (v21 = 0), v21 && ((v29 = (const char *)(strlen(a2) + 1), sub_828470((int *)a5, v9, a2, (size_t)v29, (ssize_t *)&v36)) || v36 != v29)) ) { sub_828178(v8, "Failed to send SOCKS4 connect request."); return 7; } v22 = 8; v23 = &v38; for ( i = 0; ; i += buf[0] ) { do { v24 = sub_83D604((_DWORD *)*a5, nullptr, 1); v25 = -1; v26 = (char *)v24; if ( v24 < 0 ) goto LABEL_46; v27 = sub_842E08(v9, -1, -1, v24); v25 = v22; v26 = (char *)buf; if ( v27 <= 0 ) goto LABEL_46; v28 = sub_828914(v9, v23, v22, buf); } while ( v28 == 81 ); if ( v28 ) goto LABEL_46; v26 = (char *)buf[0]; v23 += buf[0]; if ( v22 == buf[0] ) break; if ( !buf[0] ) goto LABEL_46; v22 -= buf[0]; } v26 = (char *)(i + v22); if ( i + v22 != 8 ) { LABEL_46: sub_828178(v8, "Failed to receive SOCKS4 connect request ack.", v25, v26); return 7; } if ( v38 ) { sub_828178(v8, "SOCKS4 reply has wrong version, version should be 4."); return 7; } switch ( v39 ) { case 'Z': if ( v10 ) v30 = "a"; else v30 = &byte_BF4ECA; sub_8280FC(v8, "SOCKS4%s request granted.\n", v30); sub_8461C8(v9, 1); result = 0; break; case '[': sub_828178( v8, "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d), request rejected or failed.", v42, v43, v44, v45, v47 | ((unsigned __int8)v46 << 8), 91); return 7; case '\\': sub_828178( v8, "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d), request rejected because SOCKS server cannot connect t" "o identd on the client.", v42, v43, v44, v45, v47 | ((unsigned __int8)v46 << 8), 92); return 7; case ']': sub_828178( v8, "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d), request rejected because the client program and identd" " report different user-ids.", v42, v43, v44, v45, v47 | ((unsigned __int8)v46 << 8), 93); return 7; default: sub_828178( v8, "Can't complete SOCKS4 connection to %d.%d.%d.%d:%d. (%d), Unknown.", v42, v43, v44, v45, v47 | ((unsigned __int8)v46 << 8), v39); return 7; } return result; }
GD Web Decomp Icon

GD Web Decomp

Raw Source