Merge pull request #803 from m1crod0t/Select_SSIDs_from_Probe

Select SSIDs from Probe Request Sniff #796
This commit is contained in:
Just Call Me Koko
2025-06-24 09:00:22 -04:00
committed by GitHub
5 changed files with 101 additions and 2 deletions

View File

@@ -1817,6 +1817,8 @@ void MenuFunctions::RunSetup()
extern LinkedList<Station>* stations;
extern LinkedList<AirTag>* airtags;
extern LinkedList<IPAddress>* ipList;
extern LinkedList<ProbeReqSsid>* probe_req_ssids;
extern LinkedList<ssid>* ssids;
this->disable_touch = false;
@@ -1866,6 +1868,7 @@ void MenuFunctions::RunSetup()
//#ifndef HAS_ILI9341
wifiStationMenu.list = new LinkedList<MenuNode>();
//#endif
selectProbeSSIDsMenu.list = new LinkedList<MenuNode>();
// WiFi HTML menu stuff
htmlMenu.list = new LinkedList<MenuNode>();
@@ -2208,6 +2211,67 @@ void MenuFunctions::RunSetup()
this->changeMenu(&generateSSIDsMenu);
wifi_scan_obj.RunGenerateSSIDs();
});
//Add Select probe ssid
this->addNodes(&wifiGeneralMenu, text_table1[65], TFTCYAN, NULL, KEYBOARD_ICO, [this]() {
selectProbeSSIDsMenu.list->clear();
// Add the back button
this->addNodes(&selectProbeSSIDsMenu, text09, TFTLIGHTGREY, NULL, 0, [this]() {
this->changeMenu(&wifiGeneralMenu);
// TODO: TBD - Should probe_req_ssids have it´s own life and override ap.config and/or ssids -list for EP?
// If so, then we should not add selected ssids to ssids list
// Add selected ssid names to ssids list when clicking back button
if (probe_req_ssids->size() > 0) {
//TODO: TBD - Clear ssids list before adding new ones??
for (int i = 0; i < probe_req_ssids->size(); i++) {
ProbeReqSsid cur_probe_ssid = probe_req_ssids->get(i);
if (cur_probe_ssid.selected) {
bool ssidExists = false;
for (int i = 0; i < ssids->size(); i++) {
if (ssids->get(i).essid == cur_probe_ssid.essid) {
ssidExists = true;
break;
}
}
if (!ssidExists) {
wifi_scan_obj.addSSID(cur_probe_ssid.essid);
}
}
}
}
});
// Populate the menu with buttons
for (int i = 0; i < probe_req_ssids->size(); i++) {
ProbeReqSsid cur_ssid = probe_req_ssids->get(i);
// This is the menu node
this->addNodes(
&selectProbeSSIDsMenu,
"[" + String(cur_ssid.requests) + "]" + cur_ssid.essid,
TFTCYAN,
NULL,
255,
[this, i]() {
ProbeReqSsid new_ssid = probe_req_ssids->get(i);
new_ssid.selected = !probe_req_ssids->get(i).selected;
// Change selection status of menu node
MenuNode new_node = current_menu->list->get(i + 1);
new_node.selected = !current_menu->list->get(i + 1).selected;
current_menu->list->set(i + 1, new_node);
probe_req_ssids->set(i, new_ssid);
},
probe_req_ssids->get(i).selected);
}
this->changeMenu(&selectProbeSSIDsMenu);
});
#ifdef HAS_ILI9341
this->addNodes(&wifiGeneralMenu, text_table1[1], TFTNAVY, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();

View File

@@ -188,6 +188,7 @@ class MenuFunctions
Menu genAPMacMenu;
Menu cloneAPMacMenu;
Menu setMacMenu;
Menu selectProbeSSIDsMenu;
// Bluetooth menu stuff
Menu bluetoothSnifferMenu;

View File

@@ -16,6 +16,7 @@ LinkedList<Station>* stations;
LinkedList<AirTag>* airtags;
LinkedList<Flipper>* flippers;
LinkedList<IPAddress>* ipList;
LinkedList<ProbeReqSsid>* probe_req_ssids;
extern "C" int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3){
if (arg == 31337)
@@ -548,6 +549,7 @@ void WiFiScan::RunSetup() {
airtags = new LinkedList<AirTag>();
flippers = new LinkedList<Flipper>();
ipList = new LinkedList<IPAddress>();
probe_req_ssids = new LinkedList<ProbeReqSsid>;
// for Pinescan
pinescan_trackers = new LinkedList<PineScanTracker>();
confirmed_pinescan = new LinkedList<ConfirmedPineScan>();
@@ -3351,6 +3353,8 @@ void WiFiScan::RunDeauthScan(uint8_t scan_mode, uint16_t color)
// Function for running probe request scan
void WiFiScan::RunProbeScan(uint8_t scan_mode, uint16_t color)
{
probe_req_ssids->clear();
if (scan_mode == WIFI_SCAN_PROBE)
startPcap("probe");
else if (scan_mode == WIFI_SCAN_STATION_WAR_DRIVE) {
@@ -5773,6 +5777,8 @@ void WiFiScan::probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
if ((snifferPacket->payload[0] == 0x40) && (buf == 0))
{
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) {
String probe_req_essid;
delay(random(0, 10));
Serial.print("RSSI: ");
Serial.print(snifferPacket->rx_ctrl.rssi);
@@ -5788,9 +5794,30 @@ void WiFiScan::probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
for (int i = 0; i < snifferPacket->payload[25]; i++)
{
Serial.print((char)snifferPacket->payload[26 + i]);
display_string.concat((char)snifferPacket->payload[26 + i]);
probe_req_essid.concat((char)snifferPacket->payload[26 + i]);
}
display_string.concat(probe_req_essid);
if (probe_req_essid.length() > 0) {
bool essidExist = false;
for (int i = 0; i < probe_req_ssids->size(); i++) {
ProbeReqSsid cur_probe_ssid = probe_req_ssids->get(i);
if (cur_probe_ssid.essid == probe_req_essid) {
cur_probe_ssid.requests++;
probe_req_ssids->set(i, cur_probe_ssid);
essidExist = true;
break;
}
}
if (!essidExist) {
ProbeReqSsid probeReqSsid;
probeReqSsid.essid = probe_req_essid;
probeReqSsid.requests = 1;
probeReqSsid.selected = false;
probe_req_ssids->add(probeReqSsid);
}
}
// Print spaces because of the rotating lines of the hardware scroll.
// The same characters print from previous lines so I just overwrite them
// with spaces.

View File

@@ -105,6 +105,7 @@ PROGMEM const char text1_61[] = "Select Stations";
PROGMEM const char text1_62[] = "Deauth Targeted";
PROGMEM const char text1_63[] = "Detect Pineapple";
PROGMEM const char text1_64[] = "Detect MultiSSID";
PROGMEM const char text1_65[] = "Select probe SSIDs";
//SDInterface.cpp texts
PROGMEM const char text2_0[] = "Error, could not find update.bin";
@@ -185,7 +186,7 @@ PROGMEM const char text4_49[] = " Detect MultiSSID ";
//Making tables
PROGMEM const char *text_table0[] = {text0_0,text0_1, text0_2, text0_3, text0_4, text0_5, text0_6, text0_7, text0_8};
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56,text1_57,text1_58,text1_59,text1_60,text1_61,text1_62,text1_63,text1_64};
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56,text1_57,text1_58,text1_59,text1_60,text1_61,text1_62,text1_63,text1_64, text1_65};
PROGMEM const char *text_table2[] = {text2_0,text2_1,text2_2,text2_3,text2_4,text2_5,text2_6,text2_7,text2_8,text2_9,text2_10,text2_11,text2_12,text2_13,text2_14};
PROGMEM const char *text_table3[] = {text3_0,text3_1,text3_2,text3_3,text3_4,text3_5};
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text1_54,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44,text4_45,text4_46,text4_47,text4_48,text4_49};

View File

@@ -21,6 +21,12 @@ struct Station {
uint16_t ap;
};
struct ProbeReqSsid {
String essid;
bool selected;
uint8_t requests;
};
const char apple_ouis[][9] PROGMEM = {
"00:17:F2", "00:1E:C2", "00:26:08", "F8:1E:DF", "BC:92:6B",
"28:E0:2C", "3C:07:54", "7C:D1:C3", "DC:A9:04", "F0:D1:A9",