mirror of
https://github.com/maxDcb/C2Core
synced 2026-06-08 15:48:01 +00:00
46 lines
892 B
C++
46 lines
892 B
C++
#pragma once
|
|
|
|
#include "ModuleCmd.hpp"
|
|
|
|
#ifdef _WIN32
|
|
#include <Windows.h>
|
|
#endif
|
|
|
|
|
|
class AssemblyExec : public ModuleCmd
|
|
{
|
|
|
|
public:
|
|
AssemblyExec();
|
|
~AssemblyExec();
|
|
|
|
std::string getInfo();
|
|
|
|
int init(std::vector<std::string>& splitedCmd, C2Message& c2Message);
|
|
int initConfig(const nlohmann::json &config);
|
|
int process(C2Message& c2Message, C2Message& c2RetMessage);
|
|
|
|
private:
|
|
std::string m_processToSpawn;
|
|
|
|
#ifdef _WIN32
|
|
int createNewProcess(const std::string& payload, const std::string& processToSpawn, std::string& result);
|
|
int createNewThread(const std::string& payload, std::string& result);
|
|
|
|
bool m_isProcessRuning;
|
|
HANDLE m_processHandle;
|
|
int killProcess();
|
|
#endif
|
|
};
|
|
|
|
#ifdef _WIN32
|
|
|
|
extern "C" __declspec(dllexport) AssemblyExec * A_AssemblyExecConstructor();
|
|
|
|
#else
|
|
|
|
extern "C" __attribute__((visibility("default"))) AssemblyExec * AssemblyExecConstructor();
|
|
|
|
#endif
|
|
|