Function at 0x50562b
Capabilities:
Write file on windows

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x3c
mov ebp, dword [esp + 0x54]
mov esi, ecx
test ebp, ebp
je 0x50565a
push edx
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
cmp eax, 0xffffffff
je 0x505669
mov edi, eax
test eax, eax
jne 0x50568b
mov eax, edi
push 6
pop edi
mov dword [esi + 4], edi
mov dword [esi], eax
jmp 0x505661
and dword [esi + 4], 0
mov byte [esi], 4
add esp, 0x3c
pop esi
pop edi
pop ebx
pop ebp
ret
lea edi, [esp + 0x14]
mov ecx, edi
call fcn.0050554d
cmp byte [edi], 4
jne 0x50567f
mov edi, dword [esp + 0x18]
jmp 0x50568b
mov eax, dword [esp + 0x14]
mov edi, dword [esp + 0x18]
cmp al, 4
jne 0x505653
lea eax, [esp + 0x14]
mov ebx, dword [esp + 0x50]
and dword [eax], 0
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x50574e
mov eax, dword [esp + 0x58]
movzx eax, byte [eax + 4]
test eax, eax
je 0x5057a2
cmp al, 4
jae 0x50587b
mov cl, byte [ebx]
mov edx, ecx
and dl, 0xc0
neg dl
jno 0x5057f7
mov ebx, dword [esp + 0x58]
mov byte [ebx + eax], cl
mov al, byte [ebx + 4]
inc al
mov byte [ebx + 4], al
movzx ecx, byte [ebx]
movzx ecx, byte [ecx + 0x508e93]
cmp cl, al
ja 0x50586b
movzx eax, al
mov dword [esp + 0x10], ecx
cmp al, 5
jae 0x50587b
lea ebp, [esp + 0x14]
mov edx, ebx
mov ecx, ebp
push eax
call fcn.00503351
pop eax
test byte [ebp], 1
mov byte [ebx + 4], 0
jne 0x5057ff
mov eax, dword [esp + 0x10]
cmp dword [esp + 0x1c], eax
jne 0x50587b
lea ebx, [esp + 4]
mov edx, edi
mov ecx, ebx
push eax
push dword [esp + 0x1c]
call fcn.005058ca
pop eax
pop ecx
cmp byte [ebx], 4
jne 0x505858
mov eax, dword [esp + 8]
jmp 0x505865
lea eax, [esp + 0x2c]
mov ecx, 0x103
and dword [eax + 4], 0
mov dword [eax], ecx
push 0
push 0
push ebp
push ebx
push eax
push 0
push 0
push 0
push edi
call dword [sym.imp.ntdll.dll_NtWriteFile]
mov ecx, 0x103
cmp eax, ecx
jne 0x505792
push 0xffffffffffffffff
push edi
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov eax, dword [esp + 0x2c]
cmp eax, 0x103
je 0x50587d
test eax, eax
js 0x505811
mov eax, dword [esp + 0x30]
mov dword [esi + 4], eax
jmp 0x50565e
mov eax, 0x1000
lea ecx, [esp + 4]
mov edx, ebx
cmp ebp, eax
cmovb eax, ebp
push eax
call fcn.00503351
pop eax
lea eax, [esp + 4]
test byte [eax], 1
je 0x505823
cmp dword [esp + 8], 0
je 0x50583e
mov eax, dword [esp + 8]
cmp eax, ebp
ja 0x50587b
mov edx, ebx
lea ebx, [esp + 0x14]
mov ecx, ebx
push eax
call fcn.00503351
pop eax
cmp dword [ebx], 1
je 0x50587b
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x1c]
jmp 0x50582b
mov eax, dword [esp + 0x58]
mov byte [eax + 4], 0
mov dword [esi + 4], str.Windows_stdio_in_console_mode_does_not_support_writing_non_UTF_8_byte_sequences
mov dword [esi], 2
jmp 0x505661
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
and dword [esi], 0
mov dword [esi + 4], eax
jmp 0x505661
mov eax, dword [esp + 8]
mov ebx, dword [esp + 0xc]
mov ecx, esi
mov edx, edi
push ebx
push eax
call fcn.005058ca
add esp, 0x44
jmp 0x505664
movzx eax, byte [ebx]
movzx ecx, byte [eax + 0x508e93]
cmp ecx, ebp
jbe 0x5057ff
mov ecx, dword [esp + 0x58]
mov byte [ecx], al
mov byte [ecx + 4], 1
jmp 0x50586b
mov ecx, dword [esp + 4]
mov eax, dword [esp + 8]
cmp cl, 4
jne 0x505877
cmp eax, dword [esp + 0x10]
jne 0x50587b
mov dword [esi + 4], 1
jmp 0x50565e
mov dword [esi], ecx
jmp 0x50581b
ud2
lea edx, [esp + 0x34]
mov eax, esp
mov dword [esp + 0x14], 0x509080
mov dword [esp + 0x18], 1
and dword [esp + 0x24], 0
lea esi, [esp + 4]
mov dword [esp + 0x1c], eax
and dword [edx], 0
and dword [esp + 0x20], 0
lea eax, [esp + 0x14]
mov byte [edx + 4], 0
mov ecx, esi
push eax
call fcn.00505a88
pop eax
mov ecx, dword [esi]
mov edx, dword [esi + 4]
call fcn.0050561c
push 7
pop ecx
int 0x29
ud2