Function at 0x401467
Capabilities:
Check os version
Create process on windows
Extract resource via kernel32 functions
Get file attributes
Impersonate user
Set current directory
Set file attributes
Terminate process

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x950
push ebx
push esi
push edi
push 0xa
push 4
push dword [0x413378]
call dword [sym.imp.KERNEL32.dll_FindResourceA]
xor edi, edi
mov dword [ebp - 0x10], eax
cmp eax, edi
je 0x4014a2
push eax
mov dword [ebp - 0x18], edi
push dword [0x413378]
call dword [sym.imp.KERNEL32.dll_LoadResource]
mov ebx, eax
cmp ebx, edi
jne 0x4014a9
xor eax, eax
jmp 0x401b70
mov esi, 0x94
lea eax, [ebp - 0x414]
push esi
push edi
push eax
call fcn.00406200
add esp, 0xc
lea eax, [ebp - 0x414]
mov dword [ebp - 0x414], esi
push eax
call dword [sym.imp.KERNEL32.dll_GetVersionExA]
cmp dword [ebp - 0x404], 2
jne 0x4014eb
cmp dword [ebp - 0x410], 5
jb 0x4014eb
mov dword [ebp - 0x18], 1
movsx eax, byte [0x412ed0]
push eax
call fcn.00405dd0
sub eax, 0x40
push eax
call fcn.00405d79
pop ecx
pop ecx
push 0x412ed0
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
push ebx
call dword [sym.imp.KERNEL32.dll_LockResource]
push dword [ebp - 0x10]
mov esi, eax
push dword [0x413378]
call dword [sym.imp.KERNEL32.dll_SizeofResource]
mov ebx, eax
push str.hsdiafwiuera
push ebx
push esi
call fcn.00401fba
push 3
push ebx
push esi
call fcn.004055b8
lea ecx, [ebp - 0x644]
mov dword [ebp - 0x14], eax
push ecx
push 0xffffffffffffffff
push eax
call fcn.00405616
mov ebx, dword [ebp - 0x644]
mov esi, 0x4130d8
push 0x410220
push esi
mov dword [ebp - 0x30], ebx
call fcn.00406170
add esp, 0x2c
test eax, eax
jne 0x40158e
push str.CScript.exe
lea eax, [ebp - 0x27c]
push eax
call fcn.00405890
pop ecx
mov dword [ebp - 8], 1
pop ecx
jmp 0x401643
push str.WScript__Windows_Script_Host_
push esi
call fcn.00406170
pop ecx
test eax, eax
pop ecx
jne 0x4015a6
push str.WScript.exe
jmp 0x401574
push str.MSHTA
push esi
call fcn.00406170
pop ecx
test eax, eax
pop ecx
jne 0x4015d3
lea eax, [ebp - 0x27c]
push str.MSHTA.exe
push eax
call fcn.00405890
pop ecx
mov dword [ebp - 8], 2
pop ecx
jmp 0x401643
push str.Windows_PowerShell
push esi
call fcn.00406170
pop ecx
test eax, eax
pop ecx
jne 0x401600
lea eax, [ebp - 0x27c]
push str.powershell.exe
push eax
call fcn.00405890
pop ecx
mov dword [ebp - 8], 3
pop ecx
jmp 0x401643
push str.SAPIEN_Script_Host
push esi
call fcn.00406170
pop ecx
test eax, eax
pop ecx
jne 0x40162d
lea eax, [ebp - 0x27c]
push 0x413384
push eax
call fcn.00405890
pop ecx
mov dword [ebp - 8], 5
pop ecx
jmp 0x401643
lea eax, [ebp - 0x27c]
push esi
push eax
call fcn.00405890
pop ecx
mov dword [ebp - 8], 6
pop ecx
lea eax, [ebp - 0x380]
push eax
lea eax, [ebp - 0x27c]
push str.PATH
push eax
call fcn.00406059
lea eax, [ebp - 0x27c]
push 0x410058
push eax
call fcn.00405890
lea eax, [ebp - 0x380]
push eax
lea eax, [ebp - 0x27c]
push eax
call fcn.004058a0
add esp, 0x1c
cmp dword [ebp - 8], 1
jne 0x40168f
push str.____noLogo
jmp 0x401694
push 0x410184
lea eax, [ebp - 0x27c]
push eax
call fcn.004058a0
cmp dword [ebp - 0x18], edi
pop ecx
pop ecx
mov dword [ebp - 0x1c], edi
jne 0x4016e4
mov esi, 0x4131f0
push esi
call fcn.00405980
test eax, eax
pop ecx
je 0x4016e4
lea eax, [ebp - 0x1c]
push eax
push edi
push 2
push 0x413230
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_LogonUserA]
test eax, eax
jne 0x4016e4
push str.Could_not_authenticate_user._n
call fcn.004056ca
pop ecx
push 1
call fcn.00405f84
cmp ebx, edi
mov dword [ebp - 0xc], edi
jle 0x401b64
lea eax, [ebp - 0x644]
push eax
push dword [ebp - 0xc]
push dword [ebp - 0x14]
call fcn.00405616
lea eax, [ebp - 0x640]
push 0x2e
push eax
call fcn.00405f30
add esp, 0x14
cmp eax, edi
je 0x40173a
push eax
call dword [sym.imp.KERNEL32.dll_GetTickCount]
mov esi, 0x412ed0
push eax
push esi
lea eax, [ebp - 0x178]
push str._s_lX_s
push eax
call fcn.00405edb
add esp, 0x14
jmp 0x401777
lea eax, [ebp - 0x178]
push 0x412ed0
push eax
call fcn.00405890
lea eax, [ebp - 0x178]
push 0x410154
push eax
call fcn.004058a0
lea eax, [ebp - 0x640]
push eax
lea eax, [ebp - 0x178]
push eax
call fcn.004058a0
add esp, 0x18
mov esi, 0x412ed0
lea eax, [ebp - 0x178]
push edi
push eax
call fcn.00405d35
neg eax
sbb eax, eax
pop ecx
inc eax
pop ecx
mov dword [ebp - 0x10], eax
je 0x4017ad
lea eax, [ebp - 0x178]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
and al, 0xfc
push eax
lea eax, [ebp - 0x178]
push eax
call dword [sym.imp.KERNEL32.dll_SetFileAttributesA]
push 2
lea eax, [ebp - 0x178]
push edi
push eax
push dword [ebp - 0xc]
push dword [ebp - 0x14]
call fcn.00405649
mov ebx, eax
lea eax, [ebp - 0x178]
push edi
push eax
call fcn.00405d35
add esp, 0x1c
test eax, eax
je 0x4017eb
lea eax, [ebp - 0x178]
push eax
push str.Could_not_create_Script__s_n
call fcn.00405eaa
pop ecx
pop ecx
cmp ebx, edi
jne 0x401b75
cmp dword [ebp - 0x10], edi
jne 0x401807
lea eax, [ebp - 0x178]
push 2
push eax
call dword [sym.imp.KERNEL32.dll_SetFileAttributesA]
lea eax, [ebp - 0x178]
push 0x20
push eax
call fcn.004057d0
pop ecx
test eax, eax
pop ecx
je 0x40188e
cmp dword [ebp - 8], 3
jne 0x401857
lea eax, [ebp - 0x380]
push 0x410134
push eax
call fcn.00405890
lea eax, [ebp - 0x178]
push 0x5c
push eax
call fcn.00405f30
add esp, 0x10
cmp eax, edi
je 0x4018a3
inc eax
push eax
lea eax, [ebp - 0x380]
push eax
call fcn.004058a0
jmp 0x4018a1
mov ebx, 0x410058
lea eax, [ebp - 0x380]
push ebx
push eax
call fcn.00405890
lea eax, [ebp - 0x178]
push eax
lea eax, [ebp - 0x380]
push eax
call fcn.004058a0
lea eax, [ebp - 0x380]
push ebx
push eax
call fcn.004058a0
add esp, 0x18
jmp 0x4018a3
lea eax, [ebp - 0x178]
push eax
lea eax, [ebp - 0x380]
push eax
call fcn.00405890
pop ecx
pop ecx
mov ebx, 0x413274
push ebx
call fcn.00405980
test eax, eax
pop ecx
je 0x4018d4
lea eax, [ebp - 0x380]
push 0x410054
push eax
call fcn.004058a0
lea eax, [ebp - 0x380]
push ebx
push eax
call fcn.004058a0
add esp, 0x10
push 0x44
lea eax, [ebp - 0x74]
pop ebx
push ebx
push edi
push eax
call fcn.00406200
lea eax, [ebp - 0x27c]
mov dword [ebp - 0x74], ebx
push eax
lea eax, [ebp - 0x518]
push eax
mov word [ebp - 0x44], 5
mov dword [ebp - 0x48], 1
call fcn.00405890
lea eax, [ebp - 0x380]
push eax
lea eax, [ebp - 0x518]
push eax
call fcn.004058a0
mov ebx, 0x4131f0
push ebx
call fcn.00405980
add esp, 0x20
test eax, eax
je 0x401a62
cmp dword [ebp - 0x18], edi
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x74]
push eax
push esi
push edi
push 0x20
je 0x4019d8
lea eax, [ebp - 0x518]
push eax
push edi
push 1
push 0x413230
push edi
push ebx
call 0x401b91
test eax, eax
je 0x401999
mov esi, dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
lea eax, [ebp - 4]
push eax
push dword [ebp - 0x2c]
call esi
cmp dword [0x4131e8], edi
jne 0x401b1e
cmp dword [ebp - 4], 0x103
jne 0x401b1e
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
lea eax, [ebp - 4]
push eax
push dword [ebp - 0x2c]
jmp 0x40196a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
lea ecx, [ebp - 0x950]
push 0x104
push ecx
push 0x400
push eax
push edi
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
lea eax, [ebp - 0x950]
push eax
call fcn.00405980
test eax, eax
pop ecx
lea eax, [ebp - 0x950]
jmp 0x401aed
push edi
push edi
lea eax, [ebp - 0x518]
push edi
push eax
push edi
push dword [ebp - 0x1c]
call dword [sym.imp.ADVAPI32.dll_CreateProcessAsUserA]
test eax, eax
je 0x401a23
lea eax, [ebp - 4]
push eax
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
cmp dword [0x4131e8], edi
jne 0x401b1e
cmp dword [ebp - 4], 0x103
jne 0x401b1e
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x4019f0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
lea ecx, [ebp - 0x748]
push 0x104
push ecx
push 0x400
push eax
push edi
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
lea eax, [ebp - 0x748]
push eax
call fcn.00405980
test eax, eax
pop ecx
lea eax, [ebp - 0x748]
jmp 0x401aed
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 0x74]
push eax
push esi
push edi
push 0x20
push 1
push edi
lea eax, [ebp - 0x518]
push edi
push eax
push edi
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
test eax, eax
je 0x401ab3
lea eax, [ebp - 4]
push eax
push dword [ebp - 0x2c]
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
cmp dword [0x4131e8], edi
jne 0x401b1e
cmp dword [ebp - 4], 0x103
jne 0x401b1e
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
jmp 0x401a84
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
lea ecx, [ebp - 0x84c]
push 0x104
push ecx
push 0x400
push eax
push edi
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageA]
lea eax, [ebp - 0x84c]
push eax
call fcn.00405980
test eax, eax
pop ecx
lea eax, [ebp - 0x84c]
jne 0x401af4
mov eax, str.Unknown_error
push eax
push str.Cannot_run_Script__error:__s_n
call fcn.00405eaa
cmp dword [0x413380], edi
pop ecx
pop ecx
je 0x401b1e
lea eax, [ebp - 0x518]
push esi
push eax
push str.Attempted_to_run__s_in__s_n
call fcn.00405eaa
add esp, 0xc
cmp dword [ebp - 0x10], edi
jne 0x401b55
cmp dword [0x4131e8], edi
jne 0x401b55
lea eax, [ebp - 0x178]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
and al, 0xfc
push eax
lea eax, [ebp - 0x178]
push eax
call dword [sym.imp.KERNEL32.dll_SetFileAttributesA]
lea eax, [ebp - 0x178]
push eax
call fcn.00402031
pop ecx
inc dword [ebp - 0xc]
mov eax, dword [ebp - 0xc]
cmp eax, dword [ebp - 0x30]
jl 0x4016ef
push dword [ebp - 0x14]
call fcn.00405683
pop ecx
push 1
pop eax
pop edi
pop esi
pop ebx
leave
ret
lea eax, [ebp - 0x178]
push ebx
push eax
push str.Cannot_write_Script__s__error:__lX_n
call fcn.00405eaa
add esp, 0xc
push 1
call fcn.00405f84
push ebp
mov ebp, esp
sub esp, 0x54
push ebx
push esi
push edi
push str.ADVAPI32.DLL
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
xor esi, esi
mov dword [ebp - 0x10], eax
cmp eax, esi
jne 0x401bb6
or eax, 0xffffffff
jmp 0x401d44
push str.CreateProcessWithLogonW
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
cmp eax, esi
mov dword [ebp - 0xc], eax
jne 0x401bd1
push 0xfffffffffffffffe
pop eax
jmp 0x401d44
push 0x44
lea eax, [ebp - 0x54]
pop edi
push edi
push esi
push eax
call fcn.00406200
push 0x10
push esi
push dword [ebp + 0x30]
mov dword [ebp - 0x54], edi
call fcn.00406200
mov edi, dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ebx, dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
add esp, 0x18
cmp dword [ebp + 0x28], esi
jne 0x401c06
mov dword [ebp + 0x28], esi
jmp 0x401c36
push dword [ebp + 0x28]
call edi
inc eax
mov dword [ebp - 4], eax
add eax, eax
add eax, 3
and al, 0xfc
call fcn.00406260
mov eax, esp
push dword [ebp - 4]
mov dword [ebp - 8], eax
push eax
push 0xffffffffffffffff
push dword [ebp + 0x28]
mov word [eax], si
push esi
push esi
call ebx
mov eax, dword [ebp - 8]
mov dword [ebp + 0x28], eax
cmp dword [ebp + 0x1c], esi
jne 0x401c40
mov dword [ebp + 0x1c], esi
jmp 0x401c70
push dword [ebp + 0x1c]
call edi
inc eax
mov dword [ebp - 4], eax
add eax, eax
add eax, 3
and al, 0xfc
call fcn.00406260
mov eax, esp
push dword [ebp - 4]
mov dword [ebp - 8], eax
push eax
push 0xffffffffffffffff
push dword [ebp + 0x1c]
mov word [eax], si
push esi
push esi
call ebx
mov eax, dword [ebp - 8]
mov dword [ebp + 0x1c], eax
cmp dword [ebp + 0x10], esi
jne 0x401c7a
mov dword [ebp + 0x10], esi
jmp 0x401caa
push dword [ebp + 0x10]
call edi
inc eax
mov dword [ebp - 4], eax
add eax, eax
add eax, 3
and al, 0xfc
call fcn.00406260
mov eax, esp
push dword [ebp - 4]
mov dword [ebp - 8], eax
push eax
push 0xffffffffffffffff
push dword [ebp + 0x10]
mov word [eax], si
push esi
push esi
call ebx
mov eax, dword [ebp - 8]
mov dword [ebp + 0x10], eax
cmp dword [ebp + 0xc], esi
jne 0x401cb4
mov dword [ebp + 0xc], esi
jmp 0x401ce4
push dword [ebp + 0xc]
call edi
inc eax
mov dword [ebp - 4], eax
add eax, eax
add eax, 3
and al, 0xfc
call fcn.00406260
mov eax, esp
push dword [ebp - 4]
mov dword [ebp - 8], eax
push eax
push 0xffffffffffffffff
push dword [ebp + 0xc]
mov word [eax], si
push esi
push esi
call ebx
mov eax, dword [ebp - 8]
mov dword [ebp + 0xc], eax
cmp dword [ebp + 8], esi
jne 0x401ced
xor eax, eax
jmp 0x401d18
push dword [ebp + 8]
call edi
mov edi, eax
inc edi
lea eax, [edi + edi]
add eax, 3
and al, 0xfc
call fcn.00406260
mov eax, esp
push edi
push eax
push 0xffffffffffffffff
push dword [ebp + 8]
mov dword [ebp - 8], eax
mov word [eax], si
push esi
push esi
call ebx
mov eax, dword [ebp - 8]
push dword [ebp + 0x30]
lea ecx, [ebp - 0x54]
push ecx
push dword [ebp + 0x28]
push esi
push dword [ebp + 0x20]
push dword [ebp + 0x1c]
push esi
push dword [ebp + 0x14]
push dword [ebp + 0x10]
push dword [ebp + 0xc]
push eax
call dword [ebp - 0xc]
push dword [ebp - 0x10]
mov esi, eax
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, esi
lea esp, [ebp - 0x60]
pop edi
pop esi
pop ebx
leave
ret 0x2c