Skip to content

Commit e6689e7

Browse files
authored
Merge pull request #8 from leedave/feature/subghz_updates
Can finally send, correctly control LEDs and return to menu when done
2 parents 3ea8078 + 31f62b8 commit e6689e7

13 files changed

+96
-24
lines changed

README.md

+19-7
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,35 @@ This app triggers restaurant pagers in a brute force manner, useful to test if d
66

77
## Supported Pagers
88
- Retekess T119
9-
- Retekess TD157
10-
- Retekess TD165
11-
- Retekess TD174
9+
- Retekess TD157 (coming soon)
10+
- Retekess TD165 (coming soon)
11+
- Retekess TD174 (coming soon)
1212

1313
### Features
14-
- Select range of stations
15-
- Select range of pagers
14+
- Select range of stations (needs improving for full range)
15+
- Select range of pagers (needs improving for full range)
1616

1717
## How to install on Flipper Zero
18-
- If you do not have one, download a firmware<br>
18+
- If you do not have one, download a firmware onto your PC via git<br>
1919
- Plug your Flipper Zero in via USB. <br>
2020
- Copy the contents of this folder into the applications_user folder of your firmware. <br>
2121

22+
## What does the blinking mean
23+
24+
### Yellow Blinking LED
25+
Means that the SubGhz Code is being generated for the configured range
26+
27+
### Purple Blinking LED
28+
Means that SubGhz Signals are being sent
29+
2230
## Can this Brute-Force Attacks
23-
In Theory yes, but I wouldn't recommend trying it. Most pagers support 8191 Stations. Triggering ~30 Pagers per station would easily take over 2h. That when only sending each trigger once. It is recommended is to repeat the signal approx 10x, so that would already take all day.
31+
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.
32+
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.
2433
Chances are also, that your Flipper Zero will crash in that time.
2534

35+
## Does this even work
36+
I don't know. It's based on intel collected from other people. The Flipper sends data, I checked that with a second flipper. But if the data actually triggers something is not sure.
37+
2638
Then run the command:
2739
```
2840
.\fbt launch APPSRC=applications_user/meal_pager

docs/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.5
2+
3+
Compiled .sub data is read out and sent via SubGhz. Currently only support for T119.
4+
15
## v0.1
26

37
Can now generate a temporary .sub file for Retekess T119 Pager triggers. Must still be run via SubGhz App

helpers/meal_pager_custom_event.h

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ typedef enum {
1919
Meal_PagerCustomEventScene2Right,
2020
Meal_PagerCustomEventScene2Ok,
2121
Meal_PagerCustomEventScene2Back,
22+
Meal_PagerCustomEventViewTransmitterBack,
23+
Meal_PagerCustomEventViewTransmitterSendStart,
24+
Meal_PagerCustomEventViewTransmitterSendStop,
25+
Meal_PagerCustomEventViewTransmitterError,
2226
} Meal_PagerCustomEvent;
2327

2428
enum Meal_PagerCustomEventType {

helpers/meal_pager_storage.c

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ static void meal_pager_close_storage() {
1111

1212
static void meal_pager_close_config_file(FlipperFormat* file) {
1313
if (file == NULL) return;
14+
flipper_format_rewind(file);
1415
flipper_format_file_close(file);
1516
flipper_format_free(file);
1617
}

helpers/retekess/meal_pager_retekess_t119.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ bool meal_pager_retekess_t119_generate_all(void* context) {
191191
bool success = meal_pager_save_subghz_buffer_file_start(app, ff, storage);
192192

193193
if (!success) {
194-
FURI_LOG_D(TAG, "failed to save buffer");
194+
FURI_LOG_D(TAG, "failed to save to buffer");
195195
meal_pager_save_subghz_buffer_stop(app, ff);
196196
furi_record_close(RECORD_STORAGE);
197197
return success;

helpers/subghz/subghz.c

+30-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/* Reduced variant of the Flipper Zero SubGhz Class */
22

33
#include "subghz_i.h"
4+
#include "../../helpers/meal_pager_custom_event.h"
5+
#include "../../helpers/meal_pager_led.h"
46
//#include "../meal_pager_storage.h"
57

6-
static SubGhz* subghz_alloc() {
8+
SubGhz* subghz_alloc() {
79
SubGhz* subghz = malloc(sizeof(SubGhz));
810

911
subghz->file_path = furi_string_alloc();
@@ -13,7 +15,7 @@ static SubGhz* subghz_alloc() {
1315
return subghz;
1416
}
1517

16-
static void subghz_free(SubGhz* subghz) {
18+
void subghz_free(SubGhz* subghz) {
1719
//TxRx
1820
subghz_txrx_free(subghz->txrx);
1921

@@ -24,11 +26,23 @@ static void subghz_free(SubGhz* subghz) {
2426
free(subghz);
2527
}
2628

29+
30+
void subghz_scene_transmit_callback_end_tx(void* context) {
31+
furi_assert(context);
32+
//UNUSED(context);
33+
FURI_LOG_D(TAG, "callback end");
34+
Meal_Pager* app = context;
35+
view_dispatcher_send_custom_event(
36+
app->view_dispatcher, Meal_PagerCustomEventViewTransmitterSendStop);
37+
}
38+
2739
void subghz_send(void* context) {
28-
UNUSED(context);
29-
SubGhz* subghz = subghz_alloc();
40+
//UNUSED(context);
41+
Meal_Pager* app = context;
42+
//SubGhz* subghz = subghz_alloc();
3043

31-
subghz_load_protocol_from_file(subghz);
44+
FURI_LOG_D(TAG, "loading protocol from file");
45+
subghz_load_protocol_from_file(app->subghz);
3246

3347
/*Storage* storage = furi_record_open(RECORD_STORAGE);
3448
FlipperFormat* ff = flipper_format_file_alloc(storage);
@@ -41,7 +55,14 @@ void subghz_send(void* context) {
4155
}*/
4256

4357
//subghz_txrx_tx_start(subghz->txrx, ff);
44-
subghz_txrx_tx_start(subghz->txrx, subghz_txrx_get_fff_data(subghz->txrx)); //Seems like it must be done this way
58+
59+
FURI_LOG_D(TAG, "Starting Transmission");
60+
subghz_txrx_tx_start(app->subghz->txrx, subghz_txrx_get_fff_data(app->subghz->txrx)); //Seems like it must be done this way
61+
62+
FURI_LOG_D(TAG, "setting sugbhz raw file encoder worker callback");
63+
subghz_txrx_set_raw_file_encoder_worker_callback_end(
64+
app->subghz->txrx, subghz_scene_transmit_callback_end_tx, app);
65+
app->state_notifications = SubGhzNotificationStateTx;
4566

4667
/*flipper_format_rewind(ff);
4768
flipper_format_file_close(ff);
@@ -50,5 +71,7 @@ void subghz_send(void* context) {
5071
furi_record_close(RECORD_STORAGE);*/
5172

5273

53-
subghz_free(subghz);
74+
//subghz_free(subghz);
75+
FURI_LOG_D(TAG, "Finished Transmitting");
76+
//meal_pager_blink_stop(app);
5477
}

helpers/subghz/subghz.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#include "subghz_i.h"
44

5-
//typedef struct SubGhz SubGhz;
5+
typedef struct SubGhz SubGhz;
66

7+
SubGhz* subghz_alloc();
8+
void subghz_free(SubGhz* subghz);
79
void subghz_send(void* context);

helpers/subghz/subghz_txrx.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,15 @@ SubGhzProtocolDecoderBase* subghz_txrx_get_decoder(SubGhzTxRx* instance) {
556556
subghz_receiver_set_rx_callback(instance->receiver, callback, context);
557557
}*/
558558

559-
/*void subghz_txrx_set_raw_file_encoder_worker_callback_end(
559+
void subghz_txrx_set_raw_file_encoder_worker_callback_end(
560560
SubGhzTxRx* instance,
561561
SubGhzProtocolEncoderRAWCallbackEnd callback,
562562
void* context) {
563563
subghz_protocol_raw_file_encoder_worker_set_callback_end(
564564
(SubGhzProtocolEncoderRAW*)subghz_transmitter_get_protocol_instance(instance->transmitter),
565565
callback,
566566
context);
567-
}*/
567+
}
568568

569569
bool subghz_txrx_radio_device_is_external_connected(SubGhzTxRx* instance, const char* name) {
570570
furi_assert(instance);

helpers/subghz/subghz_txrx.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ SubGhzSetting* subghz_txrx_get_setting(SubGhzTxRx* instance);
285285
* @param callback Callback for Raw decoder, end of data transfer
286286
* @param context Context for callback
287287
*/
288-
/*void subghz_txrx_set_raw_file_encoder_worker_callback_end(
288+
void subghz_txrx_set_raw_file_encoder_worker_callback_end(
289289
SubGhzTxRx* instance,
290290
SubGhzProtocolEncoderRAWCallbackEnd callback,
291-
void* context);*/
291+
void* context);
292292

293293
/* Checking if an external radio device is connected
294294
*

meal_pager.c

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ Meal_Pager* meal_pager_app_alloc() {
5858
app->dialogs = furi_record_open(RECORD_DIALOGS);
5959
app->file_path = furi_string_alloc();
6060

61+
app->subghz = subghz_alloc();
62+
6163
// Load configs
6264
meal_pager_read_settings(app);
6365

@@ -97,6 +99,8 @@ void meal_pager_app_free(Meal_Pager* app) {
9799
furi_record_close(RECORD_DIALOGS);
98100
furi_string_free(app->file_path);
99101

102+
subghz_free(app->subghz);
103+
100104
//Remove whatever is left
101105
free(app);
102106
}

meal_pager_i.h

+5
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@
1818
#include "views/meal_pager_startscreen.h"
1919
#include "views/meal_pager_transmit.h"
2020
#include "helpers/meal_pager_storage.h"
21+
#include "helpers/subghz/subghz_types.h"
22+
#include "helpers/subghz/subghz.h"
2123

2224
#define TAG "Meal_Pager"
2325

2426
#define SUBGHZ_APP_EXTENSION ".sub"
2527
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
2628

2729
typedef struct Meal_PagerTransmit Meal_PagerTransmit;
30+
typedef struct SubGhz SubGhz;
2831

2932
typedef struct {
3033
Gui* gui;
3134
NotificationApp* notification;
35+
SubGhzNotificationState state_notifications;
3236
ViewDispatcher* view_dispatcher;
3337
Submenu* submenu;
38+
SubGhz* subghz;
3439
SceneManager* scene_manager;
3540
VariableItemList* variable_item_list;
3641
Meal_PagerStartscreen* meal_pager_startscreen;

scenes/meal_pager_scene_settings.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ void meal_pager_scene_settings_on_enter(void* context) {
144144
item = variable_item_list_add(
145145
app->variable_item_list,
146146
"Pager Type:",
147-
4,
147+
//4,
148+
1,
148149
meal_pager_scene_settings_set_pager_type,
149150
app);
150151
value_index = value_index_uint32(app->pager_type, pager_type_value, 4);

scenes/meal_pager_scene_transmit.c

+19-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "../views/meal_pager_transmit.h"
55
#include "../helpers/meal_pager_led.h"
66
#include "../helpers/subghz/subghz.h"
7+
#include <dolphin/dolphin.h>
78

89
void meal_pager_transmit_callback(Meal_PagerCustomEvent event, void* context) {
910
furi_assert(context);
@@ -30,13 +31,16 @@ void meal_pager_scene_transmit_on_enter(void* context) {
3031
return;
3132
}
3233
FURI_LOG_D(TAG, "Generated tmp.sub");
33-
meal_pager_blink_start_subghz(app);
34+
//meal_pager_blink_start_subghz(app);
3435
FURI_LOG_D(TAG, "Start Transmitting");
3536
subghz_send(app);
36-
FURI_LOG_D(TAG, "Finished Transmitting");
37-
meal_pager_blink_stop(app);
37+
38+
dolphin_deed(DolphinDeedSubGhzSend);
39+
//FURI_LOG_D(TAG, "Finished Transmitting");
40+
//meal_pager_blink_stop(app);
3841
}
3942

43+
4044
bool meal_pager_scene_transmit_on_event(void* context, SceneManagerEvent event) {
4145
Meal_Pager* app = context;
4246
bool consumed = false;
@@ -61,7 +65,19 @@ bool meal_pager_scene_transmit_on_event(void* context, SceneManagerEvent event)
6165
}
6266
consumed = true;
6367
break;
68+
case Meal_PagerCustomEventViewTransmitterSendStop:
69+
app->state_notifications = SubGhzNotificationStateIDLE;
70+
subghz_txrx_stop(app->subghz->txrx);
71+
meal_pager_blink_stop(app);
72+
scene_manager_next_scene(app->scene_manager, Meal_PagerSceneMenu);
73+
FURI_LOG_D(TAG, "Stop Event");
74+
break;
75+
}
76+
} else if(event.type == SceneManagerEventTypeTick) {
77+
if(app->state_notifications == SubGhzNotificationStateTx) {
78+
notification_message(app->notification, &sequence_blink_magenta_10);
6479
}
80+
return true;
6581
}
6682

6783
return consumed;

0 commit comments

Comments
 (0)