Skip to content

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

select the network interface from the current mode for discovery cmd

Geoe22f68449fdf
diff --git a/src/Abstracts/ANetworkController.cpp b/src/Abstracts/ANetworkController.cpp
index 843986f4..338e4357 100644
--- a/src/Abstracts/ANetworkController.cpp
+++ b/src/Abstracts/ANetworkController.cpp
@@ -111,34 +111,17 @@ void ANetworkController::handleDiscovery(const TerminalCommand &cmd)
bool ethConnected = ethernetService.isConnected();
phy_interface_t phy_interface = phy_interface_t::phy_none;
- if (!wifiConnected && !ethConnected) {
- terminalView.println("Discovery: You must be connected to Wi-Fi or Ethernet. Use 'connect' first.");
- return;
- }
-
// Which interface to scan
- auto args = argTransformer.splitArgs(cmd.getArgs());
- if (cmd.getSubcommand().empty() || args.size() < 1) {
- if (wifiConnected){
- terminalView.println("Discovery: Using WiFi as default interface.");
- phy_interface = phy_interface_t::phy_wifi;
- }
- else{
- terminalView.println("Discovery: Using Ethernet as default interface.");
- phy_interface = phy_interface_t::phy_eth;
- }
+ auto mode = globalState.getCurrentMode();
+ if (wifiConnected && mode == ModeEnum::WiFi){
+ phy_interface = phy_interface_t::phy_wifi;
+ }
+ else if (ethConnected && mode == ModeEnum::ETHERNET) {
+ phy_interface = phy_interface_t::phy_eth;
}
else {
- if (cmd.getSubcommand() == "eth"){
- terminalView.println("Discovery: Using Ethernet as default interface.");
- phy_interface = phy_interface_t::phy_eth;
- }else if (cmd.getSubcommand() == "wifi"){
- terminalView.println("Discovery: Using WiFi as default interface.");
- phy_interface = phy_interface_t::phy_wifi;
- }
- else {
- terminalView.println("Discovery: Invalid interface. Use 'wifi' or 'eth'.");
- }
+ terminalView.println("Discovery: You must be connected to Wi-Fi or Ethernet. Use 'connect' first.");
+ return;
}
const std::string deviceIP = phy_interface == phy_interface_t::phy_wifi ? wifiService.getLocalIP() : ethernetService.getLocalIP();
diff --git a/src/Services/ICMPService.cpp b/src/Services/ICMPService.cpp
index abdb6a3f..02fbec4f 100644
--- a/src/Services/ICMPService.cpp
+++ b/src/Services/ICMPService.cpp
@@ -100,7 +100,7 @@ void ICMPService::discoveryTask(void* params){
ip4_addr_t targetIP;
uint32_t targetsResponded = 0;
- pushICMPLog("Discovery: Scanning network for devices... Press [ENTER] to stop.");
+ pushICMPLog("Discovery: Scanning network for devices... Press [ENTER] to stop.\r\n");
if (!ip4addr_aton(deviceIP.c_str(), &targetIP))
{
@@ -120,7 +120,7 @@ void ICMPService::discoveryTask(void* params){
{
if (ICMPService::getICMPServiceStatus() == true)
{
- pushICMPLog("Discovery: stopped by user");
+ pushICMPLog("Discovery: Stopped by user\r\n");
delete taskParams;
vTaskDelete(nullptr);
return;