subbrute_device.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "subbrute_device_i.h"
  3. #include <lib/subghz/protocols/base.h>
  4. #include <lib/subghz/transmitter.h>
  5. #include <lib/subghz/receiver.h>
  6. #include <lib/subghz/environment.h>
  7. struct SubBruteDevice {
  8. SubBruteDeviceState state;
  9. SubBruteProtocol* protocol_info;
  10. volatile bool worker_running;
  11. // Current step
  12. uint64_t key_index;
  13. // Index of group to bruteforce in loaded file
  14. uint8_t load_index;
  15. // SubGhz
  16. FuriThread* thread;
  17. SubGhzReceiver* receiver;
  18. SubGhzProtocolDecoderBase* decoder_result;
  19. SubGhzEnvironment* environment;
  20. SubGhzTransmitter* transmitter;
  21. // Attack state
  22. SubBruteAttacks attack;
  23. char file_template[SUBBRUTE_TEXT_STORE_SIZE];
  24. uint64_t max_value;
  25. // Loaded info for attack type
  26. char current_key[SUBBRUTE_PAYLOAD_SIZE];
  27. char file_key[SUBBRUTE_MAX_LEN_NAME];
  28. // Manual transmit
  29. uint32_t last_time_tx_data;
  30. // Callback for changed states
  31. SubBruteDeviceWorkerCallback callback;
  32. void* context;
  33. };
  34. /*
  35. * PRIVATE METHODS
  36. */
  37. void subbrute_device_free_protocol_info(SubBruteDevice* instance);
  38. int32_t subbrute_worker_thread(void* context);
  39. void subbrute_device_attack_set_default_values(
  40. SubBruteDevice* context,
  41. SubBruteAttacks default_attack);
  42. bool subbrute_device_create_packet_parsed(
  43. SubBruteDevice* instance,
  44. FlipperFormat* flipper_format,
  45. uint64_t step,
  46. bool small);
  47. void subbrute_device_send_callback(SubBruteDevice* instance);
  48. void subbrute_device_subghz_transmit(SubBruteDevice* instance, FlipperFormat* flipper_format);