Skip to content

Commit

Permalink
cracker: change the type of variable pin_count from float to int
Browse files Browse the repository at this point in the history
  • Loading branch information
feitoi committed May 18, 2021
1 parent 387678d commit 1f12b0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/cracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void crack()
char *bssid = NULL;
char *pin = NULL;
int fail_count = 0, loop_count = 0, sleep_count = 0, assoc_fail_count = 0;
float pin_count = 0;
int pin_count = 0;
time_t start_time = 0;
enum wps_result result = 0;

Expand Down Expand Up @@ -279,7 +279,8 @@ void crack()
case KEY_REJECTED:
fail_count = 0;
pin_count++;
advance_pin_count();
if (!get_pin_string_mode())
advance_pin_count();
break;
/* Got it!! */
case KEY_ACCEPTED:
Expand Down Expand Up @@ -337,9 +338,9 @@ void crack()

/* If we've hit our max number of pin attempts, quit */
if((get_max_pin_attempts() > 0) &&
(pin_count == get_max_pin_attempts()))
(pin_count >= get_max_pin_attempts()))
{
cprintf(VERBOSE, "[+] Quitting after %d crack attempts\n", get_max_pin_attempts());
cprintf(VERBOSE, "[+] Quitting after %d crack attempts\n", pin_count);
break;
}
}
Expand Down Expand Up @@ -370,7 +371,7 @@ void advance_pin_count()
}

/* Displays the status and rate of cracking */
void display_status(float pin_count, time_t start_time)
void display_status(int pin_count, time_t start_time)
{
float percentage = 0;
int attempts = 0, average = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/cracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@

void crack();
void advance_pin_count();
void display_status(float pin_count, time_t start_time);
void display_status(int pin_count, time_t start_time);

#endif

0 comments on commit 1f12b0a

Please sign in to comment.