diff --git a/modules/CoffLoader/CoffLoader.cpp b/modules/CoffLoader/CoffLoader.cpp index b30fc4e..014c7cd 100644 --- a/modules/CoffLoader/CoffLoader.cpp +++ b/modules/CoffLoader/CoffLoader.cpp @@ -71,6 +71,7 @@ std::string CoffLoader::getInfo() int CoffLoader::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) if (splitedCmd.size() < 3) { c2Message.set_returnvalue(getInfo()); @@ -114,7 +115,7 @@ int CoffLoader::init(std::vector& splitedCmd, C2Message& c2Message) c2Message.set_returnvalue(msg); return -1; } - +#endif return 0; } diff --git a/modules/Download/Download.cpp b/modules/Download/Download.cpp index c03b77e..f0c23fe 100644 --- a/modules/Download/Download.cpp +++ b/modules/Download/Download.cpp @@ -60,6 +60,7 @@ std::string Download::getInfo() int Download::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) std::vector quoteRegroupedCmd = regroupStrings(splitedCmd); if (quoteRegroupedCmd.size() == 3) @@ -76,6 +77,7 @@ int Download::init(std::vector &splitedCmd, C2Message &c2Message) c2Message.set_returnvalue(getInfo()); return -1; } +#endif return 0; } @@ -196,6 +198,7 @@ int Download::process(C2Message &c2Message, C2Message &c2RetMessage) int Download::followUp(const C2Message &c2RetMessage) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) // check if there is an error if(c2RetMessage.errorCode()==-1) { @@ -218,6 +221,7 @@ int Download::followUp(const C2Message &c2RetMessage) } } +#endif return 0; } diff --git a/modules/EnumerateShares/EnumerateShares.cpp b/modules/EnumerateShares/EnumerateShares.cpp index 6f7097e..153445b 100644 --- a/modules/EnumerateShares/EnumerateShares.cpp +++ b/modules/EnumerateShares/EnumerateShares.cpp @@ -52,11 +52,14 @@ std::string EnumerateShares::getInfo() int EnumerateShares::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) std::string host; if(splitedCmd.size() > 1) host = splitedCmd[1]; c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(host); +#endif + return 0; } diff --git a/modules/GetEnv/GetEnv.cpp b/modules/GetEnv/GetEnv.cpp index 388584b..6f7bf6a 100644 --- a/modules/GetEnv/GetEnv.cpp +++ b/modules/GetEnv/GetEnv.cpp @@ -50,7 +50,10 @@ std::string GetEnv::getInfo() int GetEnv::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); +#endif + return 0; } diff --git a/modules/IpConfig/IpConfig.cpp b/modules/IpConfig/IpConfig.cpp index 0241807..c624344 100644 --- a/modules/IpConfig/IpConfig.cpp +++ b/modules/IpConfig/IpConfig.cpp @@ -57,7 +57,10 @@ std::string IpConfig::getInfo() int IpConfig::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); +#endif + return 0; } diff --git a/modules/ListDirectory/ListDirectory.cpp b/modules/ListDirectory/ListDirectory.cpp index 747b754..1799aca 100644 --- a/modules/ListDirectory/ListDirectory.cpp +++ b/modules/ListDirectory/ListDirectory.cpp @@ -60,6 +60,7 @@ std::string ListDirectory::getInfo() int ListDirectory::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) string path; for (int idx = 1; idx < splitedCmd.size(); idx++) { @@ -70,6 +71,7 @@ int ListDirectory::init(std::vector &splitedCmd, C2Message &c2Messa c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(path); +#endif return 0; } diff --git a/modules/ListProcesses/ListProcesses.cpp b/modules/ListProcesses/ListProcesses.cpp index 1581bed..3533db4 100644 --- a/modules/ListProcesses/ListProcesses.cpp +++ b/modules/ListProcesses/ListProcesses.cpp @@ -385,8 +385,10 @@ std::string ListProcesses::getInfo() int ListProcesses::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(""); +#endif return 0; } diff --git a/modules/Netstat/Netstat.cpp b/modules/Netstat/Netstat.cpp index 04fa3e5..1675129 100644 --- a/modules/Netstat/Netstat.cpp +++ b/modules/Netstat/Netstat.cpp @@ -61,7 +61,10 @@ std::string Netstat::getInfo() int Netstat::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); +#endif + return 0; } diff --git a/modules/PrintWorkingDirectory/PrintWorkingDirectory.cpp b/modules/PrintWorkingDirectory/PrintWorkingDirectory.cpp index be14df5..2b70a5a 100644 --- a/modules/PrintWorkingDirectory/PrintWorkingDirectory.cpp +++ b/modules/PrintWorkingDirectory/PrintWorkingDirectory.cpp @@ -58,8 +58,10 @@ std::string PrintWorkingDirectory::getInfo() int PrintWorkingDirectory::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(""); +#endif return 0; } diff --git a/modules/Rev2self/Rev2self.cpp b/modules/Rev2self/Rev2self.cpp index 8099468..8f10a20 100644 --- a/modules/Rev2self/Rev2self.cpp +++ b/modules/Rev2self/Rev2self.cpp @@ -60,8 +60,10 @@ std::string Rev2self::getInfo() int Rev2self::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(""); +#endif return 0; } diff --git a/modules/Run/Run.cpp b/modules/Run/Run.cpp index 6ee1233..abb870a 100644 --- a/modules/Run/Run.cpp +++ b/modules/Run/Run.cpp @@ -72,6 +72,7 @@ std::string Run::getInfo() int Run::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) if(splitedCmd.size()<2) { c2Message.set_returnvalue(getInfo()); @@ -87,6 +88,7 @@ int Run::init(std::vector &splitedCmd, C2Message &c2Message) c2Message.set_instruction(splitedCmd[0]); c2Message.set_cmd(shellCmd); +#endif return 0; } diff --git a/modules/Script/Script.cpp b/modules/Script/Script.cpp index a6afbd4..5ab23f3 100644 --- a/modules/Script/Script.cpp +++ b/modules/Script/Script.cpp @@ -58,6 +58,7 @@ std::string Script::getInfo() int Script::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) if(splitedCmd.size()<2) { c2Message.set_returnvalue(getInfo()); @@ -83,6 +84,7 @@ int Script::init(std::vector &splitedCmd, C2Message &c2Message) c2Message.set_returnvalue(err); return -1; } +#endif return 0; } diff --git a/modules/SpawnAs/SpawnAs.cpp b/modules/SpawnAs/SpawnAs.cpp index 6c0b50d..81a0b7b 100644 --- a/modules/SpawnAs/SpawnAs.cpp +++ b/modules/SpawnAs/SpawnAs.cpp @@ -238,6 +238,7 @@ SpawnAs::Options SpawnAs::unpackParameters(const std::string& data) const int SpawnAs::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) auto regroupedCmd = regroupStrings(splitedCmd); if (regroupedCmd.size() < 4) @@ -397,6 +398,7 @@ int SpawnAs::init(std::vector &splitedCmd, C2Message &c2Message) c2Message.set_cmd(cmd); c2Message.set_data(programToLaunch.data(), static_cast(programToLaunch.size())); c2Message.set_args(packParameters(options)); +#endif return 0; } diff --git a/modules/Upload/Upload.cpp b/modules/Upload/Upload.cpp index c751357..ff8232f 100644 --- a/modules/Upload/Upload.cpp +++ b/modules/Upload/Upload.cpp @@ -60,6 +60,7 @@ std::string Upload::getInfo() int Upload::init(std::vector &splitedCmd, C2Message &c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) std::vector quoteRegroupedCmd = regroupStrings(splitedCmd); if (quoteRegroupedCmd.size() == 3) @@ -89,6 +90,7 @@ int Upload::init(std::vector &splitedCmd, C2Message &c2Message) c2Message.set_returnvalue(getInfo()); return -1; } +#endif return 0; } diff --git a/modules/Whoami/Whoami.cpp b/modules/Whoami/Whoami.cpp index 37f456d..aa205da 100644 --- a/modules/Whoami/Whoami.cpp +++ b/modules/Whoami/Whoami.cpp @@ -56,7 +56,9 @@ std::string Whoami::getInfo() int Whoami::init(std::vector& splitedCmd, C2Message& c2Message) { +#if defined(BUILD_TEAMSERVER) || defined(C2CORE_BUILD_TESTS) c2Message.set_instruction(splitedCmd[0]); +#endif return 0; }