Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
gelotus committed Jun 24, 2020
2 parents ba072f1 + 2113845 commit da8d1c8
Show file tree
Hide file tree
Showing 83 changed files with 90,201 additions and 786 deletions.
45 changes: 43 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,48 @@ src/*.o
src/.deps/
src/Makefile
src/Makefile.in
src/mfoc
src/mfoc.exe
src/mfoc-hardnested
src/mfoc-hardnested.exe
stamp-h1
*.o
.history/

config.sub

config.guess

src/hardnested/.dirstamp

src/hardnested/.deps/

.settings/

.project

.cproject

.autotools

x64/

.vs/

dist/

debian/.debhelper/

debian/mfoc-hardnested/

debian/autoreconf.after

debian/autoreconf.before

debian/debhelper-build-stamp

debian/files

debian/mfoc-hardnested.debhelper.log

debian/mfoc-hardnested.substvars

config.h.in~
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
MFOC is an open source implementation of "offline nested" attack by Nethemba.
Later was added so called "hardnested" attack by Carlo Meijer and Roel Verdult.

This program allow to recover authentication keys from MIFARE Classic card.

Please note MFOC is able to recover keys from target only if it have a known key: default one (hardcoded in MFOC) or custom one (user provided using command line).

This is a port to win32 x64 platform using native tools (Visual Studio 2019 + LLVM clang-cl toolchain).
This tree was also reworked for gnu toolchain (autotool + gcc like the original).

Based on the idea by vk496 to integrate mylazycracker into mfoc, forked from his tree.

For credits (there are many) just look at the AUTHORS file.

Uses
libnfc https://github.com/nfc-tools/libnfc/
libusb-win32 https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/
pthreads4w https://sourceforge.net/projects/pthreads4w/
liblzma https://tukaani.org/xz/

pthreads4w and liblzma are static linked.
All these libs are precompiled and included in src\lib

# Build from source
Windows:
Make sure you have Visual Studio 2019 with Desktop developement with C++, C++ Clang Compiler for Windows and C++ Clang-cl for v142 build tools installed.
Open the solution and start compile.
The compiled zip package will be in dist.

Linux:
```
autoreconf -is
autoreconf -vis
./configure
make && sudo make install
```

# Usage #
Needs libusb0.dll and nfc.dll in the path, better on the same directory.
Needs to install libusbK v3.0.7.0, using Zadig https://zadig.akeo.ie/, go to Option, List All Devices, select your reader, select libusbK(v3.0.7.0) and click on replace driver.
Put one MIFARE Classic tag that you want keys recovering;
Lauching mfoc, you will need to pass options, see
```
mfoc -h
mfoc-hardnested -h
```
31 changes: 28 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
AC_INIT([mfoc],[0.10.7],[mifare@nethemba.com])
AC_INIT([mfoc-hardnested],[0.10.9],[mifare@nethemba.com])

AC_CONFIG_MACRO_DIR([m4])

AC_CONFIG_HEADERS([config.h])

AC_CONFIG_SRCDIR([src/mfoc.c])

AM_INIT_AUTOMAKE(dist-bzip2 no-dist-gzip)
AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip subdir-objects])
CFLAGS="$CFLAGS -O3"
AX_CFLAGS_WARN_ALL

AC_PROG_CC

Expand All @@ -16,6 +18,10 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
LIBNFC_REQUIRED_VERSION=1.7.0
PKG_CHECK_MODULES([libnfc], [libnfc >= $LIBNFC_REQUIRED_VERSION], [], [AC_MSG_ERROR([libnfc >= $LIBNFC_REQUIRED_VERSION is mandatory.])])

PKG_CHECK_MODULES([liblzma], [liblzma], LIBS="$LIBS -llzma", [AC_MSG_ERROR([liblzma is mandatory.])])
ACX_PTHREAD(LIBS="$LIBS $PTHREAD_CFLAGS", [AC_MSG_ERROR([pthread is mandatory.])])
AC_CHECK_LIB(m, log, LIBS="$LIBS -lm", [AC_MSG_ERROR([math is mandatory.])])

PKG_CONFIG_REQUIRES="libnfc"
AC_SUBST([PKG_CONFIG_REQUIRES])

Expand All @@ -34,8 +40,27 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset])

# x86 CPU features (without automatic gcc flags)
AC_CANONICAL_HOST
X86_SIMD=""
AS_CASE([$host_cpu],
[x86_64],
[
X86_SIMD="true"
],
[i?86],
[
X86_SIMD="true"
],
[amd64],
[
X86_SIMD="true"
],)
AC_SUBST([X86_SIMD])
AM_CONDITIONAL([X86_SIMD], [test x$X86_SIMD = xtrue])

# C99
CFLAGS="$CFLAGS -std=c99"
CFLAGS="$CFLAGS -DX86_SIMD -std=c99"

AC_CONFIG_FILES([Makefile
src/Makefile])
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
mfoc-hardnested (0.10.9) unstable; urgency=medium

* New upstream version 0.10.9

-- gelotus <gelotus@github.com> Wed, 24 Jun 2020 01:19:50 -0300

mfoc (0.10.7+git20180724-1) unstable; urgency=medium

* New upstream version 0.10.7+git20180724
Expand Down
12 changes: 5 additions & 7 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
Source: mfoc
Source: mfoc-hardnested
Section: utils
Priority: optional
Maintainer: Debian Security Tools <team+pkg-security@tracker.debian.org>
Uploaders: Samuel Henrique <samueloph@debian.org>
Maintainer: gelotus <gelotus@github.com>
Uploaders: gelotus <gelotus@github.com>
Build-Depends: debhelper (>= 11), libnfc-dev, pkg-config
Standards-Version: 4.1.5
Homepage: https://github.com/nfc-tools/mfoc
Vcs-Browser: https://salsa.debian.org/pkg-security-team/mfoc
Vcs-Git: https://salsa.debian.org/pkg-security-team/mfoc.git
Homepage: https://github.com/gelotus/mfoc

Package: mfoc
Package: mfoc-hardnested
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: MIFARE Classic offline cracker
Expand Down
2 changes: 1 addition & 1 deletion debian/manpages
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/mfoc.1
src/mfoc-hardnested.1
2 changes: 1 addition & 1 deletion debian/watch
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=4

https://github.com/nfc-tools/mfoc/tags/ .*/mfoc-(.*)\.tar\.gz
https://github.com/gelotus/mfoc/tags/ .*/mfoc-(.*)\.tar\.gz
Loading

0 comments on commit da8d1c8

Please sign in to comment.