forked from nfc-tools/miLazyCracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto1_bs.diff
35 lines (30 loc) · 1020 Bytes
/
crypto1_bs.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff --git a/Makefile b/Makefile
index 758e411..c0708be 100755
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
CC = gcc
-CFLAGS = -std=gnu99 -O3 -march=native
+CFLAGS = -std=gnu99 -O3 -march=native -fcommon
all: solve_bs solve_piwi_bs solve_piwi libnfc_crypto1_crack
diff --git a/libnfc_crypto1_crack.c b/libnfc_crypto1_crack.c
index 2015dcb..4147433 100755
--- a/libnfc_crypto1_crack.c
+++ b/libnfc_crypto1_crack.c
@@ -730,6 +730,17 @@ int main (int argc, const char * argv[]) {
return 1;
} else {
printf("Found key: %012"PRIx64"\n", found_key);
+ if (argc==7) {
+ FILE *fpKey = NULL;
+ fpKey = fopen(argv[6], "a");
+ if (fpKey) {
+ fprintf(fpKey, "%012"PRIx64"\r\n", found_key);
+ fclose(fpKey);
+ } else {
+ fprintf(stderr, "Cannot open: %s, exiting\n", argv[6]);
+ return 1;
+ }
+ }
}
printf("Tested %"llu" states\n", total_states_tested);