101 Commits

Author SHA1 Message Date
wh201906 f285f76a20 V0.2.2 2021-09-20 19:07:36 +08:00
wh201906 24adc08d84 LF config file 2021-09-20 15:32:00 +08:00
wh201906 d56c5f8dc7 Merge branch 'master' into dev 2021-09-20 00:01:57 +08:00
wh201906 222f271a31 Choose config file path 2021-09-19 23:59:55 +08:00
wh201906 0c339e91af Revert part of the commit 12a0837
I forgot I have designed "Keep the client active" for issue #22
isBusy() is deprecated for blocking the port, but it doesn't matter.
2021-09-19 21:33:53 +08:00
wh201906 85ea3fd744 Config file
_readsec(), hardnested(), _writeblk(), lockC(), setParameterC()
2021-09-19 21:00:23 +08:00
wh201906 d0bc6808d0 Config file for official client
Unfinished
Refactor darkside() _readblk(), loadSniff(), saveSniff()
Add extra waiting time when handling temp file of load/saveSniff()
2021-09-19 01:10:12 +08:00
wh201906 03d9c601fc Config fiie for official client
Unfinished
Refactor nested(), info(), chk()
2021-09-18 02:03:05 +08:00
wh201906 5a8ab42281 External command config file 2021-09-17 15:25:03 +08:00
wh201906 12a0837c50 Fix a bug
Trying to fix #22
Open client with QProcess::Text for proper newline character(s)
On Raspbian, the isBusy() function will always return false, even the serial port is actually connected.
2021-09-05 21:35:03 +08:00
wh201906 d6f02e7a69 Update building instructions 2021-08-14 17:05:13 +08:00
wh201906 02a8fe03e3 Fix a bug
#21
2021-08-07 11:21:19 +08:00
wh201906 3523c1eace Fix a bug
#20
I got a wrong tutorial saying that I should use xxx.ts on Linux
2021-08-05 11:57:35 +08:00
wh201906 bac6207634 V0.2.1 2021-03-16 11:23:01 +08:00
wh201906 ccb07651cc Mifare: Optimize read logic
Fix bug #16 mentioned in http://www.proxmark.org/forum/viewtopic.php?pid=42123 (see the 17th post)
This is caused by the output change in RRG repo
Optimize _readsec() logic
Implement getTrailerBlockId()
2021-03-16 11:06:26 +08:00
wh201906 f706d59c48 Update UI 2021-03-15 11:29:17 +08:00
wh201906 9e31496131 Fail to support non-ASCII chars in path
Using "chcp" seems to have no effect there
I fix a small bug then
2021-03-12 11:59:51 +08:00
wh201906 a232e4ec83 Fix #15 partially
The path of the start script or the client can contain spaces now(on Windows)
TODO:
Test the issue on Linux and implement the fix if it's needed
Support non-ASCII chars in the path
2021-03-11 00:46:56 +08:00
wh201906 1bec73d1ad T55xx: Add some useless UI 2021-03-08 23:02:16 +08:00
wh201906 a8b1a4a82e V0.2 2021-02-23 20:40:55 +08:00
wh201906 03bb57ee58 Update translations 2021-02-23 19:47:36 +08:00
wh201906 15538a9892 LF: Support write LF config
When setting LF freq, the "lf config" and "hw setlfdivisor" will both be called.
Change some UI
2021-02-23 18:14:59 +08:00
wh201906 466cd0ecc1 LF: support read LF config 2021-02-23 16:35:58 +08:00
wh201906 019afed198 Add QAction: Dock all windows 2021-02-22 22:20:49 +08:00
wh201906 799e00d66e Replace QTabWidget with QDockWidget
dock it(√)
doki(?)
2021-02-22 15:57:32 +08:00
wh201906 ae9e4d1a4f LF: support read(), sniff(), search() and tune() 2021-02-22 13:55:45 +08:00
wh201906 c3aafc3d31 Fix a bug in disconnect() 2021-02-22 12:47:55 +08:00
wh201906 fb8e1a6e1b New experimental feature
Keep client active even the PM3 hardware is disconnected
2021-02-21 23:00:07 +08:00
wh201906 90e4fde882 Fix a bug in RawCommand Tab
Not all of the keys should be redirected.
2021-02-21 21:30:22 +08:00
wh201906 705c8de54c Fix a bug in RawCommand Tab
If a widget is set to NoFocus, then it will not respond to the key Event
2021-02-20 20:51:26 +08:00
wh201906 aa6b93984c A small patch
Support specifying client working directory
Clean all compile warnings
2021-02-17 01:26:14 +08:00
wh201906 7f96c061dc Merge pull request #14 from wh201906/dev
V0.1.4
2021-02-16 14:28:50 +08:00
wh201906 b8c4e8e339 V0.1.4 2021-02-16 14:25:20 +08:00
wh201906 4f10e3d75c All functions are compatible to Iceman/RRG fork
Use different foreground color for Trailer block and Block 0
2021-02-16 13:52:04 +08:00
wh201906 63f3424871 Support wipe(), lockUFUID(), setUIDParameter(),
in latest Iceman repo
Fix a error in keyPattern
Test all R/W functions in Iceman client and Official client
2021-02-16 01:17:50 +08:00
wh201906 24a6e1869b Support hardnested(), darkside(), readblk(),
readsec() in latest Iceman repo
2021-02-15 23:46:05 +08:00
wh201906 6baa09221e Support chk(), nested() in latest Iceman repo 2021-02-15 23:00:02 +08:00
wh201906 6e5f654cc5 Support running a external script before client start,
to configure the environment variables

Optimize stop(reconnect) logic
Search valid ports automatically
Update translations
2021-02-15 18:38:34 +08:00
wh201906 83445c7eef Add new features
Support change language in Settings
Support customized start arguments
Strech data section in MF_dataWidget and key section in MF_keyWidget
2021-02-14 22:47:56 +08:00
wh201906 5330ed8d14 Some changes
Refactor execCMDWithOutput
Add UI for advanced settings
Add stop button(reconnect)
Update translations
2021-02-13 23:58:11 +08:00
wh201906 a56a503b23 Some slight changes
Add HighDPI support(not tested)
Support Mifare darkside attack
Hide unfinished function tabs
2021-02-12 23:48:25 +08:00
wh201906 77d8049738 Merge pull request #13 from wh201906/master
Replace textChanged() with valueChanged(). This fixes #9
2020-11-04 15:12:39 +08:00
wh201906 bf9b3fb076 Merge branch 'dev' into master 2020-11-04 15:12:18 +08:00
wh201906 6d3dd5056c Replace textChanged() with valueChanged(). This fixes #9 2020-11-04 15:09:28 +08:00
wh201906 e687cc39fd Merge pull request #12 from wh201906/master
Update translation
2020-11-01 22:46:33 +08:00
wh201906 3c3944d150 Slight change 2020-11-01 22:43:46 +08:00
wh201906 091b4f63d1 Merge pull request #11 from ruling/master
Update zh_CN.ts
2020-11-01 18:17:56 +08:00
wh201906 0c4220c9a5 Change some translation 2020-10-31 18:19:06 +08:00
Ruling 986e9aacfe Correct some Chinese Translation
Correct some Chinese Translation
2020-10-30 12:58:11 +08:00
Ruling ce262db52c Update zh_CN.ts 2020-10-27 11:31:33 +08:00
wh201906 73533608e6 Add some useless UI 2020-08-14 00:46:07 +08:00
wh201906 2f38d3c8c5 Support choose history command by Key_Up and Key_Down 2020-08-13 16:39:04 +08:00
wh201906 f2d00ee088 Replace QString with const QString& 2020-08-13 09:30:47 +08:00
wh201906 862f0775f8 Shorten the waitTime for execCMDWithOutput() 2020-08-12 12:30:15 +08:00
wh201906 a7985c5c89 Stop the running command after disconnected 2020-08-11 11:51:27 +08:00
wh201906 a3e6aa787b Check Access Bits when writing to selected blocks 2020-08-11 11:30:33 +08:00
wh201906 1c273a6527 Update preview for Trailer Decoder 2020-08-10 10:37:09 +08:00
wh201906 3f899845b7 Update README 2020-08-09 11:16:45 +08:00
wh201906 475580c342 Merge pull request #5 from wh201906/dev
V0.1.3
2020-08-09 10:34:54 +08:00
wh201906 3a577bdd32 V0.1.3 2020-08-09 10:33:15 +08:00
wh201906 f8d2bbb206 Fix Trailer Decoder and add write feedback 2020-08-09 10:32:48 +08:00
wh201906 d6beafe175 Merge pull request #4 from wh201906/dev
V0.1.2
2020-08-08 22:02:32 +08:00
wh201906 f881a05fa3 V0.1.2 2020-08-08 22:00:16 +08:00
wh201906 ad10a6e789 Support Choose Trailer block 2020-08-08 21:49:43 +08:00
wh201906 bf8136a7fe Unify all read and write functions 2020-08-08 21:04:09 +08:00
wh201906 6af85bffc0 Remove writeC() and readC(), unify them into _readblk() and _writeblk() 2020-08-08 17:41:08 +08:00
wh201906 3751349004 Update Introducton 2020-08-08 16:51:34 +08:00
wh201906 44c61a8202 Update translation 2020-08-08 12:10:44 +08:00
wh201906 fbe8a5e51d Fix a small bug 2020-08-08 11:23:17 +08:00
wh201906 41bbcd2c4a Support write selected blocks and fix a bug 2020-08-08 00:19:37 +08:00
wh201906 4dba7882e5 Support read selected blocks 2020-08-07 23:51:24 +08:00
wh201906 25d7886f2a Refactor _readsec() and readAll() 2020-08-07 17:30:48 +08:00
wh201906 7e4dedeff1 Save client path automatically 2020-08-07 15:28:17 +08:00
wh201906 7dfabb60e9 Support encode Access Bits(in the Trailer Decoder) 2020-08-06 14:53:49 +08:00
wh201906 46b3912e82 Refactor 2020-08-06 11:19:56 +08:00
wh201906 fe8f8b2d51 Refactor _readblk() and _readsec() 2020-08-06 00:38:44 +08:00
wh201906 d15b8e21fc Iceman support: info(), chk(), nested() 2020-08-05 23:55:14 +08:00
wh201906 eb5fa7ec9a Replace QRegExp with QRegularExpression(Uncompleted) 2020-08-05 22:46:41 +08:00
wh201906 ef6ebea568 Support Iceman fork(Command Line only) 2020-08-05 19:08:02 +08:00
wh201906 6f860111df Complete Trailer Decoder(without test) 2020-08-05 00:45:54 +08:00
wh201906 a935ff9703 Add Trailer Decoder(Uncompleted) 2020-08-04 23:33:14 +08:00
wh201906 02b0c312a4 Rename something 2020-08-04 16:05:21 +08:00
wh201906 946d0acb01 Refactor and Add _readsec() 2020-08-04 13:44:20 +08:00
wh201906 a60b28ee66 Add Fill keys 2020-08-01 22:04:30 +08:00
wh201906 43752bd5e4 Small fix 2020-08-01 21:48:59 +08:00
wh201906 a77985824c Add _readblk() (not tested) 2020-08-01 21:30:55 +08:00
wh201906 cd122b8959 Refactor(Replace isKeyA with KeyType) 2020-07-29 22:02:49 +08:00
wh201906 87dddf4d3d Add block selection 2020-06-27 14:02:58 +08:00
wh201906 b2baaede5d Unfinished 2020-06-26 23:48:08 +08:00
wh201906 7ea9c363fd Fix a small bug 2020-06-26 22:39:46 +08:00
wh201906 241b0cdc29 Optimize writeAll() 2020-06-26 22:35:39 +08:00
wh201906 3181848e75 Make UI customizable 2020-06-13 01:27:59 +08:00
wh201906 5cccb7b8bb Merge pull request #3 from wh201906/dev
V0.1.1
2020-05-09 23:54:59 +08:00
wh201906 461c48fee9 V0.1.1 2020-05-09 23:49:25 +08:00
wh201906 2790afc193 Support Mifare Simulate and Sniff function 2020-05-09 23:43:10 +08:00
wh201906 5816d1b1b6 Complete Mifare module 2020-05-03 23:40:09 +08:00
wh201906 fe8b9d6161 Complete Mifare Simulate function 2020-05-03 00:14:49 +08:00
wh201906 afe2474fe3 Add UI for simulate function 2020-05-01 23:37:23 +08:00
wh201906 0995e529ad Reformat 2020-04-30 21:00:57 +08:00
wh201906 b44488fbed Support read/write data in emulator 2020-04-30 20:32:43 +08:00
wh201906 5f1df6782a Merge pull request #2 from wh201906/dev
V0.1
2020-04-29 20:53:16 +08:00
51 changed files with 8724 additions and 1500 deletions
-1
View File
@@ -14,7 +14,6 @@
*.so.* *.so.*
*_pch.h.cpp *_pch.h.cpp
*_resource.rc *_resource.rc
*.qm
.#* .#*
*.*# *.*#
core core
+11 -1
View File
@@ -16,23 +16,33 @@ DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
common/myeventfilter.cpp \
main.cpp \ main.cpp \
common/pm3process.cpp \ common/pm3process.cpp \
common/util.cpp \ common/util.cpp \
module/lf.cpp \
module/mifare.cpp \ module/mifare.cpp \
ui/mf_trailerdecoderdialog.cpp \
ui/mf_sim_simdialog.cpp \
ui/mf_uid_parameterdialog.cpp \ ui/mf_uid_parameterdialog.cpp \
ui/mainwindow.cpp \ ui/mainwindow.cpp \
ui/mf_attack_hardnesteddialog.cpp \ ui/mf_attack_hardnesteddialog.cpp \
HEADERS += \ HEADERS += \
common/myeventfilter.h \
common/pm3process.h \ common/pm3process.h \
common/util.h \ common/util.h \
module/lf.h \
module/mifare.h \ module/mifare.h \
ui/mf_trailerdecoderdialog.h \
ui/mf_sim_simdialog.h \
ui/mf_uid_parameterdialog.h \ ui/mf_uid_parameterdialog.h \
ui/mainwindow.h \ ui/mainwindow.h \
ui/mf_attack_hardnesteddialog.h \ ui/mf_attack_hardnesteddialog.h \
FORMS += \ FORMS += \
ui/mf_trailerdecoderdialog.ui \
ui/mf_sim_simdialog.ui \
ui/mf_uid_parameterdialog.ui \ ui/mf_uid_parameterdialog.ui \
ui/mainwindow.ui \ ui/mainwindow.ui \
ui/mf_attack_hardnesteddialog.ui ui/mf_attack_hardnesteddialog.ui
@@ -46,7 +56,7 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
VERSION = 0.1 VERSION = 0.2.2
QMAKE_TARGET_PRODUCT = "Proxmark3GUI" QMAKE_TARGET_PRODUCT = "Proxmark3GUI"
QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI" QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI"
QMAKE_TARGET_COMPANY = "wh201906" QMAKE_TARGET_COMPANY = "wh201906"
+93 -11
View File
@@ -1,33 +1,115 @@
# Proxmark3GUI # Proxmark3GUI
A GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client ![downloads](https://img.shields.io/github/downloads/wh201906/Proxmark3GUI/total)
[中文](README/README.zh_CN.md) A cross-platform GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
[中文介绍](README/doc/README_zh_CN.md)
*** ***
## Features ## Features
+ Support raw commands of Proxmark3 client + Easy to find available Serial Port
+ Support raw commands of Proxmark3 client(Official/Iceman)
+ Have a friendly UI to test Mifare cards + Have a friendly UI to test Mifare cards
+ Easy to edit Mifare data files + Support different card size(MINI, 1K, 2K, 4K)
+ Support binary(.bin .dump) files and text(.eml) files + Easy to edit Mifare block data
+ ... + Easy to read all/selected blocks with well-designed read logic
+ Easy to write all/selected blocks
+ Support binary(.bin .dump) files and text(.eml) files
+ Analyze Access Bits
+ Support Chinese Magic Card
+ Have basic support for LF commands
+ Customize UI
+ ...
*** ***
## Previews ## Preview
![nested_attack](README/mf_nested_attack.gif) ![preview](README/img/preview.png)
![mf_load_file](README/mf_load_file.gif) [more previews](README/doc/previews.md)
![mf_edit_file](README/mf_edit_file.gif) ***
![raw_command](README/raw_command.gif) ## About Iceman fork/repo
The [Iceman fork/repo](https://github.com/RfidResearchGroup/proxmark3) has more powerful functions. These guys even developed a new hardware called Proxmark3 RDV4 with smart card support. But the official repo and the Iceman repo is not fully compatible.
This GUI is compatible with Iceman/RRG repo(tested on v4.13441)
***
## About Compiled Windows clients
A cool guy [Gator96100](https://github.com/Gator96100) creates [ProxSpace](https://github.com/Gator96100/ProxSpace) and makes it possible to compile both the firmware and the client on Windows.
Also, he makes the [pre-compiled Windows client](https://www.proxmarkbuilds.org/) so you can download it and run your PM3 client on Windows instantly.
I included his compiled client in my releases so you can use the GUI on the fly, and you can also use the GUI with your prefered client.
Great thanks to him.
***
## Build on Linux
cd ~
sudo apt-get update
sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev
git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1
cd Proxmark3GUI
mkdir build
cd build
qmake ../
make
make clean
cp -r ../lang ./
cp -r ../config ./
./Proxmark3GUI
*** ***
## Update Log: ## Update Log:
### V0.2.2
+ Load command format from external json file
+ Fix bug [#20](https://github.com/wh201906/Proxmark3GUI/issues/20), [#21](https://github.com/wh201906/Proxmark3GUI/issues/21), [#22](https://github.com/wh201906/Proxmark3GUI/issues/22)
+ Support Iceman/RRG repo v4.13441
### V0.2.1
+ Optimize MIFARE Classic reading logic
+ Fix bug [#16](https://github.com/wh201906/Proxmark3GUI/issues/16)
+ Fix bug [#15](https://github.com/wh201906/Proxmark3GUI/issues/15) partially (the path can contain spaces now)
### V0.2
+ Use Dock widget for more flexible layout
+ Support basic LF commands
+ Fix a bug in RawCommand tab
### V0.1.4
+ Optimize performance
+ Optimize UI
+ Search available ports automatically
+ Add High-DPI support
+ Support configuring environment variables by script
(Useful when the client requires specific environment variables)
+ All functions are compatible with Iceman/RRG repo(tested on v4.9237)
+ Support specifying client working directory
+ Fix some bugs
### V0.1.3
+ Fix Trailer Decoder
+ Add feedback when writing selected blocks
### V0.1.2
+ Optimize read logic
+ Make UI Customizable
+ Save client path automatically
+ Add Trailer Decoder(Deprecated, plz use V0.1.3 or higher version)
+ Support read/write selected blocks
+ Support a few Iceman functions
+ Fix some bugs
### V0.1.1
+ Complete Mifare module(support simulate and sniff)
### V0.1 ### V0.1
+ Able to deal with Mifare card and related files + Able to deal with Mifare card and related files
-35
View File
@@ -1,35 +0,0 @@
# Proxmark3GUI
一个自制的[Proxmark3](https://github.com/Proxmark/proxmark3) GUI
[English](../README.md)
***
## 特色功能
+ 支持直接输入PM3命令
+ 有针对于Mifare卡(IC卡)的图形界面
+ 支持编辑Mifare扇区数据文件
+ 可以打开二进制/文本格式的扇区数据文件
+ ...
***
## 预览图
![nested_attack](mf_nested_attack.gif)
![mf_load_file](mf_load_file.gif)
![mf_edit_file](mf_edit_file.gif)
![raw_command](raw_command.gif)
***
## 更新日志:
### V0.1
+ 支持处理Mifare卡片及相关数据文件
### V0.0.1
+ 一个带串口选择框的实验版本
+116
View File
@@ -0,0 +1,116 @@
# Proxmark3GUI
![downloads](https://img.shields.io/github/downloads/wh201906/Proxmark3GUI/total)
一个自制的[Proxmark3](https://github.com/Proxmark/proxmark3) GUI,可在Windows/Linux系统下运行
[English](../../README.md)
***
## 功能
+ 快速查找可用端口并连接
+ 支持直接输入PM3命令(官方版/冰人版)
+ 有针对于Mifare卡(IC卡)的图形界面
+ 支持不同大小的卡片(MINI, 1K, 2K, 4K)
+ 支持编辑Mifare扇区数据
+ 支持读取全卡/选中扇区,读卡逻辑更加智能
+ 支持写入全卡/选中扇区
+ 可以打开二进制/文本格式的扇区数据文件
+ 分析访问控制位(Access Bits
+ 支持UID卡操作(UID快速读写,UFUID锁卡)
+ 支持部分低频命令
+ 自定义UI界面,各选项卡可拆分组合
+ ...
***
## 预览图
![preview](../img/preview_zh_CN.png)
[更多预览](../doc/previews.md)
***
## 关于冰人版
[冰人版](https://github.com/RfidResearchGroup/proxmark3)(Iceman/RRG)的客户端和固件更新更为激进,相比官方版具有更多的功能
此GUI所有功能均兼容冰人版(在v4.13441上测试通过)
***
## 关于预编译Windows客户端
一位国外大佬 [Gator96100](https://github.com/Gator96100) 做了个 [ProxSpace](https://github.com/Gator96100/ProxSpace) 以便在Windows平台上编译PM3固件和客户端,他还把自己编译好的客户端放到了[网站](https://www.proxmarkbuilds.org/)上
release页面中有含客户端的GUI。这个GUI也可以搭配你自己的客户端使用
(本来打算在CSDN下载里面放几个最新版客户端的,结果不能把下载币改为0)
感谢大佬
***
## 在Linux系统下编译
cd ~
sudo apt-get update
sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev
git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1
cd Proxmark3GUI
mkdir build
cd build
qmake ../
make
make clean
cp -r ../lang ./
cp -r ../config ./
./Proxmark3GUI
***
## 更新日志:
### V0.2.2
+ 从外部文件加载客户端命令格式
+ 修复 [#20](https://github.com/wh201906/Proxmark3GUI/issues/20), [#21](https://github.com/wh201906/Proxmark3GUI/issues/21), [#22](https://github.com/wh201906/Proxmark3GUI/issues/22)
+ 兼容冰人版客户端 v4.13441
### V0.2.1
+ 优化MIFARE Classic读卡逻辑
+ 修复 [#16](https://github.com/wh201906/Proxmark3GUI/issues/16) (配合新版RRG固件时无法读取扇区数据)
+ 修复 [#15](https://github.com/wh201906/Proxmark3GUI/issues/15) (路径中支持空格)
### V0.2
+ 使用浮动窗口,界面配置更加灵活
+ 支持部分低频命令
+ 修复原始命令选项卡中的一个Bug
### V0.1.4
+ 优化性能
+ 优化用户界面
+ 自动搜索可用端口
+ 支持高分屏
+ 可通过外部脚本配置环境变量
(在客户端需要配置环境变量时很有用)
+ 全功能兼容冰人版(在v4.9237上测试通过)
+ 支持指定客户端工作路径
+ 修复部分bug
### V0.1.3
+ 修复访问控制位解码器
+ 写多个块时显示写入结果
### V0.1.2
+ 优化读卡逻辑
+ UI自定义
+ 自动保存客户端路径
+ 添加访问控制位解码器(也可用于自己构造访问控制位)(有bug,请使用V0.1.3或更高版本)
+ 支持仅读写选中块
+ 支持部分冰人功能
+ 修复部分bug
### V0.1.1
+ 完成整个Mifare模块(支持模拟卡和嗅探功能)
### V0.1
+ 支持处理Mifare卡片及相关数据文件
### V0.0.1
+ 一个带串口选择框的实验版本
+20
View File
@@ -0,0 +1,20 @@
## Previews
Raw Command:
![raw_command](../img/raw_command.gif)
Mifare Nested Attack:
![nested_attack](../img/mf_nested_attack.gif)
Mifare Load File:
![mf_loadfile](../img/mf_loadfile.gif)
Mifare Edit File:
![mf_editfile](../img/mf_editfile.gif)
Mifare Trailer Decoder:
![mf_trailer](../img/mf_trailer.gif)
Dock Widget:
![dock1](../img/dock1.png)
![dock2](../img/dock2.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 650 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 KiB

+13
View File
@@ -0,0 +1,13 @@
#include "myeventfilter.h"
MyEventFilter::MyEventFilter(QEvent::Type filter)
{
targetEventType = filter;
}
bool MyEventFilter::eventFilter(QObject *obj, QEvent *event)
{
if(event->type() == targetEventType)
emit eventHappened(obj, *event);
return QObject::eventFilter(obj, event);
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef MYEVENTFILTER_H
#define MYEVENTFILTER_H
#include <QObject>
#include <QKeyEvent>
class MyEventFilter : public QObject
{
Q_OBJECT
public:
explicit MyEventFilter(QEvent::Type filter);
protected:
bool eventFilter(QObject *obj, QEvent *event) override;
signals:
void eventHappened(QObject* obj_addr, QEvent& event);
private:
QEvent::Type targetEventType;
};
#endif // MYEVENTFILTER_H
+73 -13
View File
@@ -12,33 +12,62 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
serialListener->setTimerType(Qt::VeryCoarseTimer); serialListener->setTimerType(Qt::VeryCoarseTimer);
connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout); connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout);
connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead); connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead);
portInfo = nullptr;
} }
void PM3Process::connectPM3(const QString path, const QString port) void PM3Process::connectPM3(const QString& path, const QStringList args)
{ {
QString result;
Util::ClientType clientType;
setRequiringOutput(true); setRequiringOutput(true);
// stash for reconnect
currPath = path;
currArgs = args;
// using "-f" option to make the client output flushed after every print. // using "-f" option to make the client output flushed after every print.
start(path, QStringList() << port << "-f", QProcess::Unbuffered | QProcess::ReadWrite); start(path, args, QProcess::Unbuffered | QProcess::ReadWrite | QProcess::Text);
if(waitForStarted(10000)) if(waitForStarted(10000))
{ {
while(waitForReadyRead(1000)) waitForReadyRead(10000);
;
setRequiringOutput(false); setRequiringOutput(false);
QString result = *requiredOutput; result = *requiredOutput;
if(result.indexOf("[=]") != -1)
{
clientType = Util::CLIENTTYPE_ICEMAN;
setRequiringOutput(true);
write("hw version\n");
for(int i = 0; i < 50; i++)
{
waitForReadyRead(200);
result += *requiredOutput;
if(result.indexOf("os: ") != -1)
break;
}
setRequiringOutput(false);
}
else
{
clientType = Util::CLIENTTYPE_OFFICIAL;
}
if(result.indexOf("os: ") != -1) // make sure the PM3 is connected if(result.indexOf("os: ") != -1) // make sure the PM3 is connected
{ {
emit changeClientType(clientType);
result = result.mid(result.indexOf("os: ")); result = result.mid(result.indexOf("os: "));
result = result.left(result.indexOf("\r\n")); result = result.left(result.indexOf("\n"));
result = result.mid(3, result.lastIndexOf(" ") - 3); result = result.mid(4, result.indexOf(" ", 4) - 4);
emit PM3StatedChanged(true, result); emit PM3StatedChanged(true, result);
setSerialListener(port, true);
} }
else else
kill(); kill();
} }
} }
void PM3Process::reconnectPM3()
{
connectPM3(currPath, currArgs);
}
void PM3Process::setRequiringOutput(bool st) void PM3Process::setRequiringOutput(bool st)
{ {
isRequiringOutput = st; isRequiringOutput = st;
@@ -55,6 +84,7 @@ void PM3Process::setSerialListener(const QString& name, bool state)
{ {
if(state) if(state)
{ {
currPort = name;
portInfo = new QSerialPortInfo(name); portInfo = new QSerialPortInfo(name);
serialListener->start(); serialListener->start();
qDebug() << serialListener->thread(); qDebug() << serialListener->thread();
@@ -62,18 +92,29 @@ void PM3Process::setSerialListener(const QString& name, bool state)
else else
{ {
serialListener->stop(); serialListener->stop();
delete portInfo; if(portInfo != nullptr)
{
delete portInfo;
portInfo = nullptr;
}
} }
} }
void PM3Process::setSerialListener(bool state)
{
setSerialListener(currPort, state);
}
void PM3Process::onTimeout() //when the proxmark3 client is unexpectedly terminated or the PM3 hardware is removed, the isBusy() will return false(only tested on Windows); void PM3Process::onTimeout() //when the proxmark3 client is unexpectedly terminated or the PM3 hardware is removed, the isBusy() will return false(only tested on Windows);
{ {
// isBusy() is a deprecated function because it will block the serial port when the port is not in use.
// However, the PM3 client is supposed to use the target serial port exclusively, so it should be fine
// isBusy() will always return false on Raspbian, in this case, check "Keep the client active" in the Settings panel.
//
// qDebug()<<portInfo->isBusy(); // qDebug()<<portInfo->isBusy();
if(!portInfo->isBusy()) if(!portInfo->isBusy())
{ {
kill(); killPM3();
emit PM3StatedChanged(false);
setSerialListener("", false);
} }
} }
@@ -82,7 +123,6 @@ void PM3Process::testThread()
qDebug() << "PM3:" << QThread::currentThread(); qDebug() << "PM3:" << QThread::currentThread();
} }
qint64 PM3Process::write(QString data) qint64 PM3Process::write(QString data)
{ {
return QProcess::write(data.toLatin1()); return QProcess::write(data.toLatin1());
@@ -100,3 +140,23 @@ void PM3Process::onReadyRead()
} }
} }
void PM3Process::setProcEnv(const QStringList* env)
{
// qDebug() << "passed Env List" << *env;
this->setEnvironment(*env);
// qDebug() << "final Env List" << processEnvironment().toStringList();
}
void PM3Process::setWorkingDir(const QString& dir)
{
// the working directory cannot be the default, or the client will failed to load the dll
this->setWorkingDirectory(dir);
}
void PM3Process::killPM3()
{
kill();
emit PM3StatedChanged(false);
setSerialListener(false);
}
+18 -4
View File
@@ -8,6 +8,10 @@
#include <QTimer> #include <QTimer>
#include <QtSerialPort/QSerialPortInfo> #include <QtSerialPort/QSerialPortInfo>
#include <QtSerialPort/QSerialPort> #include <QtSerialPort/QSerialPort>
#include <QProcessEnvironment>
#include <QDir>
#include "util.h"
class PM3Process : public QProcess class PM3Process : public QProcess
{ {
@@ -19,9 +23,14 @@ public:
void testThread(); void testThread();
public slots: public slots:
void connectPM3(const QString path, const QString port); void connectPM3(const QString& path, const QStringList args);
void setSerialListener(const QString &name, bool state); void setSerialListener(const QString& name, bool state);
void setSerialListener(bool state);
qint64 write(QString data); qint64 write(QString data);
void reconnectPM3();
void setProcEnv(const QStringList* env);
void setWorkingDir(const QString& dir);
void killPM3();
private slots: private slots:
void onTimeout(); void onTimeout();
void onReadyRead(); void onReadyRead();
@@ -31,9 +40,14 @@ private:
void setRequiringOutput(bool st);// It only works in this class now void setRequiringOutput(bool st);// It only works in this class now
QTimer* serialListener; QTimer* serialListener;
QSerialPortInfo* portInfo; QSerialPortInfo* portInfo;
QString currPath;
QString currPort = "";
QStringList currArgs;
signals: signals:
void PM3StatedChanged(bool st, QString info = ""); void PM3StatedChanged(bool st, const QString& info = "");
void newOutput(QString output); void newOutput(const QString& output);
void changeClientType(Util::ClientType);
}; };
#endif // PM3PROCESS_H #endif // PM3PROCESS_H
+106 -11
View File
@@ -1,13 +1,22 @@
#include "util.h" #include "util.h"
Util::ClientType Util::clientType = CLIENTTYPE_OFFICIAL;
int Util::rawTabIndex = 0;
QDockWidget* Util::rawDockPtr = nullptr;
Ui::MainWindow* Util::ui = nullptr;
Util::Util(QObject *parent) : QObject(parent) Util::Util(QObject *parent) : QObject(parent)
{ {
isRequiringOutput = false; isRequiringOutput = false;
requiredOutput = new QString(); requiredOutput = new QString();
timeStamp = QTime::currentTime(); timeStamp = QTime::currentTime();
qRegisterMetaType<Util::ClientType>("Util::ClientType");
} }
void Util::processOutput(QString output)
void Util::processOutput(const QString& output)
{ {
// qDebug() << "Util::processOutput:" << output; // qDebug() << "Util::processOutput:" << output;
if(isRequiringOutput) if(isRequiringOutput)
@@ -18,35 +27,121 @@ void Util::processOutput(QString output)
emit refreshOutput(output); emit refreshOutput(output);
} }
void Util::execCMD(QString cmd) void Util::execCMD(const QString& cmd)
{ {
qDebug() << cmd; qDebug() << "executing: " << cmd;
emit write(cmd + "\r\n"); if(isRunning)
emit write(cmd + "\n");
} }
QString Util::execCMDWithOutput(QString cmd, unsigned long timeout) QString Util::execCMDWithOutput(const QString& cmd, ReturnTrigger trigger, bool rawOutput)
{ {
// if the trigger is empty, this function will wait trigger.waitTime then return all outputs during the wait time.
// otherwise, this function will return empty string if no trigger is detected, or return outputs if any trigger is detected.
// the waitTime will be refreshed if the client have new outputs
bool isResultFound = false;
QRegularExpression re;
re.setPatternOptions(QRegularExpression::DotMatchesEverythingOption);
if(!isRunning)
return "";
QTime currTime = QTime::currentTime(); QTime currTime = QTime::currentTime();
QTime targetTime = QTime::currentTime().addMSecs(timeout); QTime targetTime = QTime::currentTime().addMSecs(trigger.waitTime);
isRequiringOutput = true; isRequiringOutput = true;
requiredOutput->clear(); requiredOutput->clear();
execCMD(cmd); execCMD(cmd);
while( QTime::currentTime() < targetTime) while(QTime::currentTime() < targetTime)
{ {
if(!isRunning)
break;
QApplication::processEvents(); QApplication::processEvents();
if(timeStamp > currTime) // qDebug() << "currOutput:" << *requiredOutput;
for(QString otpt : trigger.expectedOutputs)
{
re.setPattern(otpt);
isResultFound = re.match(*requiredOutput).hasMatch();
if(isResultFound)
{
qDebug() << "output Matched: " << *requiredOutput;
break;
}
}
if(isResultFound)
{
delay(200);
break;
}
if(timeStamp > currTime) //has new output
{ {
currTime = timeStamp; currTime = timeStamp;
targetTime = timeStamp.addMSecs(timeout); targetTime = timeStamp.addMSecs(trigger.waitTime);
} }
} }
isRequiringOutput = false; isRequiringOutput = false;
return *requiredOutput; return (isResultFound || trigger.expectedOutputs.isEmpty() || rawOutput ? *requiredOutput : "");
} }
void Util::delay(unsigned int msec) void Util::delay(unsigned int msec)
{ {
QTime timer = QTime::currentTime().addMSecs(msec); QTime timer = QTime::currentTime().addMSecs(msec);
while( QTime::currentTime() < timer ) while(QTime::currentTime() < timer)
QApplication::processEvents(QEventLoop::AllEvents, 100); QApplication::processEvents(QEventLoop::AllEvents, 100);
} }
Util::ClientType Util::getClientType()
{
return Util::clientType;
}
void Util::setClientType(Util::ClientType clientType)
{
Util::clientType = clientType;
}
void Util::setRunningState(bool st)
{
this->isRunning = st;
}
bool Util::chooseLanguage(QSettings* guiSettings, QMainWindow* window)
{
// make sure the GUISettings is not in any group
QSettings* langSettings = new QSettings("lang/languages.ini", QSettings::IniFormat);
QMap<QString, QString> langMap;
langSettings->setIniCodec("UTF-8");
langSettings->beginGroup("Languages");
QStringList langList = langSettings->allKeys();
for(int i = 0; i < langList.size(); i++)
langMap.insert(langSettings->value(langList[i]).toString(), langList[i]);
langSettings->endGroup();
delete langSettings;
bool isOk = false;
QString selectedText = QInputDialog::getItem(window, "", "Choose a language:", langMap.keys(), 0, false, &isOk);
if(isOk)
{
guiSettings->beginGroup("lang");
guiSettings->setValue("language", langMap[selectedText]);
guiSettings->endGroup();
guiSettings->sync();
}
return isOk;
}
void Util::gotoRawTab()
{
Util::ui->funcTab->setCurrentIndex(Util::rawTabIndex);
Util::rawDockPtr->setVisible(true);
Util::rawDockPtr->raise();
}
void Util::setUI(Ui::MainWindow *ui)
{
Util::ui = ui;
}
void Util::setRawTab(QDockWidget *dockPtr, int tabIndex)
{
Util::rawDockPtr = dockPtr;
Util::rawTabIndex = tabIndex;
}
+53 -5
View File
@@ -8,26 +8,74 @@
#include <QApplication> #include <QApplication>
#include <QTime> #include <QTime>
#include <QTimer> #include <QTimer>
#include <QMetaType>
#include <QRegularExpression>
#include <QSettings>
#include <QMainWindow>
#include <QInputDialog>
#include <QDockWidget>
#include "ui_mainwindow.h"
class Util : public QObject class Util : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum ClientType
{
CLIENTTYPE_OFFICIAL,
CLIENTTYPE_ICEMAN,
};
struct ReturnTrigger
{
unsigned long waitTime;
QStringList expectedOutputs;
ReturnTrigger(unsigned long time)
{
waitTime = time;
expectedOutputs = QStringList();
}
ReturnTrigger(const QStringList& outputs)
{
waitTime = 10000;
expectedOutputs = outputs;
}
ReturnTrigger(unsigned long time, const QStringList& outputs)
{
waitTime = time;
expectedOutputs = outputs;
}
};
Q_ENUM(Util::ClientType)
explicit Util(QObject *parent = nullptr); explicit Util(QObject *parent = nullptr);
void execCMD(QString cmd); void execCMD(const QString& cmd);
QString execCMDWithOutput(QString cmd, unsigned long timeout = 2000); QString execCMDWithOutput(const QString& cmd, ReturnTrigger trigger = 10000, bool rawOutput = false);
void delay(unsigned int msec); void delay(unsigned int msec);
static ClientType getClientType();
static int rawTabIndex;
static QDockWidget* rawDockPtr;
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window);
public slots: public slots:
void processOutput(QString output); void processOutput(const QString& output);
static void setClientType(Util::ClientType clientType);
void setRunningState(bool st);
static void gotoRawTab();
static void setUI(Ui::MainWindow *ui);
static void setRawTab(QDockWidget* dockPtr, int tabIndex);
private: private:
bool isRequiringOutput; bool isRequiringOutput;
bool isRunning;
QString* requiredOutput; QString* requiredOutput;
QTime timeStamp; QTime timeStamp;
static ClientType clientType;
static Ui::MainWindow *ui;
signals: signals:
void refreshOutput(const QString& output); void refreshOutput(const QString& output);
void write(QString data); void write(QString data); // connected to PM3Process::write(QString data);
}; };
#endif // UTIL_H #endif // UTIL_H
+195
View File
@@ -0,0 +1,195 @@
{
"//": "Based on Proxmark3 official repo v3.1.0, commit 6116334",
"//": "You can change this file if the command format of client changes",
"mifare classic": {
"nested": {
"cmd": "hf mf nested <card type> *",
"card type": {
"mini": "0",
"1k": "1",
"2k": "2",
"4k": "4"
},
"key pattern": "\\|\\s*\\d{3}\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|",
"key A index": 2,
"key B index": 4
},
"check": {
"cmd": "hf mf chk *<card type> ?",
"card type": {
"mini": "0",
"1k": "1",
"2k": "2",
"4k": "4"
},
"key pattern": "\\|\\s*\\d{3}\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|",
"key A index": 2,
"key B index": 3
},
"info": {
"cmd": "hf 14a info"
},
"sniff": {
"cmd": "hf mf sniff"
},
"sniff 14a": {
"cmd": "hf 14a snoop"
},
"list": {
"cmd": "hf list mf"
},
"dump": {
"cmd": "hf mf dump"
},
"restore": {
"cmd": "hf mf restore"
},
"emulator wipe": {
"cmd": "hf mf eclr"
},
"Magic Card wipe": {
"cmd": "hf mf cwipe <card type> f",
"card type": {
"mini": "0",
"1k": "1",
"2k": "2",
"4k": "4"
}
},
"emulator read block": {
"cmd": "hf mf eget <block>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"Magic Card read block": {
"cmd": "hf mf cgetblk <block>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"normal read block": {
"cmd": "hf mf rdbl <block> <key type> <key>",
"key type": {
"A": "A",
"B": "B"
},
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"darkside": {
"cmd": "hf mf mifare"
},
"save sniff": {
"cmd": "hf list mf -s <filename>"
},
"load sniff": {
"cmd": "hf list mf -l <filename>"
},
"hardnested": {
"cmd": "hf mf hardnested <known key block> <known key type> <known key> <target key block> <target key type>",
"known key type": {
"A": "A",
"B": "B"
},
"target key type": {
"A": "A",
"B": "B"
}
},
"normal read sector": {
"cmd": "hf mf rdsc <sector> <key type> <key>",
"key type": {
"A": "A",
"B": "B"
},
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"Magic Card read sector": {
"cmd": "hf mf cgetsc <sector>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"//": "When writing a block, if the result is not empty and doesn't contain the failed flag, the function will return true",
"normal write block": {
"cmd": "hf mf wrbl <block> <key type> <key> <data>",
"key type": {
"A": "A",
"B": "B"
},
"failed flag": [
"isOk:00"
]
},
"Magic Card write block": {
"cmd": "hf mf csetblk <block> <data>",
"failed flag": [
"No chinese magic"
]
},
"emulator write block": {
"cmd": "hf mf eset <block> <data>"
},
"Magic Card lock": {
"cmd": "hf 14a raw ",
"sequence": [
"-pa -b7 40",
"-pa 43",
"-pa E0 00 39 F7",
"-pa E1 00 E1 EE",
"-pa 85 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 18 47",
"-a 52"
]
},
"Magic Card set parameter": {
"cmd": "hf mf csetuid <uid> <atqa> <sak>"
}
},
"lf": {
"read": {
"cmd": "lf read",
"show cmd": "data plot"
},
"sniff": {
"cmd": "lf snoop",
"show cmd": "data plot"
},
"search": {
"cmd": "lf search u"
},
"tune": {
"cmd": "hw tune l"
},
"get config": {
"cmd": "hw status",
"field start": "LF Sampling config:",
"field end": "USB Speed:",
"divisor": {
"flag": "divisor:",
"pattern": "\\d+"
},
"bits per sample": {
"flag": "bps:",
"pattern": "\\d+"
},
"decimation": {
"flag": "decimation:",
"pattern": "\\d+"
},
"averaging": {
"flag": "averaging:",
"pattern": "\\d+"
},
"trigger threshold": {
"flag": "trigger threshold:",
"pattern": "\\d+"
},
"samples to skip": {
"flag": "samples to skip:",
"pattern": "\\d+"
},
"//": "execute 'cmd' then find parameters between 'field stard' and 'field end'",
"//": "for each line, if the line doesn't have any flag, skip",
"//": "otherwise, delete characters before 'flag' and 'flag' itself, then use 'pattern' to get the parameter",
"//": "If 'replace' dict exists, replace all keys with respective values before getting parameters"
},
"set config": {
"cmd": "lf config q <divisor> b <bits per sample> d <decimation> a <averaging> t <trigger threshold> s <samples to skip>",
"divisor cmd": "hw setlfdivisor <divisor>"
}
}
}
+203
View File
@@ -0,0 +1,203 @@
{
"//": "Based on Proxmark3 rrg repo v4.13441, commit 35ddebc",
"//": "You can change this file if the command format of client changes",
"mifare classic": {
"nested": {
"cmd": "hf mf nested --<card type> --blk <block> -<key type> -k <key>",
"static cmd": "hf mf staticnested --<card type> --blk <block> -<key type> -k <key>",
"card type": {
"mini": "mini",
"1k": "1k",
"2k": "2k",
"4k": "4k"
},
"key type": {
"A": "a",
"B": "b"
},
"key pattern": "\\|\\s*\\d{3}\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|",
"key A index": 2,
"key B index": 4
},
"check": {
"cmd": "hf mf chk --<card type>",
"card type": {
"mini": "mini",
"1k": "1k",
"2k": "2k",
"4k": "4k"
},
"key pattern": "\\|\\s*\\d{3}\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|\\s*.+?\\s*\\|",
"key A index": 2,
"key B index": 4
},
"info": {
"cmd": "hf 14a info"
},
"sniff": {
"cmd": "hf sniff"
},
"sniff 14a": {
"cmd": "hf 14a sniff"
},
"list": {
"cmd": "trace list -t mf"
},
"dump": {
"cmd": "hf mf dump"
},
"restore": {
"cmd": "hf mf restore"
},
"emulator wipe": {
"cmd": "hf mf eclr"
},
"Magic Card wipe": {
"cmd": "hf mf cwipe"
},
"emulator read block": {
"cmd": "hf mf egetblk --blk <block>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"Magic Card read block": {
"cmd": "hf mf cgetblk --blk <block>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"normal read block": {
"cmd": "hf mf rdbl --blk <block> -<key type> -k <key>",
"key type": {
"A": "a",
"B": "b"
},
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"darkside": {
"cmd": "hf mf darkside"
},
"save sniff": {
"cmd": "trace save -f <filename>"
},
"load sniff": {
"cmd": "trace load -f <filename>",
"show cmd": "trace list --buffer -t mf"
},
"hardnested": {
"cmd": "hf mf hardnested --blk <known key block> -<known key type> -k <known key> --tblk <target key block> --t<target key type>",
"known key type": {
"A": "a",
"B": "b"
},
"target key type": {
"A": "a",
"B": "b"
}
},
"normal read sector": {
"cmd": "hf mf rdsc --sec <sector> -<key type> -k <key>",
"key type": {
"A": "a",
"B": "b"
},
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"Magic Card read sector": {
"cmd": "hf mf cgetsc --sec <sector>",
"data pattern": "([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}"
},
"//": "When writing a block, if the result is not empty and doesn't contain the failed flag, the function will return true",
"normal write block": {
"cmd": "hf mf wrbl --blk <block> -<key type> -k <key> -d <data>",
"key type": {
"A": "a",
"B": "b"
},
"failed flag": [
"fail",
"error"
]
},
"Magic Card write block": {
"cmd": "hf mf csetblk --blk <block> -d <data>",
"failed flag": [
"fail",
"error"
]
},
"emulator write block": {
"cmd": "hf mf esetblk --blk <block> -d <data>"
},
"Magic Card lock": {
"cmd": "hf 14a raw ",
"sequence": [
"-ak -b 7 40",
"-ak 43",
"-ak E0 00 39 F7",
"-ak E1 00 E1 EE",
"-ak 85 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 18 47",
"-a 52"
]
},
"Magic Card set parameter": {
"cmd": "hf mf csetuid --uid <uid> --atqa <atqa> --sak <sak>"
}
},
"lf": {
"read": {
"cmd": "lf read -v",
"show cmd": "data plot"
},
"sniff": {
"cmd": "lf sniff -v",
"show cmd": "data plot"
},
"search": {
"cmd": "lf search -u"
},
"tune": {
"cmd": "lf tune --divisor <divisor>"
},
"get config": {
"cmd": "hw status",
"field start": "LF Sampling config",
"field end": "LF Sampling Stack",
"divisor": {
"flag": "divisor",
"pattern": "\\d+"
},
"bits per sample": {
"flag": "bits per sample",
"pattern": "\\d+"
},
"decimation": {
"flag": "decimation",
"pattern": "\\d+"
},
"averaging": {
"flag": "averaging",
"pattern": "\\d+",
"replace": {
"yes": "1",
"no": "0",
"Yes": "1",
"No": "0"
}
},
"trigger threshold": {
"flag": "trigger threshold",
"pattern": "\\d+"
},
"samples to skip": {
"flag": "samples to skip",
"pattern": "\\d+"
},
"//": "execute 'cmd' then find parameters between 'field stard' and 'field end'",
"//": "for each line, if the line doesn't have any flag, skip",
"//": "otherwise, delete characters before 'flag' and 'flag' itself, then use 'pattern' to get the parameter",
"//": "If 'replace' dict exists, replace all keys with respective values before getting parameters"
},
"set config": {
"cmd": "lf config --divisor <divisor> --bps <bits per sample> --dec <decimation> --avg <averaging> --trig <trigger threshold> --skip <samples to skip>",
"divisor cmd": "hw setlfdivisor -d <divisor>"
}
}
}
BIN
View File
Binary file not shown.
+1228 -445
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
[Languages]
en_US=English
zh_CN=简体中文
BIN
View File
Binary file not shown.
+1003 -249
View File
File diff suppressed because it is too large Load Diff
+24 -29
View File
@@ -4,54 +4,49 @@
#include <QSettings> #include <QSettings>
#include <QTranslator> #include <QTranslator>
#include <QMessageBox> #include <QMessageBox>
#include <QInputDialog> #include <QTextCodec>
#include <QDir>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QDir *langPath = new QDir();
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat); QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat);
QVariant lang = settings->value("lang", "null"); settings->setIniCodec("UTF-8");
if(lang == "null") settings->beginGroup("lang");
QString currLang = settings->value("language", "").toString();
settings->endGroup();
if(currLang == "")
{ {
#ifdef Q_OS_WIN if(Util::chooseLanguage(settings, &w))
lang = "lang/en_US.qm";
#else
lang = "lang/en_US.ts";
#endif
QStringList langList;
langList.append("English");
langList.append("简体中文");
QString seletedText = QInputDialog::getItem(&w, "", "Choose a language:", langList, 0, false);
if(seletedText == "English")
{ {
#ifdef Q_OS_WIN settings->beginGroup("lang");
lang = "lang/en_US.qm"; currLang = settings->value("language", "").toString();
#else settings->endGroup();
lang = "lang/en_US.ts";
#endif
}
else if(seletedText == "简体中文")
{
#ifdef Q_OS_WIN
lang = "lang/zh_CN.qm";
#else
lang = "lang/zh_CN.ts";
#endif
} }
else
currLang = "en_US";
} }
currLang += ".qm";
langPath->cd("lang");
QTranslator* translator = new QTranslator(&w); QTranslator* translator = new QTranslator(&w);
if(translator->load(lang.toString())) if(translator->load(currLang, langPath->absolutePath()))
{ {
a.installTranslator(translator); a.installTranslator(translator);
settings->setValue("lang", lang);
} }
else else
{ {
QMessageBox::information(&w, "Error", "Can't load " + lang.toString() + " as translation file."); QMessageBox::information(&w, "Error", "Can't load " + currLang + " as translation file.");
} }
delete settings; delete settings;
delete langPath;
w.initUI(); w.initUI();
w.show(); w.show();
return a.exec(); return a.exec();
} }
+154
View File
@@ -0,0 +1,154 @@
#include "lf.h"
#include <QJsonArray>
const LF::LFConfig LF::defaultLFConfig;
LF::LF(Ui::MainWindow *ui, Util *addr, QWidget *parent): QObject(parent)
{
this->parent = parent;
util = addr;
this->ui = ui;
LFconfigPattern = new QRegularExpression("(\\d+)|Yes|No");
currLFConfig = defaultLFConfig;
}
void LF::read()
{
QVariantMap config = configMap["read"].toMap();
util->execCMD(config["cmd"].toString());
Util::gotoRawTab();
util->execCMD(config["show cmd"].toString());
}
void LF::sniff()
{
QVariantMap config = configMap["sniff"].toMap();
util->execCMD(config["cmd"].toString());
Util::gotoRawTab();
util->execCMD(config["show cmd"].toString());
}
void LF::search()
{
QVariantMap config = configMap["search"].toMap();
util->execCMD(config["cmd"].toString());
Util::gotoRawTab();
}
void LF::tune()
{
QVariantMap config = configMap["tune"].toMap();
QString cmd = config["cmd"].toString();
cmd.replace("<divisor>", QString::number(currLFConfig.divisor));
util->execCMD(cmd);
Util::gotoRawTab();
}
bool LF::getLFConfig_helper(const QVariantMap& map, QString& str, int* result)
{
int len;
QString flag = map["flag"].toString();
QRegularExpressionMatch reMatch;
if(!str.contains(flag))
return false;
len = str.length() - (str.indexOf(flag) + flag.length());
str = str.right(len);
if(map.contains("replace"))
{
QVariantMap table = map["replace"].toMap();
for(auto it = table.begin(); it != table.end(); it++)
{
str.replace(it.key(), it.value().toString());
}
}
reMatch = QRegularExpression(map["pattern"].toString()).match(str);
if(!reMatch.hasMatch())
return false;
*result = reMatch.captured().toInt();
qDebug() << *result;
return true;
}
void LF::getLFConfig()
{
QRegularExpressionMatch reMatch;
QString result;
QStringList resultList;
int start, end, temp;
QVariantMap config = configMap["get config"].toMap();
QString cmd = config["cmd"].toString();
result = util->execCMDWithOutput(cmd, 400);
start = result.indexOf(config["field start"].toString());
end = result.indexOf(config["field end"].toString());
result = result.mid(start, end - start);
resultList = result.split("\n", Qt::SkipEmptyParts);
qDebug() << "LF CONFIG GET\n" << resultList;
for(auto it = resultList.begin(); it != resultList.end(); it++)
{
if(getLFConfig_helper(config["divisor"].toMap(), *it, &temp))
currLFConfig.divisor = temp;
else if(getLFConfig_helper(config["bits per sample"].toMap(), *it, &temp))
currLFConfig.bitsPerSample = temp;
else if(getLFConfig_helper(config["decimation"].toMap(), *it, &temp))
currLFConfig.decimation = temp;
else if(getLFConfig_helper(config["averaging"].toMap(), *it, &temp))
currLFConfig.averaging = (bool)temp;
else if(getLFConfig_helper(config["trigger threshold"].toMap(), *it, &temp))
currLFConfig.triggerThreshold = temp;
else if(getLFConfig_helper(config["samples to skip"].toMap(), *it, &temp))
currLFConfig.samplesToSkip = temp;
}
syncWithUI();
}
void LF::setLFConfig(LF::LFConfig lfconfig)
{
currLFConfig = lfconfig;
QVariantMap config = configMap["set config"].toMap();
QString cmd = config["cmd"].toString();
cmd.replace("<divisor>", QString::number(currLFConfig.divisor));
cmd.replace("<bits per sample>", QString::number(currLFConfig.bitsPerSample));
cmd.replace("<decimation>", QString::number(currLFConfig.decimation));
cmd.replace("<averaging>", currLFConfig.averaging ? "1" : "0");
cmd.replace("<trigger threshold>", QString::number(currLFConfig.triggerThreshold));
cmd.replace("<samples to skip>", QString::number(currLFConfig.samplesToSkip));
util->execCMDWithOutput(cmd, 500);
cmd = config["divisor cmd"].toString();
cmd.replace("<divisor>", QString::number(currLFConfig.divisor));
util->execCMDWithOutput(cmd, 500);
}
void LF::resetLFConfig()
{
setLFConfig(defaultLFConfig);
getLFConfig();
}
float LF::divisor2Freq(uint8_t divisor)
{
return (12000.0 / (divisor + 1.0));
}
uint8_t LF::freq2Divisor(float freq)
{
return ((uint16_t)(12000.0 / freq + 0.5) - 1); // uint16_t for (divisor + 1) = 256
}
void LF::syncWithUI()
{
ui->LF_LFConf_freqDivisorBox->setValue(currLFConfig.divisor); // will trigger valueChanged()
ui->LF_LFConf_bitsPerSampleBox->setValue(currLFConfig.bitsPerSample);
ui->LF_LFConf_decimationBox->setValue(currLFConfig.decimation);
ui->LF_LFConf_averagingBox->setChecked(currLFConfig.averaging);
ui->LF_LFConf_thresholdBox->setValue(currLFConfig.triggerThreshold);
ui->LF_LFConf_skipsBox->setValue(currLFConfig.samplesToSkip);
}
void LF::setConfigMap(const QVariantMap& configMap)
{
this->configMap = configMap;
qDebug() << configMap;
}
+59
View File
@@ -0,0 +1,59 @@
#ifndef LF_H
#define LF_H
#include <QObject>
#include "common/util.h"
#include "ui_mainwindow.h"
class LF : public QObject
{
Q_OBJECT
public:
explicit LF(Ui::MainWindow *ui, Util *addr, QWidget *parent = nullptr);
struct LFConfig
{
uint8_t divisor;
uint8_t bitsPerSample;
uint8_t decimation;
bool averaging;
uint8_t triggerThreshold;
uint16_t samplesToSkip;
};
static constexpr LFConfig defaultLFConfig =
{
95,
8,
1,
true,
0,
0
};
void read();
void sniff();
void search();
void tune();
void getLFConfig();
void setLFConfig(LF::LFConfig lfconfig);
void resetLFConfig();
static float divisor2Freq(uint8_t divisor);
static uint8_t freq2Divisor(float freq);
void setConfigMap(const QVariantMap &configMap);
private:
QWidget* parent;
Ui::MainWindow *ui;
Util* util;
LFConfig currLFConfig;
QRegularExpression* LFconfigPattern;
QVariantMap configMap;
void syncWithUI();
bool getLFConfig_helper(const QVariantMap& map, QString& str, int* result);
signals:
};
#endif // LF_H
+880 -382
View File
File diff suppressed because it is too large Load Diff
+82 -67
View File
@@ -5,29 +5,24 @@
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "ui/mf_attack_hardnesteddialog.h" #include "ui/mf_attack_hardnesteddialog.h"
#include "ui/mf_uid_parameterdialog.h" #include "ui/mf_uid_parameterdialog.h"
#include "ui/mf_sim_simdialog.h"
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QRegExp> #include <QRegularExpression>
#include <QMessageBox> #include <QMessageBox>
#include <QJsonObject>
class Mifare : public QObject class Mifare : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Mifare(Ui::MainWindow *ui, Util *addr, QWidget *parent = nullptr); explicit Mifare(Ui::MainWindow *ui, Util *addr, QWidget *parent = nullptr);
QString info(bool isRequiringOutput = false); enum KeyType
void chk(); {
void nested(); KEY_A = 'A',
void hardnested(); KEY_B = 'B',
void sniff(); };
void list();
void read();
void readAll();
void write();
void writeAll();
void dump();
void restore();
enum DataType enum DataType
{ {
@@ -38,73 +33,88 @@ public:
struct CardType struct CardType
{ {
int type; quint8 type;
int sectors; quint8 sector_size;
int blocks; quint16 block_size;
int blk[40]; quint8 blk[40];
int blks[40]; quint8 blks[40];
QString typeText;
}; };
const CardType card_mini = enum AccessType
{ {
0, ACC_NEVER = 0,
5, ACC_KEY_A = 1,
20, ACC_KEY_B = 2,
{4, 4, 4, 4, 4}, ACC_KEY_AB = 3,
{0, 4, 8, 12, 16}
};
const CardType card_1k =
{
1,
16,
64,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60}
};
const CardType card_2k =
{
2,
32,
128,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124}
};
const CardType card_4k =
{
4,
40,
256,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, 16, 16},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 144, 160, 176, 192, 208, 224, 240}
}; };
void data_clearData(); enum TargetType
void data_clearKey(); {
bool data_isKeyValid(const QString &key); TARGET_MIFARE,
Mifare::DataType data_isDataValid(QString data); TARGET_UID,
TARGET_EMULATOR,
};
static const CardType card_mini;
static const CardType card_1k;
static const CardType card_2k;
static const CardType card_4k;
static const AccessType dataCondition[8][4];
static const AccessType trailerReadCondition[8][3];
static const AccessType trailerWriteCondition[8][3];
QMap<QString, QString> info(bool isRequiringOutput = false);
void chk();
void nested(bool isStaticNested = false);
void darkside();
void hardnested();
void sniff();
void sniff14a();
void list();
void readOne(TargetType targetType = TARGET_MIFARE);
void readSelected(TargetType targetType = TARGET_MIFARE);
void writeOne(TargetType targetType = TARGET_MIFARE);
void writeSelected(TargetType targetType = TARGET_MIFARE);
void dump();
void restore();
void data_clearData(bool clearAll = true);
void data_clearKey(bool clearAll = true);
static bool data_isKeyValid(const QString& key);
static Mifare::DataType data_isDataValid(const QString& data);
void data_syncWithDataWidget(bool syncAll = true, int block = 0); void data_syncWithDataWidget(bool syncAll = true, int block = 0);
void data_syncWithKeyWidget(bool syncAll = true, int sector = 0, bool isKeyA = true); void data_syncWithKeyWidget(bool syncAll = true, int sector = 0, KeyType keyType = KEY_A);
CardType cardType; CardType cardType;
Mifare::CardType getCardType(); Mifare::CardType getCardType();
void setCardType(int type); void setCardType(int type);
void writeAllC();
void writeC();
void readAllC();
void readC();
void wipeC(); void wipeC();
void setParameterC(); void setParameterC();
bool data_loadDataFile(const QString &filename); bool data_loadDataFile(const QString& filename);
bool data_loadKeyFile(const QString &filename); bool data_loadKeyFile(const QString& filename);
bool data_saveDataFile(const QString& filename, bool isBin); bool data_saveDataFile(const QString& filename, bool isBin);
bool data_saveKeyFile(const QString &filename, bool isBin); bool data_saveKeyFile(const QString& filename, bool isBin);
void data_key2Data(); void data_key2Data();
void data_data2Key(); void data_data2Key();
void data_setData(int block, const QString &data); void data_setData(int block, const QString& data);
void data_setKey(int sector, bool isKeyA, const QString &key); void data_setKey(int sector, KeyType keyType, const QString& key);
void lockC(); void lockC();
void wipeE();
void simulate();
void loadSniff(const QString& file);
void saveSniff(const QString& file);
void data_fillKeys();
static QList<quint8> data_getACBits(const QString& text);
static int data_b2s(int block);
static bool data_isACBitsValid(const QString& text, QList<quint8> *returnHalfBytes = nullptr);
QString data_getUID();
quint16 getTrailerBlockId(quint8 sectorId, qint8 cardTypeId = -1); // -1: use current cardtype
void setConfigMap(const QVariantMap& configMap);
public slots: public slots:
signals: signals:
@@ -113,14 +123,19 @@ private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
Util* util; Util* util;
QVariantMap configMap;
QStringList* keyAList; QStringList* keyAList;
QStringList* keyBList; QStringList* keyBList;
QStringList* dataList; QStringList* dataList;
QRegExp* dataPattern; QRegularExpression* dataPattern;
QRegExp* chkKeyPattern; QRegularExpression* keyPattern_res;
QRegExp* nestedKeyPattern; QRegularExpression* keyPattern;
QRegExp* UIDPattern; QString bin2text(const QByteArray& buff, int start, int length);
QString bin2text(const QByteArray &buff, int start, int length);
QString _readblk(int blockId, KeyType keyType, const QString& key, TargetType targetType = TARGET_MIFARE, int waitTime = 300);
QStringList _readsec(int sectorId, KeyType keyType, const QString& key, TargetType targetType = TARGET_MIFARE, int waitTime = 300);
bool _writeblk(int blockId, KeyType keyType, const QString& key, const QString& data, TargetType targetType = TARGET_MIFARE, int waitTime = 300);
}; };
#endif // MIFARE_H #endif // MIFARE_H
+851 -97
View File
File diff suppressed because it is too large Load Diff
+135 -18
View File
@@ -16,13 +16,27 @@
#include <QMimeData> #include <QMimeData>
#include <QAction> #include <QAction>
#include <QDesktopServices> #include <QDesktopServices>
#include <QGroupBox>
#include <QSizePolicy>
#include <QSettings>
#include <QPushButton>
#include <QProcessEnvironment>
#include <QScrollBar>
#include <QTimer>
#include <QDateTime>
#include <QDockWidget>
#include <QMenu>
#include "common/myeventfilter.h"
#include "common/pm3process.h" #include "common/pm3process.h"
#include "module/mifare.h" #include "module/mifare.h"
#include "module/lf.h"
#include "common/util.h" #include "common/util.h"
#include "ui/mf_trailerdecoderdialog.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { namespace Ui
{
class MainWindow; class MainWindow;
} }
QT_END_NAMESPACE QT_END_NAMESPACE
@@ -38,11 +52,13 @@ public:
void initUI(); void initUI();
bool eventFilter(QObject *watched, QEvent *event); bool eventFilter(QObject *watched, QEvent *event);
public slots: public slots:
void refreshOutput(const QString &output); void refreshOutput(const QString& output);
void refreshCMD(const QString &cmd); void refreshCMD(const QString& cmd);
void setStatusBar(QLabel* target, const QString & text); void setStatusBar(QLabel* target, const QString& text);
void onPM3StateChanged(bool st, QString info); void onPM3StateChanged(bool st, const QString& info);
void MF_onTypeChanged(int id, bool st); void MF_onMFCardTypeChanged(int id, bool st);
void on_Raw_keyPressed(QObject *obj_addr, QEvent &event);
void on_MF_keyWidget_resized(QObject *obj_addr, QEvent &event);
private slots: private slots:
void on_PM3_connectButton_clicked(); void on_PM3_connectButton_clicked();
@@ -54,7 +70,8 @@ private slots:
void on_Raw_clearOutputButton_clicked(); void on_Raw_clearOutputButton_clicked();
void sendMSG(); void sendMSG();
void on_PM3_refreshPortButton_clicked();
void on_portSearchTimer_timeout();
void on_Raw_CMDHistoryBox_stateChanged(int arg1); void on_Raw_CMDHistoryBox_stateChanged(int arg1);
@@ -72,7 +89,7 @@ private slots:
void on_MF_Sniff_listButton_clicked(); void on_MF_Sniff_listButton_clicked();
void on_MF_RW_readAllButton_clicked(); void on_MF_RW_readSelectedButton_clicked();
void on_MF_RW_readBlockButton_clicked(); void on_MF_RW_readBlockButton_clicked();
@@ -80,18 +97,17 @@ private slots:
void on_MF_Attack_infoButton_clicked(); void on_MF_Attack_infoButton_clicked();
void on_MF_RW_writeAllButton_clicked(); void on_MF_RW_writeSelectedButton_clicked();
void on_MF_RW_dumpButton_clicked(); void on_MF_RW_dumpButton_clicked();
void on_MF_RW_restoreButton_clicked(); void on_MF_RW_restoreButton_clicked();
void on_MF_UID_readAllButton_clicked(); void on_MF_UID_readSelectedButton_clicked();
void on_MF_UID_readBlockButton_clicked(); void on_MF_UID_readBlockButton_clicked();
void on_MF_UID_writeAllButton_clicked(); void on_MF_UID_writeSelectedButton_clicked();
void on_MF_UID_writeBlockButton_clicked(); void on_MF_UID_writeBlockButton_clicked();
@@ -99,9 +115,9 @@ private slots:
void on_MF_File_saveButton_clicked(); void on_MF_File_saveButton_clicked();
void on_MF_data2KeyBotton_clicked(); void on_MF_data2KeyButton_clicked();
void on_MF_key2DataBotton_clicked(); void on_MF_key2DataButton_clicked();
void on_MF_dataWidget_itemChanged(QTableWidgetItem *item); void on_MF_dataWidget_itemChanged(QTableWidgetItem *item);
@@ -119,31 +135,132 @@ private slots:
void on_MF_UID_lockButton_clicked(); void on_MF_UID_lockButton_clicked();
void on_MF_Sim_readSelectedButton_clicked();
void on_MF_Sim_writeSelectedButton_clicked();
void on_MF_Sim_clearButton_clicked();
void on_MF_Sim_simButton_clicked();
void on_MF_Sniff_loadButton_clicked();
void on_MF_Sniff_saveButton_clicked();
void on_GroupBox_clicked(bool checked);
void on_MF_selectAllBox_stateChanged(int arg1);
void on_MF_fillKeysButton_clicked();
void on_MF_14aSniff_snoopButton_clicked();
void on_MF_trailerDecoderButton_clicked();
void on_MF_selectTrailerBox_stateChanged(int arg1);
void on_stopButton_clicked();
void on_Raw_CMDEdit_textChanged(const QString &arg1);
void on_MF_Attack_darksideButton_clicked();
void on_Set_Client_startArgsEdit_editingFinished();
void on_Set_Client_forceEnabledBox_stateChanged(int arg1);
void on_Set_GUI_setLanguageButton_clicked();
void setButtonsEnabled(bool st);
void on_PM3_refreshPortButton_clicked();
void on_Set_Client_envScriptEdit_editingFinished();
void on_Set_Client_keepClientActiveBox_stateChanged(int arg1);
void on_LF_LFConf_freqSlider_valueChanged(int value);
void on_LF_LFConf_freqDivisorBox_valueChanged(int arg1);
void on_LF_LFConf_freq125kButton_clicked();
void on_LF_LFConf_freq134kButton_clicked();
void on_LF_Op_searchButton_clicked();
void on_LF_Op_readButton_clicked();
void on_LF_Op_tuneButton_clicked();
void on_LF_Op_sniffButton_clicked();
void on_LF_LFConf_getButton_clicked();
void on_LF_LFConf_setButton_clicked();
void on_LF_LFConf_resetButton_clicked();
void on_Set_Client_workingDirEdit_editingFinished();
void on_Set_Client_configPathEdit_editingFinished();
private: private:
Ui::MainWindow* ui; Ui::MainWindow* ui;
QButtonGroup* typeBtnGroup; QButtonGroup* MFCardTypeBtnGroup;
QLabel* connectStatusBar; QLabel* connectStatusBar;
QLabel* programStatusBar; QLabel* programStatusBar;
QLabel* PM3VersionBar; QLabel* PM3VersionBar;
QPushButton* stopButton;
QAction* dockAllWindows;
QAction* myInfo; QAction* myInfo;
QAction* currVersion;
QAction* checkUpdate;
QSettings* settings;
MyEventFilter* keyEventFilter;
MyEventFilter* resizeEventFilter;
QString stashedCMDEditText;
int stashedIndex = -1;
void uiInit(); void uiInit();
PM3Process* pm3; PM3Process* pm3;
bool pm3state; bool pm3state;
bool keepButtonsEnabled;
bool keepClientActive;
QThread* pm3Thread; QThread* pm3Thread;
QTimer* portSearchTimer;
QStringList portList;
QStringList clientEnv;
QDir* clientWorkingDir;
Mifare* mifare; Mifare* mifare;
LF* lf;
Util* util; Util* util;
QList<QDockWidget*> dockList;
QMenu* contextMenu;
MF_trailerDecoderDialog* decDialog;
void signalInit(); void signalInit();
void MF_widgetReset(); void MF_widgetReset();
void setTableItem(QTableWidget *widget, int row, int column, const QString &text); void setTableItem(QTableWidget *widget, int row, int column, const QString& text);
void setState(bool st); void setState(bool st);
void saveClientPath(const QString& path);
void onLFfreqConfChanged(int value, bool isCustomized);
void dockInit();
void loadConfig();
protected:
void contextMenuEvent(QContextMenuEvent *event) override;
signals: signals:
void connectPM3(const QString path, const QString port); void connectPM3(const QString& path, const QStringList args);
void reconnectPM3();
void killPM3(); void killPM3();
void setSerialListener(const QString &name, bool state); void setSerialListener(bool state);
void setSerialListener(const QString& name, bool state);
void setProcEnv(const QStringList *env);
void setWorkingDir(const QString& dir);
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H
+1949 -104
View File
File diff suppressed because it is too large Load Diff
+11 -13
View File
@@ -1,16 +1,17 @@
#include "mf_attack_hardnesteddialog.h" #include "mf_attack_hardnesteddialog.h"
#include "ui_mf_attack_hardnesteddialog.h" #include "ui_mf_attack_hardnesteddialog.h"
MF_Attack_hardnestedDialog::MF_Attack_hardnestedDialog(int blocks, QWidget *parent) : MF_Attack_hardnestedDialog::MF_Attack_hardnestedDialog(int blocks, const QVariantMap& config, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::MF_Attack_hardnestedDialog) ui(new Ui::MF_Attack_hardnestedDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
for(int i = 0; i < blocks; i++) for(int i = 0; i < blocks; i++)
{ {
ui->knownKeySectorBox->addItem(QString::number(i)); ui->knownKeyBlockBox->addItem(QString::number(i));
ui->targetKeySectorBox->addItem(QString::number(i)); ui->targetKeyBlockBox->addItem(QString::number(i));
} }
this->config = config;
} }
@@ -21,14 +22,11 @@ MF_Attack_hardnestedDialog::~MF_Attack_hardnestedDialog()
void MF_Attack_hardnestedDialog::on_buttonBox_accepted() void MF_Attack_hardnestedDialog::on_buttonBox_accepted()
{ {
emit sendCMD("hf mf hardnested " QString cmd = config["cmd"].toString();
+ ui->knownKeySectorBox->currentText() cmd.replace("<known key block>", ui->knownKeyBlockBox->currentText());
+ " " cmd.replace("<known key type>", config["known key type"].toMap()[ui->knownKeyTypeBox->currentText()].toString());
+ ui->knownKeyTypeBox->currentText() cmd.replace("<known key>", ui->knownKeyBox->text());
+ " " cmd.replace("<target key block>", ui->targetKeyBlockBox->currentText());
+ ui->knownKeyBox->text() cmd.replace("<target key type>", config["target key type"].toMap()[ui->targetKeyTypeBox->currentText()].toString());
+ " " emit sendCMD(cmd);
+ ui->targetKeySectorBox->currentText()
+ " "
+ ui->targetKeyTypeBox->currentText());
} }
+6 -3
View File
@@ -2,8 +2,10 @@
#define MF_ATTACK_HARDNESTEDDIALOG_H #define MF_ATTACK_HARDNESTEDDIALOG_H
#include <QDialog> #include <QDialog>
#include "common/util.h"
namespace Ui { namespace Ui
{
class MF_Attack_hardnestedDialog; class MF_Attack_hardnestedDialog;
} }
@@ -12,14 +14,15 @@ class MF_Attack_hardnestedDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit MF_Attack_hardnestedDialog(int blocks, QWidget *parent = nullptr); explicit MF_Attack_hardnestedDialog(int blocks, const QVariantMap& config, QWidget *parent = nullptr);
~MF_Attack_hardnestedDialog(); ~MF_Attack_hardnestedDialog();
private: private:
Ui::MF_Attack_hardnestedDialog *ui; Ui::MF_Attack_hardnestedDialog *ui;
QVariantMap config;
signals: signals:
void sendCMD(QString cmd); void sendCMD(const QString& cmd);
private slots: private slots:
void on_buttonBox_accepted(); void on_buttonBox_accepted();
}; };
+2 -2
View File
@@ -31,7 +31,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="knownKeySectorBox"> <widget class="QComboBox" name="knownKeyBlockBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
@@ -106,7 +106,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="targetKeySectorBox"> <widget class="QComboBox" name="targetKeyBlockBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>60</width> <width>60</width>
+103
View File
@@ -0,0 +1,103 @@
#include "mf_sim_simdialog.h"
#include "ui_mf_sim_simdialog.h"
MF_Sim_simDialog::MF_Sim_simDialog(int cardType, QString cardTypeText, QWidget *parent) :
QDialog(parent),
ui(new Ui::MF_Sim_simDialog)
{
ui->setupUi(this);
if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL)
{
ui->atqaGroupBox->setVisible(false);
ui->atqaLine->setVisible(false);
ui->sakGroupBox->setVisible(false);
ui->sakLine->setVisible(false);
ui->vGroupBox->setVisible(false);
ui->vLine->setVisible(false);
}
else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN)
{
ui->fGroupBox->setVisible(false);
ui->fLine->setVisible(false);
ui->rGroupBox->setVisible(false);
ui->rLine->setVisible(false);
ui->uBox->setText("-u");
ui->nBox->setText("-n");
ui->iBox->setText("-i");
ui->xBox->setText("--crack");
ui->eBox->setText("-e");
}
this->cardType = cardType;
this->cardTypeText = cardTypeText;
}
MF_Sim_simDialog::~MF_Sim_simDialog()
{
delete ui;
}
void MF_Sim_simDialog::on_eBox_clicked(bool checked)
{
if(checked)
{
ui->iBox->setChecked(true);
ui->xBox->setChecked(true);
}
if(!ui->eBox->isChecked() && !ui->fBox->isChecked())
{
ui->iBox->setEnabled(true);
ui->xBox->setEnabled(true);
}
else
{
ui->iBox->setEnabled(false);
ui->xBox->setEnabled(false);
}
}
void MF_Sim_simDialog::on_fBox_clicked(bool checked)
{
if(checked)
{
ui->iBox->setChecked(true);
ui->xBox->setChecked(true);
}
if(!ui->eBox->isChecked() && !ui->fBox->isChecked())
{
ui->iBox->setEnabled(true);
ui->xBox->setEnabled(true);
}
else
{
ui->iBox->setEnabled(false);
ui->xBox->setEnabled(false);
}
}
void MF_Sim_simDialog::on_buttonBox_accepted()
{
QString paras;
if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL)
{
paras += (ui->uBox->isChecked() ? "u " + ui->uEdit->text() + " " : "");
paras += (ui->nBox->isChecked() ? "n " + ui->nEdit->text() + " " : "");
paras += (ui->iBox->isChecked() ? "i " : "");
paras += (ui->xBox->isChecked() ? "x " : "");
paras += (ui->eBox->isChecked() ? "e " : "");
paras += (ui->fBox->isChecked() ? "f " + ui->fEdit->text() + " " : "");
paras += (ui->rBox->isChecked() ? "r " : "");
emit sendCMD(QString("hf mf sim ") + "*" + QString::number(cardType) + " " + paras.trimmed());
}
else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN)
{
paras += (ui->uBox->isChecked() ? "-u " + ui->uEdit->text() + " " : "");
paras += (ui->atqaBox->isChecked() ? "--atqa " + ui->atqaEdit->text() + " " : "");
paras += (ui->sakBox->isChecked() ? "--sak " + ui->sakEdit->text() + " " : "");
paras += (ui->nBox->isChecked() ? "-n " + ui->nEdit->text() + " " : "");
paras += (ui->iBox->isChecked() ? "-i " : "");
paras += (ui->xBox->isChecked() ? "--crack " : "");
paras += (ui->eBox->isChecked() ? "-e " : "");
paras += (ui->vBox->isChecked() ? "-v " : "");
emit sendCMD(QString("hf mf sim --") + cardTypeText + " " + paras.trimmed());
}
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef MF_SIM_SIMDIALOG_H
#define MF_SIM_SIMDIALOG_H
#include <QDialog>
#include <QDebug>
#include "common/util.h"
namespace Ui
{
class MF_Sim_simDialog;
}
class MF_Sim_simDialog : public QDialog
{
Q_OBJECT
public:
explicit MF_Sim_simDialog(int cardType, QString cardTypeText, QWidget *parent = nullptr);
~MF_Sim_simDialog();
private slots:
void on_eBox_clicked(bool checked);
void on_fBox_clicked(bool checked);
private:
Ui::MF_Sim_simDialog *ui;
int cardType;
QString cardTypeText;
signals:
void sendCMD(const QString& cmd);
private slots:
void on_buttonBox_accepted();
};
#endif // MF_SIM_SIMDIALOG_H
+667
View File
@@ -0,0 +1,667 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MF_Sim_simDialog</class>
<widget class="QDialog" name="MF_Sim_simDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<height>524</height>
</rect>
</property>
<property name="windowTitle">
<string>Simulate</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="uGroupBox">
<layout class="QHBoxLayout" name="uLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="uBox">
<property name="text">
<string>u</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="uEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UID 4 or 7 bytes. If not specified, the UID 4B from emulator memory will be used</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="uLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="atqaGroupBox">
<layout class="QHBoxLayout" name="atqaLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="atqaBox">
<property name="text">
<string>--atqa</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="atqaEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Provide explicit ATQA (2 bytes)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="atqaLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="sakGroupBox">
<layout class="QHBoxLayout" name="sakLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="sakBox">
<property name="text">
<string>--sak</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="sakEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Provide explicit SAK (1 byte)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="sakLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="nGroupBox">
<layout class="QHBoxLayout" name="nLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="nBox">
<property name="text">
<string>n</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically exit simulation after &lt;numreads&gt; blocks have been read by reader. 0 = infinite</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="nLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="iGroupBox">
<layout class="QHBoxLayout" name="iLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="iBox">
<property name="text">
<string>i</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interactive, means that console will not be returned until simulation finishes or is aborted</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="iLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="xGroupBox">
<layout class="QHBoxLayout" name="xLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="xBox">
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="xLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="eGroupBox">
<layout class="QHBoxLayout" name="eLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="eBox">
<property name="text">
<string>e</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>set keys found from 'reader attack' to emulator memory (implies x(--crack) and i)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="eLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="fGroupBox">
<layout class="QHBoxLayout" name="fLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="fBox">
<property name="text">
<string>f</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>get UIDs to use for 'reader attack' from file 'f &lt;filename.txt&gt;' (implies x and i)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="fLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="rGroupBox">
<layout class="QHBoxLayout" name="rLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="rBox">
<property name="text">
<string>r</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Generate random nonces instead of sequential nonces. Standard reader attack won't work with this option, only moebius attack works</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="rLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="vGroupBox">
<layout class="QHBoxLayout" name="vLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="vBox">
<property name="text">
<string>-v</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>verbose output</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="vLine">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MF_Sim_simDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MF_Sim_simDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+154
View File
@@ -0,0 +1,154 @@
#include "mf_trailerdecoderdialog.h"
#include "ui_mf_trailerdecoderdialog.h"
MF_trailerDecoderDialog::MF_trailerDecoderDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::MF_trailerDecoderDialog)
{
ui->setupUi(this);
QRegularExpression re("(([0-9a-fA-F]{2} ){0,4})|([0-9a-fA-F]{0,8})");
validator = new QRegularExpressionValidator(this);
validator->setRegularExpression(re);
ui->accessBitsEdit->setValidator(validator);
sizeGroup = new QButtonGroup(this);
sizeGroup->addButton(ui->size4Button, 4);
sizeGroup->addButton(ui->size16Button, 16);
connect(sizeGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), this, &MF_trailerDecoderDialog::on_blockSizeChanged);
connect(ui->C0Box, QOverload<int>::of(&QSpinBox::valueChanged), this, &MF_trailerDecoderDialog::on_boxChanged);
connect(ui->C1Box, QOverload<int>::of(&QSpinBox::valueChanged), this, &MF_trailerDecoderDialog::on_boxChanged);
connect(ui->C2Box, QOverload<int>::of(&QSpinBox::valueChanged), this, &MF_trailerDecoderDialog::on_boxChanged);
connect(ui->C3Box, QOverload<int>::of(&QSpinBox::valueChanged), this, &MF_trailerDecoderDialog::on_boxChanged);
ui->dataBlockWidget->setRowCount(3);
ui->dataBlockWidget->setColumnCount(4);
ui->trailerBlockWidget->setRowCount(2);
ui->trailerBlockWidget->setColumnCount(3);
}
MF_trailerDecoderDialog::~MF_trailerDecoderDialog()
{
delete ui;
}
void MF_trailerDecoderDialog::on_accessBitsEdit_textChanged(const QString &arg1)
{
ui->C0Box->blockSignals(true);
ui->C1Box->blockSignals(true);
ui->C2Box->blockSignals(true);
ui->C3Box->blockSignals(true);
QList<quint8> ACBits = Mifare::data_getACBits(arg1);
if(ACBits.size() == 0)
{
ui->isAccessBitsValidLabel->setStyleSheet("color:rgb(200, 0, 0)");
ui->isAccessBitsValidLabel->setText(tr("Invalid!\nIt could make the whole sector blocked irreversibly!"));
}
else
{
ui->C0Box->setValue(ACBits[0]);
ui->C1Box->setValue(ACBits[1]);
ui->C2Box->setValue(ACBits[2]);
ui->C3Box->setValue(ACBits[3]);
ui->isAccessBitsValidLabel->setStyleSheet("color:rgb(0, 200, 0)");
ui->isAccessBitsValidLabel->setText(tr("Valid"));
bool isKeyBReadable = ACBits[3] == 0 || ACBits[3] == 1 || ACBits[3] == 4;
for(int j = 0; j < 3; j++)
{
setTableItem(ui->trailerBlockWidget, 0, j, Mifare::trailerReadCondition[ACBits[3]][j]);
setTableItem(ui->trailerBlockWidget, 1, j, Mifare::trailerWriteCondition[ACBits[3]][j]);
}
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 4; j++)
{
Mifare::AccessType type = Mifare::dataCondition[ACBits[i]][j];
if(type == Mifare::ACC_KEY_B && isKeyBReadable)
{
type = Mifare::ACC_NEVER;
}
else if(type == Mifare::ACC_KEY_AB && isKeyBReadable)
{
type = Mifare::ACC_KEY_A;
}
setTableItem(ui->dataBlockWidget, i, j, type);
}
}
}
ui->C0Box->blockSignals(false);
ui->C1Box->blockSignals(false);
ui->C2Box->blockSignals(false);
ui->C3Box->blockSignals(false);
}
void MF_trailerDecoderDialog::on_blockSizeChanged(int id, bool st)
{
if(st)
{
if(id == 4)
{
ui->dataBlockWidget->verticalHeaderItem(0)->setText("Block0");
ui->dataBlockWidget->verticalHeaderItem(1)->setText("Block1");
ui->dataBlockWidget->verticalHeaderItem(2)->setText("Block2");
}
else if(id == 16)
{
ui->dataBlockWidget->verticalHeaderItem(0)->setText("Block0~4");
ui->dataBlockWidget->verticalHeaderItem(1)->setText("Block5~9");
ui->dataBlockWidget->verticalHeaderItem(2)->setText("Block10~14");
}
}
}
void MF_trailerDecoderDialog::setTableItem(QTableWidget* widget, int row, int column, Mifare::AccessType accessType)
{
if(widget->item(row, column) == nullptr)
widget->setItem(row, column, new QTableWidgetItem());
QString text;
if(accessType == Mifare::ACC_NEVER)
{
text = "X";
}
else if(accessType == Mifare::ACC_KEY_A)
{
text = "KeyA";
}
else if(accessType == Mifare::ACC_KEY_B)
{
text = "KeyB";
}
else if(accessType == Mifare::ACC_KEY_AB)
{
text = "KeyA+B";
}
widget->item(row, column)->setText(text);
}
void MF_trailerDecoderDialog::on_boxChanged()
{
quint8 ACBits[4];
ACBits[0] = ui->C0Box->value();
ACBits[1] = ui->C1Box->value();
ACBits[2] = ui->C2Box->value();
ACBits[3] = ui->C3Box->value();
quint8 halfBytes[6] = {0, 0, 0, 0, 0, 0};
for(int i = 0; i < 4; i++)
{
halfBytes[2] |= (((ACBits[i] >> 0) & 1) << i);
halfBytes[5] |= (((ACBits[i] >> 1) & 1) << i);
halfBytes[4] |= (((ACBits[i] >> 2) & 1) << i);
}
halfBytes[0] = (~halfBytes[5]) & 0xf;
halfBytes[1] = (~halfBytes[2]) & 0xf;
halfBytes[3] = (~halfBytes[4]) & 0xf;
QString result;
for(int i = 0; i < 3; i++)
{
result += QString::number(halfBytes[i * 2], 16);
result += QString::number(halfBytes[i * 2 + 1], 16);
result += " ";
}
result = result.toUpper();
ui->accessBitsEdit->setText(result);
}
+39
View File
@@ -0,0 +1,39 @@
#ifndef MF_TRAILERDECODERDIALOG_H
#define MF_TRAILERDECODERDIALOG_H
#include <QDialog>
#include <QValidator>
#include <QDebug>
#include <QButtonGroup>
#include <QTableWidget>
#include "../module/mifare.h"
namespace Ui
{
class MF_trailerDecoderDialog;
}
class MF_trailerDecoderDialog : public QDialog
{
Q_OBJECT
public:
explicit MF_trailerDecoderDialog(QWidget *parent = nullptr);
~MF_trailerDecoderDialog();
private slots:
void on_accessBitsEdit_textChanged(const QString& arg1);
void on_blockSizeChanged(int id, bool st);
void on_boxChanged();
private:
Ui::MF_trailerDecoderDialog *ui;
QRegularExpressionValidator* validator;
QButtonGroup* sizeGroup;
void setTableItem(QTableWidget *widget, int row, int column, Mifare::AccessType accessType);
};
#endif // MF_TRAILERDECODERDIALOG_H
+402
View File
@@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MF_trailerDecoderDialog</class>
<widget class="QDialog" name="MF_trailerDecoderDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>507</height>
</rect>
</property>
<property name="windowTitle">
<string>Trailer Decoder</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="sizeGroupBox">
<property name="title">
<string>Blocks</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="size4Button">
<property name="text">
<string>4</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="size16Button">
<property name="text">
<string>16</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Trailer Data:
(like &quot;FF0780&quot; or &quot;FF 07 80&quot;)</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="accessBitsEdit"/>
</item>
<item>
<widget class="QLabel" name="isAccessBitsValidLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Or set bits manually</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Cx0</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="C0Box">
<property name="maximum">
<number>7</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Cx1</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="C1Box">
<property name="maximum">
<number>7</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Cx2</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="C2Box">
<property name="maximum">
<number>7</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_9">
<property name="text">
<string>Cx3</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="C3Box">
<property name="maximum">
<number>7</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Data Block Permission:</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="dataBlockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<row>
<property name="text">
<string>Block0</string>
</property>
</row>
<row>
<property name="text">
<string>Block1</string>
</property>
</row>
<row>
<property name="text">
<string>Block2</string>
</property>
</row>
<column>
<property name="text">
<string>Read</string>
</property>
</column>
<column>
<property name="text">
<string>Write</string>
</property>
</column>
<column>
<property name="text">
<string>Increase</string>
</property>
</column>
<column>
<property name="text">
<string>Decrease/Transfer/Restore</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Trailer Block Permission:</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="trailerBlockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>3</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<row>
<property name="text">
<string>Read</string>
</property>
</row>
<row>
<property name="text">
<string>Write</string>
</property>
</row>
<column>
<property name="text">
<string>KeyA</string>
</property>
</column>
<column>
<property name="text">
<string>Access Bits</string>
</property>
</column>
<column>
<property name="text">
<string>KeyB</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Reference:
MF1S70YYX_V1 Product data sheet
Rev. 3.2 — 23 November 2017</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string>Note:the Access Bits usually contains 4 bytes(8 hex symbols), but only the first 3 bytes matters. You can set the 4th byte randomly.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MF_trailerDecoderDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MF_trailerDecoderDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+7 -7
View File
@@ -1,7 +1,7 @@
#include "mf_uid_parameterdialog.h" #include "mf_uid_parameterdialog.h"
#include "ui_mf_uid_parameterdialog.h" #include "ui_mf_uid_parameterdialog.h"
MF_UID_parameterDialog::MF_UID_parameterDialog(const QString& uid, const QString& atqa, const QString& sak, QWidget *parent) : MF_UID_parameterDialog::MF_UID_parameterDialog(const QString& uid, const QString& atqa, const QString& sak, const QVariantMap& config, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::MF_UID_parameterDialog) ui(new Ui::MF_UID_parameterDialog)
{ {
@@ -9,6 +9,7 @@ MF_UID_parameterDialog::MF_UID_parameterDialog(const QString& uid, const QString
ui->UIDLineEdit->setText(uid); ui->UIDLineEdit->setText(uid);
ui->ATQALineEdit->setText(atqa); ui->ATQALineEdit->setText(atqa);
ui->SAKLineEdit->setText(sak); ui->SAKLineEdit->setText(sak);
this->config = config;
} }
MF_UID_parameterDialog::~MF_UID_parameterDialog() MF_UID_parameterDialog::~MF_UID_parameterDialog()
@@ -18,10 +19,9 @@ MF_UID_parameterDialog::~MF_UID_parameterDialog()
void MF_UID_parameterDialog::on_buttonBox_accepted() void MF_UID_parameterDialog::on_buttonBox_accepted()
{ {
emit sendCMD("hf mf csetuid " QString cmd = config["cmd"].toString();
+ ui->UIDLineEdit->text() cmd.replace("<uid>", ui->UIDLineEdit->text());
+ " " cmd.replace("<atqa>", ui->ATQALineEdit->text());
+ ui->ATQALineEdit->text() cmd.replace("<sak>", ui->SAKLineEdit->text());
+ " " emit sendCMD(cmd);
+ ui->SAKLineEdit->text());
} }
+6 -3
View File
@@ -2,8 +2,10 @@
#define MF_UID_PARAMETERDIALOG_H #define MF_UID_PARAMETERDIALOG_H
#include <QDialog> #include <QDialog>
#include "common/util.h"
namespace Ui { namespace Ui
{
class MF_UID_parameterDialog; class MF_UID_parameterDialog;
} }
@@ -12,13 +14,14 @@ class MF_UID_parameterDialog : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit MF_UID_parameterDialog(const QString& uid, const QString& atqa, const QString& sak, QWidget *parent = nullptr); explicit MF_UID_parameterDialog(const QString& uid, const QString& atqa, const QString& sak, const QVariantMap& config, QWidget *parent = nullptr);
~MF_UID_parameterDialog(); ~MF_UID_parameterDialog();
private: private:
Ui::MF_UID_parameterDialog *ui; Ui::MF_UID_parameterDialog *ui;
QVariantMap config;
signals: signals:
void sendCMD(QString cmd); void sendCMD(const QString& cmd);
private slots: private slots:
void on_buttonBox_accepted(); void on_buttonBox_accepted();
}; };