Function at 0x4051c0
Capabilities:
Download and write a file
Get socket status
Receive and write data from server to client
Receive data
Receive data on socket
Send data
Send data on socket
Write file on windows

Disassembly:
sub esp, 0x510
push ebx
push ebp
push esi
mov esi, dword [esp + 0x520]
xor ebp, ebp
push edi
mov eax, dword [esi + 0x10]
lea edi, [esi + 0x4054]
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x528]
cmp eax, ebp
jne 0x405267
push 4
call sub.WSOCK32.dll_htons
mov word [edi], ax
mov word [edi + 2], bp
mov ecx, dword [esi + 0x18]
push ebp
push 4
push edi
push ecx
call sub.WSOCK32.dll_send
cmp eax, 4
je 0x405267
call fcn.00403340
push eax
push str.send
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edx, [esi + 0x426a]
push eax
push edx
lea eax, [esp + 0x130]
push str.File___s__:_error__d_in_system_call__s__s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
mov edx, dword [esi + 0x446c]
mov eax, dword [esi + 0x10]
lea ecx, [esp + 0x138]
push ecx
push edx
push eax
push ebp
call fcn.00408200
push ebp
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov dword [esi + 0x38], ebp
mov dword [esi + 0x34], ebp
mov eax, dword [esi + 0x34]
mov ecx, dword [esi + 0x18]
sub eax, ebp
mov dword [esp + 0x20], ecx
mov dword [esp + 0x1c], 1
mov dword [esp + 0x18], ebp
je 0x40529f
dec eax
je 0x405293
mov edx, dword [esi + 0x40]
mov dword [esp + 0x14], edx
jmp 0x4052ac
mov eax, dword [esi + 0x40]
inc eax
shr eax, 1
mov dword [esp + 0x14], eax
jmp 0x4052ac
mov ecx, dword [esi + 0x40]
add ecx, 3
shr ecx, 2
mov dword [esp + 0x14], ecx
lea edx, [esp + 0x14]
lea eax, [esp + 0x1c]
push edx
push ebp
push ebp
push eax
push 1
call sub.WSOCK32.dll_select
cmp eax, 0xffffffff
jne 0x405394
call fcn.00403340
push eax
push str.select
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea ecx, [esi + 0x426a]
push eax
push ecx
lea edx, [esp + 0x130]
push str.File___s__:_error__d_in_system_call__s__s
push edx
call dword [sym.imp.USER32.dll_wsprintfA]
mov ecx, dword [esi + 0x446c]
mov edx, dword [esi + 0x10]
lea eax, [esp + 0x138]
push eax
push ecx
push edx
push ebp
call fcn.00408200
push ebp
push esi
call fcn.004061d0
add esp, 0x30
mov edx, dword [esi + 0x24]
mov eax, dword [esi + 0x446c]
mov ecx, dword [esp + 0x10]
inc edx
push edx
push str.timeout_while_waiting_for_data_blk__d
push eax
push ecx
push 9
call fcn.00408200
mov eax, dword [esi + 0x34]
add esp, 0x14
inc eax
mov dword [esi + 0x34], eax
push 4
call sub.WSOCK32.dll_htons
lea edi, [esi + 0x4054]
mov word [edi], ax
mov dx, word [esi + 0x24]
push edx
call sub.WSOCK32.dll_htons
mov word [edi + 2], ax
mov eax, dword [esi + 0x18]
push ebp
push 4
push edi
push eax
call sub.WSOCK32.dll_send
mov ecx, dword [esi + 0x30]
mov eax, dword [esi + 0x3c]
cmp ecx, eax
mov eax, dword [0x416b20]
jne 0x4055c6
cmp dword [esi + 0x38], 0x32
jae 0x4055cc
cmp dword [esi + 0x34], eax
jae 0x4055c6
jmp 0x40526d
cmp eax, ebp
je 0x405317
mov eax, dword [esi + 0x18]
lea ebx, [esi + 0x50]
push ebp
push 0x4004
push ebx
push eax
call sub.WSOCK32.dll_recv
mov edi, eax
cmp edi, ebp
jle 0x40549e
cmp edi, 4
jb 0x4054fa
mov cx, word [ebx]
push ecx
call sub.WSOCK32.dll_ntohs
cmp ax, 3
jne 0x40552a
mov dx, word [ebx + 2]
push edx
call sub.WSOCK32.dll_ntohs
test ax, ax
jne 0x405428
cmp dword [esi + 0x24], ebp
jne 0x405428
lea eax, [edi - 4]
mov dword [esi + 0x30], eax
mov eax, dword [esi + 0x4470]
cmp eax, ebp
jne 0x405369
cmp dword [esi + 0x38], ebp
jne 0x405369
mov ecx, dword [esi + 0x446c]
mov edx, dword [esp + 0x10]
push str.WARNING:_First_block_sent_by_client_is_0__should_be_1__fixed_by_Tftpd32
push ecx
push edx
push 1
call fcn.00408200
mov eax, dword [esi + 0x24]
add esp, 0x10
dec eax
mov dword [esi + 0x24], eax
mov ax, word [ebx + 2]
push eax
call sub.WSOCK32.dll_ntohs
mov cx, word [esi + 0x24]
inc cx
cmp ax, cx
jne 0x40533e
mov edx, dword [esi + 0x34]
mov eax, dword [esi + 0x4474]
mov ecx, dword [esi + 0x24]
add eax, edx
mov dword [esi + 0x4474], eax
lea eax, [edi - 4]
lea edi, [esi + 0x30]
push ebp
push edi
push eax
mov dword [edi], eax
mov eax, dword [esi + 0x1c]
add ebx, 4
inc ecx
push ebx
push eax
mov dword [esi + 0x24], ecx
mov dword [esi + 0x34], ebp
mov dword [esi + 0x38], ebp
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x405569
mov ecx, dword [edi]
mov edx, dword [esi + 0x4470]
add edx, ecx
push esi
mov dword [esi + 0x4470], edx
call fcn.00404f90
add esp, 4
jmp 0x40533e
call fcn.00403340
push eax
push str.recv
call dword [sym.imp.KERNEL32.dll_GetLastError]
lea edx, [esi + 0x426a]
push eax
push edx
lea eax, [esp + 0x130]
push str.File___s__:_error__d_in_system_call__s__s
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
mov edx, dword [esi + 0x446c]
mov eax, dword [esi + 0x10]
lea ecx, [esp + 0x138]
push ecx
push edx
push eax
push ebp
call fcn.00408200
push ebp
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov ecx, dword [esi + 0x446c]
mov edx, dword [esp + 0x10]
push str.rcvd_packet_too_short
push ecx
push edx
push 1
call fcn.00408200
push 4
push esi
call fcn.004061d0
add esp, 0x18
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov ax, word [ebx]
push eax
call sub.WSOCK32.dll_ntohs
mov ecx, dword [esi + 0x446c]
mov edx, dword [esp + 0x10]
and eax, 0xffff
push eax
push str.Peer_sent_unexpected_message__d
push ecx
push edx
push 1
call fcn.00408200
push 4
push esi
call fcn.004061d0
add esp, 0x1c
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
call fcn.00403340
push eax
push str.write
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esi + 0x426a]
push eax
lea ecx, [esp + 0x130]
push str.File___s__:_error__d_in_system_call__s__s
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
mov eax, dword [esi + 0x446c]
mov ecx, dword [esi + 0x10]
lea edx, [esp + 0x138]
push edx
push eax
push ecx
push ebp
call fcn.00408200
push 3
push esi
call fcn.004061d0
add esp, 0x30
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
cmp dword [esi + 0x38], 0x32
jb 0x4055f2
mov ax, word [esi + 0x24]
mov ecx, dword [esi + 0x446c]
inc ax
lea edx, [esi + 0x426a]
and eax, 0xffff
push edx
mov edx, dword [esp + 0x14]
push eax
push str.MAX_RETRIES_while_waiting_for_Data_block__d._file___s_
push ecx
push edx
jmp 0x40561c
cmp dword [esi + 0x34], eax
jb 0x405639
mov cx, word [esi + 0x24]
mov edx, dword [esi + 0x446c]
inc cx
lea eax, [esi + 0x426a]
and ecx, 0xffff
push eax
mov eax, dword [esp + 0x14]
push ecx
push str.TIMEOUT_while_waiting_for_Data_block__d__file___s_
push edx
push eax
push ebp
call fcn.00408200
push ebp
push esi
call fcn.004061d0
add esp, 0x20
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x510
ret
mov dx, word [esi + 0x4268]
mov ecx, dword [esi + 0x10]
push edx
mov dword [esp + 0x18], ecx
call sub.WSOCK32.dll_ntohs
mov ebp, dword [esi + 0x24]
cmp ax, 1
jne 0x405657
dec ebp
mov eax, dword [esi + 0x4474]
mov ebx, 0x41b998
cmp eax, 1
mov dword [esp + 0x10], 0x415dd0
ja 0x405673
mov dword [esp + 0x10], ebx
cmp ebp, 1
jle 0x40567d
mov ebx, 0x415dd0
mov ax, word [esi + 0x4268]
push eax
call sub.WSOCK32.dll_ntohs
cmp ax, 1
mov edi, str.sent
je 0x40569a
mov edi, str.rcvd
mov ecx, dword [esp + 0x10]
mov edx, dword [esi + 0x4474]
push ecx
push edx
push 0
call fcn.0040b12b
mov ecx, dword [esi + 0x447c]
add esp, 4
sub eax, ecx
mov edx, dword [esi + 0x446c]
push eax
mov eax, dword [esi + 0x4470]
push eax
mov eax, dword [esp + 0x24]
push ebx
push ebp
lea ecx, [esi + 0x426a]
push edi
push ecx
push str.__s_:__s__d_blk_s___d_bytes_in__d_s.__d_blk_s_resent
push edx
push eax
push 2
call fcn.00408200
mov eax, dword [0x416b4c]
add esp, 0x30
test eax, eax
je 0x40570d
push 0
call fcn.0040b12b
mov edx, dword [esi + 0x447c]
add esp, 4
sub eax, edx
cmp eax, 0xa
jle 0x40570d
push 0x40
call dword [sym.imp.USER32.dll_MessageBeep]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x510
ret