kk Blog —— 通用基础


date [-d @int|str] [+%s|"+%F %T"]
netstat -ltunp
sar -n DEV 1

使用PN532复制IC卡

https://catro.me/post/20190225_duplicate_ic_card/

https://www.xubo.wang/2021/04/16/mfoc-PN532%E5%A4%8D%E5%88%B6%E5%8D%A1%E7%89%87/

本文介绍复制IC卡所需要的硬件和软件,复制过程中遇到的一些问题以及解决方案。其中并不涉及IC卡存储格式或通信协议,需要了解请搜索相关资料。复制的IC卡可以置于手机及手机壳之间以达到近似于手机刷卡的效果。

硬件列表

PN532模块: 读写IC卡,支持Mifare 1K等卡片。

USB转TTL:链接电脑和PN532模块。

IC/ID二合一卡:IC卡可以更改UID,ID卡为T5577类型。下一篇会介绍如何复制ID卡。

消磁贴(可选):复制卡贴在手机后需要使用,否则读卡器无法识别。

软件列表

libusb: http://libusb.sf.net

libnfc: https://github.com/nfc-tools/libnfc

mfoc: https://github.com/nfc-tools/mfoc

mfcuk: https://github.com/nfc-tools/mfcuk

Linux下安装过程

linux下读写卡需要用到libnfc,mfoc

libnfc 是PN532模块读写卡片所必需的库

1
yum install libnfc-bin libnfc-dev libnfc-examples

mfoc 是一个开源的离线Nested攻击工具 这个程序可以获取mifare classic卡片的密钥

mfoc “离线嵌套”攻击的开源实现,该程序允许从 MIFARE 经典卡恢复身份验证密钥。

mfoc 安装可以直接从github拉取代码直接编译

运行

1
sudo nfc-list

如果模块没问题,会显示device信息

将门禁卡放到 PN532 模块上,然后执行

1
sudo mfoc -O orig.mfd

mfoc 会自动选用自带的默认 key 去解锁并读取卡片中的所有16个扇区的数据,如果部分扇区采用了非默认的 key 进行加密,mfoc 则会尝试去破解。

如果所有扇区的 key 都能够被破解出来,mfoc 会将 dump 出的数据导出到 orig.mfd 文件中.

写入门禁卡数据

拿到原始的门禁卡数据后,就可以拿去写入新的卡片了。按理说,标准的 Mifare Classic 卡片的0扇区应该是出厂后无法再次写入的,但是万能的淘宝可以买到0扇区可写入的卡片,将卡片放在 PN532 模块上,然后执行写入命令:

1
sudo nfc-mfclassic W a orig.mfd orig.mfd

https://sxy91.com/posts/nfc-ic-card/

mfoc 安装失败的解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 问题1
autoreconf: command not found
# 解决办法:安装 autoconf
brew install autoconf

# 问题2
Can't exec "aclocal": No such file or directory at
# 解决问题,安装 automake
brew install automake

# 问题3
configure.ac:17: error: possibly undefined macro: AC_MSG_ERROR
# 解决办法 安装 pkg-config 
brew install pkg-config 

# 问题4
configure: error: libnfc >= 1.7.0 is mandatory.
# 解决办法 安装 libnfc
brew install libnfc

https://blog.csdn.net/linuxchen/article/details/75350706

编译hitch的过程出现如下错误:

1
2
3
4
5
6
7
[Web01 root@iZ2zeg6umj2lyn48376fyjZ hitch-master]#./bootstrap
+ set -o errexit
+ aclocal -I .
+ autoconf
configure.ac:46: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.

网上搜索提示可能的问题

  1. pkg-config package was missing.

我检查了pkg-config 存在,并且相关的依赖的库都已经安装正常

  1. 编译加m4_pattern_allow参数

即:./configure –enable-m4_pattern_allow

尝试还是不行

解决办法:

最后判断是aclocal相关的宏没有找到,aclocal -I . 这行改为 aclocal -I . -I /usr/share/aclocal/ 目标是找到相关的aclocal 相关的 .m4文件,尤其是/usr/share/aclocal/pkg.m4

tools, ic

« window 内存分析工具RAMMap M1卡破解方法 »