diff --git a/beacon/CMakeLists.txt b/beacon/CMakeLists.txt index c50f11e..cbb6f4a 100644 --- a/beacon/CMakeLists.txt +++ b/beacon/CMakeLists.txt @@ -12,9 +12,9 @@ set(SOURCES_BEACON_HTTP_EXE add_executable(BeaconHttp ${SOURCES_BEACON_HTTP_EXE} project.rc) if(WIN32) - target_link_libraries(BeaconHttp SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconHttp SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconHttp SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost) + target_link_libraries(BeaconHttp SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconHttp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") @@ -31,9 +31,9 @@ set(SOURCES_BEACON_HTTP_DLL add_library(BeaconHttpDll SHARED ${SOURCES_BEACON_HTTP_DLL}) if(WIN32) - target_link_libraries(BeaconHttpDll SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconHttpDll SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconHttpDll SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost) + target_link_libraries(BeaconHttpDll SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconHttpDll POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") @@ -51,9 +51,9 @@ set(SOURCES_BEACON_TCP_EXE add_executable(BeaconTcp ${SOURCES_BEACON_TCP_EXE}) if(WIN32) - target_link_libraries(BeaconTcp SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconTcp SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconTcp SocketHandler PipeHandler MemoryModule boost::boost) + target_link_libraries(BeaconTcp SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconTcp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") @@ -71,9 +71,9 @@ set(SOURCES_BEACON_SMB_EXE add_executable(BeaconSmb ${SOURCES_BEACON_SMB_EXE}) if(WIN32) - target_link_libraries(BeaconSmb SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconSmb SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconSmb SocketHandler PipeHandler MemoryModule boost::boost) + target_link_libraries(BeaconSmb SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconSmb POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") @@ -91,9 +91,9 @@ set(SOURCES_BEACON_GITHUB_EXE add_executable(BeaconGithub ${SOURCES_BEACON_GITHUB_EXE}) if(WIN32) - target_link_libraries(BeaconGithub SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconGithub SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconGithub SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost) + target_link_libraries(BeaconGithub SocketHandler PipeHandler MemoryModule openssl::openssl boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconGithub POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") @@ -111,9 +111,9 @@ set(SOURCES_BEACON_DNS_EXE add_executable(BeaconDns ${SOURCES_BEACON_DNS_EXE}) if(WIN32) - target_link_libraries(BeaconDns Dnscommunication SocketHandler PipeHandler MemoryModule) + target_link_libraries(BeaconDns Dnscommunication SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(BeaconDns Dnscommunication SocketHandler PipeHandler MemoryModule boost::boost) + target_link_libraries(BeaconDns Dnscommunication SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET BeaconDns POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Beacons/$") diff --git a/beacon/tests/CMakeLists.txt b/beacon/tests/CMakeLists.txt index a95a4d8..800988d 100644 --- a/beacon/tests/CMakeLists.txt +++ b/beacon/tests/CMakeLists.txt @@ -14,9 +14,9 @@ testBeacon.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) IF (WIN32) - target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule) + target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) ELSE() - target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule boost::boost) + target_link_libraries(testBeacon SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) ENDIF() add_custom_command(TARGET testBeacon POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") @@ -29,7 +29,11 @@ testBeaconDns.cpp ../../listener/ListenerTcp.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testBeaconDns SocketHandler Dnscommunication PipeHandler MemoryModule) +IF (WIN32) + target_link_libraries(testBeaconDns SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) +ELSE() + target_link_libraries(testBeaconDns SocketHandler Dnscommunication PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) +ENDIF() add_custom_command(TARGET testBeaconDns POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testBeaconDns COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -41,7 +45,11 @@ testBeaconGithub.cpp ../../listener/ListenerTcp.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testBeaconGithub SocketHandler PipeHandler MemoryModule) +IF (WIN32) + target_link_libraries(testBeaconGithub SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) +ELSE() + target_link_libraries(testBeaconGithub SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) +ENDIF() add_custom_command(TARGET testBeaconGithub POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testBeaconGithub COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -53,7 +61,11 @@ testBeaconHttp.cpp ../../listener/ListenerTcp.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testBeaconHttp SocketHandler PipeHandler MemoryModule) +IF (WIN32) + target_link_libraries(testBeaconHttp SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) +ELSE() + target_link_libraries(testBeaconHttp SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) +ENDIF() add_custom_command(TARGET testBeaconHttp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testBeaconHttp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -65,7 +77,11 @@ testBeaconSmb.cpp ../../listener/ListenerTcp.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testBeaconSmb SocketHandler PipeHandler MemoryModule) +IF (WIN32) + target_link_libraries(testBeaconSmb SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) +ELSE() + target_link_libraries(testBeaconSmb SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) +ENDIF() add_custom_command(TARGET testBeaconSmb POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testBeaconSmb COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -77,7 +93,11 @@ testBeaconTcp.cpp ../../listener/ListenerTcp.cpp ../../listener/ListenerSmb.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testBeaconTcp SocketHandler PipeHandler MemoryModule) +IF (WIN32) + target_link_libraries(testBeaconTcp SocketHandler PipeHandler MemoryModule spdlog::spdlog nlohmann_json::nlohmann_json) +ELSE() + target_link_libraries(testBeaconTcp SocketHandler PipeHandler MemoryModule boost::boost spdlog::spdlog nlohmann_json::nlohmann_json) +ENDIF() add_custom_command(TARGET testBeaconTcp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testBeaconTcp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") diff --git a/listener/Listener.cpp b/listener/Listener.cpp index 59b0637..9bbfcde 100644 --- a/listener/Listener.cpp +++ b/listener/Listener.cpp @@ -328,7 +328,10 @@ bool Listener::handleMessages(const std::string& input, std::string& output) bool SessionExist = isSessionExist(beaconHash, listenerhash); if(SessionExist==false) { - DEBUG("beaconHash " << beaconHash << " listenerhash " << listenerhash); + +#if defined(BUILD_TEAMSERVER) || defined(BUILD_TESTS) + SPDLOG_DEBUG("beaconHash {0}, listenerhash {0}", beaconHash, listenerhash); +#endif std::string username = bundleC2Message->username(); std::string hostname = bundleC2Message->hostname(); diff --git a/listener/Listener.hpp b/listener/Listener.hpp index 7216946..9ef15e2 100644 --- a/listener/Listener.hpp +++ b/listener/Listener.hpp @@ -9,6 +9,12 @@ #include "Session.hpp" #include "Common.hpp" +#ifdef BUILD_TEAMSERVER +#include "spdlog/spdlog.h" +#include "spdlog/sinks/stdout_color_sinks.h" +#include "spdlog/sinks/rotating_file_sink.h" +#include "spdlog/sinks/basic_file_sink.h" +#endif #ifdef __linux__ @@ -91,6 +97,5 @@ protected: std::vector> m_sessions; private: - std::mutex m_mutex; - + std::mutex m_mutex; }; diff --git a/listener/ListenerGithub.cpp b/listener/ListenerGithub.cpp index c520dd4..7497e8c 100644 --- a/listener/ListenerGithub.cpp +++ b/listener/ListenerGithub.cpp @@ -1,12 +1,5 @@ #include "ListenerGithub.hpp" -#include -#include -#include - -namespace logging = boost::log; - - using namespace std; using namespace httplib; using json = nlohmann::json; @@ -62,13 +55,13 @@ void ListenerGithub::checkGithubIssues() auto err = response.error(); if(err!=httplib::Error::Success) { - BOOST_LOG_TRIVIAL(error) << "Http client Get " << httplib::to_string(err); + SPDLOG_ERROR("Http client Get {0}", httplib::to_string(err)); continue; } if(response->status!=200 && response->status!=201) { - BOOST_LOG_TRIVIAL(error) << "Error with the ListenerGithub: " << response->body; + SPDLOG_ERROR("Error with the ListenerGithub: {0}", response->body); continue; } @@ -86,10 +79,10 @@ void ListenerGithub::checkGithubIssues() if(nbComments!=0) { - BOOST_LOG_TRIVIAL(debug) << "Issue with comments: " << std::to_string(number) << std::endl;; + SPDLOG_DEBUG("Issue with comments: {0}", std::to_string(number)); } - BOOST_LOG_TRIVIAL(trace) << "[+] handle issue: " << std::to_string(number); + SPDLOG_TRACE("[+] handle issue: {0}", std::to_string(number)); if(title.rfind("ResponseC2: ", 0) == 0) { @@ -122,7 +115,7 @@ void ListenerGithub::checkGithubIssues() chunks.push_back(res.substr(i, maxChunkSize)); } - BOOST_LOG_TRIVIAL(debug) << "Split response of " << chunks.size() << " chunks" << std::endl; + SPDLOG_DEBUG("Split response of {0} chunks", chunks.size()); nlohmann::json responseData = { {"title", reponseTitle}, @@ -137,15 +130,15 @@ void ListenerGithub::checkGithubIssues() err = response.error(); if(err!=httplib::Error::Success) { - BOOST_LOG_TRIVIAL(error) << "Http client Post Issue " << httplib::to_string(err); + SPDLOG_ERROR("Http client Post Issue {0}", httplib::to_string(err)); continue; } - BOOST_LOG_TRIVIAL(trace) << "Issue created " << response->status << std::endl; + SPDLOG_TRACE("Issue created {0}", response->status); if(response->status!=200 && response->status!=201) { - BOOST_LOG_TRIVIAL(error) << "Error with the ListenerGithub: " << response->body; + SPDLOG_ERROR("Error with the ListenerGithub: {0}", response->body); continue; } @@ -171,13 +164,13 @@ void ListenerGithub::checkGithubIssues() err = response.error(); if(err!=httplib::Error::Success) { - BOOST_LOG_TRIVIAL(error) << "Http client Post Comments" << httplib::to_string(err); + SPDLOG_ERROR("Http client Post Comments {0}", httplib::to_string(err)); continue; } if(response->status!=200 && response->status!=201) { - BOOST_LOG_TRIVIAL(error) << "Error with the ListenerGithub: " << response->body; + SPDLOG_ERROR("Error with the ListenerGithub: {0}", response->body); continue; } } @@ -199,13 +192,13 @@ void ListenerGithub::checkGithubIssues() err = response.error(); if(err!=httplib::Error::Success) { - BOOST_LOG_TRIVIAL(error) << "Http client Post " << httplib::to_string(err); + SPDLOG_ERROR("Http client Post {0}", httplib::to_string(err)); continue; } if(response->status!=200 && response->status!=201) { - BOOST_LOG_TRIVIAL(error) << "Error with the ListenerGithub: " << response->body; + SPDLOG_ERROR("Error with the ListenerGithub: {0}", response->body); continue; } } @@ -224,7 +217,7 @@ void ListenerGithub::checkGithubIssues() err = response.error(); if(err!=httplib::Error::Success) { - BOOST_LOG_TRIVIAL(error) << "Http client Post close " << httplib::to_string(err); + SPDLOG_ERROR("Http client Post close {0}", httplib::to_string(err)); continue; } } @@ -238,7 +231,7 @@ void ListenerGithub::checkGithubIssues() int ListenerGithub::HandleCheckIn(const std::string& req, std::string& output) { - BOOST_LOG_TRIVIAL(trace) << "HandleCheckIn"; + SPDLOG_TRACE("HandleCheckIn"); try { @@ -246,11 +239,11 @@ int ListenerGithub::HandleCheckIn(const std::string& req, std::string& output) } catch (const std::exception& ex) { - BOOST_LOG_TRIVIAL(error) << "HandleCheckIn catch exception"; + SPDLOG_ERROR("HandleCheckIn catch exception"); } catch (...) { - BOOST_LOG_TRIVIAL(error) << "HandleCheckIn catch..."; + SPDLOG_ERROR("HandleCheckIn catch..."); } diff --git a/listener/ListenerHttp.cpp b/listener/ListenerHttp.cpp index 46b4cdc..5f1d8f0 100644 --- a/listener/ListenerHttp.cpp +++ b/listener/ListenerHttp.cpp @@ -1,12 +1,5 @@ #include "ListenerHttp.hpp" -#include -#include -#include - -namespace logging = boost::log; - - using namespace std; using namespace httplib; using json = nlohmann::json; @@ -52,7 +45,7 @@ ListenerHttp::ListenerHttp(const std::string& ip, int localPort, const nlohmann: } catch (const json::out_of_range) { - BOOST_LOG_TRIVIAL(fatal) << "No ServHttpsListenerCrtFile or ServHttpsListenerKeyFile in config."; + SPDLOG_CRITICAL("No ServHttpsListenerCrtFile or ServHttpsListenerKeyFile in config."); return; } } @@ -89,14 +82,17 @@ void ListenerHttp::lauchHttpServ() if(it != m_config[0].end()) downloadFolder = m_config[0]["downloadFolder"].get();; - BOOST_LOG_TRIVIAL(info) << "uriFileDownload " << uriFileDownload; - BOOST_LOG_TRIVIAL(info) << "downloadFolder " << downloadFolder; + SPDLOG_INFO("uriFileDownload {0}", uriFileDownload); + SPDLOG_INFO("downloadFolder {0}", downloadFolder); for (json::iterator it = uri.begin(); it != uri.end(); ++it) - BOOST_LOG_TRIVIAL(info) << "uri " << *it; + { + std::string uriTmp = *it; + SPDLOG_INFO("uri {0}", uriTmp); + } } catch (const json::out_of_range) { - BOOST_LOG_TRIVIAL(fatal) << "No uri in config."; + SPDLOG_CRITICAL("No uri in config."); return; } @@ -117,7 +113,7 @@ void ListenerHttp::lauchHttpServ() } else { - BOOST_LOG_TRIVIAL(info) << "Unauthorized connection " << req.path; + SPDLOG_INFO("Unauthorized connection {0}", req.path); res.status = 401; return Server::HandlerResponse::Handled; } @@ -129,18 +125,18 @@ void ListenerHttp::lauchHttpServ() { try { - BOOST_LOG_TRIVIAL(info) << "Post connection: " << req.path; + SPDLOG_INFO("Post connection: {0}", req.path); this->HandleCheckIn(req, res); res.status = 200; } catch(const std::exception& ex) { - BOOST_LOG_TRIVIAL(info) << "Execption " << ex.what(); + SPDLOG_INFO("Execption {0}", ex.what()); res.status = 401; } catch (...) { - BOOST_LOG_TRIVIAL(info) << "Unknown failure occurred."; + SPDLOG_INFO("Unknown failure occurred."); res.status = 401; } }); @@ -151,7 +147,7 @@ void ListenerHttp::lauchHttpServ() { try { - BOOST_LOG_TRIVIAL(info) << "Get connection: " << req.path; + SPDLOG_INFO("Get connection: {0}", req.path); if (req.has_header("Authorization")) { // jwt should contained Bearer b64data.b6data.beaconData @@ -170,24 +166,24 @@ void ListenerHttp::lauchHttpServ() } else { - BOOST_LOG_TRIVIAL(info) << "Get: invalide JWT"; + SPDLOG_INFO("Get: invalide JWT"); res.status = 401; } } else { - BOOST_LOG_TRIVIAL(info) << "Get: no Authorization header"; + SPDLOG_INFO("Get: no Authorization header"); res.status = 401; } } catch(const std::exception& ex) { - BOOST_LOG_TRIVIAL(info) << "Execption " << ex.what(); + SPDLOG_INFO("Execption {0}", ex.what()); res.status = 401; } catch (...) { - BOOST_LOG_TRIVIAL(info) << "Unknown failure occurred."; + SPDLOG_INFO("Unknown failure occurred."); res.status = 401; } }); @@ -199,7 +195,7 @@ void ListenerHttp::lauchHttpServ() fileDownloadReg+=":filename"; m_svr->Get(fileDownloadReg, [&](const Request& req, Response& res) { - BOOST_LOG_TRIVIAL(info) << "File server connection: " << req.path; + SPDLOG_INFO("File server connection: {0}", req.path); std::string filename = req.path_params.at("filename"); std::string filePath = downloadFolder; @@ -216,7 +212,7 @@ void ListenerHttp::lauchHttpServ() } else { - BOOST_LOG_TRIVIAL(info) << "File server: File not found."; + SPDLOG_INFO("File server: File not found."); res.status = 404; } }); @@ -230,8 +226,8 @@ int ListenerHttp::HandleCheckIn(const httplib::Request& req, httplib::Response& { string input = req.body; - BOOST_LOG_TRIVIAL(trace) << "m_isHttps " << std::to_string(m_isHttps); - BOOST_LOG_TRIVIAL(trace) << "input.size " << std::to_string(input.size()); + SPDLOG_TRACE("m_isHttps {0}", std::to_string(m_isHttps)); + SPDLOG_TRACE("input.size {0}", std::to_string(input.size())); string output; bool ret = handleMessages(input, output); @@ -244,7 +240,7 @@ int ListenerHttp::HandleCheckIn(const httplib::Request& req, httplib::Response& } catch (const json::out_of_range) { - BOOST_LOG_TRIVIAL(fatal) << "No server headers in config."; + SPDLOG_CRITICAL("No server headers in config."); return -1; } @@ -253,7 +249,7 @@ int ListenerHttp::HandleCheckIn(const httplib::Request& req, httplib::Response& httpServerHeaders.insert({(it).key(), (it).value()}); res.headers = httpServerHeaders; - BOOST_LOG_TRIVIAL(trace) << "output.size " << std::to_string(output.size()); + SPDLOG_TRACE("output.size {0}", std::to_string(output.size())); if(ret) res.body = output; @@ -266,8 +262,8 @@ int ListenerHttp::HandleCheckIn(const httplib::Request& req, httplib::Response& int ListenerHttp::HandleCheckIn(const std::string& requestData, httplib::Response& res) { - BOOST_LOG_TRIVIAL(trace) << "m_isHttps " << std::to_string(m_isHttps); - BOOST_LOG_TRIVIAL(trace) << "requestData.size " << std::to_string(requestData.size()); + SPDLOG_TRACE("m_isHttps {0}", std::to_string(m_isHttps)); + SPDLOG_TRACE("requestData.size {0}", std::to_string(requestData.size())); string output; bool ret = handleMessages(requestData, output); @@ -280,7 +276,7 @@ int ListenerHttp::HandleCheckIn(const std::string& requestData, httplib::Respons } catch (const json::out_of_range) { - BOOST_LOG_TRIVIAL(fatal) << "No server headers in config."; + SPDLOG_CRITICAL("No server headers in config."); return -1; } @@ -289,7 +285,7 @@ int ListenerHttp::HandleCheckIn(const std::string& requestData, httplib::Respons httpServerHeaders.insert({(it).key(), (it).value()}); res.headers = httpServerHeaders; - BOOST_LOG_TRIVIAL(trace) << "output.size " << std::to_string(output.size()); + SPDLOG_TRACE("output.size {0}", std::to_string(output.size())); if(ret) res.body = output; diff --git a/listener/tests/CMakeLists.txt b/listener/tests/CMakeLists.txt index b5cae04..edbb3db 100644 --- a/listener/tests/CMakeLists.txt +++ b/listener/tests/CMakeLists.txt @@ -7,6 +7,11 @@ ELSE() ENDIF() add_executable(testListener testListener.cpp) +if(WIN32) + +else() + target_link_libraries(testListener spdlog::spdlog nlohmann_json::nlohmann_json) +endif() add_custom_command(TARGET testListener POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListener COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -15,19 +20,31 @@ IF (WIN32) ELSE() add_executable(testListenerDns testListenerDns.cpp) -target_link_libraries(testListenerDns Dnscommunication) +if(WIN32) + target_link_libraries(testListenerDns Dnscommunication spdlog::spdlog nlohmann_json::nlohmann_json) +else() + target_link_libraries(testListenerDns Dnscommunication spdlog::spdlog nlohmann_json::nlohmann_json) +endif() add_custom_command(TARGET testListenerDns POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListenerDns COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") add_executable(testListenerGithub testListenerGithub.cpp) -target_link_libraries(testListenerGithub openssl::openssl) +if(WIN32) + target_link_libraries(testListenerGithub openssl::openssl spdlog::spdlog nlohmann_json::nlohmann_json) +else() + target_link_libraries(testListenerGithub openssl::openssl spdlog::spdlog nlohmann_json::nlohmann_json) +endif() add_custom_command(TARGET testListenerGithub POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListenerGithub COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") add_executable(testListenerHttp testListenerHttp.cpp) -target_link_libraries(testListenerHttp openssl::openssl) +if(WIN32) + target_link_libraries(testListenerHttp openssl::openssl spdlog::spdlog nlohmann_json::nlohmann_json) +else() + target_link_libraries(testListenerHttp openssl::openssl spdlog::spdlog nlohmann_json::nlohmann_json) +endif() add_custom_command(TARGET testListenerHttp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListenerHttp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") @@ -35,13 +52,21 @@ add_test(NAME testListenerHttp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListenerSmb COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") add_executable(testListenerTcp testListenerTcp.cpp) -target_link_libraries(testListenerTcp SocketHandler) +if(WIN32) + target_link_libraries(testListenerTcp SocketHandler spdlog::spdlog nlohmann_json::nlohmann_json) +else() + target_link_libraries(testListenerTcp SocketHandler spdlog::spdlog nlohmann_json::nlohmann_json) +endif() add_custom_command(TARGET testListenerTcp POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") add_test(NAME testListenerTcp COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") diff --git a/modules/AssemblyExec/CMakeLists.txt b/modules/AssemblyExec/CMakeLists.txt index 5d764b3..a78470c 100644 --- a/modules/AssemblyExec/CMakeLists.txt +++ b/modules/AssemblyExec/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(../) add_library(AssemblyExec SHARED AssemblyExec.cpp) if(WITH_TESTS) message(STATUS "[+] AssemblyExec Tests are enable.") - target_link_libraries(AssemblyExec ${Donut}) + target_link_libraries(AssemblyExec ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() message(STATUS "[-] AssemblyExec Tests are disable.") endif() @@ -13,9 +13,9 @@ if(WITH_TESTS) add_executable(testsAssemblyExec tests/testsAssemblyExec.cpp AssemblyExec.cpp) if(WIN32) - target_link_libraries(testsAssemblyExec ${Donut} ) + target_link_libraries(testsAssemblyExec ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(testsAssemblyExec ${Donut} ${aplib64} ) + target_link_libraries(testsAssemblyExec ${Donut} ${aplib64} spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET testsAssemblyExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy diff --git a/modules/Cat/CMakeLists.txt b/modules/Cat/CMakeLists.txt index d193b6f..fee177d 100644 --- a/modules/Cat/CMakeLists.txt +++ b/modules/Cat/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Cat SHARED Cat.cpp) +target_link_libraries(Cat spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Cat POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsCat tests/testsCat.cpp Cat.cpp) -target_link_libraries(testsCat) -add_custom_command(TARGET testsCat POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsCat tests/testsCat.cpp Cat.cpp) + target_link_libraries(testsCat spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsCat POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsCat COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsCat COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/ChangeDirectory/CMakeLists.txt b/modules/ChangeDirectory/CMakeLists.txt index 2d9e516..adcef7b 100644 --- a/modules/ChangeDirectory/CMakeLists.txt +++ b/modules/ChangeDirectory/CMakeLists.txt @@ -1,12 +1,14 @@ include_directories(../) add_library(ChangeDirectory SHARED ChangeDirectory.cpp) +target_link_libraries(ChangeDirectory spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET ChangeDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsChangeDirectory tests/testsChangeDirectory.cpp ChangeDirectory.cpp) -add_custom_command(TARGET testsChangeDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsChangeDirectory tests/testsChangeDirectory.cpp ChangeDirectory.cpp) + target_link_libraries(testsChangeDirectory spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsChangeDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsChangeDirectory COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsChangeDirectory COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Chisel/CMakeLists.txt b/modules/Chisel/CMakeLists.txt index 6c443c7..42f5aa7 100644 --- a/modules/Chisel/CMakeLists.txt +++ b/modules/Chisel/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(../) add_library(Chisel SHARED Chisel.cpp) if(WITH_TESTS) message(STATUS "[+] Chisel Tests are enable.") - target_link_libraries(Chisel ${Donut}) + target_link_libraries(Chisel ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() message(STATUS "[-] Chisel Tests are disable.") endif() @@ -13,9 +13,9 @@ if(WITH_TESTS) add_executable(testsChisel tests/testsChisel.cpp Chisel.cpp) if(WIN32) - target_link_libraries(testsChisel ${Donut} ) + target_link_libraries(testsChisel ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(testsChisel ${Donut} ${aplib64} ) + target_link_libraries(testsChisel ${Donut} ${aplib64} spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET testsChisel POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy @@ -23,3 +23,4 @@ $ "${CMAKE_SOURCE_DIR}/Tests/$") endif() + diff --git a/modules/CoffLoader/CMakeLists.txt b/modules/CoffLoader/CMakeLists.txt index 618a5d7..9183b89 100644 --- a/modules/CoffLoader/CMakeLists.txt +++ b/modules/CoffLoader/CMakeLists.txt @@ -1,14 +1,14 @@ include_directories(../) add_library(Coff SHARED CoffLoader.cpp) -target_link_libraries(Coff CoffLoader CoffPacker) +target_link_libraries(Coff CoffLoader CoffPacker spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Coff POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsCoffLoader tests/testsCoffLoader.cpp CoffLoader.cpp) -target_link_libraries(testsCoffLoader CoffLoader CoffPacker) -add_custom_command(TARGET testsCoffLoader POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsCoffLoader tests/testsCoffLoader.cpp CoffLoader.cpp) + target_link_libraries(testsCoffLoader CoffLoader CoffPacker spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsCoffLoader POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsCoffLoader COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsCoffLoader COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Download/CMakeLists.txt b/modules/Download/CMakeLists.txt index 14fa226..94ba86a 100644 --- a/modules/Download/CMakeLists.txt +++ b/modules/Download/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Download SHARED Download.cpp) +target_link_libraries(Download spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Download POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsDownload tests/testsDownload.cpp Download.cpp) -target_link_libraries(testsDownload) -add_custom_command(TARGET testsDownload POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsDownload tests/testsDownload.cpp Download.cpp) + target_link_libraries(testsDownload spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsDownload POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsDownload COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsDownload COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Evasion/CMakeLists.txt b/modules/Evasion/CMakeLists.txt index b75c9df..4cd32a9 100644 --- a/modules/Evasion/CMakeLists.txt +++ b/modules/Evasion/CMakeLists.txt @@ -1,14 +1,14 @@ include_directories(../) add_library(Evasion SHARED Evasion.cpp) -target_link_libraries(Evasion) +target_link_libraries(Evasion spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Evasion POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsEvasion tests/testsEvasion.cpp Evasion.cpp) -target_link_libraries(testsEvasion) -add_custom_command(TARGET testsEvasion POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsEvasion tests/testsEvasion.cpp Evasion.cpp) + target_link_libraries(testsEvasion spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsEvasion POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsEvasion COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") -endif() \ No newline at end of file + add_test(NAME testsEvasion COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") +endif() diff --git a/modules/Inject/CMakeLists.txt b/modules/Inject/CMakeLists.txt index b44e77a..88f4d5a 100644 --- a/modules/Inject/CMakeLists.txt +++ b/modules/Inject/CMakeLists.txt @@ -2,7 +2,7 @@ include_directories(../) add_library(Inject SHARED Inject.cpp) if(WITH_TESTS) message(STATUS "[+] Inject Tests are enable.") - target_link_libraries(Inject ${Donut}) + target_link_libraries(Inject ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() message(STATUS "[-] Inject Tests are disable.") endif() @@ -13,9 +13,9 @@ if(WITH_TESTS) add_executable(testsInject tests/testsInject.cpp Inject.cpp) if(WIN32) - target_link_libraries(testsInject ${Donut} ) + target_link_libraries(testsInject ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(testsInject ${Donut} ${aplib64} ) + target_link_libraries(testsInject ${Donut} ${aplib64} spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET testsInject POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy diff --git a/modules/KerberosUseTicket/CMakeLists.txt b/modules/KerberosUseTicket/CMakeLists.txt index ac73464..65b4812 100644 --- a/modules/KerberosUseTicket/CMakeLists.txt +++ b/modules/KerberosUseTicket/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(KerberosUseTicket SHARED KerberosUseTicket.cpp) +target_link_libraries(KerberosUseTicket spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET KerberosUseTicket POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsKerberosUseTicket tests/testsKerberosUseTicket.cpp KerberosUseTicket.cpp) -target_link_libraries(testsKerberosUseTicket) -add_custom_command(TARGET testsKerberosUseTicket POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsKerberosUseTicket tests/testsKerberosUseTicket.cpp KerberosUseTicket.cpp) + target_link_libraries(testsKerberosUseTicket spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsKerberosUseTicket POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsKerberosUseTicket COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsKerberosUseTicket COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/ListDirectory/CMakeLists.txt b/modules/ListDirectory/CMakeLists.txt index 6782e1d..b2b4ca5 100644 --- a/modules/ListDirectory/CMakeLists.txt +++ b/modules/ListDirectory/CMakeLists.txt @@ -1,11 +1,12 @@ include_directories(../) add_library(ListDirectory SHARED ListDirectory.cpp) +target_link_libraries(ListDirectory spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET ListDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) add_executable(testsListDirectory tests/testsListDirectory.cpp ListDirectory.cpp) -target_link_libraries(testsListDirectory) +target_link_libraries(testsListDirectory spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET testsListDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Tests/$") diff --git a/modules/ListProcesses/CMakeLists.txt b/modules/ListProcesses/CMakeLists.txt index 6fb691a..b78e70c 100644 --- a/modules/ListProcesses/CMakeLists.txt +++ b/modules/ListProcesses/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(ListProcesses SHARED ListProcesses.cpp) +target_link_libraries(ListProcesses spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET ListProcesses POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsListProcesses tests/testsListProcesses.cpp ListProcesses.cpp) -target_link_libraries(testsListProcesses) -add_custom_command(TARGET testsListProcesses POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsListProcesses tests/testsListProcesses.cpp ListProcesses.cpp) + target_link_libraries(testsListProcesses spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsListProcesses POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsListProcesses COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsListProcesses COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/MakeToken/CMakeLists.txt b/modules/MakeToken/CMakeLists.txt index 92a7f9e..550102e 100644 --- a/modules/MakeToken/CMakeLists.txt +++ b/modules/MakeToken/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(MakeToken SHARED MakeToken.cpp) +target_link_libraries(MakeToken spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET MakeToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsMakeToken tests/testsMakeToken.cpp MakeToken.cpp) -target_link_libraries(testsMakeToken) -add_custom_command(TARGET testsMakeToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsMakeToken tests/testsMakeToken.cpp MakeToken.cpp) + target_link_libraries(testsMakeToken spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsMakeToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsMakeToken COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsMakeToken COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/ModuleCmd/CMakeLists.txt b/modules/ModuleCmd/CMakeLists.txt index 6aaa055..33c3071 100644 --- a/modules/ModuleCmd/CMakeLists.txt +++ b/modules/ModuleCmd/CMakeLists.txt @@ -1,15 +1,15 @@ if(WITH_TESTS) -add_executable(testsModuleCmd tests/testsModuleCmd.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testsModuleCmd) -add_custom_command(TARGET testsModuleCmd POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsModuleCmd COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsModuleCmd tests/testsModuleCmd.cpp ../../../thirdParty/base64/base64.cpp) + target_link_libraries(testsModuleCmd spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsModuleCmd POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsModuleCmd COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") -add_executable(testsTools tests/testsTools.cpp ../../../thirdParty/base64/base64.cpp) -target_link_libraries(testsTools) -add_custom_command(TARGET testsTools POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsTools tests/testsTools.cpp ../../../thirdParty/base64/base64.cpp) + target_link_libraries(testsTools spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsTools POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsTools COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsTools COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/ModuleCmd/ModuleCmd.hpp b/modules/ModuleCmd/ModuleCmd.hpp index 11961af..d072bc8 100644 --- a/modules/ModuleCmd/ModuleCmd.hpp +++ b/modules/ModuleCmd/ModuleCmd.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include "nlohmann/json.hpp" // diff --git a/modules/ModuleCmd/tests/testsModuleCmd.cpp b/modules/ModuleCmd/tests/testsModuleCmd.cpp index 8cb4e8e..862649f 100644 --- a/modules/ModuleCmd/tests/testsModuleCmd.cpp +++ b/modules/ModuleCmd/tests/testsModuleCmd.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include "nlohmann/json.hpp" using json = nlohmann::json; using namespace std; diff --git a/modules/Powershell/CMakeLists.txt b/modules/Powershell/CMakeLists.txt index 1624870..3bfe9db 100644 --- a/modules/Powershell/CMakeLists.txt +++ b/modules/Powershell/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Powershell SHARED Powershell.cpp) +target_link_libraries(Powershell spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Powershell POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsPowershell tests/testsPowershell.cpp Powershell.cpp) -target_link_libraries(testsPowershell) -add_custom_command(TARGET testsPowershell POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsPowershell tests/testsPowershell.cpp Powershell.cpp) + target_link_libraries(testsPowershell spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsPowershell POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsPowershell COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsPowershell COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/PrintWorkingDirectory/CMakeLists.txt b/modules/PrintWorkingDirectory/CMakeLists.txt index d5813c2..fdaf50c 100644 --- a/modules/PrintWorkingDirectory/CMakeLists.txt +++ b/modules/PrintWorkingDirectory/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(PrintWorkingDirectory SHARED PrintWorkingDirectory.cpp) +target_link_libraries(PrintWorkingDirectory spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET PrintWorkingDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsPrintWorkingDirectory tests/testsPrintWorkingDirectory.cpp PrintWorkingDirectory.cpp) -target_link_libraries(testsPrintWorkingDirectory) -add_custom_command(TARGET testsPrintWorkingDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsPrintWorkingDirectory tests/testsPrintWorkingDirectory.cpp PrintWorkingDirectory.cpp) + target_link_libraries(testsPrintWorkingDirectory spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsPrintWorkingDirectory POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsPrintWorkingDirectory COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsPrintWorkingDirectory COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/PsExec/CMakeLists.txt b/modules/PsExec/CMakeLists.txt index c258b4c..54ec807 100644 --- a/modules/PsExec/CMakeLists.txt +++ b/modules/PsExec/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(PsExec SHARED PsExec.cpp) +target_link_libraries(PsExec spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET PsExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsPsExec tests/testsPsExec.cpp PsExec.cpp) -target_link_libraries(testsPsExec) -add_custom_command(TARGET testsPsExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsPsExec tests/testsPsExec.cpp PsExec.cpp) + target_link_libraries(testsPsExec spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsPsExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsPsExec COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsPsExec COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Rev2self/CMakeLists.txt b/modules/Rev2self/CMakeLists.txt index b5deb1b..52f950d 100644 --- a/modules/Rev2self/CMakeLists.txt +++ b/modules/Rev2self/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Rev2self SHARED Rev2self.cpp) +target_link_libraries(Rev2self spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Rev2self POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsRev2self tests/testsRev2self.cpp Rev2self.cpp) -target_link_libraries(testsRev2self) -add_custom_command(TARGET testsRev2self POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsRev2self tests/testsRev2self.cpp Rev2self.cpp) + target_link_libraries(testsRev2self spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsRev2self POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsRev2self COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsRev2self COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Run/CMakeLists.txt b/modules/Run/CMakeLists.txt index ce90d28..ad93aae 100644 --- a/modules/Run/CMakeLists.txt +++ b/modules/Run/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Run SHARED Run.cpp) +target_link_libraries(Run spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Run POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsRun tests/testsRun.cpp Run.cpp) -target_link_libraries(testsRun) -add_custom_command(TARGET testsRun POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsRun tests/testsRun.cpp Run.cpp) + target_link_libraries(testsRun spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsRun POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsRun COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsRun COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Script/CMakeLists.txt b/modules/Script/CMakeLists.txt index 93270b8..63f1fb9 100644 --- a/modules/Script/CMakeLists.txt +++ b/modules/Script/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Script SHARED Script.cpp) +target_link_libraries(Script spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Script POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsScript tests/testsScript.cpp Script.cpp) -target_link_libraries(testsScript) -add_custom_command(TARGET testsScript POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsScript tests/testsScript.cpp Script.cpp) + target_link_libraries(testsScript spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsScript POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsScript COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsScript COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/SpawnAs/CMakeLists.txt b/modules/SpawnAs/CMakeLists.txt index 3d5e846..00228de 100644 --- a/modules/SpawnAs/CMakeLists.txt +++ b/modules/SpawnAs/CMakeLists.txt @@ -1,6 +1,6 @@ include_directories(../) add_library(SpawnAs SHARED SpawnAs.cpp) -target_link_libraries(SpawnAs ${Donut}) +target_link_libraries(SpawnAs ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET SpawnAs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") @@ -8,9 +8,9 @@ if(WITH_TESTS) add_executable(testsSpawnAs tests/testsSpawnAs.cpp SpawnAs.cpp) if(WIN32) - target_link_libraries(testsSpawnAs ${Donut} ) + target_link_libraries(testsSpawnAs ${Donut} spdlog::spdlog nlohmann_json::nlohmann_json) else() - target_link_libraries(testsSpawnAs ${Donut} ${aplib64} ) + target_link_libraries(testsSpawnAs ${Donut} ${aplib64} spdlog::spdlog nlohmann_json::nlohmann_json) endif() add_custom_command(TARGET testsSpawnAs POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy diff --git a/modules/StealToken/CMakeLists.txt b/modules/StealToken/CMakeLists.txt index add88f7..680ad6c 100644 --- a/modules/StealToken/CMakeLists.txt +++ b/modules/StealToken/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(StealToken SHARED StealToken.cpp) +target_link_libraries(StealToken spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET StealToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsStealToken tests/testsStealToken.cpp StealToken.cpp) -target_link_libraries(testsStealToken) -add_custom_command(TARGET testsStealToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsStealToken tests/testsStealToken.cpp StealToken.cpp) + target_link_libraries(testsStealToken spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsStealToken POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsStealToken COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsStealToken COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Tree/CMakeLists.txt b/modules/Tree/CMakeLists.txt index fecf802..60ef597 100644 --- a/modules/Tree/CMakeLists.txt +++ b/modules/Tree/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(Tree SHARED Tree.cpp) +target_link_libraries(Tree spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Tree POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsTree tests/testsTree.cpp Tree.cpp) -target_link_libraries(testsTree) -add_custom_command(TARGET testsTree POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsTree tests/testsTree.cpp Tree.cpp) + target_link_libraries(testsTree spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsTree POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsTree COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsTree COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file diff --git a/modules/Upload/CMakeLists.txt b/modules/Upload/CMakeLists.txt index 9bfbf12..0fc39b7 100644 --- a/modules/Upload/CMakeLists.txt +++ b/modules/Upload/CMakeLists.txt @@ -1,11 +1,14 @@ include_directories(../) add_library(Upload SHARED Upload.cpp) +target_link_libraries(Upload spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET Upload POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") -add_executable(testsUpload tests/testsUpload.cpp Upload.cpp) -target_link_libraries(testsUpload) -add_custom_command(TARGET testsUpload POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") +if(WITH_TESTS) + add_executable(testsUpload tests/testsUpload.cpp Upload.cpp) + target_link_libraries(testsUpload spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsUpload POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsUpload COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") \ No newline at end of file + add_test(NAME testsUpload COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") +endif() \ No newline at end of file diff --git a/modules/WmiExec/CMakeLists.txt b/modules/WmiExec/CMakeLists.txt index f006bda..9a67e87 100644 --- a/modules/WmiExec/CMakeLists.txt +++ b/modules/WmiExec/CMakeLists.txt @@ -1,13 +1,14 @@ include_directories(../) add_library(WmiExec SHARED WmiExec.cpp) +target_link_libraries(WmiExec spdlog::spdlog nlohmann_json::nlohmann_json) add_custom_command(TARGET WmiExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ "${CMAKE_SOURCE_DIR}/Release/Modules/$") if(WITH_TESTS) -add_executable(testsWmiExec tests/testsWmiExec.cpp WmiExec.cpp) -target_link_libraries(testsWmiExec) -add_custom_command(TARGET testsWmiExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy -$ "${CMAKE_SOURCE_DIR}/Tests/$") + add_executable(testsWmiExec tests/testsWmiExec.cpp WmiExec.cpp) + target_link_libraries(testsWmiExec spdlog::spdlog nlohmann_json::nlohmann_json) + add_custom_command(TARGET testsWmiExec POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy + $ "${CMAKE_SOURCE_DIR}/Tests/$") -add_test(NAME testsWmiExec COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") + add_test(NAME testsWmiExec COMMAND "${CMAKE_SOURCE_DIR}/Tests/$") endif() \ No newline at end of file