Just Call Me Koko 6 лет назад
Родитель
Сommit
1f980fe8b3

+ 14 - 1
esp32_marauder/Assets.h

@@ -103,6 +103,19 @@ PROGMEM const unsigned char menu_icons[][66] = {
     0x03, 0x18, 0x38, 0x03, 0x38, 0x38, 0xC3, 0x7F, 0x38, 0xC3, 0x7F, 0x38, 
     0x03, 0x38, 0x38, 0x03, 0x18, 0x38, 0x07, 0x08, 0x3C, 0x07, 0x00, 0x3C, 
     0x0F, 0x00, 0x3E, 0x1F, 0x00, 0x3F, 0x3F, 0x80, 0x3F, 0xFF, 0xE0, 0x3F, 
-    0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}};
+    0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F},
+    {0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0x1F, 0x3F, 0x3E,  // Device: 17
+    0x1F, 0x3F, 0x3E, 0x1F, 0x3F, 0x3E, 0x1F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 
+    0x9F, 0x5E, 0x3E, 0x9F, 0x4C, 0x3E, 0x9F, 0x6D, 0x3E, 0x9F, 0x61, 0x3E, 
+    0x9F, 0x73, 0x3E, 0x9F, 0x73, 0x3E, 0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 
+    0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 0xFF, 0xFF, 0x3F, 
+    0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F},
+    {0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F,  // Device Info: 18
+    0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xFF, 0x3F, 
+    0xFF, 0xFF, 0x3F, 0x7F, 0xF0, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 
+    0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 
+    0xFF, 0xF1, 0x3F, 0x7F, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 
+    0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}
+    };
 
 #endif

+ 22 - 5
esp32_marauder/MenuFunctions.cpp

@@ -11,7 +11,8 @@ MenuFunctions::MenuFunctions()
 void MenuFunctions::main()
 {
   if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
-      (wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
+      (wifi_scan_obj.currentScanMode == OTA_UPDATE) || 
+      (wifi_scan_obj.currentScanMode == SHOW_INFO)) {
     if (wifi_scan_obj.orient_display) {
       this->orientDisplay();
       wifi_scan_obj.orient_display = false;
@@ -49,7 +50,10 @@ void MenuFunctions::main()
 
   
   // This is if there are scans/attacks going on
-  if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) && (pressed) && (wifi_scan_obj.currentScanMode != OTA_UPDATE))
+  if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) && 
+      (pressed) && 
+      (wifi_scan_obj.currentScanMode != OTA_UPDATE) &&
+      (wifi_scan_obj.currentScanMode != SHOW_INFO))
   {  
     // Stop the current scan
     if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) ||
@@ -145,7 +149,11 @@ void MenuFunctions::RunSetup()
   wifiMenu.list = new LinkedList<MenuNode>(); // Get list in second menu ready
   bluetoothMenu.list = new LinkedList<MenuNode>(); // Get list in third menu ready
   generalMenu.list = new LinkedList<MenuNode>();
+  deviceMenu.list = new LinkedList<MenuNode>();
+
+  // Device menu stuff
   updateMenu.list = new LinkedList<MenuNode>();
+  infoMenu.list = new LinkedList<MenuNode>();
 
   // WiFi menu stuff
   wifiSnifferMenu.list = new LinkedList<MenuNode>();
@@ -159,8 +167,10 @@ void MenuFunctions::RunSetup()
   // Work menu names
   mainMenu.name = " ESP32 Marauder ";
   wifiMenu.name = " WiFi ";
+  deviceMenu.name = " Device ";
   generalMenu.name = " General Apps ";
   updateMenu.name = " Update Firmware ";
+  infoMenu.name = " Device Info ";
   bluetoothMenu.name = " Bluetooth ";
   wifiSnifferMenu.name = " WiFi Sniffers ";
   wifiScannerMenu.name = " WiFi Scanners";
@@ -173,7 +183,7 @@ void MenuFunctions::RunSetup()
   addNodes(&mainMenu, "WiFi", TFT_GREEN, NULL, WIFI, [this](){changeMenu(&wifiMenu);});
   addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, BLUETOOTH, [this](){changeMenu(&bluetoothMenu);});
   addNodes(&mainMenu, "General Apps", TFT_MAGENTA, NULL, GENERAL_APPS, [this](){changeMenu(&generalMenu);});
-  addNodes(&mainMenu, "Update Firmware", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); web_obj.setupOTAupdate();});
+  addNodes(&mainMenu, "Device", TFT_BLUE, NULL, DEVICE, [this](){changeMenu(&deviceMenu);});
   addNodes(&mainMenu, "Reboot", TFT_LIGHTGREY, NULL, REBOOT, [](){ESP.restart();});
 
   // Build WiFi Menu
@@ -221,9 +231,16 @@ void MenuFunctions::RunSetup()
   addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){display_obj.draw_tft = false; changeMenu(generalMenu.parentMenu);});
   addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, DRAW, [this](){display_obj.clearScreen(); display_obj.draw_tft = true;});
 
-  updateMenu.parentMenu = &mainMenu;
+  deviceMenu.parentMenu = &mainMenu;
+  addNodes(&deviceMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(deviceMenu.parentMenu);});
+  addNodes(&deviceMenu, "Update Firmware", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); web_obj.setupOTAupdate();});
+  addNodes(&deviceMenu, "Device Info", TFT_WHITE, NULL, DEVICE_INFO, [this](){wifi_scan_obj.currentScanMode = SHOW_INFO; changeMenu(&infoMenu); wifi_scan_obj.RunInfo();});
+
+  updateMenu.parentMenu = &deviceMenu;
   addNodes(&updateMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(updateMenu.parentMenu); WiFi.softAPdisconnect(true);});
 
+  infoMenu.parentMenu = &deviceMenu;
+  addNodes(&infoMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(infoMenu.parentMenu);});
 
   // Set the current menu to the mainMenu
   changeMenu(&mainMenu);
@@ -293,7 +310,7 @@ void MenuFunctions::buildButtons(Menu* menu)
                         buf,
                         KEY_TEXTSIZE);
 
-      display_obj.key[i].setLabelDatum(BUTTON_PADDING - (KEY_W/2), 0, ML_DATUM);
+      display_obj.key[i].setLabelDatum(BUTTON_PADDING - (KEY_W/2), 2, ML_DATUM);
     }
   }
 }

+ 6 - 0
esp32_marauder/MenuFunctions.h

@@ -42,6 +42,8 @@ extern Web web_obj;
 #define REBOOT 14
 #define GENERAL_APPS 15
 #define UPDATE 16
+#define DEVICE 17
+#define DEVICE_INFO 18
 
 struct Menu;
 
@@ -75,7 +77,11 @@ class MenuFunctions
     Menu wifiMenu;
     Menu bluetoothMenu;
     Menu generalMenu;
+    Menu deviceMenu;
+
+    // Device menu stuff
     Menu updateMenu;
+    Menu infoMenu;
 
     // WiFi menu stuff
     Menu wifiSnifferMenu;

+ 78 - 0
esp32_marauder/WiFiScan.cpp

@@ -170,6 +170,84 @@ void WiFiScan::StopScan(uint8_t scan_mode)
   display_obj.tteBar = false;
 }
 
+String WiFiScan::getStaMAC()
+{
+  char *buf;
+  uint8_t mac[6];
+  char macAddrChr[18] = {0};
+  wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
+  esp_wifi_init(&cfg);
+  esp_wifi_set_storage(WIFI_STORAGE_RAM);
+  esp_wifi_set_mode(WIFI_MODE_NULL);
+  esp_wifi_start();
+  esp_err_t mac_status = esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
+  sprintf(macAddrChr, 
+          "%02X:%02X:%02X:%02X:%02X:%02X",
+          mac[0],
+          mac[1],
+          mac[2],
+          mac[3],
+          mac[4],
+          mac[5]);
+  return String(macAddrChr);
+}
+
+String WiFiScan::getApMAC()
+{
+  char *buf;
+  uint8_t mac[6];
+  char macAddrChr[18] = {0};
+  wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
+  esp_wifi_init(&cfg);
+  esp_wifi_set_storage(WIFI_STORAGE_RAM);
+  esp_wifi_set_mode(WIFI_MODE_NULL);
+  esp_wifi_start();
+  esp_err_t mac_status = esp_wifi_get_mac(ESP_IF_WIFI_AP, mac);
+  sprintf(macAddrChr, 
+          "%02X:%02X:%02X:%02X:%02X:%02X",
+          mac[0],
+          mac[1],
+          mac[2],
+          mac[3],
+          mac[4],
+          mac[5]);
+  return String(macAddrChr);
+}
+
+
+String WiFiScan::freeRAM()
+{
+  char s[150];
+  sprintf(s, "RAM Free: %u bytes", system_get_free_heap_size());
+  return String(s);
+}
+
+
+void WiFiScan::RunInfo()
+{
+  String sta_mac = this->getStaMAC();
+  String ap_mac = this->getApMAC();
+  String free_ram = this->freeRAM();
+  
+  Serial.print("STA MAC: ");
+  Serial.println(sta_mac);
+  Serial.print("AP MAC: ");
+  Serial.println(ap_mac);
+  Serial.println(free_ram);
+
+  display_obj.tft.setTextWrap(false);
+  display_obj.tft.setFreeFont(NULL);
+  display_obj.tft.setCursor(0, 100);
+  display_obj.tft.setTextSize(1);
+  display_obj.tft.setTextColor(TFT_CYAN);
+
+  display_obj.tft.println(" Station MAC: " + sta_mac);
+  display_obj.tft.println("      AP MAC: " + ap_mac);
+  display_obj.tft.println("    " + free_ram);
+
+  
+}
+
 void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
 {
   display_obj.tft.init();

+ 6 - 1
esp32_marauder/WiFiScan.h

@@ -15,6 +15,7 @@
 #define bad_list_length 3
 
 #define OTA_UPDATE 100
+#define SHOW_INFO 101
 #define WIFI_SCAN_OFF 0
 #define WIFI_SCAN_PROBE 1
 #define WIFI_SCAN_AP 2
@@ -130,7 +131,11 @@ class WiFiScan
     bool orient_display = false;
 
     
-    
+
+    String getStaMAC();
+    String getApMAC();
+    String freeRAM();
+    void RunInfo();
     void channelHop();
     uint8_t currentScanMode = 0;
     void main(uint32_t currentTime);

BIN
pictures/icons/device_22.bmp


BIN
pictures/icons/device_info_22.bmp


+ 9 - 0
pictures/xbm/device_22.XBM

@@ -0,0 +1,9 @@
+#define 1581293081239_width 22
+#define 1581293081239_height 22
+static char 1581293081239_bits[] = {
+  0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0x1F, 0x3F, 0x3E, 
+  0x1F, 0x3F, 0x3E, 0x1F, 0x3F, 0x3E, 0x1F, 0x3F, 0x3E, 0x1F, 0x1E, 0x3E, 
+  0x9F, 0x5E, 0x3E, 0x9F, 0x4C, 0x3E, 0x9F, 0x6D, 0x3E, 0x9F, 0x61, 0x3E, 
+  0x9F, 0x73, 0x3E, 0x9F, 0x73, 0x3E, 0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 
+  0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 0x9F, 0x7F, 0x3E, 0xFF, 0xFF, 0x3F, 
+  0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, };

+ 9 - 0
pictures/xbm/device_info_22.XBM

@@ -0,0 +1,9 @@
+#define 1581293373698_width 22
+#define 1581293373698_height 22
+static char 1581293373698_bits[] = {
+  0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 
+  0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xFF, 0x3F, 
+  0xFF, 0xFF, 0x3F, 0x7F, 0xF0, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 
+  0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 
+  0xFF, 0xF1, 0x3F, 0x7F, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 
+  0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, };