Function at 0x406b10
Capabilities:
Download and write a file
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:
push ebx
mov ebx, dword [esp + 8]
push ebp
mov ebp, dword [ebx + 0x10]
push esi
push edi
xor edi, edi
cmp dword [esp + 0x18], edi
lea esi, [ebx + 0x405c]
jne 0x406b5e
push 4
call sub.WSOCK32.dll_htons
push edi
push 4
mov word [esi], ax
mov word [esi + 2], di
mov eax, dword [ebx + 0x18]
push esi
push eax
call sub.WSOCK32.dll_send
cmp eax, 4
je 0x406b5e
push edi
mov esi, str.send
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
cmp dword [ebx + 0x4494], edi
mov dword [ebx + 0x3c], edi
mov dword [ebx + 0x38], edi
je 0x406b80
lea ecx, [ebx + 0x4498]
push ecx
call fcn.00403860
add esp, 4
jmp 0x406b80
mov edi, ebx
call fcn.00405e60
test eax, eax
je 0x406c9d
mov edx, dword [ebx + 0x18]
push 0
push 0x4004
lea edi, [ebx + 0x58]
push edi
push edx
call sub.WSOCK32.dll_recv
mov esi, eax
test esi, esi
jle 0x406d49
push ebx
call fcn.00408fc0
add esp, 4
cmp esi, 4
jb 0x406d5f
movzx eax, word [edi]
push eax
call sub.WSOCK32.dll_ntohs
cmp ax, 3
jne 0x406d84
movzx ecx, word [edi + 2]
push ecx
call sub.WSOCK32.dll_ntohs
test ax, ax
jne 0x406c1f
cmp dword [ebx + 0x28], 0
jne 0x406c1f
cmp dword [ebx + 0x4478], 0
lea edx, [esi - 4]
mov dword [ebx + 0x34], edx
jne 0x406ceb
cmp dword [ebx + 0x3c], 0
jne 0x406ceb
mov eax, dword [ebx + 0x4474]
push str.WARNING:_First_block_sent_by_client_is_0__should_be_1__fixed_by_Tftpd32
push eax
push ebp
push 1
call fcn.00409890
add esp, 0x10
add dword [ebx + 0x28], 0xffffffff
movzx ecx, word [edi + 2]
push ecx
call sub.WSOCK32.dll_ntohs
mov dx, word [ebx + 0x28]
add dx, 1
cmp ax, dx
jne 0x406cbf
mov eax, dword [ebx + 0x38]
add dword [ebx + 0x447c], eax
add dword [ebx + 0x28], 1
xor ecx, ecx
push ecx
lea eax, [esi - 4]
lea esi, [ebx + 0x34]
push esi
push eax
mov dword [ebx + 0x38], ecx
mov dword [ebx + 0x3c], ecx
mov ecx, dword [ebx + 0x1c]
add edi, 4
push edi
push ecx
mov dword [esi], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x406db6
cmp dword [ebx + 0x4494], 0
je 0x406c8c
mov edx, dword [esi]
push edx
lea eax, [ebx + 0x4498]
push edi
push eax
call fcn.00403f60
add esp, 0xc
mov ecx, dword [esi]
add dword [ebx + 0x4478], ecx
mov esi, ebx
call fcn.00405400
jmp 0x406cbf
mov edx, dword [ebx + 0x28]
mov eax, dword [ebx + 0x4474]
add edx, 1
push edx
push str.timeout_while_waiting_for_data_blk__d
push eax
push ebp
push 9
call fcn.00409890
add esp, 0x14
add dword [ebx + 0x38], 1
push 4
call sub.WSOCK32.dll_htons
lea esi, [ebx + 0x405c]
mov word [esi], ax
movzx ecx, word [ebx + 0x28]
push ecx
call sub.WSOCK32.dll_htons
push 0
push 4
mov word [esi + 2], ax
mov edx, dword [ebx + 0x18]
push esi
push edx
call sub.WSOCK32.dll_send
mov eax, dword [ebx + 0x34]
cmp eax, dword [ebx + 0x40]
mov eax, dword [0x41e388]
jne 0x406d07
cmp dword [ebx + 0x3c], 0x32
jae 0x406d11
cmp dword [ebx + 0x38], eax
jb 0x406b80
cmp dword [ebx + 0x3c], 0x32
jb 0x406dcc
mov ax, word [ebx + 0x28]
add ax, 1
lea edx, [ebx + 0x4272]
push edx
mov edx, dword [ebx + 0x4474]
movzx ecx, ax
push ecx
push str.MAX_RETRIES_while_waiting_for_Data_block__d._file___s_
push edx
push ebp
push 0
call fcn.00409890
push 0
call fcn.004057e0
add esp, 0x1c
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
push 0
mov esi, str.recv
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
mov ecx, dword [ebx + 0x4474]
push str.rcvd_packet_too_short
push ecx
push ebp
push 1
call fcn.00409890
push 4
call fcn.004057e0
add esp, 0x14
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
movzx edx, word [edi]
push edx
call sub.WSOCK32.dll_ntohs
mov ecx, dword [ebx + 0x4474]
movzx eax, ax
push eax
push str.Peer_sent_unexpected_message__d
push ecx
push ebp
push 1
call fcn.00409890
push 4
call fcn.004057e0
add esp, 0x18
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
push 3
mov esi, str.write
mov ecx, ebx
call fcn.00405de0
add esp, 4
pop edi
pop esi
pop ebp
pop ebx
ret
cmp dword [ebx + 0x38], eax
jb 0x406e09
mov cx, word [ebx + 0x28]
add cx, 1
lea eax, [ebx + 0x4272]
push eax
mov eax, dword [ebx + 0x4474]
movzx edx, cx
push edx
push str.TIMEOUT_while_waiting_for_Data_block__d__file___s_
push eax
push ebp
push 0
call fcn.00409890
push 0
call fcn.004057e0
add esp, 0x1c
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
ret
cmp dword [ebx + 0x4494], 0
je 0x406e1f
cmp dword [ebx + 0x24], 0
jne 0x406e1f
mov esi, ebx
call fcn.004051d0
push ebx
call fcn.004056d0
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
ret