Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

add system cmd to help

Geo3d7ae1beaa16
diff --git a/src/Controllers/UtilityController.cpp b/src/Controllers/UtilityController.cpp
index 59403f27..d43e1ffa 100644
--- a/src/Controllers/UtilityController.cpp
+++ b/src/Controllers/UtilityController.cpp
@@ -3,29 +3,33 @@
/*
Constructor
*/
-UtilityController::UtilityController(ITerminalView& terminalView, IDeviceView& deviceView, IInput& terminalInput, PinService& pinService, UserInputManager& userInputManager, ArgTransformer& ArgTransformer)
- : terminalView(terminalView), deviceView(deviceView), terminalInput(terminalInput), pinService(pinService), userInputManager(userInputManager), argTransformer(argTransformer) {}
+UtilityController::UtilityController(
+ ITerminalView& terminalView,
+ IDeviceView& deviceView,
+ IInput& terminalInput,
+ PinService& pinService,
+ UserInputManager& userInputManager,
+ ArgTransformer& argTransformer,
+ SysInfoShell& sysInfoShell
+)
+ : terminalView(terminalView),
+ deviceView(deviceView),
+ terminalInput(terminalInput),
+ pinService(pinService),
+ userInputManager(userInputManager),
+ argTransformer(argTransformer),
+ sysInfoShell(sysInfoShell)
+{}
/*
Entry point for command
*/
void UtilityController::handleCommand(const TerminalCommand& cmd) {
- if (cmd.getRoot() == "help" || cmd.getRoot() == "h" || cmd.getRoot() == "?") {
- handleHelp();
- }
-
- else if (cmd.getRoot() == "P") {
- handleEnablePullups();
- }
-
- else if (cmd.getRoot() == "p") {
- handleDisablePullups();
- }
-
- else if (cmd.getRoot() == "logic") {
- handleLogicAnalyzer(cmd);
- }
-
+ if (cmd.getRoot() == "help" || cmd.getRoot() == "h" || cmd.getRoot() == "?") handleHelp();
+ else if (cmd.getRoot() == "P") handleEnablePullups();
+ else if (cmd.getRoot() == "p") handleDisablePullups();
+ else if (cmd.getRoot() == "logic") handleLogicAnalyzer(cmd);
+ else if (cmd.getRoot() == "system") handleSystem();
else {
terminalView.println("Unknown command. Try 'help'.");
}
@@ -251,6 +255,13 @@ void UtilityController::handleLogicAnalyzer(const TerminalCommand& cmd) {
}
}
+/*
+System Information
+*/
+void UtilityController::handleSystem() {
+ sysInfoShell.run();
+}
+
/*
Help
*/
@@ -261,6 +272,7 @@ void UtilityController::handleHelp() {
terminalView.println(" General:");
terminalView.println(" help - Show this help");
+ terminalView.println(" system - Show system infos");
terminalView.println(" mode <name> - Set active mode");
terminalView.println(" logic <pin> - Logic analyzer");
terminalView.println(" P - Enable pull-up");
@@ -452,7 +464,8 @@ void UtilityController::handleHelp() {
bool UtilityController::isGlobalCommand(const TerminalCommand& cmd) {
std::string root = cmd.getRoot();
- return (root == "help" || root == "h" || root == "?" ||
- root == "mode" || root == "m" || root == "l" ||
- root == "logic" || root == "P" || root == "p");
+ return (root == "help" || root == "h" || root == "?" ||
+ root == "mode" || root == "m" || root == "l" ||
+ root == "logic" || root == "P" || root == "p") ||
+ root == "system";
}
\ No newline at end of file
diff --git a/src/Controllers/UtilityController.h b/src/Controllers/UtilityController.h
index bbb21177..7b599181 100644
--- a/src/Controllers/UtilityController.h
+++ b/src/Controllers/UtilityController.h
@@ -14,12 +14,20 @@
#include "Services/PinService.h"
#include "Managers/UserInputManager.h"
#include "Transformers/ArgTransformer.h"
+#include "Shells/SysInfoShell.h"
class UtilityController {
public:
// Constructor
- UtilityController(ITerminalView& terminalView, IDeviceView& deviceView, IInput& terminalInput,
- PinService& pinService, UserInputManager& userInputManager, ArgTransformer& ArgTransformer);
+ UtilityController(
+ ITerminalView& terminalView,
+ IDeviceView& deviceView,
+ IInput& terminalInput,
+ PinService& pinService,
+ UserInputManager& userInputManager,
+ ArgTransformer& argTransformer,
+ SysInfoShell& sysInfoShell
+ );
// Entry point for global utility commands
void handleCommand(const TerminalCommand& cmd);
@@ -46,11 +54,15 @@ private:
// Disable internal pull-up resistors
void handleDisablePullups();
+ // System information
+ void handleSystem();
+
ITerminalView& terminalView;
IDeviceView& deviceView;
IInput& terminalInput;
PinService& pinService;
UserInputManager& userInputManager;
ArgTransformer& argTransformer;
+ SysInfoShell& sysInfoShell;
GlobalState& state = GlobalState::getInstance();
};
\ No newline at end of file