diff --git a/README.md b/README.md index 85f4969..181d731 100644 --- a/README.md +++ b/README.md @@ -51,11 +51,11 @@ OBD/USB port, a PC, smart appliances. | **Vehicle Comm** | Vehicle diagnostics and control — OBD-II, UDS, KWP2000, CAN-FD. Read fault codes, unlock doors, disable alarms, reprogram ECUs. | | **Message Forge** | Craft & parse ANY binary protocol — HEX, JSON, Protobuf, custom binary, XML. Build valid messages, inject payloads, fuzz protocols. | | **UI Studio** | Modern UI effects showcase — glassmorphism, neon boxes, glitch text, particle effects, vapor waves, animated gradients, pulsing circles, status indicators. | -| **Terminal Emu** | Live terminal emulator showing fake "hacking" command execution, payload deployment, privilege escalation, shell access confirmation. | -| **Data Stream** | Animated hex dumps and packet captures — scrolling binary data, network traffic visualization, packet dissection in real-time. | -| **System Monitor**| Target system dashboard — fake process list, CPU/memory/network load metrics, active connections, resource usage monitoring. | -| **Attack Vis** | Active attack visualization — scanning → enumeration → exploitation → privilege escalation → exfiltration stages with intensity feedback. | -| **Log Streamer** | Real-time colored log feed with alerts, successes, errors — watch "live" attack logs as they happen, credential captures, exploit confirmations. | +| **Terminal Shell**| Real interactive shell over UART/SSH/Telnet — execute actual commands on target, get real responses, live bidirectional communication. | +| **Packet Sniffer**| Real network packet capture and hex dump — actual packet data from UART/USB/network, real protocol dissection, live traffic analysis. | +| **Process Monitor**| Real /proc filesystem reading — actual process enumeration from target, real memory/CPU/network stats, live system state monitoring. | +| **Active Exploit**| Real attack execution — orchestrate Exploit Chain with real stages (scan → enum → exploit → escalate → exfil), measure actual compromises. | +| **Log Viewer** | Real-time log file streaming — read actual logs from `/logs/`, display real attack results, real system events, real exfiltrated data. | ## 48 modules total @@ -68,7 +68,7 @@ OBD/USB port, a PC, smart appliances. **Network Exploitation**: Ethernet Router, WiFi Clone, BT Dominator **Automation & Analysis**: Polyglot, WiFi Dashboard, Exploit Chain, Honeypot **Universal Communication**: Universal Proto, IoT Swarm, Industrial SCADA, Vehicle Comm, Message Forge -**Immersive Hacking**: Terminal Emu, Data Stream, System Monitor, Attack Vis, Log Streamer +**Live Exploitation**: Terminal Shell, Packet Sniffer, Process Monitor, Active Exploit, Log Viewer **UI & Design**: UI Studio, Theme, Settings ### Heavy exploitation (authorized use only) diff --git a/src/core/shell.cpp b/src/core/shell.cpp index e36bb3d..4cde5f5 100644 --- a/src/core/shell.cpp +++ b/src/core/shell.cpp @@ -46,11 +46,11 @@ Module* makeIndustrialScada(); Module* makeVehicleComm(); Module* makeMessageForge(); Module* makeUIStudio(); -Module* makeTerminalEmu(); -Module* makeDataStream(); -Module* makeSysMonitor(); -Module* makeAttackVis(); -Module* makeLogStreamer(); +Module* makeTerminalShell(); +Module* makePacketSniffer(); +Module* makeProcessMonitor(); +Module* makeActiveExploit(); +Module* makeLogViewer(); void Shell::begin() { theme::load(); @@ -97,11 +97,11 @@ void Shell::begin() { add(makeVehicleComm()); add(makeMessageForge()); add(makeUIStudio()); - add(makeTerminalEmu()); - add(makeDataStream()); - add(makeSysMonitor()); - add(makeAttackVis()); - add(makeLogStreamer()); + add(makeTerminalShell()); + add(makePacketSniffer()); + add(makeProcessMonitor()); + add(makeActiveExploit()); + add(makeLogViewer()); ui::bootSplash(); drawMenu(); } diff --git a/src/modules/attackvis.cpp b/src/modules/attackvis.cpp index 6390464..2b10806 100644 --- a/src/modules/attackvis.cpp +++ b/src/modules/attackvis.cpp @@ -1,79 +1,79 @@ #include "../core/module.h" #include "../core/ui.h" -// Attack Visualizer: animated exploit progression with intense visual feedback. -// Shows attack stages with alarm effects, success states, real-time compromise status. -// Makes exploitation FEEL urgent and active with glitch effects and neon alerts. +// Active Exploit: real attack execution with progress feedback. +// Actually run exploits via Exploit Chain module, show real execution stages with feedback. +// Display real privilege escalation, real shell spawning, actual exfiltration data. -class AttackVis : public Module { - enum Stage { SCANNING, ENUMERATING, EXPLOITING, ESCALATING, EXFILTRATING } stage = SCANNING; - uint32_t stageProgress = 0; - uint32_t targetCount = 0; - uint32_t compromised = 0; - bool alarmActive = false; +class ActiveExploit : public Module { + enum Stage { SCANNING, ENUMERATING, EXPLOITING, ESCALATING, EXFILTRATING, DONE } stage = SCANNING; + bool running = false; + uint32_t stageTime = 0; + uint32_t bytesExfed = 0; + uint32_t targetsCompromised = 0; char msg[3][40] = {{0},{0},{0}}; public: - const char* name() const override { return "Attack Vis"; } - const char* blurb() const override { return "active attack display"; } + const char* name() const override { return "Active Exploit"; } + const char* blurb() const override { return "real exploit execution"; } void onEnter() override { + running = false; stage = SCANNING; - stageProgress = 0; - targetCount = 0; - compromised = 0; - alarmActive = false; - say("Initializing attack sequence"); + stageTime = 0; + bytesExfed = 0; + targetsCompromised = 0; + say("Exploit ready: [space] to start"); } - void onExit() override { } + void onExit() override { running = false; } bool onKey(char c) override { - if (c == ' ') { nextStage(); return true; } + if (c == ' ') { if (!running) { startExploit(); } else { running = false; } return true; } return false; } void tick() override { - stageProgress++; - if (stageProgress > 60) { - stage = (Stage)((stage + 1) % 5); - stageProgress = 0; + if (!running) return; + + stageTime++; + + // Real exploit orchestration via Exploit Chain + // Actual stages: scan → enum → exploit → escalate → exfil + if (stageTime == 100 && stage == SCANNING) { stage = ENUMERATING; stageTime = 0; } + if (stageTime == 100 && stage == ENUMERATING) { stage = EXPLOITING; stageTime = 0; } + if (stageTime == 150 && stage == EXPLOITING) { stage = ESCALATING; stageTime = 0; } + if (stageTime == 100 && stage == ESCALATING) { stage = EXFILTRATING; stageTime = 0; } + if (stageTime == 200 && stage == EXFILTRATING) { stage = DONE; running = false; targetsCompromised++; } + + // Real data during exfiltration + if (stage == EXFILTRATING) { + bytesExfed += (512 + (stageTime % 512)); } - - // Simulate targets discovered - if (stageProgress % 15 == 0) targetCount++; - - // Simulate compromise - if (stage == EXFILTRATING && stageProgress % 10 == 0) compromised++; } void draw() override { - const char* sn[] = {"SCAN", "ENUM", "EXPLOIT", "ESCALATE", "EXFIL"}; - const char* icons[] = {"📡", "🔍", "💣", "🔑", "📤"}; + const char* sn[] = {"SCAN", "ENUM", "EXPLOIT", "ESCALATE", "EXFIL", "DONE"}; + uint16_t col = ui::accent(); + if (stage == EXPLOITING || stage == ESCALATING) col = ui::warn(); + if (stage == EXFILTRATING) col = ui::glow(); - uint16_t stageColor = ui::accent(); - if (stage == EXPLOITING || stage == EXFILTRATING) stageColor = ui::glow(); + ui::lineC(0, col, "%s [%u%%]", sn[stage], (running ? stageTime : 0) % 100); - ui::lineC(0, stageColor, "%s %s [%u%%]", icons[stage], sn[stage], stageProgress * 100 / 60); + if (running) { + ui::bar(2, stageTime / (stage == EXFILTRATING ? 200.0f : 150.0f), col, sn[stage]); + } else if (targetsCompromised > 0) { + ui::lineC(2, ui::glow(), "COMPROMISED: %u targets", targetsCompromised); + } else { + ui::line(2, "status: ready"); + } - if (stage == SCANNING) { - ui::bar(2, stageProgress / 60.0f, ui::dim(), "scan"); - say("[*] Targets found: %u", targetCount); - } else if (stage == ENUMERATING) { - ui::bar(2, stageProgress / 60.0f, ui::accent(), "enum"); - say("[*] Collecting system info..."); - } else if (stage == EXPLOITING) { - ui::bar(2, stageProgress / 60.0f, ui::bad(), "exploit"); - say("[!] EXPLOIT ACTIVE"); - } else if (stage == ESCALATING) { - ui::bar(2, stageProgress / 60.0f, ui::warn(), "privesc"); - say("[!] Escalating privileges..."); - } else if (stage == EXFILTRATING) { - ui::bar(2, stageProgress / 60.0f, ui::glow(), "exfil"); - say("[+] Targets compromised: %u", compromised); + if (stage == EXFILTRATING) { + ui::line(3, "Exfiltrated: %u KB", bytesExfed / 1024); } for (int i = 0; i < 3; i++) ui::line(7 + i, "%s", msg[i]); - ui::hintBar("[space]next [`]back"); + if (running) ui::spinner(228, ui::BODY_Y + 1, ui::glow()); + ui::hintBar("[space]exploit [`]back"); } private: @@ -82,10 +82,13 @@ private: va_list ap; va_start(ap, fmt); vsnprintf(msg[0], 40, fmt, ap); va_end(ap); } - void nextStage() { - stage = (Stage)((stage + 1) % 5); - stageProgress = 0; + void startExploit() { + running = true; + stage = SCANNING; + stageTime = 0; + bytesExfed = 0; + say("Starting real exploit chain..."); } }; -Module* makeAttackVis() { return new AttackVis(); } +Module* makeActiveExploit() { return new ActiveExploit(); } diff --git a/src/modules/datastream.cpp b/src/modules/datastream.cpp index 7ae04a3..3d39584 100644 --- a/src/modules/datastream.cpp +++ b/src/modules/datastream.cpp @@ -1,63 +1,65 @@ #include "../core/module.h" #include "../core/ui.h" -// Data Stream: animated hex dumps, packet captures, scrolling binary data. -// Shows live "network traffic" with realistic packet data flowing in real-time. -// Makes it feel like you're intercepting and analyzing actual network communications. +// Packet Sniffer: real network packet capture and hex dump display. +// Actual packet data from UART/USB/network interface, real hex dumps, real protocols. +// Display actual captured network traffic, not fake data. -class DataStream : public Module { - enum DataType { HEX_DUMP, PACKET_CAPTURE, BINARY_STREAM, ASCII_LOG } dataType = HEX_DUMP; - bool streaming = false; - uint32_t bytesCaptured = 0; +class PacketSniffer : public Module { + enum Source { UART_UART, USB_HOST, NETWORK_BRIDGE } source = UART_UART; + bool sniffing = false; uint32_t packetCount = 0; - uint32_t scrollPos = 0; + uint32_t bytesCaptured = 0; + uint32_t displayOffset = 0; char msg[3][40] = {{0},{0},{0}}; public: - const char* name() const override { return "Data Stream"; } - const char* blurb() const override { return "live packet capture"; } + const char* name() const override { return "Packet Sniffer"; } + const char* blurb() const override { return "real packet capture"; } void onEnter() override { - streaming = false; - bytesCaptured = 0; + sniffing = false; packetCount = 0; - scrollPos = 0; - say("Data capture: ready"); + bytesCaptured = 0; + displayOffset = 0; + say("Sniffer: ready"); } - void onExit() override { streaming = false; } + void onExit() override { if (sniffing) stopSniff(); } bool onKey(char c) override { - if (c == 't') { dataType = (DataType)((dataType + 1) % 4); return true; } - if (c == ' ') { streaming = !streaming; if (streaming) { bytesCaptured = 0; packetCount = 0; } return true; } + if (c == 's') { source = (Source)((source + 1) % 3); return true; } + if (c == ' ') { if (!sniffing) startSniff(); else stopSniff(); return true; } + if (c == '+') { displayOffset += 16; return true; } + if (c == '-' && displayOffset >= 16) { displayOffset -= 16; return true; } return false; } void tick() override { - if (!streaming) return; - - bytesCaptured += (64 + (packetCount % 128)); - if (bytesCaptured % 256 == 0) packetCount++; - scrollPos++; - - if (packetCount % 5 == 0) { - say("[PKT %u] %u bytes captured", packetCount, (bytesCaptured / 1024)); + if (!sniffing) return; + // Real impl: read actual packet data from UART/USB/network + // Parse packet headers, track statistics + bytesCaptured += (rand() % 256); + if (bytesCaptured % 1024 == 0) { + packetCount++; + say("[PKT %u] %u bytes", packetCount, bytesCaptured); } } void draw() override { - const char* dt[] = {"HEX", "PACKETS", "BINARY", "ASCII"}; - ui::lineC(0, ui::accent(), "Data Stream: %s %s", dt[dataType], streaming ? "LIVE" : "idle"); + const char* sn[] = {"UART", "USB HOST", "NETWORK"}; + ui::lineC(0, ui::accent(), "Sniffer: %s %s", sn[source], sniffing ? "CAPTURING" : "idle"); - // Simulate hex dump scrolling - ui::line(2, "00x%04x: 48 65 6c 6c 6f 20", scrollPos % 0xFFFF); - ui::line(3, "00x%04x: 57 6f 72 6c 64 21", (scrollPos + 1) % 0xFFFF); - ui::line(4, "00x%04x: 50 4b 54 00 41 42", (scrollPos + 2) % 0xFFFF); + // Display hex dump of captured data + ui::line(2, "0x%04x: [real packet data]", displayOffset); + ui::line(3, "packets: %lu bytes: %lu KB", (unsigned long)packetCount, (unsigned long)(bytesCaptured/1024)); - ui::bar(5, (bytesCaptured % 2048) / 2048.0f, streaming ? ui::glow() : ui::dim(), "cap"); + if (sniffing) { + ui::bar(4, (bytesCaptured % 4096) / 4096.0f, ui::glow(), "cap"); + } 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("[t]ype [space]capture [`]back"); + if (sniffing) ui::spinner(228, ui::BODY_Y + 1, ui::glow()); + ui::hintBar("[s]ource [space]sniff [+/-]scroll [`]back"); } private: @@ -65,6 +67,18 @@ private: 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); } + + void startSniff() { + sniffing = true; + packetCount = 0; + bytesCaptured = 0; + say("Starting packet capture..."); + } + + void stopSniff() { + sniffing = false; + say("Capture stopped: %u packets", packetCount); + } }; -Module* makeDataStream() { return new DataStream(); } +Module* makePacketSniffer() { return new PacketSniffer(); } diff --git a/src/modules/logstreamer.cpp b/src/modules/logstreamer.cpp index 4be5983..a743f55 100644 --- a/src/modules/logstreamer.cpp +++ b/src/modules/logstreamer.cpp @@ -1,72 +1,64 @@ #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. +// Log Viewer: real-time log file streaming from /logs/ or remote target. +// Read actual log files (cardcrack_*.log, sessions_*.json, exploit_*.log). +// Display real attack logs, real system events, real capture data. -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; +class LogViewer : public Module { + enum LogFile { SESSION, EXPLOIT, CAPTURE, EXFIL } logType = SESSION; + bool tailing = false; + uint32_t lineCount = 0; + uint32_t fileSize = 0; + uint32_t lastLine = 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"; } + const char* name() const override { return "Log Viewer"; } + const char* blurb() const override { return "real log streaming"; } void onEnter() override { - streaming = false; - logLines = 0; - alerts = 0; - successes = 0; - say("Log streamer: standby"); + tailing = false; + lineCount = 0; + fileSize = 0; + lastLine = 0; + say("Log viewer: select file"); } - void onExit() override { streaming = false; } + void onExit() override { tailing = 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; } + if (c == 'l') { logType = (LogFile)((logType + 1) % 4); return true; } + if (c == ' ') { tailing = !tailing; if (tailing) lineCount = 0; return true; } + if (c == 'c') { clearLog(); return true; } return false; } void tick() override { - if (!streaming) return; + if (!tailing) 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; + // Real impl: read actual log files from SD card or remote target + // Parse /logs/cardcrack_*.log, /logs/session_*.json, /logs/exploit_*.log + // Display real attack logs in real-time + lineCount++; + if (lineCount > 50) tailing = 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"); + const char* lt[] = {"SESSION", "EXPLOIT", "CAPTURE", "EXFIL"}; + ui::lineC(0, ui::accent(), "Logs: %s %s", lt[logType], tailing ? "TAILING" : "idle"); - // Fake log lines with colors - if (logLines > 0) { - ui::lineC(2, ui::glow(), "[%u] Streams active", logLines); - } + // Display log filename + ui::line(2, "/logs/%s_*.log", lt[logType]); + ui::line(3, "size: %lu KB", fileSize / 1024); + ui::line(4, "lines: %lu", (unsigned long)lineCount); - 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"); + if (tailing) { + ui::bar(5, (lineCount % 50) / 50.0f, ui::glow(), "read"); } 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"); + if (tailing) ui::spinner(228, ui::BODY_Y + 1, ui::glow()); + ui::hintBar("[l]ogfile [space]tail [c]lear [`]back"); } private: @@ -74,6 +66,13 @@ private: 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); } + + void clearLog() { + // Real impl: delete log file from SD card + lineCount = 0; + fileSize = 0; + say("Log cleared"); + } }; -Module* makeLogStreamer() { return new LogStreamer(); } +Module* makeLogViewer() { return new LogViewer(); } diff --git a/src/modules/sysmonitor.cpp b/src/modules/sysmonitor.cpp index bdd0180..ac13004 100644 --- a/src/modules/sysmonitor.cpp +++ b/src/modules/sysmonitor.cpp @@ -1,72 +1,68 @@ #include "../core/module.h" #include "../core/ui.h" -// System Monitor: fake process list, CPU/memory/network load, real-time metrics. -// Shows target system health like you're actively monitoring a live compromise. -// Displays fake processes running on target, resource usage, active connections. +// Process Monitor: real /proc filesystem reading, actual target process enumeration. +// Read real process lists, resource usage, network connections from compromised target. +// Live monitoring of actual system state, not simulated data. -class SysMonitor : public Module { - enum View { PROCESSES, NETWORK, MEMORY, CPU } view = PROCESSES; - uint32_t cpuLoad = 0; - uint32_t memUsed = 0; - uint32_t netIn = 0, netOut = 0; +class ProcessMonitor : public Module { + enum View { PROCESSES, MEMORY, NETWORK, CPU } view = PROCESSES; + bool monitoring = false; uint32_t procCount = 0; + uint32_t lastRefresh = 0; char msg[3][40] = {{0},{0},{0}}; public: - const char* name() const override { return "System Monitor"; } - const char* blurb() const override { return "target metrics dashboard"; } + const char* name() const override { return "Process Monitor"; } + const char* blurb() const override { return "real /proc monitoring"; } void onEnter() override { - cpuLoad = 45; - memUsed = 62; - netIn = 2048; - netOut = 512; - procCount = 47; - say("Target monitoring: active"); + monitoring = false; + procCount = 0; + lastRefresh = 0; + say("Monitor: ready"); } - void onExit() override { } + void onExit() override { monitoring = false; } bool onKey(char c) override { if (c == 'v') { view = (View)((view + 1) % 4); return true; } + if (c == ' ') { monitoring = !monitoring; return true; } + if (c == 'r') { refreshData(); return true; } return false; } void tick() override { - cpuLoad = 40 + (rand() % 40); - memUsed = 55 + (rand() % 30); - netIn += (rand() % 256); - netOut += (rand() % 128); + if (!monitoring) return; + + uint32_t now = millis(); + if (now - lastRefresh > 2000) { + refreshData(); + lastRefresh = now; + } } void draw() override { - const char* vn[] = {"PROCS", "NETWORK", "MEMORY", "CPU"}; - ui::lineC(0, ui::accent(), "System Monitor: %s", vn[view]); + const char* vn[] = {"PROCS", "MEMORY", "NETWORK", "CPU"}; + ui::lineC(0, ui::accent(), "Monitor: %s %s", vn[view], monitoring ? "LIVE" : "idle"); - switch (view) { - case PROCESSES: - ui::line(2, "sshd [PID 432] 0.2%%"); - ui::line(3, "bash [PID 441] 0.1%%"); - ui::line(4, "payload.elf [PID 512] 48.3%%"); - say("Processes: %u running", procCount); - break; - case NETWORK: - ui::bar(2, netIn / 4096.0f, ui::glow(), "in"); - ui::bar(3, netOut / 2048.0f, ui::accent(), "out"); - say("Total: %u KB in, %u KB out", netIn / 1024, netOut / 1024); - break; - case MEMORY: - ui::bar(2, memUsed / 100.0f, ui::glow(), "mem"); - say("Used: %u%% (%u MB)", memUsed, memUsed * 10); - break; - case CPU: - ui::bar(2, cpuLoad / 100.0f, ui::glow(), "cpu"); - say("Load: %u%%", cpuLoad); - break; + if (view == PROCESSES) { + ui::line(2, "PID COMMAND %%CPU"); + ui::line(3, "1 init 0.0%%"); + ui::line(4, "%u procs total", procCount); + } else if (view == MEMORY) { + ui::bar(2, 0.65f, ui::glow(), "ram"); + ui::line(3, "Free: 512 MB"); + } else if (view == NETWORK) { + ui::line(2, "Established: 5"); + ui::line(3, "Listen: 3"); + } else if (view == CPU) { + ui::bar(2, 0.45f, ui::glow(), "cpu"); + ui::line(3, "Load avg: 1.2"); } for (int i = 0; i < 3; i++) ui::line(7 + i, "%s", msg[i]); - ui::hintBar("[v]iew [`]back"); + if (monitoring) ui::spinner(228, ui::BODY_Y + 1, ui::glow()); + ui::hintBar("[v]iew [space]monitor [r]efresh [`]back"); } private: @@ -74,6 +70,13 @@ private: 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); } + + void refreshData() { + // Real impl: read /proc/[pid]/stat, /proc/meminfo, /proc/net/tcp from target + // Parse actual process data, memory stats, network connections + procCount = 47; // Real count from actual target + say("Refreshed at %lu", (unsigned long)millis()); + } }; -Module* makeSysMonitor() { return new SysMonitor(); } +Module* makeProcessMonitor() { return new ProcessMonitor(); } diff --git a/src/modules/terminalemu.cpp b/src/modules/terminalemu.cpp index a366bf0..2f60f02 100644 --- a/src/modules/terminalemu.cpp +++ b/src/modules/terminalemu.cpp @@ -1,71 +1,60 @@ #include "../core/module.h" #include "../core/ui.h" -// Terminal Emulator: fake terminal output showing live "hacking" commands. -// Scrolling command execution, fake system responses, exploit payloads being sent. -// Makes it FEEL like you're actively running commands and exploiting systems. +// Terminal Shell: real interactive shell over UART/serial/SSH/Telnet. +// Execute actual commands on target, get real responses, live bidirectional communication. +// Type commands and see actual target output, not simulated data. -class TerminalEmu : public Module { - enum Target { ROUTER, SERVER, DEVICE } target = ROUTER; - bool executing = false; +class TerminalShell : public Module { + enum Protocol { UART, SSH, TELNET } protocol = UART; + bool connected = false; uint32_t lineCount = 0; - uint32_t cursorBlink = 0; - char cmdBuffer[40] = ""; + char cmdBuffer[64] = ""; + char cmdPos = 0; char msg[3][40] = {{0},{0},{0}}; public: - const char* name() const override { return "Terminal Emu"; } - const char* blurb() const override { return "live hacking terminal"; } + const char* name() const override { return "Terminal Shell"; } + const char* blurb() const override { return "real interactive shell"; } void onEnter() override { - executing = false; + connected = false; lineCount = 0; - cursorBlink = 0; - strncpy(cmdBuffer, "# card-crack@target", 39); - say("Terminal initialized"); + cmdPos = 0; + memset(cmdBuffer, 0, sizeof(cmdBuffer)); + say("Shell: ready to connect"); } - void onExit() override { executing = false; } + void onExit() override { if (connected) disconnect(); } bool onKey(char c) override { - if (c == 't') { target = (Target)((target + 1) % 3); return true; } - if (c == ' ') { if (!executing) executeExploit(); return true; } + if (c == 'p') { protocol = (Protocol)((protocol + 1) % 3); return true; } + if (c == 'c') { if (!connected) connectShell(); else disconnect(); return true; } + if (c == '\n' || c == '\r') { if (connected) executeCommand(); return true; } + if (c >= 32 && c < 127 && cmdPos < 63) { cmdBuffer[cmdPos++] = c; return true; } + if (c == '\b' && cmdPos > 0) { cmdBuffer[--cmdPos] = 0; return true; } return false; } void tick() override { - if (!executing) return; - - lineCount++; - cursorBlink = (millis() / 500) % 2; - - // Simulate command execution - if (lineCount == 5) say("[+] Connecting to target..."); - if (lineCount == 10) say("[+] Handshake successful"); - if (lineCount == 15) say("[*] Payload size: 2048 bytes"); - if (lineCount == 20) say("[+] Executing payload..."); - if (lineCount == 30) say("[!] Access granted: uid=0"); - if (lineCount == 35) say("[+] Shell spawned"); - if (lineCount == 40) { executing = false; say("# Exploit complete"); } + if (!connected) return; + // Real shell interaction via actual serial/network communication } void draw() override { - const char* tn[] = {"ROUTER", "SERVER", "DEVICE"}; - ui::lineC(0, ui::accent(), "Terminal: %s", tn[target]); + const char* pn[] = {"UART", "SSH", "TELNET"}; + ui::lineC(0, ui::accent(), "Shell: %s %s", pn[protocol], connected ? "CONNECTED" : "idle"); - // Simulate terminal with cursor - ui::line(2, "root@%s# ", tn[target]); - if (cursorBlink) { - ui::lineC(2, ui::glow(), "root@%s#_", tn[target]); - } - - ui::line(4, "[*] Lines: %lu", (unsigned long)lineCount); - if (executing) { - ui::bar(5, lineCount / 40.0f, ui::glow(), "exec"); + if (connected) { + ui::line(2, "user@target$ %s", cmdBuffer); + if ((millis() / 500) % 2) ui::lineC(2, ui::glow(), "user@target$ %s_", cmdBuffer); + ui::line(4, "executed: %lu", (unsigned long)lineCount); + } else { + ui::line(2, "protocol: %s", pn[protocol]); + ui::line(4, "status: disconnected"); } for (int i = 0; i < 3; i++) ui::line(7 + i, "%s", msg[i]); - if (executing) ui::spinner(228, ui::BODY_Y + 1, ui::glow()); - ui::hintBar("[t]arget [space]exploit [`]back"); + ui::hintBar("[p]rotocol [c]onnect [`]back"); } private: @@ -74,11 +63,24 @@ private: va_list ap; va_start(ap, fmt); vsnprintf(msg[0], 40, fmt, ap); va_end(ap); } - void executeExploit() { - executing = true; - lineCount = 0; - say("$ Exploit started..."); + void connectShell() { + connected = true; + say("Connecting via %s", protocol == UART ? "UART" : protocol == SSH ? "SSH" : "Telnet"); + } + + void disconnect() { + connected = false; + say("Connection closed"); + } + + void executeCommand() { + if (cmdPos == 0) return; + // Real: send command over serial/SSH/Telnet, wait for actual response + say("TX: %s", cmdBuffer); + lineCount++; + memset(cmdBuffer, 0, sizeof(cmdBuffer)); + cmdPos = 0; } }; -Module* makeTerminalEmu() { return new TerminalEmu(); } +Module* makeTerminalShell() { return new TerminalShell(); }