Function at 0x40cb67
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 ebp
mov ebp, esp
push ebx
push esi
push edi
mov ebx, eax
xor edi, edi
cmp ebx, edi
jne 0x40cb8c
push 0x355
push str.._services_tftpd_thread.c
push str.pTftp_NULL
call fcn.00410334
add esp, 0xc
lea esi, [ebx + 0x4064]
cmp dword [ebp + 8], edi
jne 0x40cbce
push 4
call dword [sym.imp.WS2_32.dll_htons]
push edi
mov word [esi], ax
push 4
xor eax, eax
push esi
mov word [esi + 2], ax
push dword [ebx + 0x20]
call dword [sym.imp.WS2_32.dll_send]
cmp eax, 4
je 0x40cbce
push str.send
push edi
mov eax, ebx
call fcn.0040bc5f
pop ecx
pop ecx
jmp 0x40ce06
mov dword [ebx + 0x40], edi
mov dword [ebx + 0x3c], edi
cmp dword [ebx + 0x4518], edi
je 0x40cbe9
lea eax, [ebx + 0x451c]
push eax
call fcn.0040ecd8
pop ecx
mov esi, ebx
call fcn.0040bc98
test eax, eax
je 0x40cd15
push edi
push 0x4004
lea esi, [ebx + 0x60]
push esi
push dword [ebx + 0x20]
call dword [sym.imp.WS2_32.dll_recv]
mov dword [ebp + 8], eax
cmp eax, edi
jle 0x40cd79
cmp eax, 4
jb 0x40cd83
movzx eax, word [esi]
mov edi, dword [sym.imp.WS2_32.dll_ntohs]
push eax
call edi
cmp ax, 3
jne 0x40cd9d
movzx eax, word [esi + 2]
push eax
call edi
test ax, ax
jne 0x40cc77
xor eax, eax
cmp dword [ebx + 0x2c], eax
jne 0x40cc77
mov ecx, dword [ebp + 8]
add ecx, 0xfffffffc
mov dword [ebx + 0x38], ecx
cmp dword [ebx + 0x44f4], eax
jne 0x40cd2e
cmp dword [ebx + 0x40], eax
jne 0x40cd2e
push str.WARNING:_First_block_sent_by_client_is_0__should_be_1__fixed_by_Tftpd32
push 1
call fcn.00407001
dec dword [ebx + 0x2c]
pop ecx
pop ecx
movzx eax, word [esi + 2]
push eax
call edi
mov cx, word [ebx + 0x2c]
inc cx
cmp ax, cx
jne 0x40cce4
mov eax, dword [ebx + 0x3c]
add dword [ebx + 0x44f8], eax
mov eax, dword [ebp + 8]
inc dword [ebx + 0x2c]
and dword [ebx + 0x3c], 0
and dword [ebx + 0x40], 0
push 0
lea edi, [ebx + 0x38]
push edi
add eax, 0xfffffffc
push eax
add esi, 4
push esi
push dword [ebx + 0x24]
mov dword [edi], eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40cdbf
cmp dword [ebx + 0x4518], 0
je 0x40ccdc
push dword [edi]
lea eax, [ebx + 0x451c]
push esi
push eax
call fcn.0040f477
add esp, 0xc
mov eax, dword [edi]
add dword [ebx + 0x44f4], eax
xor edi, edi
push 4
call dword [sym.imp.WS2_32.dll_htons]
lea esi, [ebx + 0x4064]
mov word [esi], ax
movzx eax, word [ebx + 0x2c]
push eax
call dword [sym.imp.WS2_32.dll_htons]
push edi
push 4
push esi
mov word [esi + 2], ax
push dword [ebx + 0x20]
call dword [sym.imp.WS2_32.dll_send]
jmp 0x40cd30
mov eax, dword [ebx + 0x2c]
inc eax
push eax
push str.timeout_while_waiting_for_data_blk__d
push 9
call fcn.00407001
add esp, 0xc
inc dword [ebx + 0x3c]
jmp 0x40cce6
xor edi, edi
mov eax, dword [ebx + 0x38]
cmp eax, dword [ebx + 0x48]
mov eax, dword [0x429b3c]
jne 0x40cd4c
cmp dword [ebx + 0x40], 0x32
jae 0x40cd52
cmp dword [ebx + 0x3c], eax
jb 0x40cbe9
cmp dword [ebx + 0x40], 0x32
jb 0x40cdcb
lea eax, [ebx + 0x42ea]
push eax
mov ax, word [ebx + 0x2c]
inc ax
movzx eax, ax
push eax
push str.MAX_RETRIES_while_waiting_for_Data_block__d._file___s_
push edi
call fcn.00407001
push edi
call fcn.0040b99f
add esp, 0x14
jmp 0x40cd99
push str.recv
jmp 0x40cbbf
push str.rcvd_packet_too_short
push 1
call fcn.00407001
push 4
call fcn.0040b99f
add esp, 0xc
xor eax, eax
jmp 0x40ce06
movzx eax, word [esi]
push eax
call edi
movzx eax, ax
push eax
push str.Peer_sent_unexpected_message__d
push 1
call fcn.00407001
push 4
call fcn.0040b99f
add esp, 0x10
jmp 0x40cd99
push str.write
push 3
jmp 0x40cbc0
cmp dword [ebx + 0x3c], eax
jb 0x40cde8
lea eax, [ebx + 0x42ea]
push eax
mov ax, word [ebx + 0x2c]
inc ax
movzx eax, ax
push eax
push str.TIMEOUT_while_waiting_for_Data_block__d__file___s_
jmp 0x40cd68
cmp dword [ebx + 0x4518], edi
je 0x40cdfc
cmp dword [ebx + 0x28], edi
jne 0x40cdfc
mov ecx, ebx
call fcn.0040ba8a
mov esi, ebx
call fcn.0040c5db
xor eax, eax
inc eax
pop edi
pop esi
pop ebx
pop ebp
ret