Function at 0x405282
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push rbp
mov rbp, rsp
push rsi
push rbx
add rsp, 0xffffffffffffff80
mov dword [rbp + 0x10], ecx
mov qword [rbp + 0x18], rdx
call fcn.00406e00
mov qword [rbp - 0x18], 0
mov qword [rbp - 0x48], 0
mov qword [rbp - 0x20], 0
mov qword [rbp - 0x28], 0
mov word [rbp - 0x2a], 0
mov word [rbp - 0x2c], 0
mov word [rbp - 0x4a], 0
mov word [rbp - 0x2e], 0
mov word [rbp - 0x30], 0
mov qword [rbp - 0x38], 0
mov dword [rbp - 0x3c], 0
call fcn.00402f70
mov ecx, 0x10
call fcn.0040371e
mov qword [0x0040b098], rax
mov ecx, 0x10
call fcn.0040371e
mov qword [0x0040b0a0], rax
mov ecx, 0x2000
call fcn.0040371e
mov qword [0x0040bba8], rax
mov ecx, 0x2000
call fcn.0040371e
mov qword [0x0040ba90], rax
mov ecx, 0x208
call fcn.0040371e
mov qword [0x0040bba0], rax
mov ecx, 0x208
call fcn.0040371e
mov qword [0x0040ba88], rax
mov ecx, 0x4a
call fcn.0040371e
mov qword [0x0040b0b8], rax
mov ecx, 1
call sub.msvcrt.dll_malloc
mov qword [0x0040bbb0], rax
mov rax, qword [0x0040bbb0]
mov byte [rax], 1
mov rax, qword [sym.imp.msvcrt.dll__errno]
call rax
mov dword [rax], 0
mov dword [0x00408028], 4
jmp 0x40539b
nop
jmp 0x40539b
nop
cmp dword [rbp + 0x10], 1
jne 0x4058bb
mov rax, qword [rbp + 0x18]
mov rbx, qword [rax]
mov ecx, 0x400
call fcn.0040371e
mov qword [rbp + 0x18], rax
mov rax, qword [rbp + 0x18]
mov qword [rax], rbx
mov ecx, 0x2000
call fcn.0040371e
mov rbx, rax
mov rax, qword [rbp + 0x18]
add rax, 8
mov qword [rax], rbx
mov rax, qword [sym.imp.msvcrt.dll___iob_func]
call rax
lea rdx, [rax + 0x60]
lea rax, [0x004099ea]
mov r9, rdx
mov r8d, 0xa
mov edx, 1
mov rcx, rax
call sub.msvcrt.dll_fwrite
mov rax, qword [sym.imp.msvcrt.dll___iob_func]
call rax
add rax, 0x60
mov rcx, rax
call sub.msvcrt.dll_fflush
mov r8d, 0x2000
mov rdx, rbx
mov ecx, 0
call sub.msvcrt.dll__read
mov dword [0x0040b07c], eax
mov eax, dword [0x0040b07c]
test eax, eax
jne 0x405447
lea rcx, [0x004099f5]
call fcn.004035db
mov eax, dword [0x0040b07c]
mov edx, eax
mov rcx, rbx
call fcn.0040377b
mov esi, eax
test esi, esi
je 0x405471
mov edx, dword [0x0040b07c]
mov eax, esi
mov ecx, edx
sub ecx, eax
mov eax, ecx
mov dword [0x0040b07c], eax
mov eax, dword [0x0040b07c]
test eax, eax
je 0x40549c
mov eax, dword [0x0040b07c]
mov ecx, eax
movsxd rax, esi
lea rdx, [rbx + rax]
mov rax, qword [0x0040bba8]
mov r8, rcx
mov rcx, rax
call sub.msvcrt.dll_memcpy
mov rax, qword [rbp + 0x18]
add rax, 8
mov rax, qword [rax]
mov edx, 0xa
mov rcx, rax
call sub.msvcrt.dll_strchr
mov rbx, rax
test rbx, rbx
je 0x4054bf
mov byte [rbx], 0
mov rax, qword [rbp + 0x18]
add rax, 8
mov rax, qword [rax]
mov edx, 0xd
mov rcx, rax
call sub.msvcrt.dll_strchr
mov rbx, rax
test rbx, rbx
je 0x4054e2
mov byte [rbx], 0
mov rax, qword [rbp + 0x18]
add rax, 8
mov rbx, qword [rax]
add rbx, 1
mov esi, 2
jmp 0x405524
movzx eax, byte [rbx]
cmp al, 0x20
jne 0x405504
mov byte [rbx], 0
jmp 0x405520
lea rax, [rbx - 1]
movzx eax, byte [rax]
test al, al
jne 0x405520
movsxd rax, esi
shl rax, 3
add rax, qword [rbp + 0x18]
mov qword [rax], rbx
add esi, 1
add rbx, 1
movzx eax, byte [rbx]
test al, al
jne 0x4054f8
mov dword [rbp + 0x10], esi
jmp 0x4058bb
lea eax, [rsi - 0x47]
cmp eax, 0x33
ja 0x40589a
mov eax, eax
lea rdx, [rax*4]
lea rax, [0x00409b50]
mov eax, dword [rdx + rax]
movsxd rdx, eax
lea rax, [0x00409b50]
lea rax, [rdx + rax]
jmp rax
mov rax, qword [sym.imp.msvcrt.dll__errno]
call rax
mov dword [rax], 0
lea rcx, [0x00409a99]
call fcn.004035db
jmp 0x4058bb
mov rax, qword [rbp + 0x18]
lea r8, [0x00409aa8]
mov rdx, rax
mov ecx, dword [rbp + 0x10]
call fcn.00402422
mov esi, eax
cmp esi, 0xffffffff
jne 0x405533
movzx eax, word [0x0040b0d6]
test ax, ax
je 0x405907
mov ecx, 0
call fcn.004073a0
mov ecx, eax
call sub.msvcrt.dll_srand
mov ecx, 0x10000
call fcn.0040371e
mov qword [rbp - 0x38], rax
mov rax, qword [0x0040b0e8]
test rax, rax
je 0x405930
mov ecx, 0
call sub.msvcrt.dll__close
mov word [0x0040b0d4], 0
mov dword [0x0040b074], 0
movzx eax, word [0x0040b0d4]
test ax, ax
je 0x40598d
mov rax, qword [0x0040b0c0]
mov r8d, 0x1b4
mov edx, 0x301
mov rcx, rax
call sub.msvcrt.dll__open
mov dword [0x0040b074], eax
mov eax, dword [0x0040b074]
test eax, eax
jg 0x40597c
mov rax, qword [0x0040b0c0]
mov rdx, rax
lea rcx, [0x00409ac5]
call fcn.004035db
mov ecx, 0x64
call fcn.0040371e
mov qword [0x0040b0c0], rax
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
test rax, rax
je 0x4059ce
movzx eax, word [0x0040b0d2]
movzx edx, ax
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov rcx, rax
call fcn.00403841
mov qword [rbp - 0x18], rax
cmp qword [rbp - 0x18], 0
je 0x4059f2
mov rax, qword [rbp - 0x18]
add rax, 0x1c0
test rax, rax
je 0x4059f2
mov rax, qword [rbp - 0x18]
add rax, 0x1c0
mov qword [rbp - 0x28], rax
cmp qword [rbp - 0x28], 0
je 0x405a08
mov eax, dword [0x0040b048]
add eax, 1
mov dword [0x0040b048], eax
mov rax, qword [sym.imp.msvcrt.dll__errno]
call rax
mov dword [rax], 0
movzx eax, word [0x0040b0d0]
test ax, ax
je 0x405b3e
mov word [rbp - 0x30], 0
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
test rax, rax
je 0x405a92
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov edx, 0
mov rcx, rax
call fcn.00403bc0
mov word [rbp - 0x30], ax
cmp word [rbp - 0x30], 0
jne 0x405a92
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov rdx, rax
lea rcx, [0x00409ad3]
call fcn.004035db
movzx ebx, word [rbp - 0x2a]
movzx edx, word [rbp - 0x30]
mov rcx, qword [rbp - 0x20]
mov rax, qword [rbp - 0x28]
mov r9d, ebx
mov r8, rcx
mov rcx, rax
call fcn.0040425f
mov dword [0x00408010], eax
mov eax, dword [0x00408010]
test eax, eax
jle 0x405b32
mov rax, qword [0x0040b0e8]
test rax, rax
je 0x405adc
mov eax, dword [0x00408010]
cdqe
mov rcx, rax
call fcn.004026fd
mov rax, qword [0x0040b0e8]
test rax, rax
jne 0x405af7
mov eax, dword [0x00408010]
mov ecx, eax
call fcn.00404b7c
mov esi, eax
movzx eax, word [0x0040b0da]
cmp ax, 1
jbe 0x405b21
mov edx, dword [0x0040b080]
mov eax, dword [0x0040b084]
mov r8d, edx
mov edx, eax
lea rcx, str._sent__d__rcvd__d
call fcn.004034eb
cmp dword [rbp - 0x3c], 1
je 0x405397
mov ecx, esi
call sub.msvcrt.dll_exit
lea rcx, [0x00409ae3]
call fcn.004035db
cmp qword [rbp - 0x28], 0
jne 0x405b51
lea rcx, [0x00409af1]
call fcn.004035db
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
test rax, rax
jne 0x405b75
lea rcx, [0x00409b00]
call fcn.004035db
mov eax, dword [0x0040b048]
cdqe
add rax, 1
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
test rax, rax
je 0x405b9a
mov word [0x0040802c], 0
movzx eax, word [rbp - 0x2a]
mov word [rbp - 0x2c], ax
jmp 0x405edb
mov word [rbp - 0x4a], 0
movzx eax, word [rbp - 0x4a]
mov word [rbp - 0x2e], ax
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov edx, 0x2d
mov rcx, rax
call sub.msvcrt.dll_strchr
mov rbx, rax
test rbx, rbx
je 0x405c0b
mov byte [rbx], 0
add rbx, 1
mov edx, 0
mov rcx, rbx
call fcn.00403bc0
mov word [rbp - 0x2e], ax
cmp word [rbp - 0x2e], 0
jne 0x405c0b
mov rdx, rbx
lea rcx, [0x00409ad3]
call fcn.004035db
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov edx, 0
mov rcx, rax
call fcn.00403bc0
mov word [rbp - 0x4a], ax
cmp word [rbp - 0x4a], 0
jne 0x405c58
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
mov rdx, rax
lea rcx, [0x00409ad3]
call fcn.004035db
movzx eax, word [rbp - 0x2e]
cmp ax, word [rbp - 0x4a]
jbe 0x405caf
mov word [0x0040802c], 0
movzx eax, word [rbp - 0x2e]
mov word [rbp - 0x30], ax
movzx eax, word [0x0040b0d6]
test ax, ax
je 0x405ebe
movzx ecx, word [rbp - 0x2e]
movzx edx, word [rbp - 0x4a]
mov rax, qword [rbp - 0x38]
mov r8d, ecx
mov rcx, rax
call fcn.00403e4e
mov rax, qword [rbp - 0x38]
mov rcx, rax
call fcn.00403dca
mov word [rbp - 0x30], ax
jmp 0x405ebe
movzx eax, word [rbp - 0x4a]
mov word [rbp - 0x30], ax
jmp 0x405ebe
cmp word [rbp - 0x2a], 0
jne 0x405ce6
movzx eax, word [0x0040b0d6]
test ax, ax
je 0x405ce6
call sub.msvcrt.dll_rand
mov word [rbp - 0x2c], ax
cmp word [rbp - 0x2c], 0x1fff
ja 0x405ce6
add word [rbp - 0x2c], 0x2000
movzx eax, word [rbp - 0x30]
mov edx, eax
mov ecx, 0
call fcn.00403bc0
mov word [rbp - 0x30], ax
movzx ebx, word [rbp - 0x2c]
movzx edx, word [rbp - 0x30]
mov rcx, qword [rbp - 0x20]
mov rax, qword [rbp - 0x28]
mov r9d, ebx
mov r8, rcx
mov rcx, rax
call fcn.00403ec7
mov dword [0x00408010], eax
mov eax, dword [0x00408010]
test eax, eax
jle 0x405d57
movzx eax, word [0x0040b0e0]
test ax, ax
je 0x405d57
movzx eax, word [0x0040b0d8]
test ax, ax
je 0x405d57
mov eax, dword [0x00408010]
mov rdx, qword [rbp - 0x28]
mov ecx, eax
call fcn.00404773
mov dword [0x00408010], eax
mov eax, dword [0x00408010]
test eax, eax
jle 0x405dec
mov esi, 0
mov rax, qword [0x0040b0b8]
mov rdx, rax
movzx ebx, word [rbp - 0x30]
mov rax, qword [rbp - 0x18]
add rax, 0x100
mov rcx, rax
mov rax, qword [rbp - 0x18]
mov qword [rsp + 0x20], rdx
mov r9d, ebx
mov r8, rcx
mov rdx, rax
lea rcx, [0x00409b19]
call fcn.004034eb
mov rax, qword [0x0040b0e8]
test rax, rax
je 0x405dbf
mov eax, dword [0x00408010]
cdqe
mov rcx, rax
call fcn.004026fd
movzx eax, word [0x0040b0e0]
test ax, ax
jne 0x405e53
mov rax, qword [0x0040b0e8]
test rax, rax
jne 0x405e53
mov eax, dword [0x00408010]
mov ecx, eax
call fcn.00404b7c
mov esi, eax
jmp 0x405e53
mov esi, 1
movzx eax, word [0x0040802c]
test ax, ax
jne 0x405e1a
movzx eax, word [0x0040b0da]
cmp ax, 1
ja 0x405e1a
mov rax, qword [sym.imp.WSOCK32.dll_WSAGetLastError]
call rax
cmp eax, 0x274d
je 0x405e53
mov rax, qword [0x0040b0b8]
mov rdx, rax
movzx ebx, word [rbp - 0x30]
mov rax, qword [rbp - 0x18]
add rax, 0x100
mov rcx, rax
mov rax, qword [rbp - 0x18]
mov qword [rsp + 0x20], rdx
mov r9d, ebx
mov r8, rcx
mov rdx, rax
lea rcx, [0x00409b2e]
call fcn.004034eb
mov eax, dword [0x00408010]
cdqe
mov edx, 2
mov rcx, rax
mov rax, qword [sym.imp.WSOCK32.dll_shutdown]
call rax
mov eax, dword [0x00408010]
cdqe
mov rcx, rax
mov rax, qword [sym.imp.WSOCK32.dll_closesocket]
call rax
mov eax, dword [0x0040b0cc]
test eax, eax
je 0x405e9b
mov eax, dword [0x0040b0cc]
mov ecx, eax
mov rax, qword [sym.imp.msvcrt.dll__sleep]
call rax
movzx eax, word [0x0040b0d6]
test ax, ax
je 0x405eb9
mov rax, qword [rbp - 0x38]
mov rcx, rax
call fcn.00403dca
mov word [rbp - 0x30], ax
jmp 0x405ebe
sub word [rbp - 0x30], 1
movzx eax, word [rbp - 0x4a]
cmp ax, word [rbp - 0x30]
jbe 0x405cbc
mov eax, dword [0x0040b048]
add eax, 1
mov dword [0x0040b048], eax
mov eax, dword [0x0040b048]
cdqe
shl rax, 3
add rax, qword [rbp + 0x18]
mov rax, qword [rax]
test rax, rax
jne 0x405ba7
mov rax, qword [sym.imp.msvcrt.dll__errno]
call rax
mov dword [rax], 0
movzx eax, word [0x0040b0da]
cmp ax, 1
jbe 0x405f30
mov edx, dword [0x0040b080]
mov eax, dword [0x0040b084]
mov r8d, edx
mov edx, eax
lea rcx, [0x00409b3e]
call fcn.004034eb
mov rax, qword [sym.imp.WSOCK32.dll_WSACleanup]
call rax
cmp dword [rbp - 0x3c], 1
je 0x40539a
movzx eax, word [0x0040802c]
test ax, ax
je 0x405f56
mov ecx, esi
call sub.msvcrt.dll_exit
mov ecx, 0
call sub.msvcrt.dll_exit