Libnfc and nfc utils binaries (cross compile mfoc.exe , cropto1_bs.exe, mfcuk.exe, nfc-mfcclassic.exe) for Windows 10

Nfc Tools on Windows – Table of contents


  • Introduction –> link
  • How tu use ACR122U with libusbK –> link
  • Mifare One Tool English –> link
  • How to cross compile NFC commands on Windows 64 bits –> link
  • Sharp Free fare (libfreefare dotnet wrapper) + sharpNfc update –> link
  • libnfc compiled with lib usb 1.0 for Windows –> link
  • One click dump converter : android mifare classic tool  <–>  linux/windows libnfc nfc- mfc classic –> link
  • download all tools in one zip file –> link

Introduction

I’ve recently cross compiled libnfc and nfc utils , following this post : https://github.com/peacepenguin/libnfc-unofficialbuilds

I had a driver issue for using libnfc/nfc utils with my ACR122U (No NFC device found issue), but using LibUsbK, solved this problem.

  • How tu use ACR122U with libusbK –> link

Here are the working  binaries on windows 10 64x and the acr 122U LibusbK driver installer

  • mfoc.exe, mfoc_hardnested.exe, mfcuk.exe, nfc-mfcclassic.exe, cropto1_bs.exe, nfc-list.exe, nfc-scan-device.exe, …
    • Compiled binary files (mfoc.exe, mfcuk.exe + mfcuk hardnested.exe, cropto1_bs, …) –> link 
    • Compiled binary mfoc hardnested version –> link
    • Compiled binary files : libnfc 64 bits – zip  (nfc–mfcclassic.exe, nfc-list.exe, …) –> link
  • if you get an error : missing libwinpthread-1.dll or missing libgcc_s_seh-1.dll, these dll are included  in download link in this section

 

How tu use ACR122U with mfoc ,cropto1_bs.exe, mfcuk.exe, nfc-mfcclassic.exe on windows 10 ?

To use most of the exe tools I’ve cross-compiled, you may need to install libusbK driver which is a wrapper over ACR-122U native driver :

  1. Install Native driver can be found here : https://www.acs.com.hk/en/driver/3/acr122u-usb-nfc-reader/  –> MSI Installer for PC/SC Driver
  2. You can download libusbk here: https://sourceforge.net/projects/libusbk/
  3. Install Libusbk driver

 

After installing libusbK driver, the ACR122U will show NO light, and NO sound when putting a tag on it. It’s normal, and the sound and light will come back if you unsinstall libusk Driver filter


 


How to cross compile NFC commands  on windows 64


Mfoc (https://github.com/nfc-tools/mfoc) cross-compilation for windows :

on Linux Ubuntu using build_mfoc.sh :

content of build_mfoc.sh :

MAIN_FILE=mfoc
LIBNFC=libnfc
CFLAGS=`pkg-config --cflags ${LIBNFC}`
CFLAGS_LIBNFC=`pkg-config --cflags libnfc | cut -d ' ' -f 1`/${LIBNFC}

x86_64-w64-mingw32-gcc -s -Wl,--allow-multiple-definition ./${MAIN_FILE}.c ./mfoc.c ./mifare.c ./slre.c ./nfc-utils.c ./crapto1.c ./crypto1.c ./bin/libnfc.lib ${CFLAGS} ${CFLAGS_LIBNFC} -o ./bin/${MAIN_FILE}_x64.exe

then

cd mfoc/src

chmod +x build_mfoc.sh

./build_mfoc.sh

Cropto1_bs (https://github.com/vk496/cropto1_bs) cross compilation on windows : (compiled on windows 64 with msys2: http://www.msys2.org/ –> x86-x64 version)

note : to install gcc on msys2 you can follow this post : https://www.devdungeon.com/content/install-gcc-compiler-windows-msys2-cc

command :

x86_64-w64-mingw32-gcc-9.2.0 -o cropto1_bs util.o main.o parity.o ui.o cmdhfmfhard.o util_posix.o crapto1/crapto1.o crapto1/crypto1.o hardnested/hardnested_bruteforce.o hardnested/tables.o C:/libnfc-build/libnfc/libnfc.lib hardnested/hardnested_bf_core_NOSIMD.o hardnested/hardnested_bitarray_core_NOSIMD.o hardnested/hardnested_bf_core_MMX.o hardnested/hardnested_bitarray_core_MMX.o hardnested/hardnested_bf_core_SSE2.o hardnested/hardnested_bitarray_core_SSE2.o hardnested/hardnested_bf_core_AVX.o hardnested/hardnested_bitarray_core_AVX.o hardnested/hardnested_bf_core_AVX2.o hardnested/hardnested_bitarray_core_AVX2.o hardnested/hardnested_bf_core_AVX512.o hardnested/hardnested_bitarray_core_AVX512.o -lz -lm -LC:/msys64/usr/share/readline -lpthread -llzma

mfcuk (https://github.com/DrSchottky/mfcuk) cross compilation for windows from ubuntu or Mingw64:

build_mfcuk.sh :

MAIN_FILE=mfcuk
LIBNFC=libnfc
CFLAGS=`pkg-config --cflags ${LIBNFC}`
CFLAGS_LIBNFC=`pkg-config --cflags libnfc | cut -d ' ' -f 1`/${LIBNFC}

x86_64-w64-mingw32-gcc  ./${MAIN_FILE}.c ./mfcuk_mifare.c ./mfcuk_utils.c ./mifare.c ./nfc-utils.c ./mfcuk_finger.c ./crapto1.c ./crypto1.c ./bin/libnfc.lib ${CFLAGS} ${CFLAGS_LIBNFC} -o ./bin/${MAIN_FILE}_keyrecovery_darkside.exe

nfc-mfcclassic (https://github.com/nfc-tools/libnfc/tree/master/utils) build_nfc-mfcclassic.sh

cross compilation for windows from ubuntu:

MAIN_FILE=nfc-mfclassic
LIBNFC=libnfc
CFLAGS=`pkg-config --cflags ${LIBNFC}`
CFLAGS_LIBNFC=`pkg-config --cflags libnfc | cut -d ' ' -f 1`/${LIBNFC}

x86_64-w64-mingw32-gcc -s -shared -Wl,--subsystem,windows   ./${MAIN_FILE}.c ./mifare.c ./nfc-utils.c ./bin/libnfc.lib ${CFLAGS} ${CFLAGS_LIBNFC} -o ./bin/${MAIN_FILE}.exe

 

new on 7 january 2020 : mfoc hardnested windows 64x version, based on https://github.com/vk496/mfoc/tree/hardnested

 

commands used for cross-compilation : (some small changes had to be done in source files before compiling – e.g. for fixing make install errors and update version name)

(in windows mingw64) :

autoreconf -vis

automake

make install

fixing mfoc compile errors when running make install :

  • fatal error : nfc/nfc.h : No such file or directory

  • – copy libnfc\include\nfc folder to mfoc\src\ folder and edit mfoc.c file in mfoc.src:

replace :

#include <nfc/nfc.h>

with

#include "nfc/nfc.h"
  • fatal error : err.h : No such file or directory

  • copy  libnfc\contrib\win32\err.h to to mfoc\src\ and edit file nfc-utils.h in mfoc\src\

replace :

# include <err.h>

with :

# include "err.h"

and re-run :

make-install

  • if no error then ,mfoc.exe should now be created in mfoc/src directory

  • test screenshot :


Sharp free fare – 2020 january 15th

I’ve also updated C# library wrapper for sharpNfc and Sharp free fare, now based on cross compiled libnfc.dll and libfreefare.dll:

https://github.com/episage/sharp-free-fare


2020 january 17th : libnfc fork – working with libusb1.0 on Windows 64

I’ve now cross-compiled libusb1.0 on windows 64 using this : https://github.com/FPGAwars/libusb-cross-builder

Then I’ve compiled and built (after some fixes in #include ref in source code), libnfc fork – working with libusb1.0 : https://github.com/nfc-tools/libnfc/tree/libusb10

note : I’ve only defined ACR122 usb driver for compilation, no other driver

 

Mingw64 cross-compilation command :

  • edit nfc.c –> return “1.7.0 LIBUSB10”;
const char *
nfc_version(void)
{
#ifdef GIT_REVISION
  return GIT_REVISION;
#else
  return "1.7.0 LIBUSB10";
#endif // GIT_REVISION
}
  • compile –>
gcc -Dnfc_EXPORTS -DDEBUG -DDRIVER_ACR122_USB_ENABLED -c drivers/acr122_usb.c buses/usbbus.c chips/pn53x.c iso14443-subr.c nfc-internal.c nfc.c target-subr.c nfc-device.c mirror-subr.c log-internal.c -I ~/libusb/include/libusb-1.0 -I ~/libnfc-libusb10/include -I ~/libnfc-libusb10/contrib/win32 -I ~/libnfc-libusb10/libnfc -L ~/lisbusb/bin/libusb-1.0.dll.a -static -lusb-1.0
  • build –>
gcc -shared -o libnfc.dll  nfc.o target-subr.o iso14443-subr.o usbbus.o acr122_usb.o nfc-internal.o nfc-device.o pn53x.o mirror-subr.o -L ~/lisbusb/lib/libusb-1.0.dll.a  -lusb-1.0

Download libnfc.dll.zip working with libusb 1.0 for Windows 64:


content of libusb zip file :

Download libusb-1.0.dll and dependencies for Windows 64:


To use : Simply run the app : mct2dmpGui.exe then, open the input dump by clicking on “Convert” and save the converted file

This app use dotnet framework 4.7.2 and you can download it in release menu : https://github.com/xavave/bm-mifare-classic/releases

The app will automaticaly detect if it’s a Mifare classic tool dump or a nfc-mfc classic dump

download sources/binaries on github –> https://github.com/xavave/bm-mifare-classic/wiki


new on 2020 – jan – 22 : All tools Zipped in one file including latest nfc-mfcclassic with C option and tool : nfc detect chinese magic card and also libnfc_crypto_crack.exe –>

zip content :

cropto1_bs.exe
libgcc_s_seh-1.dll
liblzma-5.dll
libnfc.dll
libnfc_crypto_crack.exe
libusb0.dll
libwinpthread-1.dll
mfcuk_keyrecovery_darkside.exe
mfoc.exe
mfoc_hardnested.exe
nfc-anticol.exe
nfc-barcode.exe
nfc-dep-initiator.exe
nfc-dep-target.exe
nfc-detect-chinese-magic-card.exe
nfc-emulate-forum-tag2.exe
nfc-emulate-forum-tag4.exe
nfc-emulate-tag.exe
nfc-emulate-uid.exe
nfc-jewel.exe
nfc-list.exe
nfc-mfclassic.exe
nfc-mfsetuid.exe
nfc-mfultralight.exe
nfc-poll.exe
nfc-read-forum-tag3.exe
nfc-relay-picc.exe
nfc-relay.exe
nfc-scan-device.exe
pn53x-diagnose.exe
pn53x-sam.exe
pn53x-tamashell.exe
solve_bs.exe

1760 Downloads

 

Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

About Xavier

7 years+ .net consulting

19 Responses to Libnfc and nfc utils binaries (cross compile mfoc.exe , cropto1_bs.exe, mfcuk.exe, nfc-mfcclassic.exe) for Windows 10

  1. Juankar says:

    Thank you Xavier very good work, it is a luxury to have programmers like you in our community of electronics enthusiasts,

    thank you, ezkerrik asko

  2. lux says:

    Merci beaucoup pour le partage.

    Je ne sais pas pour vous mais depuis peux quand je le lance il me met des erreurs commande shell.

    l’application n’a pas réussi a démarrer correctement (0xc000007b). Cliquez sur OK pour fermer l’application.

    J’ai juste eu une mise à jour windows 10 mais rien de plus.

    Quelqu’un l’aurait eu aussi ?

  3. Ptitchat says:

    Gg! Ducoup le mfoc_hardnested.exe est la nouvelle version tiré de miLazyCracker ? Moi tout les exécutable se ferment instantanément, un truc en particulier à faire ? Seul le mfoc hardnested garde la fenêtre
    active et se ferme des qu’il a trouvé etoute les clef.

  4. droo says:

    Bonjour,

    Aurais tu une idée pour windows 32bits?
    Merci d’avance

  5. Tipiak says:

    Bonjour ,
    merci pour le travail!!!
    j’ai acheté un ACR122U-A9 et impossible de le faire fonctionner avec libnfc sur linux ( raspbian, debian, kali, ubuntu) , alors j’ai testé ton portage.
    mais voici le message:
    #########################################
    C:\Users\XXX\Desktop\perso\NFC\NFC-utils-Windows-1\NFC utils Windows>nfc-list.exe
    nfc-list.exe uses libnfc 1.7.1
    error libnfc.driver.acr122_usb Unable to claim USB interface (libusb0-dll:err [claim_interface] could not claim interface 0, invalid configuration 0
    )
    ERROR: Unable to open NFC device: acr122_usb:bus-0:\\.\libusb0-0001–0x072f-0x2200
    error libnfc.driver.acr122_usb Unable to write to USB (libusb0-dll:err [_usb_reap_async] reaping request failed, win error: Un pÚriphÚrique qui nÆexiste pas a ÚtÚ spÚcifiÚ.

    )
    ERROR: Unable to open NFC device: acr122_usb:bus-0:\\.\libusb0-0255–0x072f-0x2200
    #########################################
    aurais tu une solution?

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.