Function at 0x401685
Capabilities:
Get socket status

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x1588
call fcn.00405270
push esi
push edi
mov word [ebp - 8], 0x3e8
mov dword [ebp - 0x10], 0
mov dword [ebp - 4], 0
cmp dword [ebp + 8], 0
jne 0x4016c6
push 0x12f
push str.nbtscan.c
push str.ofp___0
call dword [sym.imp.MSVCRT.dll__assert]
add esp, 0xc
cmp dword [ebp + 0xc], 0xffffffff
jne 0x4016e4
push 0x130
push str.nbtscan.c
push str.SOCKET_IS_VALID_sockfd_
call dword [sym.imp.MSVCRT.dll__assert]
add esp, 0xc
cmp dword [ebp - 4], 0
jne 0x401709
lea edx, [ebp - 0xc]
push edx
call fcn.004039d0
add esp, 4
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0
jne 0x401709
cmp dword [ebp - 0x10], 0
jle 0x401b58
mov dword [ebp - 0x114], 0
mov dword [ebp - 0x218], 0
mov dword [ebp - 0x32c], 0
jmp 0x401738
mov eax, dword [ebp - 0x32c]
add eax, 1
mov dword [ebp - 0x32c], eax
mov ecx, dword [ebp - 0x32c]
cmp ecx, dword [ebp - 0x218]
jae 0x40175c
mov edx, dword [ebp - 0x32c]
mov eax, dword [ebp + edx*4 - 0x214]
cmp eax, dword [ebp + 0xc]
jne 0x40175a
jmp 0x40175c
jmp 0x401729
mov ecx, dword [ebp - 0x32c]
cmp ecx, dword [ebp - 0x218]
jne 0x401792
cmp dword [ebp - 0x218], 0x40
jae 0x401792
mov edx, dword [ebp - 0x32c]
mov eax, dword [ebp + 0xc]
mov dword [ebp + edx*4 - 0x214], eax
mov ecx, dword [ebp - 0x218]
add ecx, 1
mov dword [ebp - 0x218], ecx
xor edx, edx
test edx, edx
jne 0x40171d
mov eax, dword [0x408018]
push eax
lea ecx, [ebp - 0x220]
push ecx
call fcn.00405010
cmp dword [ebp - 4], 0
je 0x4017cf
mov ecx, 0x41
lea esi, [ebp - 0x218]
lea edi, [ebp - 0x324]
rep movsd dword es:[edi], dword [esi]
lea edx, [ebp - 0x324]
mov dword [ebp - 0x114], edx
lea eax, [ebp - 0x220]
push eax
push 0
mov ecx, dword [ebp - 0x114]
push ecx
lea edx, [ebp - 0x218]
push edx
mov eax, dword [ebp + 0xc]
add eax, 1
push eax
call dword [sym.imp.WSOCK32.dll_select]
mov dword [ebp - 0x328], eax
cmp dword [ebp - 0x328], 0
jne 0x40182c
push str.timeout__normal_end_of_scan__n
mov ecx, dword [sym.imp.MSVCRT.dll__iob]
add ecx, 0x40
push ecx
call dword [sym.imp.MSVCRT.dll_fprintf]
add esp, 8
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.MSVCRT.dll_fflush]
add esp, 4
jmp 0x401b58
cmp dword [ebp - 0x328], 0
jge 0x40185b
call dword [sym.imp.MSVCRT.dll__errno]
mov eax, dword [eax]
push eax
call dword [sym.imp.MSVCRT.dll_strerror]
add esp, 4
push eax
push str.ERROR___s__n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 8
jmp 0x401b58
cmp dword [ebp - 0x328], 0
jle 0x401a3e
lea ecx, [ebp - 0x218]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x401a3e
push 0x10
push 0
lea eax, [ebp - 0x340]
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
push 0xa18
push 0
lea ecx, [ebp - 0xd58]
push ecx
call sub.MSVCRT.dll_memset
add esp, 0xc
lea edx, [ebp - 0x340]
push edx
push 0x40c
lea eax, [ebp - 0x1164]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
call fcn.00401b7b
add esp, 0x10
mov dword [ebp - 0x330], eax
cmp dword [0x408048], 0
je 0x40195b
cmp dword [ebp - 0x330], 0
jge 0x40190b
call dword [sym.imp.MSVCRT.dll__errno]
mov edx, dword [eax]
push edx
call dword [sym.imp.MSVCRT.dll_strerror]
add esp, 4
push eax
push str.Error_on_read:__s_n
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.MSVCRT.dll_fprintf]
add esp, 0xc
jmp 0x40195b
mov ecx, dword [ebp - 0x33c]
push ecx
call dword [sym.imp.WSOCK32.dll_inet_ntoa]
push eax
mov edx, dword [ebp - 0x330]
push edx
push str.Got__d_bytes_from__s_n
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.MSVCRT.dll_fprintf]
add esp, 0x10
cmp dword [0x408048], 1
jle 0x40195b
mov ecx, dword [sym.imp.MSVCRT.dll__iob]
add ecx, 0x20
push ecx
mov edx, dword [ebp - 0x330]
push edx
lea eax, [ebp - 0x1164]
push eax
call fcn.00401f40
add esp, 0xc
cmp dword [ebp - 0x330], 0
jg 0x401969
jmp 0x4016e4
mov ecx, dword [ebp - 0x10]
sub ecx, 1
mov dword [ebp - 0x10], ecx
lea edx, [ebp - 0x110]
push edx
lea eax, [ebp - 0xd58]
push eax
mov ecx, dword [ebp - 0x330]
push ecx
lea edx, [ebp - 0x1164]
push edx
call fcn.004031f0
add esp, 0x10
test eax, eax
je 0x401a17
mov eax, dword [ebp - 0x340]
mov dword [ebp - 0xd58], eax
mov ecx, dword [ebp - 0x33c]
mov dword [ebp - 0xd54], ecx
mov edx, dword [ebp - 0x338]
mov dword [ebp - 0xd50], edx
mov eax, dword [ebp - 0x334]
mov dword [ebp - 0xd4c], eax
lea ecx, [ebp - 0xd54]
push ecx
call fcn.00403910
add esp, 4
test eax, eax
je 0x401a15
cmp dword [0x408054], 0
je 0x4019fb
lea edx, [ebp - 0xd58]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.00403d6b
add esp, 8
jmp 0x401a15
mov ecx, dword [0x408058]
push ecx
lea edx, [ebp - 0xd58]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.00402de0
add esp, 0xc
jmp 0x401a3e
lea ecx, [ebp - 0x110]
push ecx
mov edx, dword [ebp - 0x33c]
push edx
call dword [sym.imp.WSOCK32.dll_inet_ntoa]
push eax
push str.ERROR:_no_parse_for__s_____s_n
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.MSVCRT.dll_fprintf]
add esp, 0x10
cmp dword [ebp - 0x328], 0
jle 0x401b53
cmp dword [ebp - 0x114], 0
je 0x401b53
mov ecx, dword [ebp - 0x114]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call sub.WSOCK32.dll___WSAFDIsSet
test eax, eax
je 0x401b53
push 0x10
push 0
lea eax, [ebp - 0x1178]
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
mov word [ebp - 0x1178], 2
mov ecx, dword [ebp - 0xc]
mov dword [ebp - 0x1174], ecx
mov dx, word [0x408020]
push edx
call dword [sym.imp.WSOCK32.dll_htons]
mov word [ebp - 0x1176], ax
mov dword [ebp - 4], 0
mov ax, word [ebp - 8]
mov word [ebp - 0x1586], ax
mov cx, word [ebp - 0x1586]
push ecx
lea edx, [ebp - 0x1168]
push edx
lea eax, [ebp - 0x1584]
push eax
mov cx, word [ebp - 8]
add cx, 1
mov word [ebp - 8], cx
call fcn.00401b98
add esp, 0xc
cmp dword [0x408048], 0
je 0x401b0f
mov edx, dword [ebp - 0x1174]
push edx
call dword [sym.imp.WSOCK32.dll_inet_ntoa]
push eax
push str.sending_to__s_n
mov eax, dword [ebp + 8]
push eax
call dword [sym.imp.MSVCRT.dll_fprintf]
add esp, 0xc
lea ecx, [ebp - 0x1178]
push ecx
mov edx, dword [ebp - 0x1168]
push edx
lea eax, [ebp - 0x1584]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
call fcn.00401b5e
add esp, 0x10
cmp dword [0x40801c], 0
jle 0x401b45
mov edx, dword [0x40801c]
push edx
call fcn.00404f40
mov eax, dword [ebp - 0x10]
add eax, 1
mov dword [ebp - 0x10], eax
jmp 0x4016e4
jmp 0x4016e4
pop edi
pop esi
mov esp, ebp
pop ebp
ret