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

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x8068
call fcn.00597828
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 0x40fa6b
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00422c6c
cmp eax, 4
jne 0x40fa6b
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00422558
cmp eax, 3
jbe 0x40fa6b
cmp dword [ebp + 0x10], 0
jne 0x40fa75
mov eax, 0
jmp 0x40ffc8
mov dword [esp + 4], 3
mov eax, dword [ebp + 0xc]
mov dword [esp], eax
call fcn.00422580
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x28]
mov dword [esp], eax
call fcn.00422c6c
cmp eax, 1
jne 0x40faad
lea eax, [ebp - 0x40]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x28]
mov dword [esp], eax
call fcn.00422e5c
mov eax, dword [ebp - 0x40]
mov edx, dword [ebp - 0x3c]
or eax, edx
test eax, eax
je 0x40fad2
mov eax, dword [0x6f6080]
cmp eax, 1
jle 0x40fad2
mov dword [esp], str.Receiving_files
call sub.msvcrt.dll_puts
jmp 0x40fad2
nop
mov eax, dword [0x6f6084]
test eax, eax
jne 0x40fee8
lea eax, [ebp - 0x8050]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040f868
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40feeb
lea eax, [ebp - 0x804c]
mov dword [esp + 4], eax
mov eax, dword [ebp + 8]
mov dword [esp], eax
call fcn.0040f868
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x44]
test eax, eax
je 0x40feee
cmp dword [ebp - 0x1c], 0
je 0x40fb3d
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call fcn.005a0e48
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.004086a1
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0x804c]
test eax, eax
je 0x40fb7f
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.005a0e48
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.0042036d
mov eax, dword [ebp - 0x48]
cmp eax, 4
je 0x40fbcf
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 0x40fef2
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.0042036d
mov eax, dword [ebp - 0x48]
cmp eax, 1
je 0x40fc51
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 0x40fef2
mov al, byte [ebp - 0x8051]
test al, al
je 0x40fc91
mov al, byte [ebp - 0x8051]
cmp al, 0xc
je 0x40fc91
mov al, byte [ebp - 0x8051]
cmp al, 0xb
je 0x40fc91
mov eax, dword [0x6f6080]
test eax, eax
jle 0x40fc91
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], 0x673a71
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_fopen
mov dword [ebp - 0x2c], eax
jmp 0x40fe08
mov eax, dword [ebp - 0x44]
dec eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x18], 0
jmp 0x40fd4d
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x30]
mov ecx, edx
sub ecx, eax
mov eax, ecx
cmp eax, 0x7fff
ja 0x40fcf2
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 0x40fcf9
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.0042036d
mov eax, dword [ebp - 0x48]
test eax, eax
jle 0x40fd5b
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 0x40fcce
jmp 0x40fd5c
nop
mov eax, dword [ebp - 0x14]
cmp eax, dword [ebp - 0x30]
jne 0x40fd72
mov eax, dword [ebp - 0x30]
mov edx, 0
add dword [ebp - 0x10], eax
adc dword [ebp - 0xc], edx
mov eax, dword [0x6f6084]
test eax, eax
jne 0x40fe1e
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.0042036d
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 0x40fe21
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.0042036d
cmp dword [ebp - 0x2c], 0
je 0x40fe22
mov al, byte [ebp - 0x8051]
cmp al, 0xc
je 0x40fcb7
jmp 0x40fe22
nop
jmp 0x40fe22
nop
cmp dword [ebp - 0x2c], 0
je 0x40fe38
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call fcn.005a0ec8
inc dword [ebp - 0x24]
jmp 0x40fe5e
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 0x40fef1
mov al, byte [ebp - 0x8051]
cmp al, 0xb
jne 0x40fad1
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.0042036d
mov edx, dword [ebp - 0x48]
mov eax, dword [ebp - 0x34]
add eax, edx
mov byte [eax], 0
cmp byte [ebp - 0x1d], 0xc
je 0x40fed8
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.005a0e48
jmp 0x40fad1
nop
jmp 0x40fef2
nop
jmp 0x40fef2
nop
jmp 0x40fef2
nop
mov eax, dword [ebp - 0x804c]
test eax, eax
je 0x40ff0a
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.005a0e48
mov eax, dword [ebp - 0x44]
dec eax
test eax, eax
jle 0x40ff78
mov eax, dword [0x6f6080]
test eax, eax
jle 0x40ff27
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.0042036d
mov eax, dword [ebp - 0x804c]
mov dword [esp], eax
call fcn.005a0e48
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_remove
cmp dword [ebp - 0x1c], 0
je 0x40ff89
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call fcn.005a0e48
mov eax, dword [ebp - 0x8050]
test eax, eax
je 0x40ffa1
mov eax, dword [ebp - 0x8050]
mov dword [esp], eax
call fcn.005a0e48
call fcn.004222a4
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.00420734
mov eax, dword [ebp - 0x24]
leave
ret