| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- /*
- * ----------------------------------------------------------------------------------------------------
- * STEPS TO ADD A NEW STAGE:
- *
- * wifi_marauder_script.h
- * - Complement WifiMarauderScriptStageType enum with new stage
- * - Create struct WifiMarauderScriptStage???? for the new stage
- *
- * wifi_marauder_script.c
- * - Create function "WifiMarauderScriptStage????* _wifi_marauder_script_get_stage_????(cJSON *stages)"
- * - Change _wifi_marauder_script_load_stages() to load new stage
- * - Add case to free memory in wifi_marauder_script_free()
- *
- * wifi_marauder_script_executor.c
- * - Create function "void _wifi_marauder_script_execute_????(WifiMarauderScriptStage????* stage)"
- * - Add case in wifi_marauder_script_execute_stage()
- *
- * ----------------------------------------------------------------------------------------------------
- * IMPLEMENTED STAGES (In order of execution):
- * - Scan
- * - Select
- * - Deauth
- * - Probe
- * - Sniff beacon
- * - Sniff PMKID
- * - Beacon List
- * ----------------------------------------------------------------------------------------------------
- * SCRIPT SYNTAX:
- * {
- * "meta": {
- * "description": "My script",
- * "repeat": times the script will repeat (default 1),
- * "enableLed": true (default) | false,
- * "savePcap": true (default) | false
- * },
- * "stages": {
- * "scan": {
- * "type": "ap" | "station",
- * "timeout": seconds,
- * "channel": 1-11
- * },
- * "select": {
- * "type": "ap" | "station" | "ssid",
- * "filter": "all" | "contains \"{SSID fragment}\" or equals \"{SSID}\" or ..." (Not implemented yet on Marauder firmware)
- * },
- * "deauth": {
- * "timeout": seconds
- * },
- * "probe": {
- * "timeout": seconds
- * },
- * "sniffBeacon": {
- * "timeout": seconds
- * },
- * "sniffPmkid": {
- * "forceDeauth": true (default) | false,
- * "channel": 1-11,
- * "timeout": seconds
- * },
- * "beaconlist": {
- * "ssids": [
- * "SSID 1",
- * "SSID 2",
- * "SSID 3"
- * ],
- * "timeout": seconds
- * }
- * }
- * }
- * ----------------------------------------------------------------------------------------------------
- */
- #pragma once
- #include <storage/storage.h>
- #include "cJSON.h"
- typedef enum {
- WifiMarauderScriptStageTypeScan,
- WifiMarauderScriptStageTypeSelect,
- WifiMarauderScriptStageTypeDeauth,
- WifiMarauderScriptStageTypeProbe,
- WifiMarauderScriptStageTypeSniffBeacon,
- WifiMarauderScriptStageTypeSniffPmkid,
- WifiMarauderScriptStageTypeBeaconList,
- } WifiMarauderScriptStageType;
- typedef enum {
- WifiMarauderScriptScanTypeAp,
- WifiMarauderScriptScanTypeStation
- } WifiMarauderScriptScanType;
- typedef enum {
- WifiMarauderScriptSelectTypeAp,
- WifiMarauderScriptSelectTypeStation,
- WifiMarauderScriptSelectTypeSsid
- } WifiMarauderScriptSelectType;
- // Stages
- typedef struct WifiMarauderScriptStage {
- WifiMarauderScriptStageType type;
- void* stage;
- struct WifiMarauderScriptStage *next_stage;
- } WifiMarauderScriptStage;
- typedef struct WifiMarauderScriptStageScan {
- WifiMarauderScriptScanType type;
- int channel;
- int timeout;
- } WifiMarauderScriptStageScan;
- typedef struct WifiMarauderScriptStageSelect {
- WifiMarauderScriptSelectType type;
- char* filter;
- // TODO: Implement a feature to not select the same items in the next iteration of the script
- bool allow_repeat;
- } WifiMarauderScriptStageSelect;
- typedef struct WifiMarauderScriptStageDeauth {
- int timeout;
- } WifiMarauderScriptStageDeauth;
- typedef struct WifiMarauderScriptStageProbe {
- int timeout;
- } WifiMarauderScriptStageProbe;
- typedef struct WifiMarauderScriptStageSniffBeacon {
- int timeout;
- } WifiMarauderScriptStageSniffBeacon;
- typedef struct WifiMarauderScriptStageSniffPmkid {
- bool force_deauth;
- int channel;
- int timeout;
- } WifiMarauderScriptStageSniffPmkid;
- typedef struct WifiMarauderScriptStageBeaconList {
- char **ssids;
- int ssid_count;
- int timeout;
- } WifiMarauderScriptStageBeaconList;
- // Script
- typedef struct WifiMarauderScript {
- char* name;
- char* description;
- WifiMarauderScriptStage *first_stage;
- // TODO: Think of a way to not change the settings if they are not informed in the JSON
- bool enable_led;
- bool save_pcap;
- int repeat;
- } WifiMarauderScript;
- WifiMarauderScript* wifi_marauder_script_alloc();
- WifiMarauderScript* wifi_marauder_script_parse_raw(const char* script_raw);
- WifiMarauderScript* wifi_marauder_script_parse_file(const char* file_path, Storage* storage);
- WifiMarauderScriptStage* wifi_marauder_script_get_stage(WifiMarauderScript* script, WifiMarauderScriptStageType stage_type);
- void wifi_marauder_script_free(WifiMarauderScript *script);
|