-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,070 additions
and
1,070 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
Copyright (c) 2022 Der Skythe | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
|
||
Copyright (c) 2023 DerSkythe | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
#include "gui_top_buttons.h" | ||
|
||
void elements_button_top_left(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonUp_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = 0; | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x + button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x + 0, line_y, line_x + 0, y - 1); | ||
canvas_draw_line(canvas, line_x + 1, line_y, line_x + 1, y - 2); | ||
canvas_draw_line(canvas, line_x + 2, line_y, line_x + 2, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_icon(canvas, x + horizontal_offset, y - icon_v_offset, icon); | ||
canvas_draw_str( | ||
canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str); | ||
canvas_invert_color(canvas); | ||
} | ||
|
||
void elements_button_top_right(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonDown_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = canvas_width(canvas); | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x - button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, line_x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x - 1, line_y, line_x - 1, y - 1); | ||
canvas_draw_line(canvas, line_x - 2, line_y, line_x - 2, y - 2); | ||
canvas_draw_line(canvas, line_x - 3, line_y, line_x - 3, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_str(canvas, x - button_width + horizontal_offset, y - vertical_offset, str); | ||
canvas_draw_icon( | ||
canvas, x - horizontal_offset - icon_get_width(icon), y - icon_v_offset, icon); | ||
canvas_invert_color(canvas); | ||
#include "gui_top_buttons.h" | ||
|
||
void elements_button_top_left(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonUp_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = 0; | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x + button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x + 0, line_y, line_x + 0, y - 1); | ||
canvas_draw_line(canvas, line_x + 1, line_y, line_x + 1, y - 2); | ||
canvas_draw_line(canvas, line_x + 2, line_y, line_x + 2, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_icon(canvas, x + horizontal_offset, y - icon_v_offset, icon); | ||
canvas_draw_str( | ||
canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str); | ||
canvas_invert_color(canvas); | ||
} | ||
|
||
void elements_button_top_right(Canvas* canvas, const char* str) { | ||
const Icon* icon = &I_ButtonDown_7x4; | ||
|
||
const uint8_t button_height = 12; | ||
const uint8_t vertical_offset = 3; | ||
const uint8_t horizontal_offset = 3; | ||
const uint8_t string_width = canvas_string_width(canvas, str); | ||
const uint8_t icon_h_offset = 3; | ||
const uint8_t icon_width_with_offset = icon_get_width(icon) + icon_h_offset; | ||
const uint8_t icon_v_offset = icon_get_height(icon) + vertical_offset + 1; | ||
const uint8_t button_width = string_width + horizontal_offset * 2 + icon_width_with_offset; | ||
|
||
const uint8_t x = canvas_width(canvas); | ||
const uint8_t y = 0 + button_height; | ||
|
||
uint8_t line_x = x - button_width; | ||
uint8_t line_y = y - button_height; | ||
canvas_draw_box(canvas, line_x, line_y, button_width, button_height); | ||
canvas_draw_line(canvas, line_x - 1, line_y, line_x - 1, y - 1); | ||
canvas_draw_line(canvas, line_x - 2, line_y, line_x - 2, y - 2); | ||
canvas_draw_line(canvas, line_x - 3, line_y, line_x - 3, y - 3); | ||
|
||
canvas_invert_color(canvas); | ||
canvas_draw_str(canvas, x - button_width + horizontal_offset, y - vertical_offset, str); | ||
canvas_draw_icon( | ||
canvas, x - horizontal_offset - icon_get_width(icon), y - icon_v_offset, icon); | ||
canvas_invert_color(canvas); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
#pragma once | ||
|
||
#include <subghz_bruteforcer_icons.h> | ||
#include <input/input.h> | ||
#include <gui/elements.h> | ||
#include <gui/icon.h> | ||
#include <gui/icon_animation.h> | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
void elements_button_top_left(Canvas* canvas, const char* str); | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
#pragma once | ||
|
||
#include <subghz_bruteforcer_icons.h> | ||
#include <input/input.h> | ||
#include <gui/elements.h> | ||
#include <gui/icon.h> | ||
#include <gui/icon_animation.h> | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
void elements_button_top_left(Canvas* canvas, const char* str); | ||
|
||
/** | ||
* Thanks to the author of metronome | ||
* @param canvas | ||
* @param str | ||
*/ | ||
void elements_button_top_right(Canvas* canvas, const char* str); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
#pragma once | ||
|
||
#include "subbrute_worker.h" | ||
#include <lib/subghz/protocols/base.h> | ||
#include <lib/subghz/transmitter.h> | ||
#include <lib/subghz/receiver.h> | ||
#include <lib/subghz/environment.h> | ||
|
||
struct SubBruteWorker { | ||
SubBruteWorkerState state; | ||
volatile bool worker_running; | ||
volatile bool initiated; | ||
volatile bool transmit_mode; | ||
|
||
// Current step | ||
uint64_t step; | ||
|
||
// SubGhz | ||
FuriThread* thread; | ||
SubGhzProtocolDecoderBase* decoder_result; | ||
SubGhzEnvironment* environment; | ||
SubGhzTransmitter* transmitter; | ||
const char* protocol_name; | ||
uint8_t tx_timeout_ms; | ||
const SubGhzDevice* radio_device; | ||
|
||
// Initiated values | ||
SubBruteAttacks attack; // Attack state | ||
uint32_t frequency; | ||
FuriHalSubGhzPreset preset; | ||
SubBruteFileProtocol file; | ||
uint8_t bits; | ||
uint32_t te; | ||
uint8_t repeat; | ||
uint8_t load_index; // Index of group to bruteforce in loaded file | ||
uint64_t file_key; | ||
uint64_t max_value; // Max step | ||
bool two_bytes; | ||
|
||
// Manual transmit | ||
uint32_t last_time_tx_data; | ||
|
||
// Callback for changed states | ||
SubBruteWorkerCallback callback; | ||
void* context; | ||
}; | ||
|
||
int32_t subbrute_worker_thread(void* context); | ||
void subbrute_worker_subghz_transmit(SubBruteWorker* instance, FlipperFormat* flipper_format); | ||
#pragma once | ||
|
||
#include "subbrute_worker.h" | ||
#include <lib/subghz/protocols/base.h> | ||
#include <lib/subghz/transmitter.h> | ||
#include <lib/subghz/receiver.h> | ||
#include <lib/subghz/environment.h> | ||
|
||
struct SubBruteWorker { | ||
SubBruteWorkerState state; | ||
volatile bool worker_running; | ||
volatile bool initiated; | ||
volatile bool transmit_mode; | ||
|
||
// Current step | ||
uint64_t step; | ||
|
||
// SubGhz | ||
FuriThread* thread; | ||
SubGhzProtocolDecoderBase* decoder_result; | ||
SubGhzEnvironment* environment; | ||
SubGhzTransmitter* transmitter; | ||
const char* protocol_name; | ||
uint8_t tx_timeout_ms; | ||
const SubGhzDevice* radio_device; | ||
|
||
// Initiated values | ||
SubBruteAttacks attack; // Attack state | ||
uint32_t frequency; | ||
FuriHalSubGhzPreset preset; | ||
SubBruteFileProtocol file; | ||
uint8_t bits; | ||
uint32_t te; | ||
uint8_t repeat; | ||
uint8_t load_index; // Index of group to bruteforce in loaded file | ||
uint64_t file_key; | ||
uint64_t max_value; // Max step | ||
bool two_bytes; | ||
|
||
// Manual transmit | ||
uint32_t last_time_tx_data; | ||
|
||
// Callback for changed states | ||
SubBruteWorkerCallback callback; | ||
void* context; | ||
}; | ||
|
||
int32_t subbrute_worker_thread(void* context); | ||
void subbrute_worker_subghz_transmit(SubBruteWorker* instance, FlipperFormat* flipper_format); | ||
void subbrute_worker_send_callback(SubBruteWorker* instance); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
#pragma once | ||
|
||
#include <gui/scene_manager.h> | ||
|
||
// Generate scene id and total number | ||
#define ADD_SCENE(prefix, name, id) SubBruteScene##id, | ||
typedef enum { | ||
#include "subbrute_scene_config.h" | ||
SubBruteSceneNum, | ||
} SubBruteScene; | ||
#undef ADD_SCENE | ||
|
||
extern const SceneManagerHandlers subbrute_scene_handlers; | ||
|
||
// Generate scene on_enter handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_event handlers declaration | ||
#define ADD_SCENE(prefix, name, id) \ | ||
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_exit handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE | ||
#pragma once | ||
|
||
#include <gui/scene_manager.h> | ||
|
||
// Generate scene id and total number | ||
#define ADD_SCENE(prefix, name, id) SubBruteScene##id, | ||
typedef enum { | ||
#include "subbrute_scene_config.h" | ||
SubBruteSceneNum, | ||
} SubBruteScene; | ||
#undef ADD_SCENE | ||
|
||
extern const SceneManagerHandlers subbrute_scene_handlers; | ||
|
||
// Generate scene on_enter handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_event handlers declaration | ||
#define ADD_SCENE(prefix, name, id) \ | ||
bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE | ||
|
||
// Generate scene on_exit handlers declaration | ||
#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); | ||
#include "subbrute_scene_config.h" | ||
#undef ADD_SCENE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
ADD_SCENE(subbrute, load_file, LoadFile) | ||
ADD_SCENE(subbrute, load_select, LoadSelect) | ||
ADD_SCENE(subbrute, run_attack, RunAttack) | ||
ADD_SCENE(subbrute, save_name, SaveName) | ||
ADD_SCENE(subbrute, save_success, SaveSuccess) | ||
ADD_SCENE(subbrute, setup_attack, SetupAttack) | ||
ADD_SCENE(subbrute, setup_extra, SetupExtra) | ||
ADD_SCENE(subbrute, load_file, LoadFile) | ||
ADD_SCENE(subbrute, load_select, LoadSelect) | ||
ADD_SCENE(subbrute, run_attack, RunAttack) | ||
ADD_SCENE(subbrute, save_name, SaveName) | ||
ADD_SCENE(subbrute, save_success, SaveSuccess) | ||
ADD_SCENE(subbrute, setup_attack, SetupAttack) | ||
ADD_SCENE(subbrute, setup_extra, SetupExtra) | ||
ADD_SCENE(subbrute, start, Start) |
Oops, something went wrong.