mirror of
https://github.com/Orange-Cyberdefense/p3-loader
synced 2026-07-08 17:02:48 +00:00
47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
/*
|
|
* File: ShellCodeUserInput.h
|
|
* Authors: Max Hirschberger & Ogulcan Ugur
|
|
*/
|
|
|
|
|
|
#ifndef SHELLCODE_WRITER_H
|
|
#define SHELLCODE_WRITER_H
|
|
#include <Windows.h>
|
|
#include <cinttypes>
|
|
#include <vector>
|
|
|
|
|
|
class ShellCodeWriter {
|
|
public:
|
|
ShellCodeWriter();
|
|
std::vector<uint8_t> GetShellCodeBytes();
|
|
|
|
|
|
void CallMessageBoxA(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType);
|
|
void CallLoadLibraryA(LPCSTR p);
|
|
void CallTerminateProcess(HANDLE ProcessHandle, NTSTATUS ExitStatus);
|
|
void CallSuspendThread(HANDLE ThreadHandle, PULONG PreviousSuspendCount);
|
|
|
|
void LoadAndCallShellCode(const std::vector<uint8_t>& shellcode);
|
|
|
|
void AppendShellCode(const char* shellcode, size_t size);
|
|
private:
|
|
uint32_t m_total_consumed_stack_bytes;
|
|
std::vector<uint8_t> m_sc_bytes;
|
|
|
|
|
|
void SetRAXXOR(uint64_t xor_a_value, uint64_t xor_b_value);
|
|
void SetRAX(uint64_t value);
|
|
|
|
void PushValue(uint64_t value);
|
|
void PushBuffer(const void* buf, size_t size);
|
|
|
|
void SetArgRegister(int arg_index, uint64_t value);
|
|
void SetArgRegisterStackRelative(int arg_index, int stack_relative_offset);
|
|
void Call(uint64_t pfn);
|
|
|
|
void FreeStack();
|
|
|
|
};
|
|
|
|
#endif // SHELLCODE_WRITER_H
|