This commit is contained in:
ClaraCrazy
2022-12-24 21:38:19 +01:00
committed by GitHub
31 changed files with 244 additions and 285 deletions
@@ -3,98 +3,37 @@
#include <string.h>
#include <stdbool.h>
// this test is not accurate, but gives a basic understanding
// that memory management is working fine
// do not include memmgr.h here
// we also test that we are linking against stdlib
extern size_t memmgr_get_free_heap(void);
extern size_t memmgr_get_minimum_free_heap(void);
// current heap management realization consume:
// X bytes after allocate and 0 bytes after allocate and free,
// where X = sizeof(void*) + sizeof(size_t), look to BlockLink_t
const size_t heap_overhead_max_size = sizeof(void*) + sizeof(size_t);
bool heap_equal(size_t heap_size, size_t heap_size_old) {
// heap borders with overhead
const size_t heap_low = heap_size_old - heap_overhead_max_size;
const size_t heap_high = heap_size_old + heap_overhead_max_size;
// not exact, so we must test it against bigger numbers than "overhead size"
const bool result = ((heap_size >= heap_low) && (heap_size <= heap_high));
// debug allocation info
if(!result) {
printf("\n(hl: %zu) <= (p: %zu) <= (hh: %zu)\n", heap_low, heap_size, heap_high);
}
return result;
}
void test_furi_memmgr() {
size_t heap_size = 0;
size_t heap_size_old = 0;
const int alloc_size = 128;
void* ptr = NULL;
void* original_ptr = NULL;
// do not include furi memmgr.h case
#ifdef FURI_MEMMGR_GUARD
mu_fail("do not link against furi memmgr.h");
#endif
void* ptr;
// allocate memory case
heap_size_old = memmgr_get_free_heap();
ptr = malloc(alloc_size);
heap_size = memmgr_get_free_heap();
mu_assert_pointers_not_eq(ptr, NULL);
mu_assert(heap_equal(heap_size, heap_size_old - alloc_size), "allocate failed");
// free memory case
heap_size_old = memmgr_get_free_heap();
ptr = malloc(100);
mu_check(ptr != NULL);
// test that memory is zero-initialized after allocation
for(int i = 0; i < 100; i++) {
mu_assert_int_eq(0, ((uint8_t*)ptr)[i]);
}
free(ptr);
ptr = NULL;
heap_size = memmgr_get_free_heap();
mu_assert(heap_equal(heap_size, heap_size_old + alloc_size), "free failed");
// reallocate memory case
ptr = malloc(100);
memset(ptr, 66, 100);
ptr = realloc(ptr, 200);
mu_check(ptr != NULL);
// get filled array with some data
original_ptr = malloc(alloc_size);
mu_assert_pointers_not_eq(original_ptr, NULL);
for(int i = 0; i < alloc_size; i++) {
*(unsigned char*)(original_ptr + i) = i;
// test that memory is really reallocated
for(int i = 0; i < 100; i++) {
mu_assert_int_eq(66, ((uint8_t*)ptr)[i]);
}
// malloc array and copy data
ptr = malloc(alloc_size);
mu_assert_pointers_not_eq(ptr, NULL);
memcpy(ptr, original_ptr, alloc_size);
// reallocate array
heap_size_old = memmgr_get_free_heap();
ptr = realloc(ptr, alloc_size * 2);
heap_size = memmgr_get_free_heap();
mu_assert(heap_equal(heap_size, heap_size_old - alloc_size), "reallocate failed");
mu_assert_int_eq(memcmp(original_ptr, ptr, alloc_size), 0);
free(original_ptr);
// TODO: fix realloc to copy only old size, and write testcase that leftover of reallocated memory is zero-initialized
free(ptr);
// allocate and zero-initialize array (calloc)
original_ptr = malloc(alloc_size);
mu_assert_pointers_not_eq(original_ptr, NULL);
for(int i = 0; i < alloc_size; i++) {
*(unsigned char*)(original_ptr + i) = 0;
ptr = calloc(100, 2);
mu_check(ptr != NULL);
for(int i = 0; i < 100 * 2; i++) {
mu_assert_int_eq(0, ((uint8_t*)ptr)[i]);
}
heap_size_old = memmgr_get_free_heap();
ptr = calloc(1, alloc_size);
heap_size = memmgr_get_free_heap();
mu_assert(heap_equal(heap_size, heap_size_old - alloc_size), "callocate failed");
mu_assert_int_eq(memcmp(original_ptr, ptr, alloc_size), 0);
free(original_ptr);
free(ptr);
}
@@ -318,7 +318,10 @@ bool subghz_hal_async_tx_test_run(SubGhzHalAsyncTxTestType type) {
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
furi_hal_subghz_set_frequency_and_path(433920000);
furi_hal_subghz_start_async_tx(subghz_hal_async_tx_test_yield, &test);
if(!furi_hal_subghz_start_async_tx(subghz_hal_async_tx_test_yield, &test)) {
return false;
}
while(!furi_hal_subghz_is_async_tx_complete()) {
furi_delay_ms(10);
}
+20 -18
View File
@@ -73,7 +73,6 @@ void unit_tests_cli(Cli* cli, FuriString* args, void* context) {
UNUSED(cli);
UNUSED(args);
UNUSED(context);
uint32_t failed_tests = 0;
minunit_run = 0;
minunit_assert = 0;
minunit_fail = 0;
@@ -99,32 +98,35 @@ void unit_tests_cli(Cli* cli, FuriString* args, void* context) {
if(furi_string_size(args)) {
if(furi_string_cmp_str(args, unit_tests[i].name) == 0) {
failed_tests += unit_tests[i].entry();
unit_tests[i].entry();
} else {
printf("Skipping %s\r\n", unit_tests[i].name);
}
} else {
failed_tests += unit_tests[i].entry();
unit_tests[i].entry();
}
}
printf("\r\nFailed tests: %lu\r\n", failed_tests);
// Time report
cycle_counter = (furi_get_tick() - cycle_counter);
printf("Consumed: %lu ms\r\n", cycle_counter);
if(minunit_run != 0) {
printf("\r\nFailed tests: %u\r\n", minunit_fail);
// Wait for tested services and apps to deallocate memory
furi_delay_ms(200);
uint32_t heap_after = memmgr_get_free_heap();
printf("Leaked: %ld\r\n", heap_before - heap_after);
// Time report
cycle_counter = (furi_get_tick() - cycle_counter);
printf("Consumed: %lu ms\r\n", cycle_counter);
// Final Report
if(failed_tests == 0) {
notification_message(notification, &sequence_success);
printf("Status: PASSED\r\n");
} else {
notification_message(notification, &sequence_error);
printf("Status: FAILED\r\n");
// Wait for tested services and apps to deallocate memory
furi_delay_ms(200);
uint32_t heap_after = memmgr_get_free_heap();
printf("Leaked: %ld\r\n", heap_before - heap_after);
// Final Report
if(minunit_fail == 0) {
notification_message(notification, &sequence_success);
printf("Status: PASSED\r\n");
} else {
notification_message(notification, &sequence_error);
printf("Status: FAILED\r\n");
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

+1 -1
View File
@@ -9,6 +9,6 @@ Hit any button other than back repeatedly. Calculates based on the average of th
## Compiling
```
./fbt firmware_bpm_tapper
./fbt fap_bpm_tapper
```
@@ -7,7 +7,7 @@ App(
requires=["gui"],
stack_size=2 * 1024,
fap_icon="bpm_10px.png",
fap_category="Music",
fap_icon_assets="icons",
order=15,
fap_category="Music",
order=35,
)
+19 -20
View File
@@ -3,6 +3,7 @@
#include <dialogs/dialogs.h>
#include <gui/gui.h>
#include <input/input.h>
#include <m-string.h>
#include <stdlib.h>
#include "BPM_Tapper_icons.h"
@@ -126,7 +127,7 @@ static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queu
}
static void render_callback(Canvas* const canvas, void* ctx) {
FuriString* tempStr;
string_t tempStr;
const BPMTapper* bpm_state = acquire_mutex((ValueMutex*)ctx, 25);
if(bpm_state == NULL) {
@@ -136,32 +137,30 @@ static void render_callback(Canvas* const canvas, void* ctx) {
//canvas_draw_frame(canvas, 0, 0, 128, 64);
canvas_set_font(canvas, FontPrimary);
tempStr = furi_string_alloc();
string_init(tempStr);
furi_string_printf(tempStr, "Taps: %d", bpm_state->taps);
canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
string_printf(tempStr, "Taps: %d", bpm_state->taps);
canvas_draw_str_aligned(canvas, 5, 10, AlignLeft, AlignBottom, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_printf(tempStr, "Queue: %d", bpm_state->tap_queue->size);
canvas_draw_str_aligned(canvas, 70, 10, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
string_printf(tempStr, "Queue: %d", bpm_state->tap_queue->size);
canvas_draw_str_aligned(canvas, 70, 10, AlignLeft, AlignBottom, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_printf(tempStr, "Interval: %ldms", bpm_state->interval);
canvas_draw_str_aligned(canvas, 5, 20, AlignLeft, AlignBottom, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
string_printf(tempStr, "Interval: %dms", bpm_state->interval);
canvas_draw_str_aligned(canvas, 5, 20, AlignLeft, AlignBottom, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_printf(tempStr, "x2 %.2f /2 %.2f", bpm_state->bpm * 2, bpm_state->bpm / 2);
canvas_draw_str_aligned(
canvas, 64, 60, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
string_printf(tempStr, "x2 %.2f /2 %.2f", bpm_state->bpm * 2, bpm_state->bpm / 2);
canvas_draw_str_aligned(canvas, 64, 60, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_printf(tempStr, "%.2f", bpm_state->bpm);
string_printf(tempStr, "%.2f", bpm_state->bpm);
canvas_set_font(canvas, FontBigNumbers);
canvas_draw_str_aligned(
canvas, 64, 40, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
canvas_draw_str_aligned(canvas, 64, 40, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
furi_string_free(tempStr);
string_clear(tempStr);
release_mutex((ValueMutex*)ctx, bpm_state);
}
+1 -3
View File
@@ -1,7 +1,5 @@
# Metronome
[Original link](https://github.com/panki27/Metronome)
A metronome for the [Flipper Zero](https://flipperzero.one/) device. Goes along perfectly with my [BPM tapper](https://github.com/panki27/bpm-tapper).
![screenshot](img/screenshot.png)
@@ -19,5 +17,5 @@ A metronome for the [Flipper Zero](https://flipperzero.one/) device. Goes along
## Compiling
```
./fbt firmware_metronome
./fbt fap_metronome
```
@@ -8,8 +8,8 @@ App(
"gui",
],
fap_icon="metronome_icon.png",
fap_icon_assets="icons",
fap_category="Music",
fap_icon_assets="images",
stack_size=2 * 1024,
order=20,
)
@@ -1,6 +1,6 @@
#include <gui/canvas.h>
#include <gui/icon_i.h>
#include <Metronome_icons.h>
#include "Metronome_icons.h"
//lib can only do bottom left/right
void elements_button_top_left(Canvas* canvas, const char* str) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 B

+14 -21
View File
@@ -1,6 +1,7 @@
#include <furi.h>
#include <furi_hal.h>
#include <input/input.h>
#include <m-string.h>
#include <stdlib.h>
#include <gui/gui.h>
@@ -57,26 +58,23 @@ static void render_callback(Canvas* const canvas, void* ctx) {
return;
}
FuriString* tempStr;
tempStr = furi_string_alloc();
string_t tempStr;
string_init(tempStr);
canvas_draw_frame(canvas, 0, 0, 128, 64);
canvas_set_font(canvas, FontPrimary);
// draw bars/beat
furi_string_printf(
tempStr, "%d/%d", metronome_state->beats_per_bar, metronome_state->note_length);
canvas_draw_str_aligned(
canvas, 64, 8, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
string_printf(tempStr, "%d/%d", metronome_state->beats_per_bar, metronome_state->note_length);
canvas_draw_str_aligned(canvas, 64, 8, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
// draw BPM value
furi_string_printf(tempStr, "%.2f", metronome_state->bpm);
string_printf(tempStr, "%.2f", metronome_state->bpm);
canvas_set_font(canvas, FontBigNumbers);
canvas_draw_str_aligned(
canvas, 64, 24, AlignCenter, AlignCenter, furi_string_get_cstr(tempStr));
furi_string_reset(tempStr);
canvas_draw_str_aligned(canvas, 64, 24, AlignCenter, AlignCenter, string_get_cstr(tempStr));
string_reset(tempStr);
// draw volume indicator
// always draw first waves
@@ -128,7 +126,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
canvas, 8, 36, 112, (float)metronome_state->current_beat / metronome_state->beats_per_bar);
// cleanup
furi_string_free(tempStr);
string_clear(tempStr);
release_mutex((ValueMutex*)ctx, metronome_state);
}
@@ -160,8 +158,6 @@ static void timer_callback(void* ctx) {
break;
case Silent:
break;
default:
break;
}
} else {
// unpronounced beat
@@ -177,8 +173,6 @@ static void timer_callback(void* ctx) {
break;
case Silent:
break;
default:
break;
}
};
@@ -203,8 +197,6 @@ static void timer_callback(void* ctx) {
break;
case Silent:
break;
default:
break;
}
notification_message(metronome_state->notifications, &sequence_reset_rgb);
@@ -295,6 +287,7 @@ int32_t metronome_app() {
metronome_state->timer = furi_timer_alloc(timer_callback, FuriTimerTypePeriodic, &state_mutex);
// Open GUI and register view_port
//
Gui* gui = furi_record_open("gui");
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
@@ -333,7 +326,7 @@ int32_t metronome_app() {
case InputKeyBack:
processing = false;
break;
default:
case InputKeyMAX:
break;
}
} else if(event.input.type == InputTypeLong) {
@@ -355,7 +348,7 @@ int32_t metronome_app() {
case InputKeyBack:
processing = false;
break;
default:
case InputKeyMAX:
break;
}
} else if(event.input.type == InputTypeRepeat) {
@@ -376,7 +369,7 @@ int32_t metronome_app() {
case InputKeyBack:
processing = false;
break;
default:
case InputKeyMAX:
break;
}
}
@@ -1,7 +1,5 @@
# Minesweeper
[Original Link](https://github.com/panki27/minesweeper)
This is a Minesweeper implementation for the Flipper Zero device.
![screenshot](img/screenshot.png)
@@ -217,10 +217,6 @@ static bool game_lost(Minesweeper* minesweeper_state) {
dialog_message_set_icon(message, NULL, 0, 10);
// Set cursor to initial position
minesweeper_state->cursor_x = 0;
minesweeper_state->cursor_y = 0;
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
notification_message(notifications, &sequence_set_vibro_on);
furi_record_close(RECORD_NOTIFICATION);
@@ -476,7 +472,7 @@ int32_t minesweeper_app(void* p) {
// Exit the plugin
processing = false;
break;
default:
case InputKeyMAX:
break;
}
} else if(event.input.type == InputTypeLong) {
@@ -495,7 +491,7 @@ int32_t minesweeper_app(void* p) {
case InputKeyBack:
processing = false;
break;
default:
case InputKeyMAX:
break;
}
}
+17 -10
View File
@@ -212,8 +212,11 @@ void write_to_log_file(Storage* storage, bool f_settings) {
if(fl) {
FURI_LOG_D(TAG, "Save to %s", furi_string_get_cstr(str));
if(save_to_new_log || f_settings) {
//if(what_to_do == 1) furi_string_printf(str, "%s\n", SettingsFld_Sniff); else furi_string_reset(str);
furi_string_printf(
if(what_to_do == 1)
furi_string_printf(str, "%s\n", SettingsFld_Sniff);
else
furi_string_reset(str);
furi_string_cat_printf(
str,
"%s %d\n%s %d\n%s %d\n",
SettingsFld_Rate,
@@ -231,9 +234,11 @@ void write_to_log_file(Storage* storage, bool f_settings) {
NRF_CRC,
SettingsFld_Payload,
what_to_do == 1 ? NRF_Payload_sniff_min : NRF_Payload);
furi_string_cat_printf(str, "P0: ");
add_to_furi_str_hex_bytes(str, (char*)addrs.addr_P0, addrs.addr_len);
furi_string_cat(str, "\n");
if(addrs.addr_count > 0) {
furi_string_cat_printf(str, "P0: ");
add_to_furi_str_hex_bytes(str, (char*)addrs.addr_P0, addrs.addr_len);
furi_string_cat(str, "\n");
}
if(addrs.addr_count > 1) {
furi_string_cat_printf(str, "P1: ");
add_to_furi_str_hex_bytes(str, (char*)addrs.addr_P1, addrs.addr_len);
@@ -428,13 +433,14 @@ static uint8_t load_settings_file(Stream* file_stream) {
if(err == 0 && a) adr->addr_count = a - '0' + 1;
} else if(line_len >= 3 * 2) { // data
if(!log_loaded) {
log_loaded = true;
clear_log();
what_to_do = 0;
log_loaded = true;
}
if(log_arr_idx < MAX_LOG_RECORDS - 1) {
ConvertHexToArray(
line_ptr, APP->log_arr + log_arr_idx * LOG_REC_SIZE, LOG_REC_SIZE);
if(ConvertHexToArray(
line_ptr, APP->log_arr + log_arr_idx * LOG_REC_SIZE, LOG_REC_SIZE) > 0)
err = 0;
log_arr_idx++;
}
}
@@ -511,13 +517,14 @@ static void prepare_nrf24(bool fsend_packet) {
}
if(what_to_do == 1) { // SNIFF
payload = 32;
nrf24_write_reg(nrf24_HANDLE, REG_CONFIG, 0x70); // Mask all interrupts
nrf24_write_reg(nrf24_HANDLE, REG_CONFIG, 0x70); // Mask all interrupts, NO CRC
nrf24_write_reg(nrf24_HANDLE, REG_SETUP_RETR, 0); // Automatic Retransmission
nrf24_write_reg(nrf24_HANDLE, REG_EN_AA, 0); // Auto acknowledgement
nrf24_write_reg(
nrf24_HANDLE,
REG_FEATURE,
0); // Enables the W_TX_PAYLOAD_NOACK command, Disable Payload with ACK, set Dynamic Payload
nrf24_write_reg(nrf24_HANDLE, REG_RF_CH, NRF_channel);
} else if(setup_from_log) { // Scan
nrf24_write_reg(
nrf24_HANDLE,
@@ -1013,7 +1020,7 @@ static void render_callback(Canvas* const canvas, void* ctx) {
if(log_arr_idx && (*p & 0x80)) { // +RAW
snprintf(screen_buf, sizeof(screen_buf), "Start read: ");
add_to_str_hex_bytes(screen_buf, (char*)p + 2, (*(p + 1) & 0b11) + 2);
if(what_to_do == 3) strcpy(screen_buf + strlen(screen_buf) - 2, "* ");
if(what_to_do == 2) strcpy(screen_buf + strlen(screen_buf) - 2, "* ");
} else
snprintf(
screen_buf,
@@ -34,7 +34,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
app->text_box_store_strlen = 0;
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
const char* help_msg =
"Marauder companion v0.2.2\nFor app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
"Marauder companion v0.3.0\nFor app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
furi_string_cat_str(app->text_box_store, help_msg);
app->text_box_store_strlen += strlen(help_msg);
}
@@ -26,7 +26,13 @@ typedef struct {
// NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
const WifiMarauderItem items[NUM_MENU_ITEMS] = {
{"View Log from", {"start", "end"}, 2, {"", ""}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP},
{"Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP},
{"Scan",
{"ap", "station"},
2,
{"scanap", "scansta"},
NO_ARGS,
FOCUS_CONSOLE_END,
SHOW_STOPSCAN_TIP},
{"SSID",
{"add rand", "add name", "remove"},
3,
@@ -34,12 +40,24 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
INPUT_ARGS,
FOCUS_CONSOLE_START,
NO_TIP},
{"List", {"ap", "ssid"}, 2, {"list -a", "list -s"}, NO_ARGS, FOCUS_CONSOLE_START, NO_TIP},
{"Select", {"ap", "ssid"}, 2, {"select -a", "select -s"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
{"List",
{"ap", "ssid", "station"},
3,
{"list -a", "list -s", "list -c"},
NO_ARGS,
FOCUS_CONSOLE_START,
NO_TIP},
{"Select",
{"ap", "ssid", "station"},
3,
{"select -a", "select -s", "select -c"},
INPUT_ARGS,
FOCUS_CONSOLE_END,
NO_TIP},
{"Clear List",
{"ap", "ssid"},
2,
{"clearlist -a", "clearlist -s"},
{"ap", "ssid", "station"},
3,
{"clearlist -a", "clearlist -s", "clearlist -c"},
NO_ARGS,
FOCUS_CONSOLE_END,
NO_TIP},
@@ -50,6 +68,13 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
NO_ARGS,
FOCUS_CONSOLE_END,
SHOW_STOPSCAN_TIP},
{"Targeted Deauth",
{"station", "manual"},
2,
{"attack -t deauth -c", "attack -t deauth -s"},
TOGGLE_ARGS,
FOCUS_CONSOLE_END,
SHOW_STOPSCAN_TIP},
{"Beacon Spam",
{"ap list", "ssid list", "random"},
3,
@@ -87,18 +112,19 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
FOCUS_CONSOLE_END,
NO_TIP},
{"Settings",
{"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "other"},
6,
{"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "EnableLED", "other"},
7,
{"settings",
"settings -r",
"settings -s ForcePMKID enable",
"settings -s ForceProbe enable",
"settings -s SavePCAP enable",
"settings -s EnableLED enable",
"settings -s"},
TOGGLE_ARGS,
FOCUS_CONSOLE_START,
NO_TIP},
{"Update", {""}, 1, {"update -w"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
{"Update", {"ota", "sd"}, 2, {"update -w", "update -s"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
{"Reboot", {""}, 1, {"reboot"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
{"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
};
@@ -3,13 +3,34 @@
void wifi_marauder_scene_text_input_callback(void* context) {
WifiMarauderApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
switch(app->special_case_input_step) {
case 0: // most commands
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
break;
case 1: // special case for deauth: save source MAC
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventSaveSourceMac);
break;
case 2: // special case for deauth: save destination MAC
view_dispatcher_send_custom_event(
app->view_dispatcher, WifiMarauderEventSaveDestinationMac);
break;
default:
break;
}
}
void wifi_marauder_scene_text_input_on_enter(void* context) {
WifiMarauderApp* app = context;
if(false == app->is_custom_tx_string) {
if(0 ==
strncmp("attack -t deauth -s", app->selected_tx_string, strlen("attack -t deauth -s"))) {
// Special case for manual deauth input
app->special_case_input_step = 1;
bzero(app->text_input_store, WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE);
} else if(false == app->is_custom_tx_string) {
// Most commands
app->special_case_input_step = 0;
// Fill text input with selected string so that user can add to it
size_t length = strlen(app->selected_tx_string);
furi_assert(length < WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE);
@@ -25,7 +46,9 @@ void wifi_marauder_scene_text_input_on_enter(void* context) {
// Setup view
TextInput* text_input = app->text_input;
// Add help message to header
if(0 == strncmp("ssid -a -g", app->selected_tx_string, strlen("ssid -a -g"))) {
if(app->special_case_input_step == 1) {
text_input_set_header_text(text_input, "Enter source MAC");
} else if(0 == strncmp("ssid -a -g", app->selected_tx_string, strlen("ssid -a -g"))) {
text_input_set_header_text(text_input, "Enter # SSIDs to generate");
} else if(0 == strncmp("ssid -a -n", app->selected_tx_string, strlen("ssid -a -n"))) {
text_input_set_header_text(text_input, "Enter SSID name to add");
@@ -59,6 +82,65 @@ bool wifi_marauder_scene_text_input_on_event(void* context, SceneManagerEvent ev
app->selected_tx_string = app->text_input_store;
scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
consumed = true;
} else if(event.event == WifiMarauderEventSaveSourceMac) {
if(12 != strlen(app->text_input_store)) {
text_input_set_header_text(app->text_input, "MAC must be 12 hex chars!");
} else {
snprintf(
app->special_case_input_src_addr,
sizeof(app->special_case_input_src_addr),
"%c%c:%c%c:%c%c:%c%c:%c%c:%c%c",
app->text_input_store[0],
app->text_input_store[1],
app->text_input_store[2],
app->text_input_store[3],
app->text_input_store[4],
app->text_input_store[5],
app->text_input_store[6],
app->text_input_store[7],
app->text_input_store[8],
app->text_input_store[9],
app->text_input_store[10],
app->text_input_store[11]);
// Advance scene to input destination MAC, clear text input
app->special_case_input_step = 2;
bzero(app->text_input_store, WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE);
text_input_set_header_text(app->text_input, "Enter destination MAC");
}
consumed = true;
} else if(event.event == WifiMarauderEventSaveDestinationMac) {
if(12 != strlen(app->text_input_store)) {
text_input_set_header_text(app->text_input, "MAC must be 12 hex chars!");
} else {
snprintf(
app->special_case_input_dst_addr,
sizeof(app->special_case_input_dst_addr),
"%c%c:%c%c:%c%c:%c%c:%c%c:%c%c",
app->text_input_store[0],
app->text_input_store[1],
app->text_input_store[2],
app->text_input_store[3],
app->text_input_store[4],
app->text_input_store[5],
app->text_input_store[6],
app->text_input_store[7],
app->text_input_store[8],
app->text_input_store[9],
app->text_input_store[10],
app->text_input_store[11]);
// Construct command with source and destination MACs
snprintf(
app->text_input_store,
WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE,
"attack -t deauth -s %18s -d %18s",
app->special_case_input_src_addr,
app->special_case_input_dst_addr);
app->selected_tx_string = app->text_input_store;
scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
}
consumed = true;
}
}
@@ -50,6 +50,8 @@ WifiMarauderApp* wifi_marauder_app_alloc() {
app->selected_option_index[i] = 0;
}
app->special_case_input_step = 0;
app->text_box = text_box_alloc();
view_dispatcher_add_view(
app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
@@ -14,7 +14,7 @@
#include <gui/modules/text_input.h>
#include <gui/modules/variable_item_list.h>
#define NUM_MENU_ITEMS (15)
#define NUM_MENU_ITEMS (16)
#define WIFI_MARAUDER_TEXT_BOX_STORE_SIZE (4096)
#define WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE (512)
@@ -41,6 +41,11 @@ struct WifiMarauderApp {
bool is_custom_tx_string;
bool focus_console_start;
bool show_stopscan_tip;
// For input source and destination MAC in targeted deauth attack
int special_case_input_step;
char special_case_input_src_addr[20];
char special_case_input_dst_addr[20];
};
// Supported commands:
@@ -4,4 +4,6 @@ typedef enum {
WifiMarauderEventRefreshConsoleOutput = 0,
WifiMarauderEventStartConsole,
WifiMarauderEventStartKeyboard,
WifiMarauderEventSaveSourceMac,
WifiMarauderEventSaveDestinationMac
} WifiMarauderCustomEvent;
@@ -0,0 +1,11 @@
Rate: 1
Ch: 2
ESB: 1
DPL: 0
CRC: 2
Payload: 4
P0: C8C8C0
P1: C8C8C1
P2: C2
P3: C3
P4: E5
-86
View File
@@ -2100,89 +2100,3 @@ protocol: RC5
address: 10 00 00 00
command: 0F 00 00 00
#
# Model: Samsung HW-K450 Soundbar
#
name: Power
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4637 4376 612 419 584 420 584 420 583 421 582 1427 531 1477 531 472 532 472 557 1452 556 1451 557 1451 557 1452 556 447 557 448 556 449 555 449 555 4453 554 450 554 450 554 451 553 450 554 451 553 451 553 451 553 450 554 1455 553 1454 554 1454 554 451 553 1454 554 1454 554 1455 553 1454 554 451 553 450 554 450 554 1455 553 55439 4554 4458 555 449 555 449 555 450 554 450 554 1455 553 1454 554 451 553 450 554 1454 554 1454 554 1454 554 1455 553 450 554 451 553 451 553 451 553 4453 554 451 553 451 552 451 553 451 553 451 553 451 553 451 553 451 553 1455 553 1455 553 1455 553 451 553 1455 553 1455 553 1455 553 1455 553 451 553 451 552 451 553 1455 553
#
name: Play
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4636 4380 612 392 612 394 610 394 610 419 583 1399 557 1452 556 473 556 448 556 1428 581 1453 555 1453 555 1453 555 449 555 450 554 451 553 452 552 4457 551 452 552 452 552 452 552 452 552 452 552 1457 551 452 552 1457 551 452 552 452 552 453 551 1457 552 1457 551 452 552 1457 551 452 552 1457 551 1457 551 1457 552 452 552 55450 4551 4461 553 451 553 452 552 452 552 452 552 1456 552 1456 552 452 552 452 552 1456 552 1456 552 1456 552 1456 552 452 552 452 552 453 551 453 551 4456 551 453 551 453 551 453 551 453 551 453 551 1457 551 453 551 1457 552 453 551 454 550 454 550 1457 552 1457 551 454 550 1457 551 454 550 1458 551 1457 551 1458 550 454 550
#
name: Vol_up
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4640 4405 583 420 583 421 582 421 583 422 581 1427 531 1478 530 473 531 472 557 1452 557 1452 556 1452 556 1452 556 448 556 448 556 449 555 450 554 4454 554 451 553 451 553 451 553 451 553 1455 554 1455 553 1455 553 451 553 1455 553 1456 553 1456 553 451 553 451 553 451 553 451 554 1455 554 451 553 452 553 451 553 1456 553 55447 4556 4458 555 449 555 450 554 450 554 450 554 1455 553 1455 553 451 553 451 553 1455 553 1455 553 1455 553 1455 553 451 553 451 553 451 553 451 553 4454 553 451 553 450 554 451 553 450 554 1455 553 1455 553 1455 553 451 553 1455 553 1455 553 1455 553 451 553 451 553 451 553 450 554 1455 553 451 553 451 553 451 553 1455 553
#
name: Vol_dn
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4636 4378 613 393 611 392 612 393 611 393 557 1451 558 1450 610 420 583 421 557 1427 581 1452 556 1452 556 1452 556 448 555 449 555 450 554 450 554 4455 553 451 553 451 553 451 553 451 553 451 553 451 553 452 552 1456 553 1456 552 1456 553 1456 552 451 553 1456 553 1456 552 1456 553 451 553 451 553 452 552 451 553 1456 552 55452 4553 4461 553 450 554 451 553 451 553 451 553 1456 553 1456 552 451 553 451 553 1456 552 1455 553 1455 553 1455 553 451 553 451 553 451 553 451 553 4456 552 451 553 451 553 451 553 451 553 451 553 451 553 451 553 1456 552 1455 553 1455 553 1455 553 451 553 1455 553 1456 552 1456 552 451 553 451 553 451 553 451 553 1456 552
#
name: Prev
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 255 113623 4638 4378 613 391 612 392 559 446 558 446 558 1477 531 1477 532 472 532 472 532 1476 532 1476 532 1476 532 1477 531 473 555 449 555 449 555 450 554 4455 554 450 554 450 554 450 554 450 554 1455 554 1455 554 450 554 1455 554 450 555 450 554 450 554 1455 554 451 553 451 553 1455 554 450 554 1455 554 1456 553 1455 554 450 554
#
name: Next
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4557 4430 611 392 610 394 559 445 559 446 558 1451 558 1477 531 448 556 472 532 1476 532 1477 532 1477 531 1477 531 473 556 449 555 449 555 450 554 4454 554 450 554 450 554 450 554 450 555 450 554 450 554 1455 554 1455 554 450 554 450 554 450 554 1455 554 1455 554 1455 553 451 553 450 554 1455 554 1455 554 1455 554 450 554 55458 4555 4459 554 450 554 450 554 450 554 450 554 1455 553 1455 553 450 554 450 554 1455 553 1455 553 1455 553 1455 553 450 554 450 554 450 554 450 554 4454 554 450 554 450 554 450 554 451 553 450 554 450 554 1455 553 1455 553 451 553 450 554 450 554 1455 553 1455 553 1455 553 450 554 451 553 1455 554 1455 553 1455 553 450 554
#
name: Mute
type: raw
frequency: 38000
duty_cycle: 0.330000
data: 4639 4406 586 418 585 393 559 447 557 447 557 1477 532 1477 532 472 532 472 532 1476 533 1476 532 1476 532 1476 532 473 555 449 555 449 555 449 555 4455 554 450 554 450 554 450 554 450 554 1455 554 450 554 450 554 450 554 1455 554 1455 553 1455 553 450 554 450 554 1455 554 1455 554 1455 554 450 554 450 554 450 554 1455 554 55454 4557 4458 555 449 555 449 555 450 554 450 554 1455 554 1455 553 450 554 450 554 1455 554 1455 554 1454 554 1455 554 450 554 450 554 450 555 450 554 4455 553 450 554 450 554 450 554 450 554 1455 554 450 554 450 554 450 554 1455 554 1455 554 1455 553 450 554 450 554 1455 554 1455 553 1455 554 450 554 450 554 450 554 1455 554
#
# Model: Edifier R1850DB
name: Power
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 46 B9 00 00
#
name: Play
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 5E A1 00 00
#
name: Vol_up
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 05 FA 00 00
#
name: Vol_dn
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 49 B6 00 00
#
name: Next
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 02 FD 00 00
#
name: Prev
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 1E E1 00 00
#
name: Mute
type: parsed
protocol: NECext
address: 10 E7 00 00
command: 41 BE 00 00
-18
View File
@@ -1774,21 +1774,3 @@ protocol: NEC
address: 00 00 00 00
command: 33 00 00 00
#
# Model: VIZIO
name: MUTE
type: parsed
protocol: NEC
address: 04 00 00 00
command: 09 00 00 00
#
name: VOL+
type: parsed
protocol: NEC
address: 04 00 00 00
command: 02 00 00 00
#
name: VOL-
type: parsed
protocol: NEC
address: 04 00 00 00
command: 03 00 00 00
+1 -1
View File
@@ -24,7 +24,7 @@ def flp_serial_by_name(flp_name):
return ""
UPDATE_TIMEOUT = 60
UPDATE_TIMEOUT = 60 * 4 # 4 minutes
def main():