yubicrack
yubicrack copied to clipboard
Iterate only hex-numbers options
Will search hex-numers only code space, which goes like
0x00
..
0x09
0x10
0x11
..
0x20
0x21
..
0x29
0x30
..
0x99
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..151570d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+yubicrack
diff --git a/yubicrack.c b/yubicrack.c
index b38029c..17301b3 100644
--- a/yubicrack.c
+++ b/yubicrack.c
@@ -57,8 +57,27 @@ inline int bruteforce(unsigned char* t, int deep) {
return -1;
}
-int main(int argc, char** argv) {
+/* Iterate through only hex numbers values
+ * This could take a 0.625*(loooooooooong time).*/
+int bruteforceNumbers(unsigned char* t, int deep) {
+ int id = 5 - deep;
+ for (unsigned char counter = 0; counter <= 0x99; counter++) {
+ if(counter % 16 >= 10) { counter += 6; }
+ t[id] = counter;
+ if(deep > 0) if(bruteforceNumbers(t, deep - 1) == 0) return 0;
+ if(!yk_write_config(yk,
+ coreconfig, coreconfignum,
+ t)) {
+ print_access_code("Fail", t);
+ } else {
+ print_access_code("\aWin", t);
+ return 0;
+ }
+ }
+ return -1;
+}
+int main(int argc, char** argv) {
char showmessage = 1;
if((argc == 2) && (strcmp(argv[1], "-y") == 0)) showmessage = 0;
if(showmessage == 1) {
@@ -80,7 +99,7 @@ int main(int argc, char** argv) {
puts("Quitting.");
return EXIT_SUCCESS;
}
- }
+ }
yk = 0;
unsigned char access_code[6];
@@ -118,9 +137,9 @@ int main(int argc, char** argv) {
coreconfig = ykp_core_config(cfg);
coreconfignum = ykp_config_num(cfg);
- bruteforce(access_code, 5);
+ bruteforceNumbers(access_code, 5);
- if(st) free(st);
+ if(st) ykds_free(st);
if(!yk_close_key(yk)) {
fputs("Can't close Yubikey! What the hell are you doing over there?", stderr);
return EXIT_FAILURE;