Procházet zdrojové kódy

Merge pull request #18 from leedave/feature/repeats

Feature/repeats
David Lee před 2 roky
rodič
revize
85a94f800c

+ 19 - 1
README.md

@@ -27,9 +27,27 @@ Means that the SubGhz Code is being generated for the configured range
 ### Purple Blinking LED
 ### Purple Blinking LED
 Means that SubGhz Signals are being sent
 Means that SubGhz Signals are being sent
 
 
+## Settings Explanation
+
+### Pager Type
+Sets the current Pager type your targeting. Each model uses a different encoding, you cannot trigger multiple models at once
+
+### First Station / Last Station
+Each Station has a unique id. This is important so many stations can run in one location without conflicting each other. Use these settings to define a range of stations to trigger
+
+I do not recommend a lager range than 10
+
+### Fist Pager / Last Pager
+The range of numbers on the pagers to be triggered. Most stations don't have many pagers, so a range of 0 - 31 probably is enough for all.
+
+### Signal Repeat
+How many times a single pager trigger is sent. Usually a signal is sent multiple times to combat radio noise that can cause a signal not to be recognised. 
+This is the total number of signals, so a setting of 0 will not send anything. More signals take longer, less have a higher risk of no effect. Set a number between 1 and 10. 
+
+
 ## Can this Brute-Force Attacks
 ## Can this Brute-Force Attacks
 This is a Proof-of-Concept. In Theory it could, but I wouldn't recommend trying it. Its annoying for people targeted and it could get you into trouble. Seriously, don't be that person, nobody will like your for it. 
 This is a Proof-of-Concept. In Theory it could, but I wouldn't recommend trying it. Its annoying for people targeted and it could get you into trouble. Seriously, don't be that person, nobody will like your for it. 
-Appart from that, most pagers support 8191 Stations. Triggering ~30 Pagers per station would easily take a long time. That when only sending each trigger once. It is recommended is to repeat the signal approx 10x (currently not possible, but possible that stations don't react to a single call), so that would already take all day. 
+Appart from that, most pagers support 8191 Stations. Triggering ~30 Pagers per station would easily take a long time. That when only sending each trigger once. It is recommended is to repeat the signal approx 10x, so that would already take all day. 
 Also your Flipper Zero will crash in that time, as the generated signals use RAM which is limited in the device. There may be ways to work around this, but I think its better to have such a limitation.
 Also your Flipper Zero will crash in that time, as the generated signals use RAM which is limited in the device. There may be ways to work around this, but I think its better to have such a limitation.
 
 
 ## Does this even work
 ## Does this even work

+ 1 - 1
application.fam

@@ -7,7 +7,7 @@ App(
     fap_icon="icons/meal_pager_10px.png",
     fap_icon="icons/meal_pager_10px.png",
     fap_icon_assets="icons",
     fap_icon_assets="icons",
     fap_category="Sub-Ghz",
     fap_category="Sub-Ghz",
-    fap_version="0.7",
+    fap_version="0.8",
     fap_author="leedave",
     fap_author="leedave",
     fap_weburl="https://github.com/leedave/flipper-zero-meal-pager",
     fap_weburl="https://github.com/leedave/flipper-zero-meal-pager",
     fap_description="This app triggers restaurant pagers in a brute force manner, useful to test if devices are still functional.",
     fap_description="This app triggers restaurant pagers in a brute force manner, useful to test if devices are still functional.",

+ 6 - 0
docs/changelog.md

@@ -1,3 +1,9 @@
+## v0.8
+- Added Repeats feature 
+- Repeats configuration in settings
+- Usage of repeats in T119
+- Usage of repeats in TD157
+
 ## v0.7
 ## v0.7
 
 
 - Added support for TD157
 - Added support for TD157

+ 3 - 0
helpers/meal_pager_storage.c

@@ -126,6 +126,8 @@ void meal_pager_save_settings(void* context) {
     flipper_format_write_uint32(
     flipper_format_write_uint32(
         fff_file, MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER, &app->first_pager, 1);
         fff_file, MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER, &app->first_pager, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LAST_PAGER, &app->last_pager, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LAST_PAGER, &app->last_pager, 1);
+    flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LAST_PAGER, &app->last_pager, 1);
+    flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_REPEATS, &app->repeats, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LED, &app->led, 1);
     flipper_format_write_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LED, &app->led, 1);
@@ -185,6 +187,7 @@ void meal_pager_read_settings(void* context) {
     flipper_format_read_uint32(
     flipper_format_read_uint32(
         fff_file, MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER, &app->first_pager, 1);
         fff_file, MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER, &app->first_pager, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LAST_PAGER, &app->last_pager, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LAST_PAGER, &app->last_pager, 1);
+    flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_REPEATS, &app->repeats, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_HAPTIC, &app->haptic, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_SPEAKER, &app->speaker, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LED, &app->led, 1);
     flipper_format_read_uint32(fff_file, MEAL_PAGER_SETTINGS_KEY_LED, &app->led, 1);

+ 2 - 1
helpers/meal_pager_storage.h

@@ -6,7 +6,7 @@
 #include <flipper_format/flipper_format_i.h>
 #include <flipper_format/flipper_format_i.h>
 #include "../meal_pager_i.h"
 #include "../meal_pager_i.h"
 
 
-#define MEAL_PAGER_SETTINGS_FILE_VERSION 1
+#define MEAL_PAGER_SETTINGS_FILE_VERSION 2
 #define CONFIG_FILE_DIRECTORY_PATH EXT_PATH("apps_data/meal_pager")
 #define CONFIG_FILE_DIRECTORY_PATH EXT_PATH("apps_data/meal_pager")
 #define MEAL_PAGER_SETTINGS_SAVE_PATH CONFIG_FILE_DIRECTORY_PATH "/meal_pager.conf"
 #define MEAL_PAGER_SETTINGS_SAVE_PATH CONFIG_FILE_DIRECTORY_PATH "/meal_pager.conf"
 #define MEAL_PAGER_SETTINGS_SAVE_PATH_TMP MEAL_PAGER_SETTINGS_SAVE_PATH ".tmp"
 #define MEAL_PAGER_SETTINGS_SAVE_PATH_TMP MEAL_PAGER_SETTINGS_SAVE_PATH ".tmp"
@@ -16,6 +16,7 @@
 #define MEAL_PAGER_SETTINGS_KEY_LAST_STATION "Last Station"
 #define MEAL_PAGER_SETTINGS_KEY_LAST_STATION "Last Station"
 #define MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER "First Pager"
 #define MEAL_PAGER_SETTINGS_KEY_FIRST_PAGER "First Pager"
 #define MEAL_PAGER_SETTINGS_KEY_LAST_PAGER "Last Pager"
 #define MEAL_PAGER_SETTINGS_KEY_LAST_PAGER "Last Pager"
+#define MEAL_PAGER_SETTINGS_KEY_REPEATS "Repeats"
 #define MEAL_PAGER_SETTINGS_KEY_HAPTIC "Haptic"
 #define MEAL_PAGER_SETTINGS_KEY_HAPTIC "Haptic"
 #define MEAL_PAGER_SETTINGS_KEY_LED "Led"
 #define MEAL_PAGER_SETTINGS_KEY_LED "Led"
 #define MEAL_PAGER_SETTINGS_KEY_SPEAKER "Speaker"
 #define MEAL_PAGER_SETTINGS_KEY_SPEAKER "Speaker"

+ 4 - 1
helpers/retekess/meal_pager_retekess_t119.c

@@ -67,7 +67,10 @@ static void meal_pager_retekess_t119_generate_pager(
     //FURI_LOG_D(TAG, "Manchester: %s", manchester);
     //FURI_LOG_D(TAG, "Manchester: %s", manchester);
     char* rawSignal = genRawDataT119(200, 600, manchester);
     char* rawSignal = genRawDataT119(200, 600, manchester);
     //FURI_LOG_D(TAG, "RAW_Data: %s", rawSignal);
     //FURI_LOG_D(TAG, "RAW_Data: %s", rawSignal);
-    flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
+    for(u_int32_t i = 1; app->repeats >= i; i++) {
+        flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
+    }
+    //flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
     free(manchester);
     free(manchester);
     free(rawSignal);
     free(rawSignal);
 }
 }

+ 3 - 1
helpers/retekess/meal_pager_retekess_td157.c

@@ -55,7 +55,9 @@ static void meal_pager_retekess_td157_generate_pager(
     customConcat(fullId, actionId);
     customConcat(fullId, actionId);
     char* manchester = encManchester(fullId, 0);
     char* manchester = encManchester(fullId, 0);
     char* rawSignal = genRawDataTD157(200, 600, manchester);
     char* rawSignal = genRawDataTD157(200, 600, manchester);
-    flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
+    for(u_int32_t i = 1; app->repeats >= i; i++) {
+        flipper_format_write_string_cstr(ff, "RAW_Data", rawSignal);
+    }
     free(manchester);
     free(manchester);
     free(rawSignal);
     free(rawSignal);
 }
 }

+ 3 - 1
meal_pager.c

@@ -49,13 +49,15 @@ Meal_Pager* meal_pager_app_alloc() {
     app->pager_type = 0;
     app->pager_type = 0;
     app->first_station = 0;
     app->first_station = 0;
     app->first_station_char = "0";
     app->first_station_char = "0";
-    app->last_station = 255;
+    app->last_station = 10;
     app->last_station_char = "10";
     app->last_station_char = "10";
     app->first_pager = 0;
     app->first_pager = 0;
     app->first_pager_char = "0";
     app->first_pager_char = "0";
     app->last_pager = 31;
     app->last_pager = 31;
     app->last_pager_char = "31";
     app->last_pager_char = "31";
     app->stop_transmit = false;
     app->stop_transmit = false;
+    app->repeats = 1;
+    app->repeats_char = "1";
 
 
     // Used for File Browser
     // Used for File Browser
     app->dialogs = furi_record_open(RECORD_DIALOGS);
     app->dialogs = furi_record_open(RECORD_DIALOGS);

+ 2 - 0
meal_pager_i.h

@@ -57,6 +57,8 @@ typedef struct {
     uint32_t current_station;
     uint32_t current_station;
     uint32_t current_pager;
     uint32_t current_pager;
     bool stop_transmit;
     bool stop_transmit;
+    uint32_t repeats;
+    char* repeats_char;
 } Meal_Pager;
 } Meal_Pager;
 
 
 typedef enum {
 typedef enum {

+ 14 - 0
scenes/meal_pager_scene_settings.c

@@ -101,6 +101,15 @@ static void meal_pager_scene_settings_set_last_pager(VariableItem* item) {
     app->last_pager = index;
     app->last_pager = index;
 }
 }
 
 
+static void meal_pager_scene_settings_set_repeats(VariableItem* item) {
+    Meal_Pager* app = variable_item_get_context(item);
+    uint32_t index = variable_item_get_current_value_index(item);
+
+    snprintf(app->repeats_char, 20, "%lu", index);
+    variable_item_set_current_value_text(item, app->repeats_char);
+    app->repeats = index;
+}
+
 static void meal_pager_scene_settings_set_haptic(VariableItem* item) {
 static void meal_pager_scene_settings_set_haptic(VariableItem* item) {
     Meal_Pager* app = variable_item_get_context(item);
     Meal_Pager* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
     uint8_t index = variable_item_get_current_value_index(item);
@@ -189,6 +198,11 @@ void meal_pager_scene_settings_on_enter(void* context) {
     variable_item_set_current_value_text(item, app->last_pager_char);
     variable_item_set_current_value_text(item, app->last_pager_char);
 
 
     // Repeat Attacks
     // Repeat Attacks
+    item = variable_item_list_add(
+        app->variable_item_list, "Signal Repeat", 11, meal_pager_scene_settings_set_repeats, app);
+    variable_item_set_current_value_index(item, app->repeats);
+    snprintf(app->repeats_char, 20, "%lu", app->repeats);
+    variable_item_set_current_value_text(item, app->repeats_char);
 
 
     // Vibro on/off
     // Vibro on/off
     item = variable_item_list_add(
     item = variable_item_list_add(