Function at 0x402660
Capabilities:
Download and write a file
Read file on windows
Receive and write data from server to client
Receive data
Receive data on socket
Write file on windows

Disassembly:
sub esp, 0x20
push ebx
push ebp
push esi
xor ebx, ebx
push edi
mov dword [esp + 0x18], ebx
lea ecx, [ecx]
mov eax, dword [esp + 0x3c]
mov edx, dword [0x418e0c]
push eax
mov eax, dword [esp + 0x38]
lea ecx, [esp + 0x24]
push ecx
push 0x30
push edx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov esi, eax
cmp esi, ebx
jne 0x40269e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x18]
cmp eax, 0x3e5
je 0x402a5c
cmp eax, ebx
jne 0x402a66
mov eax, dword [esp + 0x20]
cmp eax, 0x30
je 0x4026fb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x18], eax
cmp dword [0x418e28], ebx
je 0x4026f7
push eax
push esi
push str.sock_read_async
push 0x1c9
push 0x4165fc
push str.usbip_err:__13s:_4d____12s__incomplete_header__d__d_n_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x1c
mov eax, dword [esp + 0x20]
mov esi, dword [0x418e0c]
mov edi, esi
mov ebp, esi
mov dword [esp + 0x2c], edi
mov dword [esp + 0x10], ebx
mov dword [esp + 0x28], ebp
cmp eax, 0x30
jne 0x40292a
call fcn.00402210
test eax, eax
js 0x402a95
mov ecx, dword [ebp + 4]
xor edx, edx
mov eax, ecx
mov esi, 0x64
div esi
test edx, edx
jne 0x402750
push ecx
push str.Receive_sequence:_____d_r
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0xc
mov ecx, dword [ebp + 4]
push ecx
call dword [sym.imp.WS2_32.dll_htonl]
xor ecx, ecx
lea esp, [esp]
cmp dword [ecx*4 + 0x418a08], eax
je 0x40286d
inc ecx
cmp ecx, 0x100
jl 0x402760
mov edx, dword [ebp + 0x18]
mov dword [esp + 0x14], edx
mov ecx, edx
mov eax, dword [ebp + 0x20]
shl eax, 4
mov dword [esp + 0x24], eax
cmp ecx, ebx
jne 0x40287f
cmp eax, ebx
jne 0x40287f
mov eax, dword [esp + 0x40]
mov edx, dword [esp + 0x38]
push eax
lea ecx, [esp + 0x14]
push ecx
push 0x30
push ebp
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
cmp esi, ebx
je 0x4027c2
cmp dword [esp + 0x10], 0x30
je 0x402670
cmp dword [0x418e28], ebx
je 0x402a95
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x416310
push 0x191
push 0x416320
push str.usbip_err:__13s:_4d____12s__last_error:_ld_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x18
cmp dword [0x418e28], ebx
je 0x402a95
mov ecx, dword [esp + 0x10]
push esi
push ecx
push 0x41635c
push 0x192
push 0x41636c
push str.usbip_err:__13s:_4d____12s__out:_ld_ret:_d_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x1c
cmp dword [0x418e28], ebx
je 0x402a95
push 0x4163a8
push 0x193
push 0x4163b8
push 0x4163c8
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x14
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x20
ret
mov dword [ecx*4 + 0x418a08], ebx
xor ecx, ecx
mov dword [esp + 0x14], ecx
jmp 0x40277f
lea ebp, [eax + ecx]
lea edx, [ebp + 0x30]
mov dword [esp + 0x1c], edx
cmp edx, 0xf4240
jg 0x40295b
add edi, 0x30
mov esi, ebp
test ebp, ebp
jne 0x4028a2
xor ebx, ebx
jmp 0x4028ca
mov eax, dword [esp + 0x34]
push 8
push esi
push edi
push eax
call dword [sym.imp.WS2_32.dll_recv]
test eax, eax
jle 0x4028bf
add edi, eax
add ebx, eax
sub esi, eax
jne 0x4028a2
jmp 0x4028c2
or ebx, 0xffffffff
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x14]
cmp ebx, ebp
jne 0x40299a
test eax, eax
je 0x4028ec
mov edx, dword [0x418e0c]
mov eax, dword [esp + 0x28]
mov eax, dword [eax + 0x20]
lea ecx, [edx + ecx + 0x30]
call fcn.004022f0
mov ecx, dword [esp + 0x40]
mov eax, dword [esp + 0x1c]
push ecx
mov ecx, dword [esp + 0x30]
lea edx, [esp + 0x14]
push edx
mov edx, dword [esp + 0x40]
push eax
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, eax
test esi, esi
je 0x4029c4
mov eax, dword [esp + 0x10]
cmp eax, dword [esp + 0x1c]
jne 0x4029c4
xor ebx, ebx
jmp 0x402670
push eax
push 0x416278
push 0x176
push 0x416288
push str.usbip_err:__13s:_4d____12s__read_from_sock_ret__d_not_equal_a_usbip_header_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x18
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x20
ret
cmp dword [0x418e28], ebx
je 0x402a95
push eax
push ecx
push edx
push 0x4163f8
push 0x19a
push 0x416408
push str.usbip_err:__13s:_4d____12s__too_big_len__d__ld__ld_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x20
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x20
ret
cmp dword [0x418e28], 0
je 0x402a95
add eax, ecx
push eax
push ebx
push 0x41644c
push 0x1a2
push 0x41645c
push str.usbip_err:__13s:_4d____12s__recv_from_sock_failed__d__ld_n
jmp 0x402a84
cmp dword [0x418e28], 0
je 0x402a95
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x4164a8
push 0x1ab
push 0x4164b8
push str.usbip_err:__13s:_4d____12s__last_error:_ld_n_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x18
cmp dword [0x418e28], 0
je 0x402a95
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x10]
push edx
push esi
push eax
push 0x4164f8
push 0x1ac
push 0x416508
push str.usbip_err:__13s:_4d____12s__out:_ld_ret:_d_len:_d_n_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x20
cmp dword [0x418e28], 0
je 0x402a95
push str.write_to_dev
push 0x1ad
push 0x41655c
push str.usbip_err:__13s:_4d____12s__write_dev_failed_n
jmp 0x402851
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x20
ret
cmp dword [0x418e28], ebx
je 0x402a95
push eax
push esi
push 0x41659c
push 0x1c2
push 0x4165ac
push str.usbip_err:__13s:_4d____12s__read:_d_err:_d_n_n
call fcn.0040602e
add eax, 0x40
push eax
call fcn.004062a0
add esp, 0x1c
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x20
ret