A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol
C arduinobluetoothcan-busdebuggingeepromesp32flipperzerogpiohardware-hackingi2cjtagopenocdprotocolspwmradiorfidspisubghzuartwifi
add eeprom cmd to I2C controller
Geo14c96cff3cf3
diff --git a/src/Controllers/I2cController.cpp b/src/Controllers/I2cController.cppindex 52cfb4b5..645554b3 100644--- a/src/Controllers/I2cController.cpp+++ b/src/Controllers/I2cController.cpp@@ -2,8 +2,8 @@I2cController::I2cController(ITerminalView& terminalView, IInput& terminalInput,I2cService& i2cService, ArgTransformer& argTransformer,- UserInputManager& userInputManager)- : terminalView(terminalView), terminalInput(terminalInput), i2cService(i2cService), argTransformer(argTransformer), userInputManager(userInputManager) {}+ UserInputManager& userInputManager, I2cEepromShell& eepromShell)+ : terminalView(terminalView), terminalInput(terminalInput), i2cService(i2cService), argTransformer(argTransformer), userInputManager(userInputManager), eepromShell(eepromShell) {}/*Entry point to handle I2C command@@ -18,6 +18,7 @@ void I2cController::handleCommand(const TerminalCommand& cmd) {else if (cmd.getRoot() == "slave") handleSlave(cmd);else if (cmd.getRoot() == "glitch") handleGlitch(cmd);else if (cmd.getRoot() == "flood") handleFlood(cmd);+ else if (cmd.getRoot() == "eeprom") handleEeprom(cmd);else if (cmd.getRoot() == "recover") handleRecover();else if (cmd.getRoot() == "config") handleConfig();else handleHelp();@@ -618,6 +619,32 @@ void I2cController::handleFlood(const TerminalCommand& cmd) {}}+/*+EEPROM+*/+void I2cController::handleEeprom(const TerminalCommand& cmd) {+ uint8_t addr = 0x50; // Default EEPROM I2C address++ auto sub = cmd.getSubcommand();+ if (!sub.empty()) {+ if (!argTransformer.isValidNumber(sub)) {+ terminalView.println("Usage: eeprom [addr]");+ return;+ }++ auto parsed = argTransformer.parseHexOrDec(sub);+ if (parsed < 0x03 || parsed > 0x77) { // plage valide I2C 7-bit+ terminalView.println("❌ Invalid I2C address. Must be between 0x03 and 0x77.");+ return;+ }++ addr = parsed;+ }++ eepromShell.run(addr);+ ensureConfigured();+}+/*Help*/@@ -633,6 +660,7 @@ void I2cController::handleHelp() {terminalView.println(" glitch <addr>");terminalView.println(" flood <addr>");terminalView.println(" recover");+ terminalView.println(" eeprom");terminalView.println(" config");terminalView.println(" raw instructions, e.g: [0x13 0x4B r:8]");}diff --git a/src/Controllers/I2cController.h b/src/Controllers/I2cController.hindex 6de47490..6f8f6a3c 100644--- a/src/Controllers/I2cController.h+++ b/src/Controllers/I2cController.h@@ -12,13 +12,14 @@#include "Transformers/ArgTransformer.h"#include "Managers/UserInputManager.h"#include "Vendors/i2c_sniffer.h"+#include "Shells/I2cEepromShell.h"struct I2cSniffState;class I2cController {public:// Constructor- I2cController(ITerminalView& terminalView, IInput& terminalInput, I2cService& i2cService, ArgTransformer& argTransformer, UserInputManager& userInputManager);+ I2cController(ITerminalView& terminalView, IInput& terminalInput, I2cService& i2cService, ArgTransformer& argTransformer, UserInputManager& userInputManager, I2cEepromShell& eepromShell);// Entry point for I2C commandvoid handleCommand(const TerminalCommand& cmd);@@ -36,6 +37,7 @@ private:ArgTransformer& argTransformer;UserInputManager& userInputManager;GlobalState& state = GlobalState::getInstance();+ I2cEepromShell& eepromShell;bool configured = false;// Ping an I2C address@@ -65,6 +67,9 @@ private:// Configure I2C parametersvoid handleConfig();+ // I2C EEPROM operations+ void handleEeprom(const TerminalCommand& cmd);+// Show I2C help messagevoid handleHelp();