Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Mar 28, 2023
2 parents fd56ac3 + 5340ebe commit 6e710c5
Show file tree
Hide file tree
Showing 30 changed files with 826 additions and 138 deletions.
21 changes: 7 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
### New changes
* If you have copied apps into `apps` folder - remove `apps` folder on your microSD before installing this release to avoid issues!
* Dev Builds: Add extra pack dev branch to avoid "bug" reports with `API mismatch`
* App Loader: Add option to ignore api mismatch (warning! some apps WILL not work, please update them to avoid any issues) -> (by @Willy-JL | PR #395)
* SubGHz: Add manually -> GSN protocol support
* SubGHz: Add 318 and 418 MHz back to hopping list
* SubGHz: Fix hopper stuck at 433.42 due to wide range signals -
When we using 433.92 remote flipper in hopping mode will stuck at 433.42 and may loose signal because of that, need to avoid using close freqs in hopping, only freqs with bigger difference like 310 -> 315
* Plugins: Update **TOTP (Authenticator)** [(by akopachov)](https://github.com/akopachov/flipper-zero_authenticator) -> BadBT Support
* OFW: Screen streaming improvements
* OFW: 1-Wire Overdrive Mode -> **Breaking API change, api was changed from 19.x to 20.x**
* OFW: Disable UART IRQs by default
* OFW: BadUSB: implement boot protocol
* OFW: Remove hmac_sha256 from public API -> **Breaking API change, api was changed from 18.x to 19.x**
**(this will make your manually copied plugins not work, update them in same way you installed them, or delete `apps` folder and then install firmware, if you using extra pack builds (with `e` in version) all apps in _Extra will be updated automatically)**
* SubGHz: AN-Motors AT4 + Alutech AT4N - Add Manually support
* SubGHz: Aprimatic keeloq emulation support + Add Manually
* NFC: MF Classic User Dict -> Fix deleting of the key in extra actions menu
* Plugins: Update WiFi Marauder [(by 0xchocolate)](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion)
* Plugins: Fix POCSAG pager `RIC:` text repetition and overlap (by @Willy-JL | PR #398)
* OFW: NFC: MF Classic - Additional checks before invalidating the key (Fixes issues with not using MF keys from user dict)
* OFW: Fix crash when emulating a DSGeneric key

#### [🎲 Download latest extra apps pack](https://github.com/xMasterX/all-the-plugins/archive/refs/heads/main.zip)

Expand Down
11 changes: 6 additions & 5 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Our Discord Community:
- Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/77)
- Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu [(by derskythe)](https://github.com/DarkFlippers/unleashed-firmware/pull/79)
- Lock device with pin(or regular lock if pin not set) by holding UP button on main screen [(by an4tur0r)](https://github.com/DarkFlippers/unleashed-firmware/pull/107)
* Sub-GHz -> Press OK in frequency analyzer to use detected frequency in Read modes
* Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu
* Sub-GHz -> External CC1101 module support
* Sub-GHz -> Short press OK in frequency analyzer to save detected frequency for usage in Read modes
* Sub-GHz -> Long press OK button in Sub-GHz Frequency analyzer to switch to Read menu and automatically use selected frequency
* Sub-GHz -> External CC1101 module support (Hardware SPI used)
* SubGHz -> **Hold right in received signal list to delete selected signal**
* SubGHz -> **Custom buttons for Keeloq / Alutech AT4N / Nice Flor S / Somfy Telis / Security+ 2.0** - now you can use arrow buttons to send signal with different button code
* SubGHz -> BFT Mitto / Somfy Telis / Nice Flor S manual creation with programming new remote into receiver (use button 0xF for BFT Mitto, 0x8 (Prog) on Somfy Telis)
Expand Down Expand Up @@ -84,10 +84,11 @@ Encoders/sending made by Eng1n33r & @xMasterX:
- Keeloq: Beninca
- Keeloq: Stilmatic / Schellenberg
- Keeloq: CAME Space
- Keeloq: Aprimatic (model TR and similar)
- CAME Atomo
- Nice Flor S
- FAAC SLH (Spa) [External seed calculation required (For info contact me in Discord: Nano#8998)]
- Keeloq: BFT Mitto [External seed calculation required (For info contact me in Discord: Nano#8998)]
- Keeloq: BFT Mitto [External seed calculation required (For info contact me in Discord: Nano#8998)] -> Update! check out new [instructions](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemoteProg.md)
- Security+ v1 & v2
- Star Line

Expand Down Expand Up @@ -189,7 +190,7 @@ Games:

## [- How to add extra Sub-GHz frequencies](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzSettings.md)

## [- How to use Flipper as new remote (Nice FlorS, BFT Mitto, Somfy Telis)](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemoteProg.md)
## [- How to use Flipper as new remote (Nice FlorS, BFT Mitto, Somfy Telis, Aprimatic, AN-Motors, etc..)](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemoteProg.md)

## [- Configure Sub-GHz Remote App](https://github.com/DarkFlippers/unleashed-firmware/blob/dev/documentation/SubGHzRemotePlugin.md)

Expand Down
3 changes: 1 addition & 2 deletions applications/external/pocsag_pager/protocols/pocsag.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ static bool pocsag_decode_message_word(SubGhzProtocolDecoderPocsag* instance, ui
// Function called when current message got decoded, but other messages might follow
static void pocsag_message_done(SubGhzProtocolDecoderPocsag* instance) {
// append the message to the long-term storage string
furi_string_cat_printf(
instance->generic.result_ric, "\e#RIC: %" PRIu32 "\e# | ", instance->ric);
furi_string_printf(instance->generic.result_ric, "\e#RIC: %" PRIu32 "\e# | ", instance->ric);
furi_string_cat_str(instance->generic.result_ric, func_msg[instance->func]);
if(instance->func != POCSAG_FUNC_ALERT1) {
furi_string_cat(instance->done_msg, instance->msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ bool totp_scene_generate_token_handle_event(

SceneState* scene_state;
if(event->input.type == InputTypeLong) {
if(event->input.key == InputKeyDown && plugin_state->automation_method & AutomationMethodBadUsb) {
if(event->input.key == InputKeyDown &&
plugin_state->automation_method & AutomationMethodBadUsb) {
scene_state = (SceneState*)plugin_state->current_scene_state;
totp_usb_type_code_worker_notify(
scene_state->usb_type_code_worker_context, TotpUsbTypeCodeWorkerEventType);
Expand All @@ -383,7 +384,9 @@ bool totp_scene_generate_token_handle_event(
return true;
}
#ifdef TOTP_BADBT_TYPE_ENABLED
else if(event->input.key == InputKeyUp && plugin_state->automation_method & AutomationMethodBadBt) {
else if(
event->input.key == InputKeyUp &&
plugin_state->automation_method & AutomationMethodBadBt) {
scene_state = (SceneState*)plugin_state->current_scene_state;
totp_bt_type_code_worker_notify(
plugin_state->bt_type_code_worker_context, TotpBtTypeCodeWorkerEventType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ App(
apptype=FlipperAppType.EXTERNAL,
entry_point="wifi_marauder_app",
requires=["gui"],
stack_size=1 * 1024,
stack_size=4 * 1024,
order=90,
fap_icon="wifi_10px.png",
fap_category="GPIO",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ADD_SCENE(wifi_marauder, start, Start)
ADD_SCENE(wifi_marauder, console_output, ConsoleOutput)
ADD_SCENE(wifi_marauder, text_input, TextInput)
ADD_SCENE(wifi_marauder, settings_init, SettingsInit)
ADD_SCENE(wifi_marauder, log_viewer, LogViewer)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
furi_assert(context);
WifiMarauderApp* app = context;

if(app->is_writing_log) {
app->has_saved_logs_this_session = true;
storage_file_write(app->log_file, buf, len);
}

// If text box store gets too big, then truncate it
app->text_box_store_strlen += len;
if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
Expand All @@ -21,15 +26,7 @@ void wifi_marauder_console_output_handle_rx_packets_cb(uint8_t* buf, size_t len,
furi_assert(context);
WifiMarauderApp* app = context;

// If it is a sniff function, open the pcap file for recording
if(strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0 && !app->is_writing) {
app->is_writing = true;
if(!app->capture_file || !storage_file_is_open(app->capture_file)) {
wifi_marauder_create_pcap_file(app);
}
}

if(app->is_writing) {
if(app->is_writing_pcap) {
storage_file_write(app->capture_file, buf, len);
}
}
Expand All @@ -49,8 +46,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
furi_string_reset(app->text_box_store);
app->text_box_store_strlen = 0;
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
const char* help_msg = "Marauder companion " WIFI_MARAUDER_APP_VERSION
"\nby @0xchocolate\nmodified by @tcpassos\n";
const char* help_msg = "Marauder companion " WIFI_MARAUDER_APP_VERSION "\n";
furi_string_cat_str(app->text_box_store, help_msg);
app->text_box_store_strlen += strlen(help_msg);
}
Expand All @@ -62,7 +58,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
}
}

// Set starting text - for "View Log", this will just be what was already in the text box store
// Set starting text - for "View Log from end", this will just be what was already in the text box store
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));

scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneConsoleOutput, 0);
Expand All @@ -76,8 +72,23 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
app->lp_uart,
wifi_marauder_console_output_handle_rx_packets_cb); // setup callback for packets rx thread

// Send command with newline '\n'
// Get ready to send command
if(app->is_command && app->selected_tx_string) {
// Create files *before* sending command
// (it takes time to iterate through the directory)
if(app->ok_to_save_logs) {
app->is_writing_log = true;
wifi_marauder_create_log_file(app);
}

// If it is a sniff function, open the pcap file for recording
if(app->ok_to_save_pcaps &&
strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0) {
app->is_writing_pcap = true;
wifi_marauder_create_pcap_file(app);
}

// Send command with newline '\n'
wifi_marauder_uart_tx(
(uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
Expand Down Expand Up @@ -111,8 +122,13 @@ void wifi_marauder_scene_console_output_on_exit(void* context) {
wifi_marauder_uart_tx((uint8_t*)("stopscan\n"), strlen("stopscan\n"));
}

app->is_writing = false;
app->is_writing_pcap = false;
if(app->capture_file && storage_file_is_open(app->capture_file)) {
storage_file_close(app->capture_file);
}

app->is_writing_log = false;
if(app->log_file && storage_file_is_open(app->log_file)) {
storage_file_close(app->log_file);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
#include "../wifi_marauder_app_i.h"

void wifi_marauder_scene_log_viewer_widget_callback(
GuiButtonType result,
InputType type,
void* context) {
WifiMarauderApp* app = context;
if(type == InputTypeShort) {
view_dispatcher_send_custom_event(app->view_dispatcher, result);
}
}

static void _read_log_page_into_text_store(WifiMarauderApp* app) {
char temp[64 + 1];
storage_file_seek(
app->log_file, WIFI_MARAUDER_TEXT_BOX_STORE_SIZE * (app->open_log_file_page - 1), true);
furi_string_reset(app->text_box_store);
for(uint16_t i = 0; i < (WIFI_MARAUDER_TEXT_BOX_STORE_SIZE / (sizeof(temp) - 1)); i++) {
uint16_t num_bytes = storage_file_read(app->log_file, temp, sizeof(temp) - 1);
if(num_bytes == 0) {
break;
}
temp[num_bytes] = '\0';
furi_string_cat_str(app->text_box_store, temp);
}
}

void wifi_marauder_scene_log_viewer_setup_widget(WifiMarauderApp* app, bool called_from_browse) {
Widget* widget = app->widget;
bool is_open = storage_file_is_open(app->log_file);
bool should_open_log = (app->has_saved_logs_this_session || called_from_browse);
if(is_open) {
_read_log_page_into_text_store(app);
} else if(
should_open_log &&
storage_file_open(app->log_file, app->log_file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
uint64_t filesize = storage_file_size(app->log_file);
app->open_log_file_num_pages = filesize / WIFI_MARAUDER_TEXT_BOX_STORE_SIZE;
int extra_page = (filesize % WIFI_MARAUDER_TEXT_BOX_STORE_SIZE != 0) ? 1 : 0;
app->open_log_file_num_pages = (filesize / WIFI_MARAUDER_TEXT_BOX_STORE_SIZE) + extra_page;
app->open_log_file_page = 1;
_read_log_page_into_text_store(app);
} else {
app->open_log_file_page = 0;
app->open_log_file_num_pages = 0;
}

widget_reset(widget);

if(furi_string_empty(app->text_box_store)) {
char help_msg[256];
snprintf(
help_msg,
sizeof(help_msg),
"The log is empty! :(\nTry sending a command?\n\nSaving pcaps to flipper sdcard: %s\nSaving logs to flipper sdcard: %s",
app->ok_to_save_pcaps ? "ON" : "OFF",
app->ok_to_save_logs ? "ON" : "OFF");
furi_string_set_str(app->text_box_store, help_msg);
}

widget_add_text_scroll_element(
widget, 0, 0, 128, 53, furi_string_get_cstr(app->text_box_store));

if(1 < app->open_log_file_page && app->open_log_file_page < app->open_log_file_num_pages) {
// hide "Browse" text for middle pages
widget_add_button_element(
widget, GuiButtonTypeCenter, "", wifi_marauder_scene_log_viewer_widget_callback, app);
} else {
// only show "Browse" text on first and last page
widget_add_button_element(
widget,
GuiButtonTypeCenter,
"Browse",
wifi_marauder_scene_log_viewer_widget_callback,
app);
}

char pagecounter[100];
snprintf(
pagecounter,
sizeof(pagecounter),
"%d/%d",
app->open_log_file_page,
app->open_log_file_num_pages);
if(app->open_log_file_page > 1) {
if(app->open_log_file_page == app->open_log_file_num_pages) {
// only show left side page-count on last page
widget_add_button_element(
widget,
GuiButtonTypeLeft,
pagecounter,
wifi_marauder_scene_log_viewer_widget_callback,
app);
} else {
widget_add_button_element(
widget, GuiButtonTypeLeft, "", wifi_marauder_scene_log_viewer_widget_callback, app);
}
}
if(app->open_log_file_page < app->open_log_file_num_pages) {
widget_add_button_element(
widget,
GuiButtonTypeRight,
pagecounter,
wifi_marauder_scene_log_viewer_widget_callback,
app);
}
}

void wifi_marauder_scene_log_viewer_on_enter(void* context) {
WifiMarauderApp* app = context;

app->open_log_file_page = 0;
app->open_log_file_num_pages = 0;
bool saved_logs_exist = false;
if(!app->has_saved_logs_this_session && furi_string_empty(app->text_box_store)) {
// no commands sent yet this session, find last saved log
if(storage_dir_open(app->log_file, MARAUDER_APP_FOLDER_LOGS)) {
char name[70];
char lastname[70];
while(storage_dir_read(app->log_file, NULL, name, sizeof(name))) {
// keep reading directory until last file is reached
strlcpy(lastname, name, sizeof(lastname));
saved_logs_exist = true;
}
if(saved_logs_exist) {
snprintf(
app->log_file_path,
sizeof(app->log_file_path),
"%s/%s",
MARAUDER_APP_FOLDER_LOGS,
lastname);
}
}
storage_dir_close(app->log_file);
}

wifi_marauder_scene_log_viewer_setup_widget(app, saved_logs_exist);

view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewWidget);
}

bool wifi_marauder_scene_log_viewer_on_event(void* context, SceneManagerEvent event) {
WifiMarauderApp* app = context;
bool consumed = false;

if(event.type == SceneManagerEventTypeCustom) {
if(event.event == GuiButtonTypeCenter) {
// Browse
FuriString* predefined_filepath = furi_string_alloc_set_str(MARAUDER_APP_FOLDER_LOGS);
FuriString* selected_filepath = furi_string_alloc();
if(dialog_file_browser_show(
app->dialogs, selected_filepath, predefined_filepath, NULL)) {
strncpy(
app->log_file_path,
furi_string_get_cstr(selected_filepath),
sizeof(app->log_file_path));
if(storage_file_is_open(app->log_file)) {
storage_file_close(app->log_file);
}
wifi_marauder_scene_log_viewer_setup_widget(app, true);
}
furi_string_free(selected_filepath);
furi_string_free(predefined_filepath);
consumed = true;
} else if(event.event == GuiButtonTypeRight) {
// Advance page
++app->open_log_file_page;
wifi_marauder_scene_log_viewer_setup_widget(app, false);
} else if(event.event == GuiButtonTypeLeft) {
// Previous page
--app->open_log_file_page;
wifi_marauder_scene_log_viewer_setup_widget(app, false);
}
}

return consumed;
}

void wifi_marauder_scene_log_viewer_on_exit(void* context) {
WifiMarauderApp* app = context;
widget_reset(app->widget);
if(storage_file_is_open(app->log_file)) {
storage_file_close(app->log_file);
}
}
Loading

0 comments on commit 6e710c5

Please sign in to comment.