nfc-tools / miLazyCracker

Mifare Classic Plus - Hardnested Attack Implementation for SCL3711 LibNFC USB reader
313 stars 61 forks source link

crypto1 errors? #7

Open michaeldeborst opened 5 years ago

michaeldeborst commented 5 years ago

So I've been trying to get this tool to work for a couple of days but I keep running into the same issues. While installing I get patch conflicts (which I have never encountered before). It also throws some errors which I think are related to setting up the crypto libs. This is my install log:

 root@kali-pi:~/Desktop/milazycracker# ./miLazyCrackerFreshInstall.sh
+ sudo apt-get install git libnfc-bin autoconf libnfc-dev
Reading package lists... Done
Building dependency tree      
Reading state information... Done
autoconf is already the newest version (2.69-11).
git is already the newest version (1:2.19.0-1).
libnfc-bin is already the newest version (1.7.1-4+b1).
libnfc-dev is already the newest version (1.7.1-4+b1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
+ '[' -d mfoc ']'
+ cd mfoc
+ git reset --hard
HEAD is now at ba072f1 update debian dir with up-to-date packaging
+ git clean -dfx
Removing INSTALL
Removing Makefile
Removing Makefile.in
Removing aclocal.m4
Removing autom4te.cache/
Removing compile
Removing config.h
Removing config.h.in
Removing config.log
Removing config.status
Removing configure
Removing depcomp
Removing install-sh
Removing missing
Removing src/.deps/
Removing src/Makefile
Removing src/Makefile.in
Removing src/crapto1.o
Removing src/crypto1.o
Removing src/mfoc.c.orig
Removing src/mfoc.c.rej
Removing src/mfoc.h.rej
Removing stamp-h1
+ patch -p1
patching file src/mfoc.c
Hunk #1 succeeded at 72 with fuzz 2 (offset 14 lines).
Hunk #2 FAILED at 159.
Hunk #3 succeeded at 257 (offset 15 lines).
Hunk #4 FAILED at 471.
Hunk #5 FAILED at 554.
Hunk #6 FAILED at 770.
Hunk #7 FAILED at 1029.
5 out of 7 hunks FAILED -- saving rejects to file src/mfoc.c.rej
+ patch -p1
patching file src/mfoc.c
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/mfoc.c.rej
+ patch -p1
patching file src/mfoc.c
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file src/mfoc.c.rej
+ patch -p1
patching file src/mfoc.c
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
6 out of 6 hunks ignored -- saving rejects to file src/mfoc.c.rej
patching file src/mfoc.h
Reversed (or previously applied) patch detected!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file src/mfoc.h.rej
+ autoreconf -vfi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:11: installing './compile'
configure.ac:9: installing './install-sh'
configure.ac:9: installing './missing'
Makefile.am: installing './INSTALL'
src/Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
+ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libnfc... yes
checking for inline... inline
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for size_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for memset... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
+ make
make  all-recursive
make[1]: Entering directory '/root/Desktop/milazycracker/mfoc'
Making all in src
make[2]: Entering directory '/root/Desktop/milazycracker/mfoc/src'
  CC       crapto1.o
  CC       crypto1.o
  CC       mfoc.o
mfoc.c:75:10: error: redefinition of 'knownKey'
 uint64_t knownKey = 0;
          ^~~~~~~~
mfoc.c:68:10: note: previous definition of 'knownKey' was here
 uint64_t knownKey = 0;
          ^~~~~~~~
mfoc.c:76:6: error: redefinition of 'knownKeyLetter'
 char knownKeyLetter = 'A';
      ^~~~~~~~~~~~~~
mfoc.c:69:6: note: previous definition of 'knownKeyLetter' was here
 char knownKeyLetter = 'A';
      ^~~~~~~~~~~~~~
mfoc.c:77:10: error: redefinition of 'knownSector'
 uint32_t knownSector = 0;
          ^~~~~~~~~~~
mfoc.c:70:10: note: previous definition of 'knownSector' was here
 uint32_t knownSector = 0;
          ^~~~~~~~~~~
mfoc.c:78:10: error: redefinition of 'unknownSector'
 uint32_t unknownSector = 0;
          ^~~~~~~~~~~~~
mfoc.c:71:10: note: previous definition of 'unknownSector' was here
 uint32_t unknownSector = 0;
          ^~~~~~~~~~~~~
mfoc.c:79:6: error: redefinition of 'unknownKeyLetter'
 char unknownKeyLetter = 'A';
      ^~~~~~~~~~~~~~~~
mfoc.c:72:6: note: previous definition of 'unknownKeyLetter' was here
 char unknownKeyLetter = 'A';
      ^~~~~~~~~~~~~~~~
mfoc.c:80:10: error: redefinition of 'unexpected_random'
 uint32_t unexpected_random = 0;
          ^~~~~~~~~~~~~~~~~
mfoc.c:73:10: note: previous definition of 'unexpected_random' was here
 uint32_t unexpected_random = 0;
          ^~~~~~~~~~~~~~~~~
mfoc.c: In function 'main':
mfoc.c:260:7: error: duplicate case value
       case 'D':
       ^~~~
mfoc.c:252:7: note: previously used here
       case 'D':
       ^~~~
make[2]: *** [Makefile:397: mfoc.o] Error 1
make[2]: Leaving directory '/root/Desktop/milazycracker/mfoc/src'
make[1]: *** [Makefile:358: all-recursive] Error 1
make[1]: Leaving directory '/root/Desktop/milazycracker/mfoc'
make: *** [Makefile:299: all] Error 2
+ sudo make install
Making install in src
make[1]: Entering directory '/root/Desktop/milazycracker/mfoc/src'
  CC       mfoc.o
mfoc.c:75:10: error: redefinition of 'knownKey'
 uint64_t knownKey = 0;
          ^~~~~~~~
mfoc.c:68:10: note: previous definition of 'knownKey' was here
 uint64_t knownKey = 0;
          ^~~~~~~~
mfoc.c:76:6: error: redefinition of 'knownKeyLetter'
 char knownKeyLetter = 'A';
      ^~~~~~~~~~~~~~
mfoc.c:69:6: note: previous definition of 'knownKeyLetter' was here
 char knownKeyLetter = 'A';
      ^~~~~~~~~~~~~~
mfoc.c:77:10: error: redefinition of 'knownSector'
 uint32_t knownSector = 0;
          ^~~~~~~~~~~
mfoc.c:70:10: note: previous definition of 'knownSector' was here
 uint32_t knownSector = 0;
          ^~~~~~~~~~~
mfoc.c:78:10: error: redefinition of 'unknownSector'
 uint32_t unknownSector = 0;
          ^~~~~~~~~~~~~
mfoc.c:71:10: note: previous definition of 'unknownSector' was here
 uint32_t unknownSector = 0;
          ^~~~~~~~~~~~~
mfoc.c:79:6: error: redefinition of 'unknownKeyLetter'
 char unknownKeyLetter = 'A';
      ^~~~~~~~~~~~~~~~
mfoc.c:72:6: note: previous definition of 'unknownKeyLetter' was here
 char unknownKeyLetter = 'A';
      ^~~~~~~~~~~~~~~~
mfoc.c:80:10: error: redefinition of 'unexpected_random'
 uint32_t unexpected_random = 0;
          ^~~~~~~~~~~~~~~~~
mfoc.c:73:10: note: previous definition of 'unexpected_random' was here
 uint32_t unexpected_random = 0;
          ^~~~~~~~~~~~~~~~~
mfoc.c: In function 'main':
mfoc.c:260:7: error: duplicate case value
       case 'D':
       ^~~~
mfoc.c:252:7: note: previously used here
       case 'D':
       ^~~~
make[1]: *** [Makefile:397: mfoc.o] Error 1
make[1]: Leaving directory '/root/Desktop/milazycracker/mfoc/src'
make: *** [Makefile:358: install-recursive] Error 1
+ '[' -d crypto1_bs ']'
+ cd crypto1_bs
+ git reset --hard
HEAD is now at 89de1ba Merge pull request #28 from dkgitdev/patch-1
+ git clean -dfx
Removing libnfc_crypto1_crack.c.orig
+ patch -p1
patching file libnfc_crypto1_crack.c
Hunk #1 succeeded at 730 with fuzz 2 (offset 17 lines).
+ make get_craptev1
wget http://crapto1.netgarage.org/craptev1-v1.1.tar.xz
--2018-11-17 21:57:44--  http://crapto1.netgarage.org/craptev1-v1.1.tar.xz
Resolving crapto1.netgarage.org (crapto1.netgarage.org)... 176.9.4.150
Connecting to crapto1.netgarage.org (crapto1.netgarage.org)|176.9.4.150|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-11-17 21:57:44 ERROR 404: Not Found.

make: *** [Makefile:34: get_craptev1] Error 8
+ make get_crapto1
wget http://crapto1.netgarage.org/crapto1-v3.3.tar.xz
--2018-11-17 21:57:44--  http://crapto1.netgarage.org/crapto1-v3.3.tar.xz
Resolving crapto1.netgarage.org (crapto1.netgarage.org)... 176.9.4.150
Connecting to crapto1.netgarage.org (crapto1.netgarage.org)|176.9.4.150|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-11-17 21:57:44 ERROR 404: Not Found.

make: *** [Makefile:38: get_crapto1] Error 8
+ make
gcc -std=gnu99 -O3 -march=native solve_bs.c crypto1_bs.c crypto1_bs_crack.c  crapto1-v3.3/crapto1.c crapto1-v3.3/crypto1.c -I crapto1-v3.3/  craptev1-v1.1/craptev1.c -I craptev1-v1.1/ -o solve_bs -lpthread -lm
gcc: error: crapto1-v3.3/crapto1.c: No such file or directory
gcc: error: crapto1-v3.3/crypto1.c: No such file or directory
gcc: error: craptev1-v1.1/craptev1.c: No such file or directory
make: *** [Makefile:19: solve_bs] Error 1
+ sudo cp -a libnfc_crypto1_crack /usr/local/bin
cp: cannot stat 'libnfc_crypto1_crack': No such file or directory
+ sudo cp -a miLazyCracker.sh /usr/local/bin/miLazyCracker
+ echo Done.
Done.
root@kali-pi:~/Desktop/milazycracker# 

Afterwards when I try to run the script (in an empty folder) it goes through the mfoc part but after that it gets stuck in an endless loop and keeps printing this error message:

libnfc_crypto1_crack 000000000000 84 B 156 B mfc_b707e364_foundKeys.txt
/usr/local/bin/miLazyCracker: line 87: libnfc_crypto1_crack: command not found
MFOC not possible, detected hardened Mifare Classic
Trying HardNested Attack...
libnfc_crypto1_crack 000000000000 84 B 156 B mfc_b707e364_foundKeys.txt
/usr/local/bin/miLazyCracker: line 87: libnfc_crypto1_crack: command not found
MFOC not possible, detected hardened Mifare Classic
Trying HardNested Attack...

I'm running Kali Linux on a RPI3.

If I can provide any additional logs to help I'd be glad to.

mattrighetti commented 5 years ago

That's because craptev1 and crapto1 aren't available anymore on that site and without those file the scripts spits out a lot of missing errors