Function at 0x4022c8
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Connect udp socket
Create process on windows
Create tcp socket
Create udp socket
Receive data
Receive data on socket
Resolve dns
Send data
Send data on socket
Send http request
Send http request with host header

Disassembly:
push ebp
mov eax, 0x20ac
mov ebp, esp
push edi
push esi
push ebx
call fcn.0040d01c
sub esp, eax
mov dword [esp + 4], str.resolving
lea ebx, [ebp - 0x2018]
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], str.upgrade.mikrotik.com
mov dword [esp], eax
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov dword [esp], str.upgrade.mikrotik.com
call sub.WS2_32.dll_gethostbyname
test eax, eax
mov esi, eax
push ecx
jne 0x402333
mov eax, ebx
call fcn.0040165e
mov dword [esp + 4], str.could_not_resolve_upgrade_host
jmp 0x4023fa
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 2
call sub.WS2_32.dll_socket
sub esp, 0xc
mov dword [ebp - 0x2090], eax
inc eax
jne 0x40236f
mov eax, ebx
call fcn.0040165e
mov dword [esp + 4], str.socket_failed:
jmp 0x4023fa
mov dword [esp + 4], str.connecting_to
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], str.upgrade.mikrotik.com
mov dword [esp], eax
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov eax, dword [esi + 0xc]
mov word [ebp - 0x2058], 2
mov eax, dword [eax]
mov eax, dword [eax]
mov dword [esp], 0x50
mov dword [ebp - 0x2054], eax
call sub.WS2_32.dll_htons
mov word [ebp - 0x2056], ax
lea eax, [ebp - 0x2058]
push edx
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x2090]
mov dword [esp + 8], 0x10
mov dword [esp], eax
call sub.WS2_32.dll_connect
sub esp, 0xc
inc eax
jne 0x40242b
mov eax, ebx
call fcn.0040165e
mov dword [esp + 4], str.could_not_connect:
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], ebx
mov dword [esp], eax
call sym.updater.exe_operator___ostream__string_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, ebx
call method.string.freeptr__
call fcn.00401b25
jmp 0x402aac
mov dword [esp + 4], str.sending_request
lea edi, [ebp - 0x2080]
mov dword [esp], sym.updater.exe_cout
lea esi, [ebp - 0x2060]
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, edi
mov dword [esp], str.6.42
call method.string.string_char_const_
mov ecx, esi
push eax
mov dword [esp], str.GET__routeros_
call method.string.string_char_const_
mov ecx, esi
push eax
mov dword [esp], edi
call fcn.0040362c
mov edx, esi
mov ecx, str._dude_
push eax
lea eax, [ebp - 0x2048]
call fcn.00401362
lea eax, [ebp - 0x2048]
mov ecx, ebx
mov dword [esp], eax
call method.string.string_string_const_
mov ecx, ebx
push edx
mov dword [esp], edi
call fcn.0040362c
lea eax, [ebp - 0x207c]
mov edx, ebx
push ecx
mov ecx, str..tgz_HTTP_1.1_r_n
call fcn.00401362
mov ecx, ebx
call method.string.freeptr__
lea ecx, [ebp - 0x2048]
call method.string.freeptr__
mov ecx, esi
call method.string.freeptr__
mov ecx, esi
mov dword [esp], str.upgrade.mikrotik.com
call method.string.string_char_const_
lea ecx, [ebp - 0x2048]
push edi
mov dword [esp], str.Host:
call method.string.string_char_const_
lea ecx, [ebp - 0x2048]
push eax
mov dword [esp], esi
call fcn.0040362c
lea edx, [ebp - 0x2048]
mov ecx, 0x413238
push eax
mov eax, ebx
call fcn.00401362
lea ecx, [ebp - 0x207c]
mov dword [esp], ebx
call fcn.0040362c
mov ecx, ebx
push eax
call method.string.freeptr__
lea ecx, [ebp - 0x2048]
call method.string.freeptr__
mov ecx, esi
xor esi, esi
call method.string.freeptr__
lea ecx, [ebp - 0x207c]
mov dword [esp], str.User_Agent:_Dude_r_n
call fcn.00403664
lea ecx, [ebp - 0x207c]
push eax
mov dword [esp], 0x413238
call fcn.00403664
push eax
mov edx, dword [ebp - 0x207c]
mov eax, dword [edx]
cmp esi, eax
je 0x4025e2
sub eax, esi
add edx, 4
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x2090]
mov dword [esp + 0xc], 0
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
test eax, eax
jg 0x4025de
mov eax, ebx
call fcn.0040165e
mov dword [esp + 4], str.send_failed:
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], ebx
mov dword [esp], eax
call sym.updater.exe_operator___ostream__string_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, ebx
call method.string.freeptr__
call fcn.00401b25
jmp 0x402a96
add esi, eax
jmp 0x402568
lea esi, [ebp - 0x2078]
mov ecx, esi
call method.string.string__
lea edi, [ebp - 0x2048]
mov dword [ebp - 0x2074], 0
mov dword [ebp - 0x208c], esi
mov eax, dword [ebp - 0x2090]
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0x2000
mov dword [esp + 4], ebx
mov dword [esp], eax
call sub.WS2_32.dll_recv
sub esp, 0x10
test eax, eax
jg 0x40266e
mov eax, edi
call fcn.0040165e
mov dword [esp + 4], str._nrecv_failed:
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], edi
mov dword [esp], eax
call sym.updater.exe_operator___ostream__string_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, edi
call method.string.freeptr__
call fcn.00401b25
jmp 0x402a8b
mov dword [esp + 4], eax
mov ecx, edi
mov dword [esp], ebx
call method.string.string_char_const__unsigned_int_
mov ecx, dword [ebp - 0x208c]
push eax
push eax
mov dword [esp], edi
call fcn.0040362c
mov ecx, edi
push eax
call method.string.freeptr__
mov ecx, dword [ebp - 0x2074]
mov eax, dword [ebp - 0x2078]
test ecx, ecx
jne 0x402831
mov dword [esp + 0x10], 4
add eax, 4
mov dword [esp + 0xc], 0
mov dword [esp + 8], str._r_n_r_n
mov edx, dword [eax - 4]
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.00402fbd
cmp eax, 0xffffffff
mov esi, eax
je 0x402605
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x208c]
lea ecx, [ebp - 0x2060]
mov dword [esp + 4], 0
mov dword [esp], eax
call method.string.substr_unsigned_int__unsigned_int__const
mov eax, dword [ebp - 0x2060]
lea edx, [eax + 4]
add eax, dword [eax]
sub esp, 0xc
add eax, 4
mov dword [ebp - 0x2094], eax
cmp edx, dword [ebp - 0x2094]
je 0x402739
movsx eax, byte [edx]
mov dword [ebp - 0x2098], edx
mov dword [esp], eax
call sub.msvcrt.dll_tolower
mov edx, dword [ebp - 0x2098]
inc edx
mov byte [edx - 1], al
jmp 0x402714
add esi, 4
mov dword [esp + 4], esi
mov esi, dword [ebp - 0x208c]
lea ecx, [ebp - 0x2048]
mov dword [esp + 8], 0xffffffff
mov dword [esp], esi
call method.string.substr_unsigned_int__unsigned_int__const
lea eax, [ebp - 0x2048]
mov ecx, esi
sub esp, 0xc
mov dword [esp], eax
call method.string.operator_string_
lea ecx, [ebp - 0x2048]
push esi
call method.string.freeptr__
lea ecx, [ebp - 0x2048]
mov dword [esp], str.content_length:
call method.string.string_char_const_
mov esi, dword [ebp - 0x2048]
push eax
lea eax, [esi + 4]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x2060]
add eax, 4
mov dword [esp], eax
call sub.msvcrt.dll_strstr
test eax, eax
jne 0x4027fa
mov dword [esp + 4], str._n_nbad_http_response:_n_n
lea ebx, [ebp - 0x2060]
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], ebx
mov dword [esp], eax
call sym.updater.exe_operator___ostream__string_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
call fcn.00401b25
lea ecx, [ebp - 0x2048]
call method.string.freeptr__
mov ecx, ebx
call method.string.freeptr__
jmp 0x402a8b
lea edx, [ebp - 0x2074]
mov dword [esp + 8], edx
mov dword [esp + 4], 0x413297
add eax, dword [esi]
mov dword [esp], eax
call sub.msvcrt.dll_sscanf
lea ecx, [ebp - 0x2048]
call method.string.freeptr__
lea ecx, [ebp - 0x2060]
call method.string.freeptr__
jmp 0x402605
imul eax, dword [eax], 0x64
xor edx, edx
mov dword [esp + 4], str._rdownloading
mov dword [esp], sym.updater.exe_cout
div ecx
mov esi, eax
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], esi
mov dword [esp], eax
call sym.updater.exe_operator___ostream__unsigned_int_
mov dword [esp + 4], str.__complete
mov dword [esp], eax
call sym.updater.exe_operator___ostream__char_const_
mov eax, dword [ebp - 0x2078]
mov edx, dword [ebp - 0x2074]
cmp dword [eax], edx
jne 0x402605
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_endl_ostream_
mov dword [esp + 4], str.uncompressing
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, edi
mov dword [esp + 4], 0x34
mov dword [esp], str.dude.tgz
call fcn.00404aee
test byte [ebp - 0x202c], 5
push ecx
push ecx
je 0x4028d1
mov dword [esp + 4], str.could_not_open
jmp 0x4028f4
mov eax, dword [ebp - 0x208c]
mov dword [esp], edi
mov dword [esp + 4], eax
call sym.updater.exe_operator___ostream__string_const_
test byte [ebp - 0x202c], 5
je 0x40291d
mov dword [esp + 4], str.could_not_write
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
call fcn.00401b25
lea ecx, [ebp - 0x2048]
call fcn.00404c5a
jmp 0x402a8b
lea ebx, [ebp - 0x2060]
mov ecx, edi
call fcn.00404c5a
mov ecx, ebx
mov dword [esp], str.dude.tgz
lea esi, [ebp - 0x2070]
call method.string.string_char_const_
mov ecx, edi
push eax
mov dword [esp + 4], 1
mov dword [esp], ebx
call fcn.0040198a
mov ecx, ebx
push eax
push eax
call method.string.freeptr__
mov eax, esi
call fcn.004014e4
mov ecx, edi
mov dword [esp], esi
call fcn.00401b56
test al, al
push edx
je 0x402a58
mov ecx, ebx
mov dword [esp], esi
call fcn.0040167a
mov ecx, 0x4132e9
mov edx, esi
push eax
mov eax, dword [ebp - 0x2060]
mov dword [ebp - 0x2090], eax
lea eax, [ebp - 0x206c]
call fcn.00401362
lea edx, [ebp - 0x206c]
mov dword [esp], edx
lea ecx, [ebp - 0x2068]
call fcn.0040167a
push eax
mov eax, dword [ebp - 0x2090]
mov dword [esp + 0x14], 1
mov dword [esp + 0xc], str.__do_update
mov dword [esp + 0x10], eax
mov eax, dword [ebp - 0x2068]
mov dword [esp + 4], str.open
mov dword [esp], 0
mov dword [esp + 8], eax
call sub.SHELL32.DLL_ShellExecuteW
lea ecx, [ebp - 0x2068]
sub esp, 0x18
mov dword [ebp - 0x2090], eax
call fcn.00401742
lea ecx, [ebp - 0x206c]
call method.string.freeptr__
mov ecx, ebx
call fcn.00401742
mov eax, dword [ebp - 0x2090]
cmp eax, 0x1f
jg 0x402a75
call sub.KERNEL32.dll_GetLastError
mov edx, eax
mov eax, ebx
call fcn.004015c5
mov dword [esp + 4], str.ShellExecute:
mov dword [esp], sym.updater.exe_cout
call sym.updater.exe_operator___ostream__char_const_
mov dword [esp + 4], ebx
mov dword [esp], eax
call sym.updater.exe_operator___ostream__string_const_
mov dword [esp], eax
call sym.updater.exe_endl_ostream_
mov ecx, ebx
call method.string.freeptr__
call fcn.00401b25
lea ecx, [ebp - 0x2070]
call method.string.freeptr__
lea ecx, [ebp - 0x2048]
call fcn.00401aee
jmp 0x402a8b
mov ecx, esi
call method.string.freeptr__
mov ecx, edi
call fcn.00401aee
mov ecx, dword [ebp - 0x208c]
jmp 0x402a91
lea ecx, [ebp - 0x2078]
call method.string.freeptr__
lea ecx, [ebp - 0x207c]
call method.string.freeptr__
lea ecx, [ebp - 0x2080]
call method.string.freeptr__
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret