Function at 0x40f65a
Capabilities:
Delete file
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x8068
call fcn.005965d8
sub esp, eax
mov dword [ebp - 0x10], 0
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x40], 0
mov dword [ebp - 0x3c], 0
mov dword [ebp - 0x44], 0
mov dword [ebp - 0x804c], 0
mov dword [ebp - 0x8050], 0
mov dword [ebp - 0x1c], 0
mov byte [ebp - 0x8051], 0
mov byte [ebp - 0x1d], 0
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x24], 0
cmp dword [ebp + 0xc], 0
je 0x40f6f3
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00421a0c
cmp eax, 4
jne 0x40f6f3
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.004212f8
cmp eax, 3
jbe 0x40f6f3
cmp dword [ebp + 0x10], 0
jne 0x40f6fd
mov eax, 0
jmp 0x40fc50
mov dword [esp + 4], 3
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00421320
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x28]
mov dword [esp], eax
call fcn.00421a0c
cmp eax, 1
jne 0x40f735
lea eax, [ebp - 0x40]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x28]
mov dword [esp], eax
call fcn.00421bfc
mov eax, dword [ebp - 0x40]
mov edx, dword [ebp - 0x3c]
or eax, edx
test eax, eax
je 0x40f75a
mov eax, dword [0x6d9080]
cmp eax, 1
jle 0x40f75a
mov dword [esp], str.Receiving_files
call sub.msvcrt.dll_puts
jmp 0x40f75a
nop
mov eax, dword [0x6d9084]
test eax, eax
jne 0x40fb70
lea eax, [ebp - 0x8050]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040f4f0
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40fb73
lea eax, [ebp - 0x804c]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040f4f0
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40fb76
cmp dword [ebp - 0x1c], 0
je 0x40f7c5
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call fcn.0059fbf8
mov dword [ebp - 0x1c], 0
mov eax, dword [ebp - 0x804c]
mov dword [esp + 8], 0
mov dword [esp + 4], eax
mov eax, dword [ebp + 0x10]
mov dword [esp], eax
call fcn.0040870d
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x804c]
test eax, eax
je 0x40f807
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.0059fbf8
mov dword [ebp - 0x804c], 0
mov dword [ebp - 0x48], 0
mov dword [ebp - 0x44], 0
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 4
lea eax, [ebp - 0x44]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov eax, dword [ebp - 0x48]
cmp eax, 4
je 0x40f857
mov dword [esp + 4], str.mb2_handle_receive_files
mov dword [esp], str.ERROR:__s:_could_not_receive_code_length__n
call sub.msvcrt.dll_printf
jmp 0x40fb7a
mov eax, dword [ebp - 0x44]
mov edx, eax
shr edx, 0x18
mov eax, dword [ebp - 0x44]
and eax, 0xff0000
shr eax, 8
or edx, eax
mov eax, dword [ebp - 0x44]
and eax, 0xff00
shl eax, 8
or edx, eax
mov eax, dword [ebp - 0x44]
shl eax, 0x18
or eax, edx
mov dword [ebp - 0x44], eax
mov al, byte [ebp - 0x8051]
mov byte [ebp - 0x1d], al
mov byte [ebp - 0x8051], 0
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 1
lea eax, [ebp - 0x8051]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov eax, dword [ebp - 0x48]
cmp eax, 1
je 0x40f8d9
mov dword [esp + 4], str.mb2_handle_receive_files
mov dword [esp], str.ERROR:__s:_could_not_receive_code__n
call sub.msvcrt.dll_printf
jmp 0x40fb7a
mov al, byte [ebp - 0x8051]
test al, al
je 0x40f919
mov al, byte [ebp - 0x8051]
cmp al, 0xc
je 0x40f919
mov al, byte [ebp - 0x8051]
cmp al, 0xb
je 0x40f919
mov eax, dword [0x6d9080]
test eax, eax
jle 0x40f919
mov al, byte [ebp - 0x8051]
movsx eax, al
mov dword [esp + 4], eax
mov dword [esp], str.Found_new_flag__02x_n
call sub.msvcrt.dll_printf
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_remove
mov dword [esp + 4], 0x657151
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0x2c], eax
jmp 0x40fa90
mov eax, dword [ebp - 0x44]
dec eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x18], 0
jmp 0x40f9d5
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x30]
mov ecx, edx
sub ecx, eax
mov eax, ecx
cmp eax, 0x7fff
ja 0x40f97a
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x30]
mov ecx, edx
sub ecx, eax
mov eax, ecx
mov dword [ebp - 0x18], eax
jmp 0x40f981
mov dword [ebp - 0x18], 0x8000
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x18]
mov dword [esp + 8], eax
lea eax, [ebp - 0x8048]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov eax, dword [ebp - 0x48]
test eax, eax
jle 0x40f9e3
mov eax, dword [ebp - 0x48]
mov edx, dword [ebp - 0x2c]
mov dword [esp + 0xc], edx
mov dword [esp + 8], eax
mov dword [esp + 4], 1
lea eax, [ebp - 0x8048]
mov dword [esp], eax
call sub.msvcrt.dll_fwrite
mov eax, dword [ebp - 0x48]
add dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x30]
jb 0x40f956
jmp 0x40f9e4
nop
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x30]
jne 0x40f9fa
mov eax, dword [ebp - 0x30]
mov edx, 0
add dword [ebp - 0x10], eax
adc dword [ebp - 0xc], edx
mov eax, dword [0x6d9084]
test eax, eax
jne 0x40faa6
mov dword [ebp - 0x44], 0
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 4
lea eax, [ebp - 0x44]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov eax, dword [ebp - 0x44]
mov edx, eax
shr edx, 0x18
mov eax, dword [ebp - 0x44]
and eax, 0xff0000
shr eax, 8
or edx, eax
mov eax, dword [ebp - 0x44]
and eax, 0xff00
shl eax, 8
or edx, eax
mov eax, dword [ebp - 0x44]
shl eax, 0x18
or eax, edx
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40faa9
mov al, byte [ebp - 0x8051]
mov byte [ebp - 0x1d], al
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov dword [esp + 8], 1
lea eax, [ebp - 0x8051]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
cmp dword [ebp - 0x2c], 0
je 0x40faaa
mov al, byte [ebp - 0x8051]
cmp al, 0xc
je 0x40f93f
jmp 0x40faaa
nop
jmp 0x40faaa
nop
cmp dword [ebp - 0x2c], 0
je 0x40fac0
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call fcn.0059fc68
inc dword [ebp - 0x24]
jmp 0x40fae6
call sub.msvcrt.dll__errno
mov eax, dword [eax]
mov dword [esp], eax
call sub.msvcrt.dll_strerror
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp + 4], eax
mov dword [esp], str.Error_opening__s_for_writing:__s_n
call sub.msvcrt.dll_printf
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40fb79
mov al, byte [ebp - 0x8051]
cmp al, 0xb
jne 0x40f759
mov eax, dword [ebp - 0x44]
mov dword [esp], eax
call sub.msvcrt.dll_malloc
mov dword [ebp - 0x34], eax
mov eax, dword [ebp - 0x44]
lea edx, [eax - 1]
lea eax, [ebp - 0x48]
mov dword [esp + 0xc], eax
mov dword [esp + 8], edx
mov eax, dword [ebp - 0x34]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov edx, dword [ebp - 0x48]
mov eax, dword [ebp - 0x34]
add eax, edx
mov byte [eax], 0
cmp byte [ebp - 0x1d], 0xc
je 0x40fb60
mov eax, dword [ebp - 0x34]
mov dword [esp + 8], eax
mov dword [esp + 4], str._nReceived_an_error_message_from_device:__s_n
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
mov dword [esp], eax
call sub.msvcrt.dll_fprintf
mov eax, dword [ebp - 0x34]
mov dword [esp], eax
call fcn.0059fbf8
jmp 0x40f759
nop
jmp 0x40fb7a
nop
jmp 0x40fb7a
nop
jmp 0x40fb7a
nop
mov eax, dword [ebp - 0x804c]
test eax, eax
je 0x40fb92
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.0059fbf8
mov eax, dword [ebp - 0x44]
dec eax
test eax, eax
jle 0x40fc00
mov eax, dword [0x6d9080]
test eax, eax
jle 0x40fbaf
mov dword [esp], str._nDiscarding_current_data_hunk.
call sub.msvcrt.dll_puts
mov eax, dword [ebp - 0x44]
dec eax
mov dword [esp], eax
call sub.msvcrt.dll_malloc
mov dword [ebp - 0x804c], eax
mov eax, dword [ebp - 0x44]
lea ecx, [eax - 1]
mov eax, dword [ebp - 0x804c]
lea edx, [ebp - 0x48]
mov dword [esp + 0xc], edx
mov dword [esp + 8], ecx
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f10d
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.0059fbf8
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_remove
cmp dword [ebp - 0x1c], 0
je 0x40fc11
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call fcn.0059fbf8
mov eax, dword [ebp - 0x8050]
test eax, eax
je 0x40fc29
mov eax, dword [ebp - 0x8050]
mov dword [esp], eax
call fcn.0059fbf8
call fcn.00421044
mov dword [esp + 0xc], eax
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0041f4d4
mov eax, dword [ebp - 0x24]
leave
ret