Skip to content

Commit

Permalink
update wifi marauder
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Aug 15, 2023
1 parent 3f7c2b8 commit e2470d4
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
TOGGLE_ARGS,
FOCUS_CONSOLE_END,
NO_TIP},
{"LED", {"hex", "pattern"}, 2, {"led -s", "led -p"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
{"LED",
{"hex", "pattern"},
2,
{"led -s", "led -p"},
INPUT_ARGS,
FOCUS_CONSOLE_END,
NO_TIP},
{"Settings",
{"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "EnableLED", "other"},
7,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
#include "../../wifi_marauder_app_i.h"

static void wifi_marauder_sniffpmkid_stage_hop_channels_setup_callback(VariableItem* item) {
WifiMarauderApp* app = variable_item_get_context(item);
WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
variable_item_set_current_value_index(item, stage->hop_channels);
}

static void wifi_marauder_sniffpmkid_stage_hop_channels_change_callback(VariableItem* item) {
WifiMarauderApp* app = variable_item_get_context(item);

uint8_t current_stage_index = variable_item_list_get_selected_item_index(app->var_item_list);
const WifiMarauderScriptMenuItem* menu_item =
&app->script_stage_menu->items[current_stage_index];

uint8_t option_index = variable_item_get_current_value_index(item);
variable_item_set_current_value_text(item, menu_item->options[option_index]);

WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
stage->hop_channels = option_index;
}


static void wifi_marauder_sniffpmkid_stage_force_deauth_setup_callback(VariableItem* item) {
WifiMarauderApp* app = variable_item_get_context(item);
WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
Expand Down Expand Up @@ -65,8 +86,8 @@ static void wifi_marauder_sniffpmkid_stage_timeout_select_callback(void* context
}

void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu* stage_menu) {
stage_menu->num_items = 3;
stage_menu->items = malloc(3 * sizeof(WifiMarauderScriptMenuItem));
stage_menu->num_items = 4;
stage_menu->items = malloc(4 * sizeof(WifiMarauderScriptMenuItem));

stage_menu->items[0] = (WifiMarauderScriptMenuItem){
.name = strdup("Force deauth"),
Expand All @@ -88,4 +109,11 @@ void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu
.num_options = 1,
.setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
.select_callback = wifi_marauder_sniffpmkid_stage_timeout_select_callback};
stage_menu->items[3] = (WifiMarauderScriptMenuItem){
.name = strdup("Hop Channels"),
.type = WifiMarauderScriptMenuItemTypeOptionsString,
.num_options = 2,
.options = {"no", "yes"},
.setup_callback = wifi_marauder_sniffpmkid_stage_hop_channels_setup_callback,
.change_callback = wifi_marauder_sniffpmkid_stage_hop_channels_change_callback};
}
22 changes: 19 additions & 3 deletions base_pack/wifi_marauder_companion/script/wifi_marauder_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,35 @@ WifiMarauderScriptStageSniffPmkid* _wifi_marauder_script_get_stage_sniff_pmkid(c

cJSON* channel_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "channel");
int channel = channel_json != NULL ? (int)cJSON_GetNumberValue(channel_json) : 0;

cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
int timeout = timeout_json != NULL ? (int)cJSON_GetNumberValue(timeout_json) :
WIFI_MARAUDER_DEFAULT_TIMEOUT_SNIFF;
WIFI_MARAUDER_DEFAULT_TIMEOUT_SNIFF;

cJSON* force_deauth_json =
cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "forceDeauth");
cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "forceDeauth");
bool force_deauth = cJSON_IsBool(force_deauth_json) ? force_deauth_json->valueint : true;

cJSON* hop_channels_json =
cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "hopChannels");
bool hop_channels = cJSON_IsBool(hop_channels_json) ? hop_channels_json->valueint : false;

WifiMarauderScriptStageSniffPmkid* sniff_pmkid_stage =
(WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));
(WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));

if (sniff_pmkid_stage == NULL) {
// Handle memory allocation error
return NULL;
}
sniff_pmkid_stage->channel = channel;
sniff_pmkid_stage->timeout = timeout;
sniff_pmkid_stage->force_deauth = force_deauth;
sniff_pmkid_stage->hop_channels = hop_channels;

return sniff_pmkid_stage;
}


WifiMarauderScriptStageSniffPwn* _wifi_marauder_script_get_stage_sniff_pwn(cJSON* stages) {
cJSON* sniffpwn_stage_json = cJSON_GetObjectItem(stages, "sniffpwn");
if(sniffpwn_stage_json == NULL) {
Expand Down Expand Up @@ -659,6 +672,9 @@ cJSON* _wifi_marauder_script_create_json_sniffpmkid(
if(sniffpmkid_stage->timeout > 0) {
cJSON_AddNumberToObject(sniffpmkid_json, "timeout", sniffpmkid_stage->timeout);
}
// Hop channels
cJSON_AddBoolToObject(sniffpmkid_json, "hopChannels", sniffpmkid_stage->hop_channels);

return stage_json;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ typedef struct WifiMarauderScriptStageSniffEsp {

typedef struct WifiMarauderScriptStageSniffPmkid {
bool force_deauth;
bool hop_channels;
int channel;
int timeout;
} WifiMarauderScriptStageSniffPmkid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ void _send_line_break() {
wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
}


void _send_channel_select(int channel) {
char command[30];
wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
_send_line_break();
snprintf(command, sizeof(command), "channel -s %d\n", channel);
wifi_marauder_uart_tx((uint8_t*)(command), strlen(command));
}
Expand Down Expand Up @@ -137,25 +138,42 @@ void _wifi_marauder_script_execute_sniff_esp(
}

void _wifi_marauder_script_execute_sniff_pmkid(
WifiMarauderScriptStageSniffPmkid* stage,
WifiMarauderScriptWorker* worker) {
char attack_command[50] = "sniffpmkid";
int len = strlen(attack_command);
WifiMarauderScriptStageSniffPmkid* stage,
WifiMarauderScriptWorker* worker) {

// If channel hopping is enabled, loop through channels 1-11
if(stage->hop_channels) {
for(int i = 1; i <= 11; i++) {
char attack_command[50] = "sniffpmkid";
int len = strlen(attack_command);

len += snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", i);
if(stage->force_deauth) {
len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
}

len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
wifi_marauder_uart_tx((uint8_t*)attack_command, len);
_wifi_marauder_script_delay(worker, stage->timeout);
_send_stop();
}
} else {
char attack_command[50] = "sniffpmkid";
int len = strlen(attack_command);

if(stage->channel > 0) {
len +=
snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
}
if(stage->channel > 0) {
len +=
snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
}

if(stage->force_deauth) {
len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
if(stage->force_deauth) {
len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
}
len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
wifi_marauder_uart_tx((uint8_t*)attack_command, len);
_wifi_marauder_script_delay(worker, stage->timeout);
_send_stop();
}

len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");

wifi_marauder_uart_tx((uint8_t*)attack_command, len);
_wifi_marauder_script_delay(worker, stage->timeout);
_send_stop();
}

void _wifi_marauder_script_execute_sniff_pwn(
Expand Down Expand Up @@ -209,6 +227,7 @@ void _wifi_marauder_script_execute_beacon_ap(
void _wifi_marauder_script_execute_exec(WifiMarauderScriptStageExec* stage) {
if(stage->command != NULL) {
wifi_marauder_uart_tx((uint8_t*)stage->command, strlen(stage->command));
_send_line_break();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "../wifi_marauder_app_i.h"
#include "wifi_marauder_script_worker.h"


WifiMarauderScriptWorker* wifi_marauder_script_worker_alloc() {
WifiMarauderScriptWorker* worker = malloc(sizeof(WifiMarauderScriptWorker));
if(worker == NULL) {
Expand Down Expand Up @@ -39,6 +40,7 @@ int32_t _wifi_marauder_script_worker_task(void* worker) {
}

script_worker->is_running = false;

return WifiMarauderScriptWorkerStatusSuccess;
}

Expand Down
2 changes: 1 addition & 1 deletion base_pack/wifi_marauder_companion/wifi_marauder_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
extern "C" {
#endif

#define WIFI_MARAUDER_APP_VERSION "v0.6.0"
#define WIFI_MARAUDER_APP_VERSION "v0.6.1"

typedef struct WifiMarauderApp WifiMarauderApp;

Expand Down

0 comments on commit e2470d4

Please sign in to comment.