/
qqga1337
/
test123
Обзор
Документация
Войти
/
qqga1337
/
test123
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
test.cpp
189 строк
6 KB
qqga1337
update test.cpp
29 янв 2026, 21:17
Верифицирован
29 янв 2026, 21:17
645c38b
Код
Авторство
О чём код?
#include <iostream> #include <fstream> #include <vector> #include <string> #include <ctime> #include <cstdlib> #include <cstdio> #ifdef _WIN32 #include <windows.h> #define sleep_ms(x) Sleep(x) #else #include <unistd.h> #define sleep_ms(x) usleep((x)*1000) #endif using namespace std; const bool SAFE_MODE = true; const string LOG_FILE = "network_activity.log"; const int CYCLE_DELAY_SECONDS = 300; class ActivityGenerator { private: ofstream logFile; vector<string> simulatedHosts; vector<int> commonPorts; bool running; string getCurrentTime() { time_t now = time(0); char buf[80]; strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", localtime(&now)); return string(buf); } void writeLog(const string& message) { string entry = "[" + getCurrentTime() + "] " + message; cout << entry << endl; logFile << entry << endl; logFile.flush(); } public: ActivityGenerator() : running(true) { simulatedHosts.push_back("192.168.100.10"); simulatedHosts.push_back("192.168.100.15"); simulatedHosts.push_back("192.168.100.20"); simulatedHosts.push_back("192.168.100.25"); simulatedHosts.push_back("192.168.100.30"); simulatedHosts.push_back("192.168.100.35"); commonPorts.push_back(22); commonPorts.push_back(80); commonPorts.push_back(443); commonPorts.push_back(445); commonPorts.push_back(3389); commonPorts.push_back(8080); logFile.open(LOG_FILE.c_str(), ios::app); if (!logFile.is_open()) { cerr << "Error: Cannot open log file" << endl; exit(1); } srand(time(0)); } ~ActivityGenerator() { if (logFile.is_open()) { logFile.close(); } } void simulateScan() { writeLog("=== Network Discovery Phase ==="); for (size_t i = 0; i < simulatedHosts.size(); i++) { writeLog("Probe target: " + simulatedHosts[i]); sleep_ms(100 + rand() % 400); int numPorts = 1 + rand() % 3; for (int j = 0; j < numPorts; j++) { int portIdx = rand() % commonPorts.size(); int port = commonPorts[portIdx]; char portStr[20]; sprintf(portStr, "%d", port); writeLog(" Port " + string(portStr) + " response from " + simulatedHosts[i]); } } char hostsNum[20]; sprintf(hostsNum, "%d", (int)simulatedHosts.size()); writeLog("Discovery complete: " + string(hostsNum) + " nodes"); } void simulateConnection() { writeLog("=== Connection Attempt Phase ==="); int attempts = 3 + rand() % 5; for (int i = 0; i < attempts; i++) { int hostIdx = rand() % simulatedHosts.size(); string target = simulatedHosts[hostIdx]; int portIdx = rand() % commonPorts.size(); int port = commonPorts[portIdx]; char portStr[20]; sprintf(portStr, "%d", port); writeLog("Attempting connection to " + target + ":" + string(portStr)); sleep_ms(1000 + rand() % 3000); if (rand() % 100 < 40) { writeLog(" Connection established to " + target); writeLog(" Data exchange simulated"); } else { writeLog(" Connection failed: timeout"); } } } void simulatePersistence() { writeLog("=== System Integration Phase ==="); vector<string> methods; methods.push_back("Registry entry working..."); methods.push_back("Service registration working..."); methods.push_back("Scheduled task working..."); methods.push_back("Startup folder working..."); for (size_t i = 0; i < methods.size(); i++) { writeLog("Attempting: " + methods[i]); sleep_ms(500 + rand() % 1000); if (rand() % 100 < 60) { writeLog(" Status: simulated success"); } else { writeLog(" Status: simulated failure"); } } } void runCycle() { writeLog("================================================"); writeLog("HACKING NETWORK ACTIVITY GENERATOR"); writeLog(string("Safe Mode: ") + (SAFE_MODE ? "ON" : "OFF")); writeLog("All operations are simulated - no real connections"); writeLog("================================================"); simulateScan(); sleep_ms(2000); simulateConnection(); sleep_ms(2000); simulatePersistence(); writeLog("================================================"); writeLog("Cycle complete. Next run in " + string(1, '0' + CYCLE_DELAY_SECONDS/60) + " minutes"); writeLog("================================================"); } void runContinuous() { while (running) { runCycle(); for (int i = 0; i < CYCLE_DELAY_SECONDS && running; i++) { sleep_ms(1000); } } writeLog("Service stopped"); } }; int main() { cout << "Network Activity Generator Service" << endl; cout << "Running in continuous mode" << endl << endl; ActivityGenerator generator; generator.runContinuous(); return 0; }