-
-
未解决 [求助]萌新有个c++ 类 ida后这怎么看啊。有大神说下么
-
发表于: 2020-8-11 17:28 2281
-
char __fastcall mootools::CXSocket::CreateClient(mootools::CXSocket *a1, u_short a2, unsigned __int8 a3, __int64 a4)
{
__int64 v4; // rbx
unsigned __int8 v5; // r12
mootools::CXSocket *v6; // rsi
unsigned int v7; // er8
SOCKET v8; // rax
mootools *v10; // r14
wint_t *v11; // rbx
mootools *v12; // r15
mootools *v13; // rdi
__int64 v14; // rdi
unsigned __int64 v15; // r8
__int64 v16; // rax
mootools *v17; // r13
signed __int64 v18; // rbx
mootools *v19; // r12
signed __int64 v20; // rdx
void *v21; // rdx
void *v22; // rdx
__int64 v23; // rcx
wchar_t v24; // ax
bool v25; // cf
wchar_t v26; // ax
int v27; // eax
__int64 v28; // rax
bool v29; // zf
const char **v30; // rax
struct hostent *v31; // rbx
void *v32; // rdx
void *v33; // rdx
int v34; // eax
bool v35; // zf
u_long argp; // [rsp+30h] [rbp-D0h]
mootools *v37[2]; // [rsp+38h] [rbp-C8h]
__int64 v38; // [rsp+48h] [rbp-B8h]
int v39; // [rsp+50h] [rbp-B0h]
mootools *v40[2]; // [rsp+58h] [rbp-A8h]
__int64 v41; // [rsp+68h] [rbp-98h]
mootools *v42[2]; // [rsp+70h] [rbp-90h]
__int64 v43; // [rsp+80h] [rbp-80h]
__int64 Dst; // [rsp+88h] [rbp-78h]
__int64 v45; // [rsp+90h] [rbp-70h]
__int64 v46; // [rsp+98h] [rbp-68h]
__int64 v47; // [rsp+A0h] [rbp-60h]
struct WSAData WSAData; // [rsp+B0h] [rbp-50h]
struct timeval timeout; // [rsp+300h] [rbp+200h]
u_short v50; // [rsp+308h] [rbp+208h]
v50 = a2;
v47 = -2i64;
v4 = a4;
v5 = a3;
v39 = a3;
v6 = a1;
timeout.tv_sec = 0;
if ( *((_QWORD *)a1 + 4) != -1i64 )
{
if ( mootools::CXSocket::SendDatas(a1, 0, 0i64, 0i64) || *((_DWORD *)v6 + 2) != 9 )
return 1;
mootools::CXSocket::CloseSocket(v6);
}
if ( !byte_18027851C )
{
if ( WSAStartup(0x202u, &WSAData) )
return 0;
mootools::AddApplicationExitCallback((mootools *)mootools::CXSocket::CloseService, 0i64, v7);
byte_18027851C = 1;
}
v8 = socket(2, 1, 0);
*((_QWORD *)v6 + 4) = v8;
if ( v8 == -1i64 )
{
*((_DWORD *)v6 + 2) = 4;
return 0;
}
_mm_storeu_si128((__m128i *)v40, (__m128i)0i64);
v41 = 0i64;
sub_180005164(v40, 0i64);
sub_180004B51(v40, *(_QWORD *)v4, *(signed int *)(v4 + 8));
v10 = v40[0];
v11 = (wint_t *)v40[0];
v12 = v40[1];
if ( (_QWORD)v40[1] > 0i64 )
{
v13 = v40[1];
do
{
*v11 = towlower(*v11);
++v11;
v13 = (mootools *)((char *)v13 - 1);
}
while ( v13 );
}
if ( (signed int)v12 > 0 )
{
v14 = 0i64;
if ( (signed __int64)v12 > 0 )
{
while ( *((_WORD *)v10 + v14) != 58 )
{
if ( ++v14 >= (signed __int64)v12 )
goto LABEL_42;
}
if ( (_DWORD)v14 != -1 )
{
_mm_storeu_si128((__m128i *)v37, (__m128i)0i64);
v38 = 0i64;
sub_180005164(v37, 0i64);
timeout.tv_sec = 1;
LODWORD(v16) = 0;
if ( (signed int)v14 + 1 >= 0 )
LODWORD(v16) = v14 + 1;
v16 = (signed int)v16;
v46 = v16;
if ( (signed int)v16 > (signed __int64)v12 )
{
if ( (unsigned __int64)(2 * v38) < 2 )
{
v38 = 16i64;
v19 = (mootools *)mootools::xrealloc(v37[0], (void *)0x20, v15);
v37[0] = v19;
*(_WORD *)v19 = 0;
}
else
{
v19 = v37[0];
*(_WORD *)v37[0] = 0;
}
v37[1] = 0i64;
}
else
{
v17 = (mootools *)((char *)v12 - v16);
v18 = 2 * ((_QWORD)v12 - v16);
if ( v18 + 2 > (unsigned __int64)(2 * v38) )
{
v20 = v18 + 1;
if ( v18 + 1 >= 16 )
{
if ( v20 < 64 )
v20 = 64i64;
}
else
{
v20 = 16i64;
}
v38 = v20;
v19 = (mootools *)mootools::xrealloc(v37[0], (void *)(2 * v20), v15);
v37[0] = v19;
v37[1] = v17;
*(_WORD *)((char *)v19 + v18) = 0;
}
else
{
v37[1] = (mootools *)((char *)v12 - v16);
v19 = v37[0];
*(_WORD *)((char *)v37[0] + v18) = 0;
}
sub_1800046FB(v19, v18, (char *)v10 + 2 * v46, v18);
}
mootools::CXTString<wchar_t>::ScanS(v37, L"%hd", &v50);
v43 = 0i64;
_mm_storeu_si128((__m128i *)v42, (__m128i)0i64);
if ( (signed int)v14 >= 0 )
{
if ( (signed int)v14 > (signed __int64)v12 )
LODWORD(v14) = (_DWORD)v12;
sub_180005164(v42, 0i64);
sub_180004B51(v42, v10, (signed int)v14);
}
else
{
sub_180005164(v42, 0i64);
}
timeout.tv_sec = 3;
sub_180004B51(v40, v42[0], SLODWORD(v42[1]));
mootools::xfree(v42[0], v21);
mootools::xfree(v19, v22);
v12 = v40[1];
v10 = v40[0];
v5 = v39;
}
}
}
LABEL_42:
v23 = 0i64;
while ( 1 )
{
v24 = *((_WORD *)v10 + v23);
v25 = v24 < aLocalhost[v23];
if ( v24 != aLocalhost[v23] )
break;
v26 = *((_WORD *)v10 + v23 + 1);
v25 = v26 < aLocalhost[v23 + 1];
if ( v26 != aLocalhost[v23 + 1] )
break;
v23 += 2i64;
if ( v23 == 10 )
{
v27 = 0;
goto LABEL_48;
}
}
v27 = -v25 | 1;
LABEL_48:
if ( v27 )
{
if ( (signed int)v12 <= 0 )
goto LABEL_55;
v28 = 0i64;
v29 = v12 == 0i64;
if ( (signed __int64)v12 <= 0 )
{
LABEL_56:
if ( v29 || (unsigned int)mootools::CXTString<wchar_t>::ScanS(v40, L"%hd", &v50) == 1 )
{
sub_180004B51(v40, L"localhost", -1i64);
v10 = v40[0];
}
goto LABEL_59;
}
while ( *((_WORD *)v10 + v28) != 46 )
{
if ( ++v28 >= (signed __int64)v12 )
goto LABEL_55;
}
if ( (_DWORD)v28 == -1 )
{
LABEL_55:
v29 = v12 == 0i64;
goto LABEL_56;
}
}
LABEL_59:
v30 = (const char **)mootools::CXTString<char>::CXTString<char>(v42, v10);
v31 = gethostbyname(*v30);
mootools::xfree(v42[0], v32);
if ( v31 )
{
argp = 1;
if ( v5 && ioctlsocket(*((_QWORD *)v6 + 4), -2147195266, &argp) == -1 )
v5 = 0;
Dst = 0i64;
v45 = 0i64;
LOWORD(Dst) = 2;
WORD1(Dst) = htons(v50);
memcpy((char *)&Dst + 4, *(const void **)v31->h_addr_list, v31->h_length);
v34 = connect(*((_QWORD *)v6 + 4), (const struct sockaddr *)&Dst, 16);
if ( v5 )
{
if ( v34 == -1 && WSAGetLastError() != 10035 )
{
LABEL_70:
mootools::CXSocket::CloseSocket(v6);
*((_DWORD *)v6 + 2) = 6;
LOBYTE(v31) = 0;
goto LABEL_72;
}
argp = 0;
ioctlsocket(*((_QWORD *)v6 + 4), -2147195266, &argp);
WSAData.lpVendorInfo = (char *)*((_QWORD *)v6 + 4);
*(_DWORD *)&WSAData.wVersion = 1;
timeout.tv_sec = 0;
timeout.tv_usec = 1;
select(0, 0i64, (fd_set *)&WSAData, 0i64, &timeout);
v35 = _WSAFDIsSet(*((_QWORD *)v6 + 4), (fd_set *)&WSAData) == 0;
}
else
{
v35 = v34 == -1;
}
if ( !v35 )
{
*((_DWORD *)v6 + 3) |= 1u;
LOBYTE(v31) = 1;
goto LABEL_72;
}
goto LABEL_70;
}
mootools::CXSocket::CloseSocket(v6);
*((_DWORD *)v6 + 2) = 2;
LABEL_72:
mootools::xfree(v10, v33);
return (char)v31;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!