系统环境 UBUNTU16.04,要安装好各种基础的编译环境,这就不说了,如果不知道需要什么,那就编译时出错时看到什么安装什么吧

下载源码包libnfc, mfoc, mfcuk,都是github上,源码都可以从https://github.com/nfc-tools中下面找到。

  • 安装依赖:

  • 安装前要稍看下README之类的,有的有依赖关系,比如,LIBNFC可能需要LIBUSB之类的,但不是必须的,根据你的硬件,如果是PN532使用UART,就需要下面的部分:

apt-get install libpcsclite-dev libusb-dev libusb-0.1-4 libpcsclite1 libccid pcscd
  • 编译安装libnfc

进入到源码目录下,需要autoreconf一下,这样才会有INSTALL等文件出现,而这又需要libtool开发工具,如果没有就需要安装下

vmuser@Linux-host:~/nfc/libnfc-master$ sudo apt-get install libtool

安装好后,运行autoreconf

vmuser@Linux-host:~/nfc/libnfc-master$ autoreconf -is
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: linking file `m4/libtool.m4'
libtoolize: linking file `m4/ltoptions.m4'
libtoolize: linking file `m4/ltsugar.m4'
libtoolize: linking file `m4/ltversion.m4'
libtoolize: linking file `m4/lt~obsolete.m4'
configure.ac:: installing './config.guess'
configure.ac:: installing './config.sub'
vmuser@Linux-host:~/nfc/libnfc-master$

有的时候,会出现MACRO错误的字样,并提示版本不匹配aclocal功能版本的原因,删除aclocal.m4后,安装新版本,并运行aclocal重新生成即可,这里没有出现,就不演示了。

继续配置,因为使用的是PN532 UART,所以按下面的配置并MAKE

vmuser@Linux-host:~/nfc/libnfc-master$ ./configure --sysconfdir=/etc --prefix=/usr --with-drivers=pn532_uart
vmuser@Linux-host:~/nfc/libnfc-master$ make
vmuser@Linux-host:~/nfc/libnfc-master$ sudo make install

如果顺得的话,就编译完成了,已经完成了一半的工作,因为还需要配置,否则很大的机率是不能工作的,如下图,反正我这里是不能工作的,

vmuser@Linux-host:~/nfc/libnfc-master$ sudo LIBNFC_LOG_LEVEL=3 nfc-list
info    libnfc.config    Unable to open file: /etc/nfc/libnfc.conf
debug    libnfc.config    Unable to open directory: /etc/nfc/devices.d
debug    libnfc.general    log_level is set to 3
debug    libnfc.general    allow_autoscan is set to true
debug    libnfc.general    allow_intrusive_scan is set to false
debug    libnfc.general    0 device(s) defined by user
nfc-list uses libnfc 1.7.1
No NFC device found.
vmuser@Linux-host:~/nfc/libnfc-master$ 
 
从上图中,设置了LIBNFC_LOG_LEVEL=3后,发现/etc/nfc/libnfc.conf,/etc/nfc/devices.d都是不存在的。其实,GITHUB上首面就已经有相关的操作方法了
sudo mkdir /etc/nfc
sudo cp libnfc.conf.sample /etc/nfc/libnfc.conf

第二个配置文件官方给的例子是是
sudo mkdir -p /etc/nfc/devices.d
printf 'name = "My first device"\nconnstring = "pn532_uart:/dev/ttyACM0"\n' | sudo tee /etc/nfc/devices.d/first.conf
printf 'name = "My second device"\nconnstring = "pn532_uart:/dev/ttyACM1"\n' | sudo tee /etc/nfc/devices.d/second.conf

上面建立了两个文件,指出需要去检测ttyACM0 ttyACM1两个作为pn532来使用,而我的设置是ttyUSB0,可以连上硬件后,通过ls /dev 和 lsusb 等命令去确认你的是哪个设备,所以我这里ttyACM0改为了ttyUSB0,如下图:
vmuser@Linux-host:/etc/nfc/devices.d$ ls
first.conf
vmuser@Linux-host:/etc/nfc/devices.d$ cat first.conf
name = "My first device"
connstring = "pn532_uart:/dev/ttyUSB0"
vmuser@Linux-host:/etc/nfc/devices.d$

继续检查

vmuser@Linux-host:/etc/nfc/devices.d$ sudo nfc-list
nfc-list uses libnfc 1.7.
NFC device: My first device opened
  • 编译mfoc

这就容易多了,解压后进入源码目录,根据README.MD,运行下面的编译过程退可

autoreconf -is
./configure
make && sudo make install

在我的计算机上,直接成功完成

  • 测试

在连好硬件后,执行mfoc命令

vmuser@Linux-host:~/nfc/mfoc-master$ mfoc -O ~/home.dump
error libnfc.driver.pn532_uart Invalid serial port: /dev/ttyUSB0
No NFC device found.
vmuser@Linux-host:~/nfc/mfoc-master$ sudo mfoc -O ~/home.dump
Found Mifare Classic 1k tag
ISO/IEC 14443A ( kbps) target:
ATQA (SENS_RES):
* UID size: single
* bit frame anticollision supported
UID (NFCID1): b5 4a cc
SAK (SEL_RES):
* Not compliant with ISO/IEC -
* Not compliant with ISO/IEC Fingerprinting based on MIFARE type Identification Procedure:
* MIFARE Classic 1K
* MIFARE Plus ( Byte UID or Byte RID) 2K, Security level
* SmartMX with MIFARE 1K emulation
Other possible matches based on ATQA & SAK values: Try to authenticate to all sectors with default keys...
Symbols: '.' no key found, '/' A key found, '\' B key found, 'x' both keys found
[Key: ffffffffffff] -> [xxxxxxxxx..xx.xx]
[Key: a0a1a2a3a4a5] -> [xxxxxxxxx..xx.xx]
[Key: d3f7d3f7d3f7] -> [xxxxxxxxx..xx.xx]
[Key: ] -> [xxxxxxxxx..xx.xx]
[Key: b0b1b2b3b4b5] -> [xxxxxxxxx..xx.xx]
[Key: 4d3a99c351dd] -> [xxxxxxxxx..xx.xx]
[Key: 1a982c7e459a] -> [xxxxxxxxx..xx.xx]
[Key: aabbccddeeff] -> [xxxxxxxxx..xx.xx]
[Key: 714c5c886e97] -> [xxxxxxxxx..xx.xx]
[Key: 587ee5f9350f] -> [xxxxxxxxx..xx.xx]
[Key: a0478cc39091] -> [xxxxxxxxx..xx.xx]
[Key: 533cb6c723f6] -> [xxxxxxxxx..xx.xx]
[Key: 8fd0a4f256e9] -> [xxxxxxxxx..xx.xx] Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Unknown Key A Unknown Key B
Sector - Unknown Key A Unknown Key B
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Unknown Key A Unknown Key B
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff
Sector - Found Key A: ffffffffffff Found Key B: ffffffffffff Using sector as an exploit sector
Sector: , type A, probe , distance .....
Found Key: A []
Data read with Key A revealed Key B: [] - checking Auth: OK
Sector: , type A
Data read with Key A revealed Key B: [] - checking Auth: OK
Found Key: A []
Sector: , type A, probe , distance .....
Found Key: A []
Data read with Key A revealed Key B: [57454942494e] - checking Auth: OK
Auth with all sectors succeeded, dumping keys to a file!
Block , type A, key ffffffffffff : ff bc ff ff ff ff ff ff
Block , type A, key ffffffffffff :
..........
..........
Block , type A, key ffffffffffff :
Block , type A, key ffffffffffff :
Block , type A, key ffffffffffff :b5 4a cc
vmuser@Linux-host:~/nfc/mfoc-master$

以上说明命令执行完成,反过来说明PN532工作正常。

  • 设置USB串口的权限

目前为止,运行MFOC需要ROOT权限,因为硬件设备一般是不能随便一个用户就可以打开的,这就需要改变USB-SERIAL的权限。

这个问题实际上LIBNFC已经给出了解决的代码,在GITHUB的代码首页上就已经有说明了,首先你曾阅读了它。

vmuser@Linux-host:~/nfc/libnfc-master$ sudo cp contrib/udev/-pn53x.rules /lib/udev/rules.d/

然后,你再编辑/lib/udev/rules.d/93-pn53x.rules文件中的设备中的PID和VID即可。

不过,上面的方法是在编译前设置的,现在再开始似乎不能生效-至少在我这里是无效的。

只好使用另外的方法

printf 'SUBSYSTEMS=="usb",  ATTRS{idVendor}=="067b",  ATTRS{idProduct}=="2303",  GROUP="users", MODE="0666"\n' | sudo tee /etc/udev/rules.d/-myusb.rules

然后再生效

vmuser@Linux-host:/lib/udev/rules.d$ sudo udevadm control --reload

重新插拔后,再查看发现设备已经任何用户都可以读写了

vmuser@Linux-host:/etc/udev/rules.d$ ls /dev/ttyU* -l
crw-rw-rw- root dialout , 11月 : /dev/ttyUSB0

至此,配置完成

  • 编译安装mfcuk

    autoreconf -is
./configure
make
sudo make install

没有悬念地成功了

  • 附记

下面是从网上其它地方摘取的资料,顺便可以了解一下网上各种工具之间的关系

1)mfoc  mfocgui 以及目前网络上,淘宝上充斥的各类破解工具都是基于nested authentication攻击原理,就是内置了一些默认密码,首先使用默认密码对每个扇区进行测试,如果某个扇区存在默认密码,然后就是用nested authentication攻击获得其他扇区的密码。
2)PM3的darkside攻击,Mfcuk等为darkside攻击工具,一个扇区密码都不知道的情况下破解用的,由于破解算法的原理本身就不是100%成功的,所以如果长时间破解不出来,就停了重新换个nt,重新选个时间破解,跟运气也有些关系。
不要别人几个小时,甚至几十分钟就破解成功了,你几天都没有破解出来,还一直傻傻的等,不如暂停换个nt,过一会再试。
3)Libnfc工具,目前用的比较多的是radiowar的nfcgui,radiowar网站上也说了,就是给nfc-list  nfc-mfsetuid  nfc-mfclassic  这三个工具写了个gui界面,你也可以使用命令行模式,或者你也可以自己写个gui界面调用这三个程序即可,这些都是操作卡或者读卡数据的工具,国内不同的IC卡读卡器都附带有一些读写卡程序,我用的一个比这个要方便的多。

mfoc安装编译的更多相关文章

  1. 比特币Bitcoin源代码安装编译

    body{ font: 16px/1.5em 微软雅黑,arial,verdana,helvetica,sans-serif; }        比特币 (货币符号: ฿;英文名:Bitcoin;英文 ...

  2. linux centos安装编译phantomjs 2.0的方法

    phantomjs 2.0最新版的官方不提供编译好的文件下载,只能自己编译,有教程但是过于简单,特别是服务器上要安装N多的支持.折腾到现在终于装好了并且能正常运行了,截图mark一下: linux c ...

  3. linux_安装_安装编译phantomjs 2.0的方法_转

    项目中要对数据公式webkit渲染,phantmjs 2.0的效果好比1.9好不少. 安装过程中 坑比较多. 转载文章: phantomjs 2.0最新版的官方不提供编译好的文件下载,只能自己编译,有 ...

  4. wxWidgets的安装编译、相关配置、问题分析处理

    wxWidgets的安装编译.相关配置.问题分析处理 一.介绍部分 (win7 下的 GUI 效果图见 本篇文章的最后部分截图2张) wxWidgets是一个开源的跨平台的C++构架库(framewo ...

  5. FFmpeg在Linux下安装编译过程

    转载请把头部出处链接和尾部二维码一起转载,本文出自:http://blog.csdn.net/hejjunlin/article/details/52402759 今天介绍下FFmpeg在Linux下 ...

  6. openblas下载安装编译

    编译好的库: https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases 源码编译 下载:https://github.com/xia ...

  7. Linux上安装编译工具链

    在Linux上安装编译工具链,安装它会依赖dpkg-dev,g++,libc6-dev,make等,所以安装之后这些依赖的工具也都会被安装.ubuntu软件库中这么描述 Informational l ...

  8. (0.2.6)Mysql安装——编译安装

    (0.2.6)Mysql安装——编译安装 待完善

  9. Linux中源码安装编译Vim

    Linux中源码安装编译Vim Linux下学习工作少不了编辑器,Vim能使你的工作效率成倍的提高.在Ubuntu上安装vim使用命令直接安装很简单.但有时还是需要自己手动编译安装.例如: vim中的 ...

随机推荐

  1. 第八届蓝桥杯C/C++ B组省赛----分巧克力

    分巧克力 问题描述 儿童节那天有K位小朋友到小明家做客.小明拿出了珍藏的巧克力招待小朋友们. 小明一共有N块巧克力,其中第i块是Hi x Wi的方格组成的长方形. 为了公平起见,小明需要从这 N 块巧 ...

  2. 如何在win7下安装python包工具pip

    1. 在安装pip前,请确认你win系统中已经安装好了python,和easy_install工具,如果系统安装成功,easy_install在目录C:\Python27\Scripts 下面, 确认 ...

  3. Python+Selenium练习篇之7-利用name定位元素

    本文介绍如何通过节点中name的值来定位这个web元素.还是来看百度首页搜索输入框,通过name的值来定位. 相关脚本代码: # coding=utf-8 from selenium import w ...

  4. Oracle 查看锁定对象 解锁

    一些ORACLE中的进程被杀掉后,状态被置为"killed",但是锁定的资源很长时间不释放,有时实在没办法,只好重启数据库.现在提供一种方法解决这种问题,那就是在ORACLE中杀不 ...

  5. linux配置Hadoop伪分布安装模式

    1)关闭禁用防火墙: /etc/init.d/iptables status 会得到一系列信息,说明防火墙开着. /etc/rc.d/init.d/iptables stop 关闭防火墙 2)禁用SE ...

  6. 我的第一个python程序——猜数字

    #Author:xiaoxiao age = 22 #标准正确答案 counter = 0 #计数器 for i in range(10): #循环10次 if counter < 3: gue ...

  7. PDF文件加密怎么转换成word

    1.将文档拖入Chrome浏览器 2. 3.右上角打印,然后会提示 另存为本地,然后再用word或者福昕套件转换就行

  8. php显示错误

    error_reporting(E_ALL); ini_set('display_errors', '1');    //将出错信息输出到一个文本文件 ini_set('error_log', dir ...

  9. redis学习(二)redis.conf文件配置

    转自: https://www.cnblogs.com/pqchao/p/6558688.html 为了更好的使用redis,我们需要详细的了解redis配置文件及相关参数作用. bind 127.0 ...

  10. Codeforces Round #321 (Div. 2) B 二分+预处理

    B. Kefa and Company time limit per test 2 seconds memory limit per test 256 megabytes input standard ...