Files
maxDcb-C2Core/modules/WmiExec/tests/testsWmiExec.cpp
T
Maxime DE CAUMIA BAILLENX 085aba53a2 Add WmiExec
2023-07-21 08:29:36 +02:00

47 lines
988 B
C++

#include "../WmiExec.hpp"
#ifdef __linux__
#elif _WIN32
#include <windows.h>
#endif
bool testWmiExec();
int main()
{
bool res;
std::cout << "[+] testWmiExec" << std::endl;
res = testWmiExec();
if (res)
std::cout << "[+] Sucess" << std::endl;
else
std::cout << "[-] Failed" << std::endl;
return 0;
}
bool testWmiExec()
{
std::unique_ptr<WmiExec> wmiExec = std::make_unique<WmiExec>();
{
std::vector<std::string> splitedCmd;
splitedCmd.push_back("wmiExec");
splitedCmd.push_back("127.0.0.1");
splitedCmd.push_back("c:\\windows\\system32\\notepad.exe");
C2Message c2Message;
C2Message c2RetMessage;
wmiExec->init(splitedCmd, c2Message);
wmiExec->process(c2Message, c2RetMessage);
std::string output = "\n\noutput:\n";
output += c2RetMessage.returnvalue();
output += "\n";
std::cout << output << std::endl;
}
return true;
}