forked from flipperdevices/flipperzero-firmware
-
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from derskythe/subbrute-rev3
SubBrute Rev3
- Loading branch information
Showing
21 changed files
with
1,330 additions
and
1,219 deletions.
There are no files selected for viewing
546 changes: 307 additions & 239 deletions
546
applications/plugins/subbrute/helpers/subbrute_worker.c
Large diffs are not rendered by default.
Oops, something went wrong.
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,39 +1,39 @@ | ||
#pragma once | ||
|
||
#include <furi_hal_subghz.h> | ||
|
||
typedef struct SubBruteWorker SubBruteWorker; | ||
/** | ||
* Same like SubGhzTxRxWorkerStatus in subghz_tx_rx_worker.h | ||
* using just to not include that file | ||
#include "../subbrute_protocols.h" | ||
|
||
typedef enum { | ||
SubBruteWorkerStatusIDLE, | ||
SubBruteWorkerStatusTx, | ||
// SubBruteWorkerStatusRx, | ||
} SubBruteWorkerStatus; | ||
SubBruteWorkerStateIDLE, | ||
SubBruteWorkerStateReady, | ||
SubBruteWorkerStateTx, | ||
SubBruteWorkerStateFinished | ||
} SubBruteWorkerState; | ||
|
||
typedef void (*SubBruteWorkerCallback)(void* context, SubBruteWorkerState state); | ||
|
||
typedef struct SubBruteWorker SubBruteWorker; | ||
|
||
//typedef void (*SubBruteWorkerCallback)(SubBruteWorkerStatus event, void* context); | ||
*/ | ||
SubBruteWorker* subbrute_worker_alloc(); | ||
void subbrute_worker_free(SubBruteWorker* instance); | ||
bool subbrute_worker_start( | ||
uint64_t subbrute_worker_get_step(SubBruteWorker* instance); | ||
bool subbrute_worker_set_step(SubBruteWorker* instance, uint64_t step); | ||
bool subbrute_worker_is_running(SubBruteWorker* instance); | ||
bool subbrute_worker_init_default_attack( | ||
SubBruteWorker* instance, | ||
uint32_t frequency, | ||
FuriHalSubGhzPreset preset, | ||
const char* protocol_name); | ||
SubBruteAttacks attack_type, | ||
uint64_t step, | ||
const SubBruteProtocol* protocol); | ||
bool subbrute_worker_init_file_attack( | ||
SubBruteWorker* instance, | ||
uint64_t step, | ||
uint8_t load_index, | ||
const char* file_key, | ||
SubBruteProtocol* protocol); | ||
bool subbrute_worker_start(SubBruteWorker* instance); | ||
void subbrute_worker_stop(SubBruteWorker* instance); | ||
bool subbrute_worker_get_continuous_worker(SubBruteWorker* instance); | ||
void subbrute_worker_set_continuous_worker(SubBruteWorker* instance, bool is_continuous_worker); | ||
//bool subbrute_worker_write(SubBruteWorker* instance, uint8_t* data, size_t size); | ||
bool subbrute_worker_is_running(SubBruteWorker* instance); | ||
bool subbrute_worker_can_transmit(SubBruteWorker* instance); | ||
bool subbrute_worker_can_manual_transmit(SubBruteWorker* instance, bool is_button_pressed); | ||
bool subbrute_worker_transmit(SubBruteWorker* instance, const char* payload); | ||
bool subbrute_worker_init_manual_transmit( | ||
bool subbrute_worker_transmit_current_key(SubBruteWorker* instance, uint64_t step); | ||
bool subbrute_worker_can_manual_transmit(SubBruteWorker* instance); | ||
void subbrute_worker_set_callback( | ||
SubBruteWorker* instance, | ||
uint32_t frequency, | ||
FuriHalSubGhzPreset preset, | ||
const char* protocol_name); | ||
bool subbrute_worker_manual_transmit(SubBruteWorker* instance, const char* payload); | ||
void subbrute_worker_manual_transmit_stop(SubBruteWorker* instance); | ||
SubBruteWorkerCallback callback, | ||
void* context); |
47 changes: 47 additions & 0 deletions
47
applications/plugins/subbrute/helpers/subbrute_worker_private.h
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#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; | ||
|
||
// Initiated values | ||
SubBruteAttacks attack; // Attack state | ||
uint32_t frequency; | ||
FuriHalSubGhzPreset preset; | ||
SubBruteFileProtocol file; | ||
uint8_t bits; | ||
uint8_t te; | ||
uint8_t repeat; | ||
uint8_t load_index; // Index of group to bruteforce in loaded file | ||
const char* file_key; | ||
uint64_t max_value; // Max step | ||
|
||
// 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
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
Oops, something went wrong.