Function at 0x40d591
Capabilities:
Get file size
Get local ipv4 addresses
Get socket information
Resolve dns

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4d4
mov eax, dword [0x4294a4]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
mov ebx, ecx
movzx eax, word [ebx + 0x42e8]
push esi
push edi
xor esi, esi
push eax
mov dword [ebp - 0x4c8], esi
mov byte [ebx + 0x44e5], 0
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
mov dword [ebp - 0x4bc], eax
cmp eax, 1
je 0x40d607
cmp eax, 2
je 0x40d607
push eax
push str.Unexpected_request__d_from_peer
push esi
call fcn.0040764f
add esp, 0xc
push str.Returning_EBADOP_to_Peer
push esi
call fcn.0040764f
push 4
call fcn.0040d211
add esp, 0xc
mov eax, 0x3ec
jmp 0x40dda4
mov esi, dword [sym.imp.KERNEL32.dll_lstrlenA]
lea edi, [ebx + 0x42ea]
push edi
call esi
cmp eax, 0x104
jl 0x40d626
push 0x42ac1c
push 0
jmp 0x40d5ee
push 0x25
push edi
call fcn.004129a0
pop ecx
pop ecx
test eax, eax
je 0x40d644
push str.Error:_Tftpd32_does_not_handle_filenames_with_a_percent_sign
push 1
call fcn.0040764f
push 2
jmp 0x40d5f5
push edi
push str.FileName_is___s_
push 9
call fcn.0040764f
add esp, 0xc
cmp dword [ebp - 0x4bc], 1
jne 0x40d66b
cmp dword [0x42bfec], 0
je 0x40d66b
call fcn.0040eafb
push edi
call esi
mov edi, dword [sym.imp.KERNEL32.dll_lstrcmpiA]
mov esi, eax
lea eax, [esi + ebx + 0x42eb]
push str.netascii
push eax
call edi
test eax, eax
je 0x40d701
push str.ascii
lea eax, [esi + ebx + 0x42eb]
push eax
call edi
test eax, eax
je 0x40d701
push str.mail
lea eax, [esi + ebx + 0x42eb]
push eax
call edi
test eax, eax
jne 0x40d6b8
mov dword [ebx + 0x50], 2
jmp 0x40d708
push 0x42acb8
lea eax, [esi + ebx + 0x42eb]
push eax
call edi
test eax, eax
je 0x40d6fb
push str.binary
lea eax, [esi + ebx + 0x42eb]
push eax
call edi
test eax, eax
je 0x40d6fb
push str.OCTET
lea eax, [esi + ebx + 0x42eb]
push eax
call edi
test eax, eax
je 0x40d6fb
push str.Uncorrect_message
jmp 0x40d622
and dword [ebx + 0x50], 0
jmp 0x40d708
mov dword [ebx + 0x50], 1
lea edi, [esi + ebx + 0x42eb]
push edi
push str.Mode_is___s_
push 0xc
call fcn.0040764f
add esp, 0xc
push edi
call dword [sym.imp.KERNEL32.dll_lstrlenA]
cmp dword [ebp - 0x4bc], 1
lea eax, [esi + eax + 2]
mov dword [ebp - 0x4b8], eax
mov eax, str.Read
je 0x40d743
mov eax, str.Write
push edi
lea esi, [ebx + 0x42ea]
push esi
push eax
push str._s_request_for_file___s_._Mode__s
push 1
call fcn.0040764f
add esp, 0x14
call fcn.0040d2a7
push dword [ebp - 0x4bc]
mov edi, esi
call fcn.0040d14f
pop ecx
test eax, eax
jne 0x40d79a
call fcn.004104c7
push eax
lea eax, [ebx + 0x42ea]
push eax
push str.Error_EACCESS_on_file__s._Ext_error__s
push 1
call fcn.0040764f
push 2
call fcn.0040d211
add esp, 0x14
jmp 0x40d5fd
mov esi, dword [sym.imp.KERNEL32.dll_lstrcpyA]
push 0x42c32c
lea eax, [ebp - 0x230]
push eax
call esi
mov edi, dword [sym.imp.KERNEL32.dll_lstrlenA]
lea eax, [ebp - 0x230]
push eax
call edi
test eax, eax
jle 0x40d7d4
cmp byte [ebp + eax - 0x231], 0x5c
je 0x40d7d4
mov byte [ebp + eax - 0x230], 0x5c
inc eax
lea ecx, [ebx + 0x42ea]
push ecx
lea eax, [ebp + eax - 0x230]
push eax
call esi
lea eax, [ebp - 0x230]
push eax
push str.final_name_:___s_
push 0xa
call fcn.0040764f
add esp, 0xc
lea eax, [ebp - 0x230]
push eax
call edi
cmp eax, 0x104
jl 0x40d815
push str.File_name_too_long__return_EBADOP_to_peer
jmp 0x40d622
mov eax, dword [ebp - 0x4bc]
xor esi, esi
dec eax
neg eax
sbb eax, eax
push esi
add eax, 3
push 0x8000020
push eax
mov eax, dword [ebp - 0x4bc]
dec eax
neg eax
sbb eax, eax
push esi
and eax, 0xc0000000
push 1
add eax, 0x80000000
push eax
lea eax, [ebp - 0x230]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebx + 0x24], eax
cmp eax, 0xffffffff
jne 0x40d87b
xor eax, eax
cmp dword [ebp - 0x4bc], 1
push str.CreateFile
setne al
inc eax
push eax
mov eax, ebx
call fcn.0040d4d1
pop ecx
pop ecx
jmp 0x40d5fd
push esi
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push 0x204
lea esi, [ebx + 0x4064]
push 0
push esi
mov dword [ebx + 0x44fc], eax
call fcn.00414720
add esp, 0xc
push 6
call dword [sym.imp.WS2_32.dll_htons]
mov word [esi], ax
add esi, 2
mov dword [ebp - 0x4d0], esi
xor edx, edx
cmp dword [0x42bfe0], edx
jne 0x40d8c9
cmp dword [0x42bfe4], edx
je 0x40dcac
cmp dword [ebp - 0x4b8], 0x200
jge 0x40dcac
mov eax, dword [ebp - 0x4b8]
lea eax, [ebx + eax + 0x42ea]
mov dword [ebp - 0x4b4], eax
cmp byte [eax], dl
jne 0x40d8f8
inc dword [ebp - 0x4b8]
jmp 0x40d8b3
push eax
push str.Option_is___s_
push 0xc
call fcn.0040764f
add esp, 0xc
mov eax, dword [ebp - 0x4b8]
cmp byte [ebx + eax + 0x42ea], 0
je 0x40d926
inc eax
mov dword [ebp - 0x4b8], eax
cmp eax, 0x200
jl 0x40d908
lea ecx, [eax + ebx + 0x42eb]
inc eax
mov dword [ebp - 0x4c4], ecx
mov dword [ebp - 0x4b8], eax
cmp eax, 0x200
jge 0x40d8b3
mov eax, dword [ebp - 0x4b8]
cmp byte [ebx + eax + 0x42ea], 0
je 0x40d967
inc dword [ebp - 0x4b8]
cmp dword [ebp - 0x4b8], 0x200
jl 0x40d945
cmp dword [ebp - 0x4b8], 0x200
jge 0x40d8b3
mov eax, dword [ebp - 0x4b8]
cmp byte [ebx + eax + 0x42ea], 0
jne 0x40d8b3
push ecx
push dword [ebp - 0x4b4]
push str.Option___s_:_value___s_
push 0xc
call fcn.0040764f
add esp, 0x10
cmp dword [0x42bfe4], 0
jne 0x40db27
push 0x42adc4
push dword [ebp - 0x4b4]
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x40da95
push dword [ebp - 0x4c4]
call fcn.00412a74
pop ecx
mov dword [ebp - 0x4c0], eax
cmp eax, 8
jae 0x40d9f4
push eax
push dword [ebp - 0x4b4]
push str.__s__proposed_by_client__d__refused_by_Tftpd32
push 9
call fcn.0040764f
add esp, 0x10
mov eax, 0x4000
cmp dword [ebp - 0x4c0], eax
jbe 0x40da29
push eax
push dword [ebp - 0x4c0]
push dword [ebp - 0x4b4]
push str.__s__proposed_by_client__d__reply_with__d
push 2
call fcn.0040764f
add esp, 0x14
mov dword [ebx + 0x48], 0x4000
mov eax, 0x4000
cmp dword [ebp - 0x4c0], 8
jb 0x40da95
cmp dword [ebp - 0x4c0], eax
ja 0x40da5e
push dword [ebp - 0x4c4]
push dword [ebp - 0x4b4]
push 0x42ae28
push 9
call fcn.0040764f
mov eax, dword [ebp - 0x4c0]
add esp, 0x10
mov dword [ebx + 0x48], eax
push dword [ebp - 0x4b4]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push esi
call edi
push dword [ebx + 0x48]
lea esi, [esi + eax + 1]
push 0x42ae40
push esi
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
push esi
call edi
lea esi, [esi + eax + 1]
mov dword [ebp - 0x4c8], 1
cmp dword [0x42bfe4], 0
jne 0x40db27
push str.timeout
push dword [ebp - 0x4b4]
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x40db27
push dword [ebp - 0x4c4]
call fcn.00412a74
mov dword [ebp - 0x4c0], eax
dec eax
pop ecx
cmp eax, 0xfe
ja 0x40db27
push dword [ebp - 0x4c4]
push dword [ebp - 0x4b4]
push str.__s__changed_to___s_
push 9
call fcn.0040764f
add esp, 0x10
push dword [ebp - 0x4b4]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push esi
call edi
push dword [ebp - 0x4c4]
lea esi, [esi + eax + 1]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push esi
call edi
lea esi, [esi + eax + 1]
mov eax, dword [ebp - 0x4c0]
mov dword [ebp - 0x4c8], 1
mov dword [ebx + 0x4c], eax
push 0x42ae64
push dword [ebp - 0x4b4]
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x40dbd4
push dword [ebp - 0x4b4]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push dword [ebp - 0x4b4]
call edi
cmp dword [ebp - 0x4bc], 1
lea esi, [esi + eax + 1]
jne 0x40db86
push dword [ebx + 0x44fc]
push 0x42ae6c
push esi
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
push esi
call edi
lea esi, [esi + eax + 1]
mov eax, dword [ebx + 0x44fc]
jmp 0x40dbac
push dword [ebp - 0x4c4]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push esi
call edi
push dword [ebp - 0x4c4]
lea esi, [esi + eax + 1]
call fcn.00412a74
pop ecx
mov dword [ebx + 0x44fc], eax
push dword [ebx + 0x44fc]
mov dword [ebx + 0x58], eax
push dword [ebp - 0x4b4]
push str.__s__changed_to___u_
push 0xa
call fcn.0040764f
add esp, 0x10
mov dword [ebp - 0x4c8], 1
cmp dword [0x42c314], 0
je 0x40d8b3
push 0x42ae88
push dword [ebp - 0x4b4]
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x40d8b3
lea eax, [ebp - 0x4cc]
push eax
lea eax, [ebp - 0x4b0]
push eax
push dword [ebx + 0x20]
mov dword [ebp - 0x4cc], 0x80
call dword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
js 0x40d8b3
push 8
push 0x20
lea eax, [ebp - 0x24]
push eax
push 0
push 0
push 0x80
lea eax, [ebp - 0x4b0]
push eax
call dword [sym.imp.WS2_32.dll_getnameinfo]
lea eax, [ebp - 0x24]
push eax
push str.using_udpport_option______s
call fcn.00410209
pop ecx
pop ecx
push dword [ebp - 0x4b4]
push esi
call dword [sym.imp.KERNEL32.dll_lstrcpyA]
push dword [ebp - 0x4b4]
call edi
lea esi, [esi + eax + 1]
lea eax, [ebp - 0x24]
push eax
call fcn.00412a74
pop ecx
push eax
call dword [sym.imp.WS2_32.dll_htons]
movzx eax, ax
push eax
push 0x42aeac
push esi
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
push esi
call edi
lea esi, [esi + eax + 1]
mov eax, dword [0x42bfd8]
mov dword [ebx + 0x44], eax
mov dword [ebp - 0x4c8], 1
jmp 0x40d8b3
lea ecx, [ebx + 0x4064]
xor eax, eax
sub esi, ecx
inc eax
lea edi, [esi - 2]
mov dword [ebx + 0x38], edi
cmp dword [ebp - 0x4bc], eax
jne 0x40dccd
cmp dword [ebp - 0x4c8], edx
je 0x40dccf
xor eax, eax
mov ecx, dword [ebx + 0x48]
mov dword [ebx + 0x34], eax
mov dword [ebx + 0x2c], eax
mov eax, dword [ebx + 0x44fc]
xor edx, edx
div ecx
xor edx, edx
inc eax
mov dword [ebx + 0x30], eax
mov eax, dword [0x42bfd0]
div ecx
cmp dword [ebp - 0x4c8], 0
mov dword [ebx + 0x54], eax
je 0x40dd93
push 0x200
lea eax, [ebp - 0x430]
push 0
push eax
call fcn.00414720
add esp, 0xc
push edi
push dword [ebp - 0x4d0]
lea eax, [ebp - 0x430]
push eax
call fcn.004147a0
add esi, 0xfffffffe
add esp, 0xc
xor edi, edi
xor edx, edx
test esi, esi
jle 0x40dd58
lea eax, [ebp + edi - 0x430]
cmp byte [eax], 0
jne 0x40dd53
mov ecx, edx
inc edx
and cl, 1
je 0x40dd4e
push 0x2c
jmp 0x40dd50
push 0x3d
pop ecx
mov byte [eax], cl
inc edi
cmp edi, esi
jl 0x40dd36
lea eax, [ebp - 0x430]
push eax
push str.OACK:___s_
push 3
call fcn.0040764f
add esp, 0xc
push dword [ebx + 0x38]
push str.Size_of_OACK_string_:___d_
push 0xd
call fcn.0040764f
xor eax, eax
add esp, 0xc
cmp dword [ebp - 0x4bc], 1
setne al
add eax, 0x3e8
jmp 0x40dda4
xor eax, eax
cmp dword [ebp - 0x4bc], 1
setne al
add eax, 0x3ea
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00411a98
leave
ret