Skip to content

Commit

Permalink
v0.2.7.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Retr0Kr0dy authored Jan 6, 2025
2 parents 9ab368c + 4259d9e commit fae26db
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Firmware/BeamStalker/main/BeamStalker-cardputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ int mainTask() {
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -94,8 +95,7 @@ int mainTask() {


else if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(50));

vTaskDelay(pdMS_TO_TICKS(300));
switch (MainMenuSelector) {
int ret;
case 0: // WiFcker
Expand Down
4 changes: 3 additions & 1 deletion Firmware/BeamStalker/main/firmware/apps/BLE/ble_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int bleMenuTask() {
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -41,10 +42,11 @@ int bleMenuTask() {
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));

switch (Selector) {
int ret;
case 0: // BLESpam
M5GFX_clear_screen();
printf ("ble_spam_task - starting\n");
ret = BLESpam();
if (ret != 0) {
Expand Down
7 changes: 6 additions & 1 deletion Firmware/BeamStalker/main/firmware/apps/BLE/ble_spam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int BLESpam() {
int Selector = 0;
struct menu Menu;

Menu.name = "~/WiFi/BLE Spm";
Menu.name = "~/BLE/BleSpm";
Menu.length = 2; // devices, statack
Menu.elements = new item[Menu.length];

Expand Down Expand Up @@ -176,6 +176,9 @@ int BLESpam() {
ESP_ERROR_CHECK(esp_bt_controller_disable());
ESP_ERROR_CHECK(esp_bt_controller_mem_release(ESP_BT_MODE_BLE));
/* END */

vTaskDelay(pdMS_TO_TICKS(300));

return 0;
}
else if (UPp) {
Expand All @@ -195,6 +198,7 @@ int BLESpam() {
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
M5GFX_clear_screen();
switch (Selector) {
case 1: // Start attack
Expand All @@ -220,6 +224,7 @@ int BLESpam() {
vTaskDelay(pdMS_TO_TICKS(delayMilliseconds));
esp_ble_gap_stop_advertising();
}
vTaskDelay(pdMS_TO_TICKS(300));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int App_Wifi_Sniffer() {
int Selector = 0;
struct menu Menu;

Menu.name = "~/WiFi/Wifi sniffer";
Menu.name = "~/WiFi/WifiSniffer";
Menu.length = 2; // filter, statasniffing
Menu.elements = new item[Menu.length];

Expand Down Expand Up @@ -42,6 +42,7 @@ int App_Wifi_Sniffer() {

if (RETURNp) {
stop_wifi();
vTaskDelay(pdMS_TO_TICKS(300));

return 0;
}
Expand All @@ -62,17 +63,19 @@ int App_Wifi_Sniffer() {
// vTaskDelay(pdMS_TO_TICKS(50));
// }
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
M5GFX_clear_screen();

switch (Selector) {
case 0: //filter
filters = select_filter_menu(&filter_count, t_filter, t_filter_count);
selected_t_filter_count = filter_count;
break;
case 1: // Start sniffing
vTaskDelay(pdMS_TO_TICKS(100));

M5GFX_display_text(0, 0, "Sniffing for 60s !\nPress any key to exit...", TFT_WHITE);
sniff(60, filters, 1);
init_sniff_pps_timer();
sniff(1000, filters, 1);
stop_sniff_pps_timer();
break;
}
}
Expand Down
6 changes: 5 additions & 1 deletion Firmware/BeamStalker/main/firmware/apps/Wifi/beacon_spam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int BeaconSpam() {
int Selector = 0;
struct menu Menu;

Menu.name = "~/WiFi/Bcn Spm";
Menu.name = "~/WiFi/BcnSpm";
Menu.length = 2; // charset, statack
Menu.elements = new item[Menu.length];

Expand Down Expand Up @@ -160,6 +160,7 @@ int BeaconSpam() {

if (RETURNp) {
stop_wifi();
vTaskDelay(pdMS_TO_TICKS(300));

return 0;
}
Expand All @@ -180,7 +181,9 @@ int BeaconSpam() {
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
M5GFX_clear_screen();

switch (Selector) {
case 1: // Start attack
init_pps_timer();
Expand All @@ -199,6 +202,7 @@ int BeaconSpam() {
}
}
stop_pps_timer();
vTaskDelay(pdMS_TO_TICKS(300));
break;
}
}
Expand Down
4 changes: 4 additions & 0 deletions Firmware/BeamStalker/main/firmware/apps/Wifi/deauther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int Deauther() {

if (RETURNp) {
stop_wifi();
vTaskDelay(pdMS_TO_TICKS(300));

return 0;
}
Expand All @@ -92,6 +93,8 @@ int Deauther() {
}
if (SELECTp) {
M5GFX_clear_screen();
vTaskDelay(pdMS_TO_TICKS(300));

switch (Selector) {
case 0: // Select AP
M5GFX_display_text(0, 0, "Scanning...\r", TFT_WHITE);
Expand Down Expand Up @@ -164,6 +167,7 @@ int Deauther() {

stop_wifi();
start_wifi(WIFI_MODE_STA, true);
vTaskDelay(pdMS_TO_TICKS(300));

break;
}
Expand Down
5 changes: 2 additions & 3 deletions Firmware/BeamStalker/main/firmware/apps/Wifi/wifi_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ int wifiMenuTask() {
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -56,26 +57,24 @@ int wifiMenuTask() {
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
switch (Selector) {
int ret;
case 0: // BeaconSpam
M5GFX_clear_screen();
printf ("beacon_spam_task - starting\n");
ret = BeaconSpam();
if (ret != 0) {
printf("Error in app.");
}
break;
case 1: // Deauther
M5GFX_clear_screen();
printf ("deauther_task - starting\n");
ret = Deauther();
if (ret != 0) {
printf("Error in app.");
}
break;
case 2: // Sniff Wifi
M5GFX_clear_screen();
printf ("wifi_sniffer_task - starting\n");
ret = App_Wifi_Sniffer();
if (ret != 0) {
Expand Down
2 changes: 2 additions & 0 deletions Firmware/BeamStalker/main/firmware/apps/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ int APP_Options() {
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -56,6 +57,7 @@ int APP_Options() {
}
if (SELECTp) {
M5GFX_clear_screen();
vTaskDelay(pdMS_TO_TICKS(300));
int wait = 1;
switch (Selector) {
case 0:
Expand Down
2 changes: 1 addition & 1 deletion Firmware/BeamStalker/main/firmware/helper.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef HELPER_H
#define HELPER_H

#define VERSION "v0-2-7-12"
#define VERSION "v0-2-7-13"
#define ROW_SIZE 7
#define COLUMN_SIZE 7
#define SCREEN_WIDTH 128
Expand Down
2 changes: 2 additions & 0 deletions Firmware/BeamStalker/main/firmware/includes/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ AP* select_wifi_menu(int *selected_ap_count) {
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -193,6 +194,7 @@ AP* select_wifi_menu(int *selected_ap_count) {
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
if (Selector == (Menu.length - 1)) { // Select
for (int i = 0; i < ap_count; i++) {
AP* selected_aps = getSelectedAPs(Menu, ap_info_list, selected_ap_count);
Expand Down
39 changes: 37 additions & 2 deletions Firmware/BeamStalker/main/firmware/includes/wifi_sniffer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
#include "wifi_sniffer.h"

void sniff_pps_timer_callback(TimerHandle_t xTimer) {
char pc_buffer[32];
snprintf(pc_buffer, sizeof(pc_buffer), "Packet: %d", sniff_packet_count);
char ch_buffer[32];
snprintf(ch_buffer, sizeof(ch_buffer), "Channel: %d", channel);

M5.Display.clear();
M5GFX_display_text(0, 0*charsize, "Sniffing for 1000s", TFT_WHITE);
M5GFX_display_text(0, 2*charsize, pc_buffer, TFT_WHITE);
M5GFX_display_text(0, 3*charsize, ch_buffer, TFT_WHITE);
M5GFX_display_text(0, 7*charsize, "Press any key to exit...", TFT_WHITE);
}

void init_sniff_pps_timer() {
sniff_packet_count = 0;
pps_timer = xTimerCreate("PPS_Timer", pdMS_TO_TICKS(1000), pdTRUE, (void *)0, sniff_pps_timer_callback);
if (pps_timer == NULL) {
printf("Failed to create timer\n");
} else {
xTimerStart(pps_timer, 0);
}
}

void stop_sniff_pps_timer() {
if (pps_timer != NULL) {
xTimerStop(pps_timer, 0);
xTimerDelete(pps_timer, 0);
pps_timer = NULL;
}
}

bool mac_equals(const uint8_t *mac1, const uint8_t *mac2) {
for (int i = 0; i < 6; i++) {
if (mac1[i] != mac2[i]) {
Expand Down Expand Up @@ -55,6 +86,8 @@ void add_ap_if_new(const uint8_t *ap_mac) {
}

void sniffer_log(const wifi_ieee80211_mac_hdr_t *hdr) {
sniff_packet_count++;

printf("frame_ctrl: %04x, duration_id: %u, "
"addr1: %02x:%02x:%02x:%02x:%02x:%02x, "
"addr2: %02x:%02x:%02x:%02x:%02x:%02x, "
Expand Down Expand Up @@ -199,8 +232,6 @@ mac_addr_t* getSelectedClients(menu Menu, ap_info_t* ap_info, int* selected_coun
return selected_clients;
}



mac_addr_t* select_client_menu(int *selected_client_count, AP* aps, int aps_count) {
sniff(10, NULL, 0);
int length = 0;
Expand Down Expand Up @@ -279,6 +310,7 @@ mac_addr_t* select_client_menu(int *selected_client_count, AP* aps, int aps_coun
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -298,6 +330,7 @@ mac_addr_t* select_client_menu(int *selected_client_count, AP* aps, int aps_coun
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
if (Selector == (Menu.length - 1)) { // Select
mac_addr_t* selected_clients = getSelectedClients(Menu, sniff_ap_list, selected_client_count);

Expand Down Expand Up @@ -391,6 +424,7 @@ uint16_t* select_filter_menu(int *selected_filter_count, uint16_t *filters, int
RETURNp = M5Cardputer.Keyboard.isKeyPressed('`');

if (RETURNp) {
vTaskDelay(pdMS_TO_TICKS(300));
return 0;
}
else if (UPp) {
Expand All @@ -410,6 +444,7 @@ uint16_t* select_filter_menu(int *selected_filter_count, uint16_t *filters, int
vTaskDelay(pdMS_TO_TICKS(50));
}
if (SELECTp) {
vTaskDelay(pdMS_TO_TICKS(300));
if (Selector == (Menu.length - 1)) { // Select
uint16_t* selected_filters = getSelectedFilter(Menu, filters, selected_filter_count);

Expand Down
4 changes: 4 additions & 0 deletions Firmware/BeamStalker/main/firmware/includes/wifi_sniffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ uint16_t *selected_t_filter = NULL;
int selected_t_filter_count;

int sniffer_verbose = 0;
int sniff_packet_count;

typedef struct {
uint8_t mac[6];
Expand Down Expand Up @@ -61,6 +62,9 @@ typedef struct {
uint8_t payload[0];
} wifi_ieee80211_packet_t;

void sniff_pps_timer_callback(TimerHandle_t xTimer);
void init_sniff_pps_timer();
void stop_sniff_pps_timer();
bool mac_equals(const uint8_t *mac1, const uint8_t *mac2);
bool is_broadcast(const uint8_t *mac);
void add_client_to_ap(const uint8_t *ap_mac, const uint8_t *client_mac);
Expand Down

0 comments on commit fae26db

Please sign in to comment.