mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 16:58:36 -07:00
Merge branch 'dev' of https://github.com/Flipper-XFW/Xtreme-Firmware into xfw-dev
This commit is contained in:
@@ -1,5 +1,25 @@
|
|||||||
#include "../../wifi_marauder_app_i.h"
|
#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) {
|
static void wifi_marauder_sniffpmkid_stage_force_deauth_setup_callback(VariableItem* item) {
|
||||||
WifiMarauderApp* app = variable_item_get_context(item);
|
WifiMarauderApp* app = variable_item_get_context(item);
|
||||||
WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
|
WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
|
||||||
@@ -65,8 +85,8 @@ static void wifi_marauder_sniffpmkid_stage_timeout_select_callback(void* context
|
|||||||
}
|
}
|
||||||
|
|
||||||
void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu* stage_menu) {
|
void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu* stage_menu) {
|
||||||
stage_menu->num_items = 3;
|
stage_menu->num_items = 4;
|
||||||
stage_menu->items = malloc(3 * sizeof(WifiMarauderScriptMenuItem));
|
stage_menu->items = malloc(4 * sizeof(WifiMarauderScriptMenuItem));
|
||||||
|
|
||||||
stage_menu->items[0] = (WifiMarauderScriptMenuItem){
|
stage_menu->items[0] = (WifiMarauderScriptMenuItem){
|
||||||
.name = strdup("Force deauth"),
|
.name = strdup("Force deauth"),
|
||||||
@@ -88,4 +108,11 @@ void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu
|
|||||||
.num_options = 1,
|
.num_options = 1,
|
||||||
.setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
|
.setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
|
||||||
.select_callback = wifi_marauder_sniffpmkid_stage_timeout_select_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};
|
||||||
}
|
}
|
||||||
@@ -244,18 +244,30 @@ WifiMarauderScriptStageSniffPmkid* _wifi_marauder_script_get_stage_sniff_pmkid(c
|
|||||||
|
|
||||||
cJSON* channel_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "channel");
|
cJSON* channel_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "channel");
|
||||||
int channel = channel_json != NULL ? (int)cJSON_GetNumberValue(channel_json) : 0;
|
int channel = channel_json != NULL ? (int)cJSON_GetNumberValue(channel_json) : 0;
|
||||||
|
|
||||||
cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
|
cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
|
||||||
int timeout = timeout_json != NULL ? (int)cJSON_GetNumberValue(timeout_json) :
|
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* 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;
|
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* 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->channel = channel;
|
||||||
sniff_pmkid_stage->timeout = timeout;
|
sniff_pmkid_stage->timeout = timeout;
|
||||||
sniff_pmkid_stage->force_deauth = force_deauth;
|
sniff_pmkid_stage->force_deauth = force_deauth;
|
||||||
|
sniff_pmkid_stage->hop_channels = hop_channels;
|
||||||
|
|
||||||
return sniff_pmkid_stage;
|
return sniff_pmkid_stage;
|
||||||
}
|
}
|
||||||
@@ -659,6 +671,9 @@ cJSON* _wifi_marauder_script_create_json_sniffpmkid(
|
|||||||
if(sniffpmkid_stage->timeout > 0) {
|
if(sniffpmkid_stage->timeout > 0) {
|
||||||
cJSON_AddNumberToObject(sniffpmkid_json, "timeout", sniffpmkid_stage->timeout);
|
cJSON_AddNumberToObject(sniffpmkid_json, "timeout", sniffpmkid_stage->timeout);
|
||||||
}
|
}
|
||||||
|
// Hop channels
|
||||||
|
cJSON_AddBoolToObject(sniffpmkid_json, "hopChannels", sniffpmkid_stage->hop_channels);
|
||||||
|
|
||||||
return stage_json;
|
return stage_json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ typedef struct WifiMarauderScriptStageSniffEsp {
|
|||||||
|
|
||||||
typedef struct WifiMarauderScriptStageSniffPmkid {
|
typedef struct WifiMarauderScriptStageSniffPmkid {
|
||||||
bool force_deauth;
|
bool force_deauth;
|
||||||
|
bool hop_channels;
|
||||||
int channel;
|
int channel;
|
||||||
int timeout;
|
int timeout;
|
||||||
} WifiMarauderScriptStageSniffPmkid;
|
} WifiMarauderScriptStageSniffPmkid;
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ void _send_line_break(bool save_pcaps) {
|
|||||||
|
|
||||||
void _send_channel_select(int channel, bool save_pcaps) {
|
void _send_channel_select(int channel, bool save_pcaps) {
|
||||||
char command[30];
|
char command[30];
|
||||||
|
_send_line_break(save_pcaps);
|
||||||
snprintf(command, sizeof(command), "channel -s %d\n", channel);
|
snprintf(command, sizeof(command), "channel -s %d\n", channel);
|
||||||
if(save_pcaps) {
|
if(save_pcaps) {
|
||||||
wifi_marauder_usart_tx((uint8_t*)("\n"), 1);
|
|
||||||
wifi_marauder_usart_tx((uint8_t*)(command), strlen(command));
|
wifi_marauder_usart_tx((uint8_t*)(command), strlen(command));
|
||||||
} else {
|
} else {
|
||||||
wifi_marauder_xtreme_uart_tx((uint8_t*)("\n"), 1);
|
|
||||||
wifi_marauder_xtreme_uart_tx((uint8_t*)(command), strlen(command));
|
wifi_marauder_xtreme_uart_tx((uint8_t*)(command), strlen(command));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,28 +197,50 @@ void _wifi_marauder_script_execute_sniff_esp(
|
|||||||
void _wifi_marauder_script_execute_sniff_pmkid(
|
void _wifi_marauder_script_execute_sniff_pmkid(
|
||||||
WifiMarauderScriptStageSniffPmkid* stage,
|
WifiMarauderScriptStageSniffPmkid* stage,
|
||||||
WifiMarauderScriptWorker* worker) {
|
WifiMarauderScriptWorker* worker) {
|
||||||
char attack_command[50] = "sniffpmkid";
|
if(stage->hop_channels) {
|
||||||
int len = strlen(attack_command);
|
for(int i = 1; i <= 11; i++) {
|
||||||
|
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", i);
|
||||||
len +=
|
if(stage->force_deauth) {
|
||||||
snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
|
len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stage->force_deauth) {
|
len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
|
||||||
len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
|
|
||||||
}
|
|
||||||
|
|
||||||
len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
|
if(worker->save_pcaps) {
|
||||||
|
wifi_marauder_usart_tx((uint8_t*)attack_command, len);
|
||||||
|
} else {
|
||||||
|
wifi_marauder_xtreme_uart_tx((uint8_t*)attack_command, len);
|
||||||
|
}
|
||||||
|
|
||||||
if(worker->save_pcaps) {
|
_wifi_marauder_script_delay(worker, stage->timeout);
|
||||||
wifi_marauder_usart_tx((uint8_t*)attack_command, len);
|
_send_stop(worker->save_pcaps);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
wifi_marauder_xtreme_uart_tx((uint8_t*)attack_command, len);
|
char attack_command[50] = "sniffpmkid";
|
||||||
}
|
int len = strlen(attack_command);
|
||||||
|
|
||||||
_wifi_marauder_script_delay(worker, stage->timeout);
|
if(stage->channel > 0) {
|
||||||
_send_stop(worker->save_pcaps);
|
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");
|
||||||
|
}
|
||||||
|
len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
|
||||||
|
|
||||||
|
if(worker->save_pcaps) {
|
||||||
|
wifi_marauder_usart_tx((uint8_t*)attack_command, len);
|
||||||
|
} else {
|
||||||
|
wifi_marauder_xtreme_uart_tx((uint8_t*)attack_command, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
_wifi_marauder_script_delay(worker, stage->timeout);
|
||||||
|
_send_stop(worker->save_pcaps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _wifi_marauder_script_execute_sniff_pwn(
|
void _wifi_marauder_script_execute_sniff_pwn(
|
||||||
@@ -309,6 +330,7 @@ void _wifi_marauder_script_execute_exec(WifiMarauderScriptStageExec* stage, bool
|
|||||||
} else {
|
} else {
|
||||||
wifi_marauder_xtreme_uart_tx((uint8_t*)stage->command, strlen(stage->command));
|
wifi_marauder_xtreme_uart_tx((uint8_t*)stage->command, strlen(stage->command));
|
||||||
}
|
}
|
||||||
|
_send_line_break(save_pcaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user