|
@@ -18,6 +18,7 @@ struct SubBruteAttackView {
|
|
|
uint64_t max_value;
|
|
uint64_t max_value;
|
|
|
uint64_t current_step;
|
|
uint64_t current_step;
|
|
|
bool is_attacking;
|
|
bool is_attacking;
|
|
|
|
|
+ uint8_t extra_repeats;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
|
typedef struct {
|
|
@@ -26,7 +27,6 @@ typedef struct {
|
|
|
uint64_t current_step;
|
|
uint64_t current_step;
|
|
|
uint8_t extra_repeats;
|
|
uint8_t extra_repeats;
|
|
|
bool is_attacking;
|
|
bool is_attacking;
|
|
|
- bool is_continuous_worker;
|
|
|
|
|
IconAnimation* icon;
|
|
IconAnimation* icon;
|
|
|
} SubBruteAttackViewModel;
|
|
} SubBruteAttackViewModel;
|
|
|
|
|
|
|
@@ -221,6 +221,8 @@ void subbrute_attack_view_init_values(
|
|
|
instance->max_value = max_value;
|
|
instance->max_value = max_value;
|
|
|
instance->current_step = current_step;
|
|
instance->current_step = current_step;
|
|
|
instance->is_attacking = is_attacking;
|
|
instance->is_attacking = is_attacking;
|
|
|
|
|
+ instance->extra_repeats = extra_repeats;
|
|
|
|
|
+
|
|
|
with_view_model(
|
|
with_view_model(
|
|
|
instance->view,
|
|
instance->view,
|
|
|
SubBruteAttackViewModel * model,
|
|
SubBruteAttackViewModel * model,
|
|
@@ -323,36 +325,43 @@ void elements_button_top_right(Canvas* canvas, const char* str) {
|
|
|
void subbrute_attack_view_draw(Canvas* canvas, void* context) {
|
|
void subbrute_attack_view_draw(Canvas* canvas, void* context) {
|
|
|
furi_assert(context);
|
|
furi_assert(context);
|
|
|
SubBruteAttackViewModel* model = (SubBruteAttackViewModel*)context;
|
|
SubBruteAttackViewModel* model = (SubBruteAttackViewModel*)context;
|
|
|
- char buffer[26];
|
|
|
|
|
|
|
+ char buffer[64];
|
|
|
|
|
|
|
|
const char* attack_name = NULL;
|
|
const char* attack_name = NULL;
|
|
|
attack_name = subbrute_protocol_name(model->attack_type);
|
|
attack_name = subbrute_protocol_name(model->attack_type);
|
|
|
|
|
+
|
|
|
// Title
|
|
// Title
|
|
|
if(model->is_attacking) {
|
|
if(model->is_attacking) {
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
canvas_draw_str_aligned(canvas, 64, 2, AlignCenter, AlignTop, attack_name);
|
|
canvas_draw_str_aligned(canvas, 64, 2, AlignCenter, AlignTop, attack_name);
|
|
|
}
|
|
}
|
|
|
- // Value
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // Current Step / Max value
|
|
|
canvas_set_font(canvas, FontBigNumbers);
|
|
canvas_set_font(canvas, FontBigNumbers);
|
|
|
snprintf(buffer, sizeof(buffer), "%04d/%04d", (int)model->current_step, (int)model->max_value);
|
|
snprintf(buffer, sizeof(buffer), "%04d/%04d", (int)model->current_step, (int)model->max_value);
|
|
|
canvas_draw_str_aligned(canvas, 64, 17, AlignCenter, AlignTop, buffer);
|
|
canvas_draw_str_aligned(canvas, 64, 17, AlignCenter, AlignTop, buffer);
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
|
|
|
|
|
|
|
+ memset(buffer, 0, sizeof(buffer));
|
|
|
if(!model->is_attacking) {
|
|
if(!model->is_attacking) {
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
canvas_draw_str_aligned(canvas, 64, 44, AlignCenter, AlignBottom, attack_name);
|
|
canvas_draw_str_aligned(canvas, 64, 44, AlignCenter, AlignBottom, attack_name);
|
|
|
|
|
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ buffer,
|
|
|
|
|
+ sizeof(buffer),
|
|
|
|
|
+ "x%d",
|
|
|
|
|
+ model->extra_repeats + subbrute_protocol_repeats_count(model->attack_type));
|
|
|
|
|
+ canvas_draw_str_aligned(canvas, 60, 6, AlignCenter, AlignCenter, buffer);
|
|
|
|
|
+
|
|
|
elements_button_left(canvas, "-1");
|
|
elements_button_left(canvas, "-1");
|
|
|
elements_button_right(canvas, "+1");
|
|
elements_button_right(canvas, "+1");
|
|
|
elements_button_center(canvas, "Start");
|
|
elements_button_center(canvas, "Start");
|
|
|
elements_button_top_left(canvas, "Save");
|
|
elements_button_top_left(canvas, "Save");
|
|
|
elements_button_top_right(canvas, "Resend");
|
|
elements_button_top_right(canvas, "Resend");
|
|
|
} else {
|
|
} else {
|
|
|
- if(model->is_continuous_worker) {
|
|
|
|
|
- canvas_invert_color(canvas);
|
|
|
|
|
- }
|
|
|
|
|
// canvas_draw_icon_animation
|
|
// canvas_draw_icon_animation
|
|
|
const uint8_t icon_h_offset = 0;
|
|
const uint8_t icon_h_offset = 0;
|
|
|
const uint8_t icon_width_with_offset =
|
|
const uint8_t icon_width_with_offset =
|
|
@@ -367,9 +376,14 @@ void subbrute_attack_view_draw(Canvas* canvas, void* context) {
|
|
|
float progress_value = (float)model->current_step / model->max_value;
|
|
float progress_value = (float)model->current_step / model->max_value;
|
|
|
elements_progress_bar(canvas, 8, 37, 110, progress_value > 1 ? 1 : progress_value);
|
|
elements_progress_bar(canvas, 8, 37, 110, progress_value > 1 ? 1 : progress_value);
|
|
|
|
|
|
|
|
|
|
+ snprintf(
|
|
|
|
|
+ buffer,
|
|
|
|
|
+ sizeof(buffer),
|
|
|
|
|
+ "x%d",
|
|
|
|
|
+ model->extra_repeats + subbrute_protocol_repeats_count(model->attack_type));
|
|
|
|
|
+ canvas_draw_str(canvas, 4, y - 8, buffer);
|
|
|
|
|
+ canvas_draw_str(canvas, 4, y - 1, "repeats");
|
|
|
|
|
+
|
|
|
elements_button_center(canvas, "Stop");
|
|
elements_button_center(canvas, "Stop");
|
|
|
- if(model->is_continuous_worker) {
|
|
|
|
|
- canvas_invert_color(canvas);
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|