|
0 |
Index: reaver/src/cracker.c
|
|
1 |
===================================================================
|
|
2 |
--- reaver.orig/src/cracker.c 2013-05-25 22:23:44.971925189 +0200
|
|
3 |
+++ reaver/src/cracker.c 2013-05-25 22:41:17.059911113 +0200
|
|
4 |
@@ -285,18 +285,65 @@
|
|
5 |
}
|
|
6 |
}
|
|
7 |
|
|
8 |
+char *get_max_time_remaining(int average, int attempts_remaining)
|
|
9 |
+{
|
|
10 |
+ char *max_time, hours[8], minutes[3], seconds[3];
|
|
11 |
+ int max_hours = 0, max_minutes = 0, max_seconds = 0;
|
|
12 |
+
|
|
13 |
+ max_time = malloc(16);
|
|
14 |
+
|
|
15 |
+ if(!max_time)
|
|
16 |
+ exit(-1);
|
|
17 |
+
|
|
18 |
+ if(average)
|
|
19 |
+ {
|
|
20 |
+ max_seconds = attempts_remaining * average;
|
|
21 |
+ if(max_seconds > 60)
|
|
22 |
+ {
|
|
23 |
+ max_minutes = max_seconds / 60;
|
|
24 |
+ max_seconds -= max_minutes * 60;
|
|
25 |
+ }
|
|
26 |
+ if(max_minutes > 60)
|
|
27 |
+ {
|
|
28 |
+ max_hours = max_minutes / 60;
|
|
29 |
+ max_minutes -= max_hours * 60;
|
|
30 |
+ }
|
|
31 |
+
|
|
32 |
+ if(max_seconds < 0 || max_minutes < 0 || max_hours < 0)
|
|
33 |
+ {
|
|
34 |
+ free(max_time);
|
|
35 |
+ return NULL;
|
|
36 |
+ }
|
|
37 |
+
|
|
38 |
+ sprintf(hours, "%d", max_hours);
|
|
39 |
+ sprintf(minutes, "%s%d", max_minutes > 9 ? "" : "0", max_minutes);
|
|
40 |
+ sprintf(seconds, "%s%d", max_seconds > 9 ? "" : "0", max_seconds);
|
|
41 |
+
|
|
42 |
+ sprintf(max_time, "%s:%s:%s", hours, minutes, seconds);
|
|
43 |
+ }
|
|
44 |
+ else
|
|
45 |
+ {
|
|
46 |
+ free(max_time);
|
|
47 |
+ return NULL;
|
|
48 |
+ }
|
|
49 |
+
|
|
50 |
+ return max_time;
|
|
51 |
+}
|
|
52 |
+
|
|
53 |
/* Displays the status and rate of cracking */
|
|
54 |
void display_status(float pin_count, time_t start_time)
|
|
55 |
{
|
|
56 |
float percentage = 0;
|
|
57 |
int attempts = 0, average = 0;
|
|
58 |
+ int attempts_remaining = 0;
|
|
59 |
time_t now = 0, diff = 0;
|
|
60 |
struct tm *tm_p = NULL;
|
|
61 |
- char time_s[256] = { 0 };
|
|
62 |
+ char time_s[256] = { 0 }, *max_time;
|
|
63 |
|
|
64 |
if(get_key_status() == KEY1_WIP)
|
|
65 |
{
|
|
66 |
attempts = get_p1_index() + get_p2_index();
|
|
67 |
+ attempts_remaining = 11000 - attempts;
|
|
68 |
}
|
|
69 |
/*
|
|
70 |
* If we've found the first half of the key, then the entire key1 keyspace
|
|
71 |
@@ -305,10 +352,12 @@
|
|
72 |
else if(get_key_status() == KEY2_WIP)
|
|
73 |
{
|
|
74 |
attempts = P1_SIZE + get_p2_index();
|
|
75 |
+ attempts_remaining = 11000 - attempts;
|
|
76 |
}
|
|
77 |
else if(get_key_status() == KEY_DONE)
|
|
78 |
{
|
|
79 |
attempts = P1_SIZE + P2_SIZE;
|
|
80 |
+ attempts_remaining = 0;
|
|
81 |
}
|
|
82 |
|
|
83 |
percentage = (float) (((float) attempts / (P1_SIZE + P2_SIZE)) * 100);
|
|
84 |
@@ -335,7 +384,12 @@
|
|
85 |
average = 0;
|
|
86 |
}
|
|
87 |
|
|
88 |
+ max_time = get_max_time_remaining(average, attempts_remaining);
|
|
89 |
+
|
|
90 |
cprintf(INFO, "[+] %.2f%% complete @ %s (%d seconds/pin)\n", percentage, time_s, average);
|
|
91 |
+ cprintf(INFO, "[+] Max time remaining at this rate: %s (%d pins left to try)\n", max_time ? max_time : "(undetermined)", attempts_remaining);
|
|
92 |
+
|
|
93 |
+ free(max_time);
|
|
94 |
|
|
95 |
return;
|
|
96 |
}
|