A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
add uart emulation cmd
Geof872012d36fd
diff --git a/src/Controllers/UartController.cpp b/src/Controllers/UartController.cppindex 56cd6fff..c25ef964 100644--- a/src/Controllers/UartController.cpp+++ b/src/Controllers/UartController.cpp@@ -14,7 +14,8 @@ UartController::UartController(ArgTransformer& argTransformer,UserInputManager& userInputManager,UartAtShell& uartAtShell,- HelpShell& helpShell+ HelpShell& helpShell,+ UartEmulationShell& uartEmulationShell): terminalView(terminalView),terminalInput(terminalInput),@@ -25,7 +26,8 @@ UartController::UartController(argTransformer(argTransformer),userInputManager(userInputManager),uartAtShell(uartAtShell),- helpShell(helpShell)+ helpShell(helpShell),+ uartEmulationShell(uartEmulationShell){}@@ -40,6 +42,7 @@ void UartController::handleCommand(const TerminalCommand& cmd) {else if (cmd.getRoot() == "write") handleWrite(cmd);else if (cmd.getRoot() == "bridge") handleBridge();else if (cmd.getRoot() == "at") handleAtCommand(cmd);+ else if (cmd.getRoot() == "emulator") handleEmulation();else if (cmd.getRoot() == "spam") handleSpam(cmd);else if (cmd.getRoot() == "glitch") handleGlitch();else if (cmd.getRoot() == "xmodem") handleXmodem(cmd);@@ -663,6 +666,13 @@ void UartController::handleSwap() {terminalView.println("");}+/*+Emulation+*/+void UartController::handleEmulation() {+ uartEmulationShell.run();+}+/*Ensure Config*/diff --git a/src/Controllers/UartController.h b/src/Controllers/UartController.hindex 448e8861..07bd8e1e 100644--- a/src/Controllers/UartController.h+++ b/src/Controllers/UartController.h@@ -15,6 +15,7 @@#include "Managers/UserInputManager.h"#include "Shells/UartAtShell.h"#include "Shells/HelpShell.h"+#include "Shells/UartEmulationShell.h"class UartController {public:@@ -28,7 +29,8 @@ public:ArgTransformer& argTransformer,UserInputManager& userInputManager,UartAtShell& uartAtShell,- HelpShell& helpShell);+ HelpShell& helpShell,+ UartEmulationShell& uartEmulationShell);// Entry point for UART commandvoid handleCommand(const TerminalCommand& cmd);@@ -85,6 +87,9 @@ private:// Send file to xmodemvoid handleXmodemSend(const std::string& path);+ // Handle UART emulation shell+ void handleEmulation();+// Scan a baudratebool scanAtBaudrate(int baud);@@ -110,6 +115,7 @@ private:UserInputManager& userInputManager;UartAtShell& uartAtShell;HelpShell& helpShell;+ UartEmulationShell& uartEmulationShell;GlobalState& state = GlobalState::getInstance();bool configured = false;bool scanCancelled = false;diff --git a/src/Shells/HelpShell.cpp b/src/Shells/HelpShell.cppindex 5de63bb0..3b582497 100644--- a/src/Shells/HelpShell.cpp+++ b/src/Shells/HelpShell.cpp@@ -141,8 +141,8 @@ void HelpShell::cmdUart() {"write <text> - Send at current baud","bridge - Full-duplex mode","at - AT commands operations",+ "emulator - Emulate UART device","spam <text> <ms> - Write text every ms",- "glitch - Timing attack","xmodem <send> <path> - Send file via XMODEM","xmodem <recv> <path> - Receive file via XMODEM","config - Configure settings",@@ -166,7 +166,7 @@ void HelpShell::cmdI2c() {printHeader("I2C");static const char* const lines[] = {"scan - Find devices",- "discovey - Report on devices",+ "discovery - Report on devices","ping <addr> - Check ACK","identify <addr> - Identify device","sniff - View traffic",@@ -232,7 +232,7 @@ void HelpShell::cmdDio() {"pulldown <pin> - Set pin pulldown","pulse <pin> <us> - Send pulse on pin","servo <pin> <angle> - Set servo angle",- "pwm <pin freq duty%> - Set PWM on pin",+ "pwm <pin> [frq duty%]- Set PWM on pin","toggle <pin> <ms> - Toggle pin periodically","measure <pin> [ms] - Calculate frequency","jam <pin> [min max] - Random high/low states",