Add 5 immersive hacking modules: terminal emulator, live data streams, system monitoring, attack visualization, log streaming
- Terminal Emu: live terminal showing fake command execution, privilege escalation, shell access - Data Stream: animated hex dumps and packet captures with scrolling binary data - System Monitor: target dashboard with processes, CPU/memory/network metrics - Attack Vis: exploit progression visualization (scan→enum→exploit→escalate→exfil) with intensity - Log Streamer: real-time colored log feed with alerts, successes, error tracking These modules make Cardputer FEEL like active hacking with live feedback, creating immersive sense of actively exploiting and monitoring compromised systems. Adds visceral "attack in progress" aesthetic to the interface. Brings toolkit to 48 modules across 11 categories.
This commit is contained in:
79
src/modules/logstreamer.cpp
Normal file
79
src/modules/logstreamer.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
#include "../core/module.h"
|
||||
#include "../core/ui.h"
|
||||
|
||||
// Log Streamer: real-time colored log output with alerts and status updates.
|
||||
// Shows live attack logs, system alerts, credential captures, exploit confirmations.
|
||||
// Scrolling log view that FEELS like you're watching a live pentest unfold in real-time.
|
||||
|
||||
class LogStreamer : public Module {
|
||||
enum LogType { ALL_LOGS, ALERTS_ONLY, SUCCESS_ONLY, ERRORS_ONLY } logType = ALL_LOGS;
|
||||
bool streaming = false;
|
||||
uint32_t logLines = 0;
|
||||
uint32_t alerts = 0;
|
||||
uint32_t successes = 0;
|
||||
char msg[3][40] = {{0},{0},{0}};
|
||||
|
||||
public:
|
||||
const char* name() const override { return "Log Streamer"; }
|
||||
const char* blurb() const override { return "real-time log feed"; }
|
||||
|
||||
void onEnter() override {
|
||||
streaming = false;
|
||||
logLines = 0;
|
||||
alerts = 0;
|
||||
successes = 0;
|
||||
say("Log streamer: standby");
|
||||
}
|
||||
void onExit() override { streaming = false; }
|
||||
|
||||
bool onKey(char c) override {
|
||||
if (c == 'l') { logType = (LogType)((logType + 1) % 4); return true; }
|
||||
if (c == ' ') { streaming = !streaming; if (streaming) logLines = 0; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
void tick() override {
|
||||
if (!streaming) return;
|
||||
|
||||
logLines++;
|
||||
|
||||
if (logLines == 5) { alerts++; say("[ALERT] Intrusion detected"); }
|
||||
if (logLines == 10) say("[INFO] Connecting to target");
|
||||
if (logLines == 15) { successes++; say("[SUCCESS] Auth bypass"); }
|
||||
if (logLines == 20) { alerts++; say("[WARNING] IDS alert"); }
|
||||
if (logLines == 25) { successes++; say("[+] Privilege escalated"); }
|
||||
if (logLines == 30) { alerts++; say("[CRITICAL] Rootkit loaded"); }
|
||||
if (logLines == 35) { successes++; say("[SUCCESS] Data exfiltration"); }
|
||||
if (logLines == 40) streaming = false;
|
||||
}
|
||||
|
||||
void draw() override {
|
||||
const char* lt[] = {"ALL", "ALERTS", "SUCCESS", "ERRORS"};
|
||||
ui::lineC(0, ui::accent(), "Log Streamer: %s %s", lt[logType], streaming ? "LIVE" : "idle");
|
||||
|
||||
// Fake log lines with colors
|
||||
if (logLines > 0) {
|
||||
ui::lineC(2, ui::glow(), "[%u] Streams active", logLines);
|
||||
}
|
||||
|
||||
ui::line(3, "Alerts: %u Success: %u", alerts, successes);
|
||||
|
||||
if (streaming) {
|
||||
ui::bar(4, (logLines % 40) / 40.0f, ui::glow(), "log");
|
||||
} else {
|
||||
ui::line(4, "status: ready");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) ui::line(7 + i, "%s", msg[i]);
|
||||
if (streaming) ui::spinner(228, ui::BODY_Y + 1, ui::glow());
|
||||
ui::hintBar("[l]ogtype [space]stream [`]back");
|
||||
}
|
||||
|
||||
private:
|
||||
void say(const char* fmt, ...) {
|
||||
for (int i = 2; i > 0; i--) strncpy(msg[i], msg[i-1], 39);
|
||||
va_list ap; va_start(ap, fmt); vsnprintf(msg[0], 40, fmt, ap); va_end(ap);
|
||||
}
|
||||
};
|
||||
|
||||
Module* makeLogStreamer() { return new LogStreamer(); }
|
||||
Reference in New Issue
Block a user