Compare commits
59 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f285f76a20 | |||
| 24adc08d84 | |||
| d56c5f8dc7 | |||
| 222f271a31 | |||
| 0c339e91af | |||
| 85ea3fd744 | |||
| d0bc6808d0 | |||
| 03d9c601fc | |||
| 5a8ab42281 | |||
| 12a0837c50 | |||
| d6f02e7a69 | |||
| 02a8fe03e3 | |||
| 3523c1eace | |||
| bac6207634 | |||
| ccb07651cc | |||
| f706d59c48 | |||
| 9e31496131 | |||
| a232e4ec83 | |||
| 1bec73d1ad | |||
| a8b1a4a82e | |||
| 03bb57ee58 | |||
| 15538a9892 | |||
| 466cd0ecc1 | |||
| 019afed198 | |||
| 799e00d66e | |||
| ae9e4d1a4f | |||
| c3aafc3d31 | |||
| fb8e1a6e1b | |||
| 90e4fde882 | |||
| 705c8de54c | |||
| aa6b93984c | |||
| 7f96c061dc | |||
| b8c4e8e339 | |||
| 4f10e3d75c | |||
| 63f3424871 | |||
| 24a6e1869b | |||
| 6baa09221e | |||
| 6e5f654cc5 | |||
| 83445c7eef | |||
| 5330ed8d14 | |||
| a56a503b23 | |||
| 77d8049738 | |||
| bf9b3fb076 | |||
| 6d3dd5056c | |||
| e687cc39fd | |||
| 3c3944d150 | |||
| 091b4f63d1 | |||
| 0c4220c9a5 | |||
| 986e9aacfe | |||
| ce262db52c | |||
| 73533608e6 | |||
| 2f38d3c8c5 | |||
| f2d00ee088 | |||
| 862f0775f8 | |||
| a7985c5c89 | |||
| a3e6aa787b | |||
| 1c273a6527 | |||
| 3f899845b7 | |||
| 475580c342 |
@@ -14,7 +14,6 @@
|
||||
*.so.*
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
|
||||
@@ -16,9 +16,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
common/myeventfilter.cpp \
|
||||
main.cpp \
|
||||
common/pm3process.cpp \
|
||||
common/util.cpp \
|
||||
module/lf.cpp \
|
||||
module/mifare.cpp \
|
||||
ui/mf_trailerdecoderdialog.cpp \
|
||||
ui/mf_sim_simdialog.cpp \
|
||||
@@ -27,8 +29,10 @@ SOURCES += \
|
||||
ui/mf_attack_hardnesteddialog.cpp \
|
||||
|
||||
HEADERS += \
|
||||
common/myeventfilter.h \
|
||||
common/pm3process.h \
|
||||
common/util.h \
|
||||
module/lf.h \
|
||||
module/mifare.h \
|
||||
ui/mf_trailerdecoderdialog.h \
|
||||
ui/mf_sim_simdialog.h \
|
||||
@@ -52,7 +56,7 @@ qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
VERSION = 0.1.3
|
||||
VERSION = 0.2.2
|
||||
QMAKE_TARGET_PRODUCT = "Proxmark3GUI"
|
||||
QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI"
|
||||
QMAKE_TARGET_COMPANY = "wh201906"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# Proxmark3GUI
|
||||
A GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
|
||||

|
||||
|
||||
[中文](README/doc/README_zh_CN.md)
|
||||
A cross-platform GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
|
||||
|
||||
[中文介绍](README/doc/README_zh_CN.md)
|
||||
|
||||
***
|
||||
|
||||
@@ -17,6 +19,7 @@ A GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
|
||||
+ Support binary(.bin .dump) files and text(.eml) files
|
||||
+ Analyze Access Bits
|
||||
+ Support Chinese Magic Card
|
||||
+ Have basic support for LF commands
|
||||
+ Customize UI
|
||||
+ ...
|
||||
|
||||
@@ -25,37 +28,81 @@ A GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
|
||||
## Preview
|
||||

|
||||
|
||||
more previews [here](README/doc/previews.md)
|
||||
[more previews](README/doc/previews.md)
|
||||
|
||||
***
|
||||
|
||||
## About Iceman fork/repo
|
||||
|
||||
The [Iceman fork/repo](https://github.com/RfidResearchGroup/proxmark3) has more powerful functions like offline sniff. 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 was designed for only official repo at first, but I'm trying to make it compatible with Iceman repo.
|
||||
|
||||
Supported functions when using Iceman client:
|
||||
|
||||
[supported functions](README/doc/supported_Iceman.md)
|
||||
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 client on Windows.
|
||||
Also, he makes the [pre-compiled Windows client](http://www.proxmark.org/forum/viewtopic.php?id=3975) so you can download it and run your PM3 client on Windows instantly.
|
||||
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:
|
||||
|
||||
### 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
|
||||
+ 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
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Proxmark3GUI
|
||||
一个自制的[Proxmark3](https://github.com/Proxmark/proxmark3) GUI
|
||||

|
||||
|
||||
一个自制的[Proxmark3](https://github.com/Proxmark/proxmark3) GUI,可在Windows/Linux系统下运行
|
||||
|
||||
[English](../../README.md)
|
||||
|
||||
@@ -17,7 +19,8 @@
|
||||
+ 可以打开二进制/文本格式的扇区数据文件
|
||||
+ 分析访问控制位(Access Bits)
|
||||
+ 支持UID卡操作(UID快速读写,UFUID锁卡)
|
||||
+ 自定义UI界面
|
||||
+ 支持部分低频命令
|
||||
+ 自定义UI界面,各选项卡可拆分组合
|
||||
+ ...
|
||||
|
||||
***
|
||||
@@ -30,28 +33,75 @@
|
||||
***
|
||||
|
||||
## 关于冰人版
|
||||
这个GUI一开始是针对官方版本做的,现在正在尽力让它兼容冰人版的功能
|
||||
(没钱买RDV4也没钱买两台PM3,测一次冰人就要烧一次固件 qwq)
|
||||
[冰人版](https://github.com/RfidResearchGroup/proxmark3)(Iceman/RRG)的客户端和固件更新更为激进,相比官方版具有更多的功能
|
||||
此GUI所有功能均兼容冰人版(在v4.13441上测试通过)
|
||||
|
||||
[已支持功能](../doc/supported_Iceman.md)
|
||||
***
|
||||
|
||||
## 关于预编译Windows客户端
|
||||
|
||||
一个国外大佬 [Gator96100](https://github.com/Gator96100) 做了个 [ProxSpace](https://github.com/Gator96100/ProxSpace) 以便在Windows平台上编译PM3固件和客户端,他还把自己编译好的客户端放到了[论坛](http://www.proxmark.org/forum/viewtopic.php?id=3975)里面
|
||||
文件都是放到Google Drive上面的,国内网络无法访问,所以我在release版本里面放了个带预编译客户端版本的GUI。这个GUI也可以搭配你自己的客户端使用
|
||||
一位国外大佬 [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
|
||||
|
||||
@@ -13,4 +13,8 @@ Mifare Edit File:
|
||||

|
||||
|
||||
Mifare Trailer Decoder:
|
||||

|
||||

|
||||
|
||||
Dock Widget:
|
||||

|
||||

|
||||
@@ -1,9 +0,0 @@
|
||||
## About Iceman fork/repo
|
||||
|
||||
The [Iceman fork/repo](https://github.com/RfidResearchGroup/proxmark3) has more powerful functions like offline sniff. 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 was designed for only official repo at first, but I'm trying to make it compatible with Iceman repo.
|
||||
Supported functions when using Iceman client:
|
||||
+ Command Line
|
||||
+ Mifare Card info
|
||||
+ Mifare Check default keys
|
||||
+ Mifare Nested Attack
|
||||
+ Mifare Read/Write
|
||||
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 407 KiB After Width: | Height: | Size: 468 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 50 KiB |
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
@@ -12,44 +12,62 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
|
||||
serialListener->setTimerType(Qt::VeryCoarseTimer);
|
||||
connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout);
|
||||
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 = Util::CLIENTTYPE_OFFICIAL;
|
||||
Util::ClientType clientType;
|
||||
setRequiringOutput(true);
|
||||
|
||||
// stash for reconnect
|
||||
currPath = path;
|
||||
currArgs = args;
|
||||
|
||||
// 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))
|
||||
{
|
||||
waitForReadyRead(1000);
|
||||
waitForReadyRead(10000);
|
||||
setRequiringOutput(false);
|
||||
result = *requiredOutput;
|
||||
if(result.indexOf("[=]") != -1)
|
||||
{
|
||||
clientType = Util::CLIENTTYPE_ICEMAN;
|
||||
setRequiringOutput(true);
|
||||
write("hw version\r\n");
|
||||
waitForReadyRead(1000);
|
||||
result = *requiredOutput;
|
||||
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
|
||||
{
|
||||
emit changeClientType(clientType);
|
||||
result = result.mid(result.indexOf("os: "));
|
||||
result = result.left(result.indexOf("\r\n"));
|
||||
result = result.mid(3, result.lastIndexOf(" ") - 3);
|
||||
result = result.left(result.indexOf("\n"));
|
||||
result = result.mid(4, result.indexOf(" ", 4) - 4);
|
||||
emit PM3StatedChanged(true, result);
|
||||
setSerialListener(port, true);
|
||||
}
|
||||
else
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
||||
void PM3Process::reconnectPM3()
|
||||
{
|
||||
connectPM3(currPath, currArgs);
|
||||
}
|
||||
|
||||
void PM3Process::setRequiringOutput(bool st)
|
||||
{
|
||||
isRequiringOutput = st;
|
||||
@@ -66,6 +84,7 @@ void PM3Process::setSerialListener(const QString& name, bool state)
|
||||
{
|
||||
if(state)
|
||||
{
|
||||
currPort = name;
|
||||
portInfo = new QSerialPortInfo(name);
|
||||
serialListener->start();
|
||||
qDebug() << serialListener->thread();
|
||||
@@ -73,18 +92,29 @@ void PM3Process::setSerialListener(const QString& name, bool state)
|
||||
else
|
||||
{
|
||||
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);
|
||||
{
|
||||
// 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();
|
||||
if(!portInfo->isBusy())
|
||||
{
|
||||
kill();
|
||||
emit PM3StatedChanged(false);
|
||||
setSerialListener("", false);
|
||||
killPM3();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +123,6 @@ void PM3Process::testThread()
|
||||
qDebug() << "PM3:" << QThread::currentThread();
|
||||
}
|
||||
|
||||
|
||||
qint64 PM3Process::write(QString data)
|
||||
{
|
||||
return QProcess::write(data.toLatin1());
|
||||
@@ -111,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);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <QTimer>
|
||||
#include <QtSerialPort/QSerialPortInfo>
|
||||
#include <QtSerialPort/QSerialPort>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QDir>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
@@ -21,9 +23,14 @@ public:
|
||||
void testThread();
|
||||
|
||||
public slots:
|
||||
void connectPM3(const QString path, const QString port);
|
||||
void setSerialListener(const QString &name, bool state);
|
||||
void connectPM3(const QString& path, const QStringList args);
|
||||
void setSerialListener(const QString& name, bool state);
|
||||
void setSerialListener(bool state);
|
||||
qint64 write(QString data);
|
||||
void reconnectPM3();
|
||||
void setProcEnv(const QStringList* env);
|
||||
void setWorkingDir(const QString& dir);
|
||||
void killPM3();
|
||||
private slots:
|
||||
void onTimeout();
|
||||
void onReadyRead();
|
||||
@@ -33,9 +40,13 @@ private:
|
||||
void setRequiringOutput(bool st);// It only works in this class now
|
||||
QTimer* serialListener;
|
||||
QSerialPortInfo* portInfo;
|
||||
QString currPath;
|
||||
QString currPort = "";
|
||||
QStringList currArgs;
|
||||
|
||||
signals:
|
||||
void PM3StatedChanged(bool st, QString info = "");
|
||||
void newOutput(QString output);
|
||||
void PM3StatedChanged(bool st, const QString& info = "");
|
||||
void newOutput(const QString& output);
|
||||
void changeClientType(Util::ClientType);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
#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)
|
||||
{
|
||||
isRequiringOutput = false;
|
||||
requiredOutput = new QString();
|
||||
timeStamp = QTime::currentTime();
|
||||
this->clientType = CLIENTTYPE_OFFICIAL;
|
||||
qRegisterMetaType<Util::ClientType>("Util::ClientType");
|
||||
}
|
||||
|
||||
void Util::processOutput(QString output)
|
||||
|
||||
void Util::processOutput(const QString& output)
|
||||
{
|
||||
// qDebug() << "Util::processOutput:" << output;
|
||||
if(isRequiringOutput)
|
||||
@@ -20,30 +27,58 @@ void Util::processOutput(QString output)
|
||||
emit refreshOutput(output);
|
||||
}
|
||||
|
||||
void Util::execCMD(QString cmd)
|
||||
void Util::execCMD(const QString& cmd)
|
||||
{
|
||||
qDebug() << cmd;
|
||||
emit write(cmd + "\r\n");
|
||||
qDebug() << "executing: " << cmd;
|
||||
if(isRunning)
|
||||
emit write(cmd + "\n");
|
||||
}
|
||||
|
||||
QString Util::execCMDWithOutput(QString cmd, unsigned long waitTime)
|
||||
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 targetTime = QTime::currentTime().addMSecs(waitTime);
|
||||
QTime targetTime = QTime::currentTime().addMSecs(trigger.waitTime);
|
||||
isRequiringOutput = true;
|
||||
requiredOutput->clear();
|
||||
execCMD(cmd);
|
||||
while(QTime::currentTime() < targetTime)
|
||||
{
|
||||
if(!isRunning)
|
||||
break;
|
||||
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;
|
||||
targetTime = timeStamp.addMSecs(waitTime);
|
||||
targetTime = timeStamp.addMSecs(trigger.waitTime);
|
||||
}
|
||||
}
|
||||
isRequiringOutput = false;
|
||||
return *requiredOutput;
|
||||
return (isResultFound || trigger.expectedOutputs.isEmpty() || rawOutput ? *requiredOutput : "");
|
||||
}
|
||||
|
||||
void Util::delay(unsigned int msec)
|
||||
@@ -52,12 +87,61 @@ void Util::delay(unsigned int msec)
|
||||
while(QTime::currentTime() < timer)
|
||||
QApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
}
|
||||
|
||||
Util::ClientType Util::getClientType()
|
||||
{
|
||||
return this->clientType;
|
||||
return Util::clientType;
|
||||
}
|
||||
|
||||
void Util::setClientType(Util::ClientType clientType)
|
||||
{
|
||||
this->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;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <QMetaType>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
#include <QMainWindow>
|
||||
#include <QInputDialog>
|
||||
#include <QDockWidget>
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
class Util : public QObject
|
||||
{
|
||||
@@ -20,26 +27,55 @@ public:
|
||||
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);
|
||||
|
||||
void execCMD(QString cmd);
|
||||
QString execCMDWithOutput(QString cmd, unsigned long waitTime = 2000);
|
||||
void execCMD(const QString& cmd);
|
||||
QString execCMDWithOutput(const QString& cmd, ReturnTrigger trigger = 10000, bool rawOutput = false);
|
||||
void delay(unsigned int msec);
|
||||
ClientType getClientType();
|
||||
static ClientType getClientType();
|
||||
static int rawTabIndex;
|
||||
static QDockWidget* rawDockPtr;
|
||||
static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window);
|
||||
public slots:
|
||||
void processOutput(QString output);
|
||||
void setClientType(Util::ClientType clientType);
|
||||
|
||||
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:
|
||||
bool isRequiringOutput;
|
||||
bool isRunning;
|
||||
QString* requiredOutput;
|
||||
QTime timeStamp;
|
||||
ClientType clientType;
|
||||
static ClientType clientType;
|
||||
static Ui::MainWindow *ui;
|
||||
signals:
|
||||
void refreshOutput(const QString& output);
|
||||
void write(QString data);
|
||||
void write(QString data); // connected to PM3Process::write(QString data);
|
||||
};
|
||||
|
||||
#endif // UTIL_H
|
||||
|
||||
@@ -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>"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
[Languages]
|
||||
en_US=English
|
||||
zh_CN=简体中文
|
||||
@@ -4,56 +4,49 @@
|
||||
#include <QSettings>
|
||||
#include <QTranslator>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QTextCodec>
|
||||
#include <QDir>
|
||||
|
||||
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);
|
||||
MainWindow w;
|
||||
|
||||
QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat);
|
||||
settings->setIniCodec("UTF-8");
|
||||
settings->beginGroup("lang");
|
||||
QVariant lang = settings->value("language", "null");
|
||||
if(lang == "null")
|
||||
QString currLang = settings->value("language", "").toString();
|
||||
settings->endGroup();
|
||||
if(currLang == "")
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
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")
|
||||
if(Util::chooseLanguage(settings, &w))
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
lang = "lang/en_US.qm";
|
||||
#else
|
||||
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
|
||||
settings->beginGroup("lang");
|
||||
currLang = settings->value("language", "").toString();
|
||||
settings->endGroup();
|
||||
}
|
||||
else
|
||||
currLang = "en_US";
|
||||
}
|
||||
currLang += ".qm";
|
||||
langPath->cd("lang");
|
||||
QTranslator* translator = new QTranslator(&w);
|
||||
if(translator->load(lang.toString()))
|
||||
if(translator->load(currLang, langPath->absolutePath()))
|
||||
{
|
||||
a.installTranslator(translator);
|
||||
settings->setValue("language", lang);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(&w, "Error", "Can't load " + lang.toString() + " as translation file.");
|
||||
QMessageBox::information(&w, "Error", "Can't load " + currLang + " as translation file.");
|
||||
}
|
||||
settings->endGroup();
|
||||
delete settings;
|
||||
delete langPath;
|
||||
w.initUI();
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonObject>
|
||||
class Mifare : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -37,6 +38,7 @@ public:
|
||||
quint16 block_size;
|
||||
quint8 blk[40];
|
||||
quint8 blks[40];
|
||||
QString typeText;
|
||||
};
|
||||
|
||||
enum AccessType
|
||||
@@ -63,12 +65,13 @@ public:
|
||||
static const AccessType trailerReadCondition[8][3];
|
||||
static const AccessType trailerWriteCondition[8][3];
|
||||
|
||||
QString info(bool isRequiringOutput = false);
|
||||
QMap<QString, QString> info(bool isRequiringOutput = false);
|
||||
void chk();
|
||||
void nested();
|
||||
void nested(bool isStaticNested = false);
|
||||
void darkside();
|
||||
void hardnested();
|
||||
void sniff();
|
||||
void snoop();
|
||||
void sniff14a();
|
||||
void list();
|
||||
void readOne(TargetType targetType = TARGET_MIFARE);
|
||||
void readSelected(TargetType targetType = TARGET_MIFARE);
|
||||
@@ -106,8 +109,12 @@ public:
|
||||
void saveSniff(const QString& file);
|
||||
void data_fillKeys();
|
||||
|
||||
static QList<quint8> data_getACBits(const QString &text);
|
||||
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:
|
||||
signals:
|
||||
|
||||
@@ -116,6 +123,8 @@ private:
|
||||
Ui::MainWindow *ui;
|
||||
Util* util;
|
||||
|
||||
QVariantMap configMap;
|
||||
|
||||
QStringList* keyAList;
|
||||
QStringList* keyBList;
|
||||
QStringList* dataList;
|
||||
@@ -124,9 +133,9 @@ private:
|
||||
QRegularExpression* keyPattern;
|
||||
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);
|
||||
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
|
||||
|
||||
@@ -1,13 +1,22 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent):
|
||||
QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
dockAllWindows = new QAction(tr("Dock all windows"), this);
|
||||
myInfo = new QAction("wh201906", this);
|
||||
currVersion = new QAction(tr("Ver: ") + QApplication::applicationVersion().section('.', 0, -2), this); // ignore the 4th version number
|
||||
checkUpdate = new QAction(tr("Check Update"), this);
|
||||
connect(dockAllWindows, &QAction::triggered, [ = ]()
|
||||
{
|
||||
for(int i = 0; i < dockList.size(); i++)
|
||||
dockList[i]->setFloating(false);
|
||||
});
|
||||
connect(myInfo, &QAction::triggered, [ = ]()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/wh201906"));
|
||||
@@ -16,18 +25,40 @@ MainWindow::MainWindow(QWidget *parent):
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/wh201906/Proxmark3GUI/releases"));
|
||||
});
|
||||
this->addAction(myInfo);
|
||||
this->addAction(checkUpdate);
|
||||
|
||||
settings = new QSettings("GUIsettings.ini", QSettings::IniFormat);
|
||||
settings->setIniCodec("UTF-8");
|
||||
|
||||
pm3Thread = new QThread(this);
|
||||
pm3 = new PM3Process(pm3Thread);
|
||||
pm3Thread->start();
|
||||
pm3state = false;
|
||||
clientWorkingDir = new QDir;
|
||||
|
||||
util = new Util(this);
|
||||
Util::setUI(ui);
|
||||
mifare = new Mifare(ui, util, this);
|
||||
lf = new LF(ui, util, this);
|
||||
|
||||
keyEventFilter = new MyEventFilter(QEvent::KeyPress);
|
||||
resizeEventFilter = new MyEventFilter(QEvent::Resize);
|
||||
|
||||
// hide unused tabs
|
||||
// ui->funcTab->removeTab(1);
|
||||
ui->funcTab->removeTab(2);
|
||||
|
||||
portSearchTimer = new QTimer(this);
|
||||
portSearchTimer->setInterval(2000);
|
||||
connect(portSearchTimer, &QTimer::timeout, this, &MainWindow::on_portSearchTimer_timeout);
|
||||
portSearchTimer->start();
|
||||
|
||||
contextMenu = new QMenu();
|
||||
contextMenu->addAction(dockAllWindows);
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(myInfo);
|
||||
currVersion->setEnabled(false);
|
||||
contextMenu->addAction(currVersion);
|
||||
contextMenu->addAction(checkUpdate);
|
||||
|
||||
}
|
||||
|
||||
@@ -41,62 +72,133 @@ MainWindow::~MainWindow()
|
||||
delete pm3Thread;
|
||||
}
|
||||
|
||||
void MainWindow::loadConfig()
|
||||
{
|
||||
QFile configList(ui->Set_Client_configPathEdit->text());
|
||||
if(!configList.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QMessageBox::information(this, tr("Info"), tr("Failed to load config file"));
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray configData = configList.readAll();
|
||||
QJsonDocument configJson(QJsonDocument::fromJson(configData));
|
||||
mifare->setConfigMap(configJson.object()["mifare classic"].toObject().toVariantMap());
|
||||
lf->setConfigMap(configJson.object()["lf"].toObject().toVariantMap());
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::initUI() // will be called by main.app
|
||||
{
|
||||
ui->retranslateUi(this);
|
||||
uiInit();
|
||||
signalInit();
|
||||
setState(false);
|
||||
dockInit();
|
||||
}
|
||||
|
||||
// ******************** basic functions ********************
|
||||
|
||||
void MainWindow::on_PM3_refreshPortButton_clicked()
|
||||
void MainWindow::on_portSearchTimer_timeout()
|
||||
{
|
||||
ui->PM3_portBox->clear();
|
||||
QSerialPort serial;
|
||||
QStringList serialList;
|
||||
QStringList newPortList;
|
||||
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
|
||||
{
|
||||
qDebug() << info.isBusy() << info.isNull() << info.portName();
|
||||
serial.setPort(info);
|
||||
|
||||
if(serial.open(QIODevice::ReadWrite))
|
||||
{
|
||||
serialList << info.portName();
|
||||
serial.close();
|
||||
}
|
||||
// qDebug() << info.isBusy() << info.isNull() << info.portName() << info.description();
|
||||
if(!info.isNull())
|
||||
newPortList << info.portName();
|
||||
}
|
||||
foreach(QString port, serialList)
|
||||
if(newPortList != portList) // update PM3_portBox when available ports changed
|
||||
{
|
||||
ui->PM3_portBox->addItem(port);
|
||||
portList = newPortList;
|
||||
ui->PM3_portBox->clear();
|
||||
ui->PM3_portBox->addItems(portList);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_PM3_connectButton_clicked()
|
||||
{
|
||||
qDebug() << "Main:" << QThread::currentThread();
|
||||
|
||||
QString port = ui->PM3_portBox->currentText();
|
||||
if(port == "")
|
||||
QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
|
||||
else
|
||||
QString startArgs = ui->Set_Client_startArgsEdit->text();
|
||||
|
||||
// on RRG repo, if no port is specified, the client will search the available port
|
||||
if(port == "" && startArgs.contains("<port>")) // has <port>, no port
|
||||
{
|
||||
saveClientPath(ui->PM3_pathEdit->text());
|
||||
emit connectPM3(ui->PM3_pathEdit->text(), port);
|
||||
QMessageBox::information(this, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!startArgs.contains("<port>")) // no <port>
|
||||
port = ""; // a symbol
|
||||
|
||||
QStringList args = startArgs.replace("<port>", port).split(' ');
|
||||
saveClientPath(ui->PM3_pathEdit->text());
|
||||
|
||||
QProcess envSetProcess;
|
||||
QFileInfo envScriptPath(ui->Set_Client_envScriptEdit->text());
|
||||
if(envScriptPath.exists())
|
||||
{
|
||||
qDebug() << envScriptPath.absoluteFilePath();
|
||||
// use the shell session to keep the environment then read it
|
||||
#ifdef Q_OS_WIN
|
||||
// cmd /c "<path>">>nul && set
|
||||
envSetProcess.start("cmd", {}, QProcess::Unbuffered | QProcess::ReadWrite | QProcess::Text);
|
||||
envSetProcess.write(QString("\"" + envScriptPath.absoluteFilePath() + "\">>nul\n").toLatin1());
|
||||
envSetProcess.waitForReadyRead(10000);
|
||||
envSetProcess.readAll();
|
||||
envSetProcess.write("set\n");
|
||||
#else
|
||||
// need implementation(or test if space works)
|
||||
// sh -c '. "<path>">>/dev/null && env'
|
||||
envSetProcess.start("sh -c \' . \"" + envScriptPath.absoluteFilePath() + "\">>/dev/null && env");
|
||||
#endif
|
||||
envSetProcess.waitForReadyRead(10000);
|
||||
QString envSetResult = QString(envSetProcess.readAll());
|
||||
clientEnv = envSetResult.split("\n", QString::SkipEmptyParts);
|
||||
if(clientEnv.size() > 2) // the first element is "set" and the last element is the current path
|
||||
{
|
||||
clientEnv.removeFirst();
|
||||
clientEnv.removeLast();
|
||||
emit setProcEnv(&clientEnv);
|
||||
}
|
||||
// qDebug() << "Get Env List" << clientEnv;
|
||||
}
|
||||
else
|
||||
clientEnv.clear();
|
||||
|
||||
clientWorkingDir->setPath(QApplication::applicationDirPath());
|
||||
qDebug() << clientWorkingDir->absolutePath();
|
||||
clientWorkingDir->mkpath(ui->Set_Client_workingDirEdit->text());
|
||||
qDebug() << clientWorkingDir->absolutePath();
|
||||
clientWorkingDir->cd(ui->Set_Client_workingDirEdit->text());
|
||||
qDebug() << clientWorkingDir->absolutePath();
|
||||
emit setWorkingDir(clientWorkingDir->absolutePath());
|
||||
|
||||
loadConfig();
|
||||
emit connectPM3(ui->PM3_pathEdit->text(), args);
|
||||
if(port != "" && !keepClientActive)
|
||||
emit setSerialListener(port, true);
|
||||
else if(!keepClientActive)
|
||||
emit setSerialListener(false);
|
||||
|
||||
envSetProcess.kill();
|
||||
}
|
||||
|
||||
void MainWindow::onPM3StateChanged(bool st, QString info)
|
||||
void MainWindow::onPM3StateChanged(bool st, const QString& info)
|
||||
{
|
||||
pm3state = st;
|
||||
setState(st);
|
||||
if(st == true)
|
||||
{
|
||||
portSearchTimer->stop();
|
||||
setStatusBar(PM3VersionBar, info);
|
||||
setStatusBar(connectStatusBar, tr("Connected"));
|
||||
}
|
||||
else
|
||||
{
|
||||
portSearchTimer->start();
|
||||
setStatusBar(PM3VersionBar, "");
|
||||
setStatusBar(connectStatusBar, tr("Not Connected"));
|
||||
}
|
||||
@@ -104,31 +206,43 @@ void MainWindow::onPM3StateChanged(bool st, QString info)
|
||||
|
||||
void MainWindow::on_PM3_disconnectButton_clicked()
|
||||
{
|
||||
pm3state = false;
|
||||
setState(false);
|
||||
emit killPM3();
|
||||
emit setSerialListener("", false);
|
||||
setStatusBar(connectStatusBar, tr("Not Connected"));
|
||||
emit setSerialListener(false);
|
||||
}
|
||||
|
||||
void MainWindow::refreshOutput(const QString& output)
|
||||
{
|
||||
// qDebug() << "MainWindow::refresh:" << output;
|
||||
ui->Raw_outputEdit->insertPlainText(output);
|
||||
ui->Raw_outputEdit->appendPlainText(output);
|
||||
ui->Raw_outputEdit->moveCursor(QTextCursor::End);
|
||||
}
|
||||
|
||||
void MainWindow::refreshCMD(const QString& cmd)
|
||||
void MainWindow::on_stopButton_clicked()
|
||||
{
|
||||
ui->Raw_CMDEdit->setText(cmd);
|
||||
if(cmd != "" && (ui->Raw_CMDHistoryWidget->count() == 0 || ui->Raw_CMDHistoryWidget->item(ui->Raw_CMDHistoryWidget->count() - 1)->text() != cmd))
|
||||
ui->Raw_CMDHistoryWidget->addItem(cmd);
|
||||
if(!pm3state)
|
||||
on_PM3_disconnectButton_clicked();
|
||||
else
|
||||
{
|
||||
on_PM3_disconnectButton_clicked();
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
util->delay(200);
|
||||
if(!pm3state)
|
||||
break;
|
||||
}
|
||||
emit reconnectPM3();
|
||||
emit setSerialListener(!keepClientActive);
|
||||
}
|
||||
}
|
||||
|
||||
// *********************************************************
|
||||
|
||||
// ******************** raw command ********************
|
||||
|
||||
void MainWindow::on_Raw_CMDEdit_textChanged(const QString &arg1)
|
||||
{
|
||||
stashedCMDEditText = arg1;
|
||||
}
|
||||
|
||||
void MainWindow::on_Raw_sendCMDButton_clicked()
|
||||
{
|
||||
util->execCMD(ui->Raw_CMDEdit->text());
|
||||
@@ -173,17 +287,81 @@ void MainWindow::sendMSG() // send command when pressing Enter
|
||||
on_Raw_sendCMDButton_clicked();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::refreshCMD(const QString& cmd)
|
||||
{
|
||||
ui->Raw_CMDEdit->blockSignals(true);
|
||||
ui->Raw_CMDEdit->setText(cmd);
|
||||
if(cmd != "" && (ui->Raw_CMDHistoryWidget->count() == 0 || ui->Raw_CMDHistoryWidget->item(ui->Raw_CMDHistoryWidget->count() - 1)->text() != cmd))
|
||||
ui->Raw_CMDHistoryWidget->addItem(cmd);
|
||||
stashedCMDEditText = cmd;
|
||||
stashedIndex = -1;
|
||||
ui->Raw_CMDEdit->blockSignals(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_Raw_keyPressed(QObject* obj_addr, QEvent& event)
|
||||
{
|
||||
if(event.type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent& keyEvent = static_cast<QKeyEvent&>(event);
|
||||
if(obj_addr == ui->Raw_CMDEdit)
|
||||
{
|
||||
if(keyEvent.key() == Qt::Key_Up)
|
||||
{
|
||||
if(stashedIndex > 0)
|
||||
stashedIndex--;
|
||||
else if(stashedIndex == -1)
|
||||
stashedIndex = ui->Raw_CMDHistoryWidget->count() - 1;
|
||||
}
|
||||
else if(keyEvent.key() == Qt::Key_Down)
|
||||
{
|
||||
if(stashedIndex < ui->Raw_CMDHistoryWidget->count() - 1 && stashedIndex != -1)
|
||||
stashedIndex++;
|
||||
else if(stashedIndex == ui->Raw_CMDHistoryWidget->count() - 1)
|
||||
stashedIndex = -1;
|
||||
}
|
||||
if(keyEvent.key() == Qt::Key_Up || keyEvent.key() == Qt::Key_Down)
|
||||
{
|
||||
ui->Raw_CMDEdit->blockSignals(true);
|
||||
if(stashedIndex == -1)
|
||||
ui->Raw_CMDEdit->setText(stashedCMDEditText);
|
||||
else
|
||||
ui->Raw_CMDEdit->setText(ui->Raw_CMDHistoryWidget->item(stashedIndex)->text());
|
||||
ui->Raw_CMDEdit->blockSignals(false);
|
||||
}
|
||||
}
|
||||
else if(obj_addr == ui->Raw_outputEdit)
|
||||
{
|
||||
if(keyEvent.key() == Qt::Key_Up || keyEvent.key() == Qt::Key_Down)
|
||||
ui->Raw_CMDEdit->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
// *****************************************************
|
||||
|
||||
// ******************** mifare ********************
|
||||
void MainWindow::MF_onTypeChanged(int id, bool st)
|
||||
void MainWindow::on_MF_keyWidget_resized(QObject* obj_addr, QEvent& event)
|
||||
{
|
||||
typeBtnGroup->blockSignals(true);
|
||||
qDebug() << id << typeBtnGroup->checkedId();
|
||||
if(obj_addr == ui->MF_keyWidget && event.type() == QEvent::Resize)
|
||||
{
|
||||
QTableWidget* widget = (QTableWidget*)obj_addr;
|
||||
int keyItemWidth = widget->width();
|
||||
keyItemWidth -= widget->verticalScrollBar()->width();
|
||||
keyItemWidth -= 2 * widget->frameWidth();
|
||||
keyItemWidth -= widget->horizontalHeader()->sectionSize(0);
|
||||
widget->horizontalHeader()->resizeSection(1, keyItemWidth / 2);
|
||||
widget->horizontalHeader()->resizeSection(2, keyItemWidth / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::MF_onMFCardTypeChanged(int id, bool st)
|
||||
{
|
||||
MFCardTypeBtnGroup->blockSignals(true);
|
||||
qDebug() << id << MFCardTypeBtnGroup->checkedId();
|
||||
if(!st)
|
||||
{
|
||||
int result;
|
||||
if(id > typeBtnGroup->checkedId()) // id is specified in uiInit() with a proper order, so I can compare the size by id.
|
||||
if(id > MFCardTypeBtnGroup->checkedId()) // id is specified in uiInit() with a proper order, so I can compare the size by id.
|
||||
{
|
||||
result = QMessageBox::question(this, tr("Info"), tr("Some of the data and key will be cleared.") + "\n" + tr("Continue?"), QMessageBox::Yes | QMessageBox::No);
|
||||
}
|
||||
@@ -194,7 +372,7 @@ void MainWindow::MF_onTypeChanged(int id, bool st)
|
||||
if(result == QMessageBox::Yes)
|
||||
{
|
||||
qDebug() << "Yes";
|
||||
mifare->setCardType(typeBtnGroup->checkedId());
|
||||
mifare->setCardType(MFCardTypeBtnGroup->checkedId());
|
||||
MF_widgetReset();
|
||||
mifare->data_syncWithDataWidget();
|
||||
mifare->data_syncWithKeyWidget();
|
||||
@@ -202,10 +380,10 @@ void MainWindow::MF_onTypeChanged(int id, bool st)
|
||||
else
|
||||
{
|
||||
qDebug() << "No";
|
||||
typeBtnGroup->button(id)->setChecked(true);
|
||||
MFCardTypeBtnGroup->button(id)->setChecked(true);
|
||||
}
|
||||
}
|
||||
typeBtnGroup->blockSignals(false);
|
||||
MFCardTypeBtnGroup->blockSignals(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_MF_selectAllBox_stateChanged(int arg1)
|
||||
@@ -489,11 +667,15 @@ void MainWindow::on_MF_File_saveButton_clicked()
|
||||
QString title = "";
|
||||
QString filename = "";
|
||||
QString selectedType = "";
|
||||
QString defaultName = mifare->data_getUID();
|
||||
if(defaultName != "")
|
||||
defaultName += "_";
|
||||
defaultName += QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss");
|
||||
|
||||
if(ui->MF_File_dataBox->isChecked())
|
||||
{
|
||||
title = tr("Plz select the location to save data file:");
|
||||
filename = QFileDialog::getSaveFileName(this, title, "./", tr("Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)"), &selectedType);
|
||||
filename = QFileDialog::getSaveFileName(this, title, "./data_" + defaultName, tr("Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)"), &selectedType);
|
||||
qDebug() << filename;
|
||||
if(filename != "")
|
||||
{
|
||||
@@ -506,7 +688,7 @@ void MainWindow::on_MF_File_saveButton_clicked()
|
||||
else if(ui->MF_File_keyBox->isChecked())
|
||||
{
|
||||
title = tr("Plz select the location to save key file:");
|
||||
filename = QFileDialog::getSaveFileName(this, title, "./", tr("Binary Key Files(*.bin *.dump)"), &selectedType);
|
||||
filename = QFileDialog::getSaveFileName(this, title, "./key_" + defaultName, tr("Binary Key Files(*.bin *.dump)"), &selectedType);
|
||||
qDebug() << filename;
|
||||
if(filename != "")
|
||||
{
|
||||
@@ -691,15 +873,16 @@ void MainWindow::on_MF_Sniff_loadButton_clicked() // use a tmp file to support c
|
||||
QString filename = "";
|
||||
|
||||
title = tr("Plz select the trace file:");
|
||||
filename = QFileDialog::getOpenFileName(this, title, "./", tr("Trace Files(*.trc);;All Files(*.*)"));
|
||||
filename = QFileDialog::getOpenFileName(this, title, clientWorkingDir->absolutePath(), tr("Trace Files(*.trc);;All Files(*.*)"));
|
||||
qDebug() << filename;
|
||||
if(filename != "")
|
||||
{
|
||||
QString tmpFile = "tmp" + QString::number(QDateTime::currentDateTime().toTime_t()) + ".trc";
|
||||
if(QFile::copy(filename, "./" + tmpFile))
|
||||
if(QFile::copy(filename, clientWorkingDir->absolutePath() + "/" + tmpFile))
|
||||
{
|
||||
mifare->loadSniff(tmpFile);
|
||||
QFile::remove("./" + tmpFile);
|
||||
util->delay(3000);
|
||||
QFile::remove(clientWorkingDir->absolutePath() + "/" + tmpFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -714,17 +897,23 @@ void MainWindow::on_MF_Sniff_saveButton_clicked()
|
||||
QString filename = "";
|
||||
|
||||
title = tr("Plz select the location to save trace file:");
|
||||
filename = QFileDialog::getSaveFileName(this, title, "./", tr("Trace Files(*.trc)"));
|
||||
filename = QFileDialog::getSaveFileName(this, title, clientWorkingDir->absolutePath(), tr("Trace Files(*.trc)"));
|
||||
qDebug() << filename;
|
||||
if(filename != "")
|
||||
{
|
||||
QString tmpFile = "tmp" + QString::number(QDateTime::currentDateTime().toTime_t()) + ".trc";
|
||||
mifare->saveSniff(tmpFile);
|
||||
if(!QFile::copy("./" + tmpFile, filename))
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
util->delay(100);
|
||||
if(QFile::exists(clientWorkingDir->absolutePath() + "/" + tmpFile))
|
||||
break;
|
||||
}
|
||||
if(!QFile::copy(clientWorkingDir->absolutePath() + "/" + tmpFile, filename))
|
||||
{
|
||||
QMessageBox::information(this, tr("Info"), tr("Failed to save to") + "\n" + filename);
|
||||
}
|
||||
QFile::remove("./" + tmpFile);
|
||||
QFile::remove(clientWorkingDir->absolutePath() + "/" + tmpFile);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -736,10 +925,10 @@ void MainWindow::on_MF_Sniff_sniffButton_clicked()
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_MF_Sniff_snoopButton_clicked()
|
||||
void MainWindow::on_MF_14aSniff_snoopButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
mifare->snoop();
|
||||
mifare->sniff14a();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
@@ -752,6 +941,7 @@ void MainWindow::MF_widgetReset()
|
||||
{
|
||||
int secs = mifare->cardType.sector_size;
|
||||
int blks = mifare->cardType.block_size;
|
||||
QBrush trailerItemForeColor = QBrush(QColor(0, 160, 255));
|
||||
ui->MF_RW_blockBox->clear();
|
||||
ui->MF_keyWidget->setRowCount(secs);
|
||||
ui->MF_dataWidget->setRowCount(blks);
|
||||
@@ -776,8 +966,10 @@ void MainWindow::MF_widgetReset()
|
||||
setTableItem(ui->MF_keyWidget, i, 1, "");
|
||||
setTableItem(ui->MF_keyWidget, i, 2, "");
|
||||
setTableItem(ui->MF_dataWidget, mifare->cardType.blks[i], 0, QString::number(i));
|
||||
ui->MF_dataWidget->item(mifare->cardType.blks[i] + mifare->cardType.blk[i] - 1, 2)->setForeground(trailerItemForeColor);
|
||||
ui->MF_dataWidget->item(mifare->cardType.blks[i], 0)->setCheckState(Qt::Checked);
|
||||
}
|
||||
ui->MF_dataWidget->item(0, 2)->setForeground(QBrush(QColor(255, 160, 0)));
|
||||
ui->MF_selectAllBox->setCheckState(Qt::Checked);
|
||||
ui->MF_selectTrailerBox->setCheckState(Qt::Checked);
|
||||
|
||||
@@ -793,43 +985,38 @@ void MainWindow::MF_widgetReset()
|
||||
|
||||
void MainWindow::uiInit()
|
||||
{
|
||||
connect(ui->Raw_CMDEdit, &QLineEdit::editingFinished, this, &MainWindow::sendMSG);
|
||||
connect(ui->Raw_CMDEdit, &QLineEdit::returnPressed, this, &MainWindow::sendMSG);
|
||||
ui->Raw_CMDEdit->installEventFilter(keyEventFilter);
|
||||
connect(keyEventFilter, &MyEventFilter::eventHappened, this, &MainWindow::on_Raw_keyPressed);
|
||||
ui->MF_keyWidget->installEventFilter(resizeEventFilter);
|
||||
connect(resizeEventFilter, &MyEventFilter::eventHappened, this, &MainWindow::on_MF_keyWidget_resized);
|
||||
ui->Raw_outputEdit->installEventFilter(keyEventFilter);
|
||||
|
||||
connectStatusBar = new QLabel(this);
|
||||
programStatusBar = new QLabel(this);
|
||||
PM3VersionBar = new QLabel(this);
|
||||
stopButton = new QPushButton(this);
|
||||
setStatusBar(connectStatusBar, tr("Not Connected"));
|
||||
setStatusBar(programStatusBar, tr("Idle"));
|
||||
setStatusBar(PM3VersionBar, "");
|
||||
stopButton->setText(tr("Stop"));
|
||||
ui->statusbar->addPermanentWidget(PM3VersionBar, 1);
|
||||
ui->statusbar->addPermanentWidget(connectStatusBar, 1);
|
||||
ui->statusbar->addPermanentWidget(programStatusBar, 1);
|
||||
ui->statusbar->addPermanentWidget(stopButton);
|
||||
|
||||
ui->MF_dataWidget->setColumnCount(3);
|
||||
ui->MF_dataWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Sec")));
|
||||
ui->MF_dataWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Blk")));
|
||||
ui->MF_dataWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Data")));
|
||||
ui->MF_dataWidget->verticalHeader()->setVisible(false);
|
||||
ui->MF_dataWidget->setColumnWidth(0, 55);
|
||||
ui->MF_dataWidget->setColumnWidth(1, 55);
|
||||
ui->MF_dataWidget->setColumnWidth(2, 430);
|
||||
|
||||
ui->MF_keyWidget->setColumnCount(3);
|
||||
ui->MF_keyWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Sec")));
|
||||
ui->MF_keyWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("KeyA")));
|
||||
ui->MF_keyWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("KeyB")));
|
||||
ui->MF_keyWidget->verticalHeader()->setVisible(false);
|
||||
ui->MF_keyWidget->setColumnWidth(0, 35);
|
||||
ui->MF_keyWidget->setColumnWidth(1, 115);
|
||||
ui->MF_keyWidget->setColumnWidth(2, 115);
|
||||
ui->MF_keyWidget->setColumnWidth(0, 45);
|
||||
|
||||
MF_widgetReset();
|
||||
typeBtnGroup = new QButtonGroup(this);
|
||||
typeBtnGroup->addButton(ui->MF_Type_miniButton, 0);
|
||||
typeBtnGroup->addButton(ui->MF_Type_1kButton, 1);
|
||||
typeBtnGroup->addButton(ui->MF_Type_2kButton, 2);
|
||||
typeBtnGroup->addButton(ui->MF_Type_4kButton, 4);
|
||||
connect(typeBtnGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), this, &MainWindow::MF_onTypeChanged);
|
||||
MFCardTypeBtnGroup = new QButtonGroup(this);
|
||||
MFCardTypeBtnGroup->addButton(ui->MF_Type_miniButton, 0);
|
||||
MFCardTypeBtnGroup->addButton(ui->MF_Type_1kButton, 1);
|
||||
MFCardTypeBtnGroup->addButton(ui->MF_Type_2kButton, 2);
|
||||
MFCardTypeBtnGroup->addButton(ui->MF_Type_4kButton, 4);
|
||||
connect(MFCardTypeBtnGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), this, &MainWindow::MF_onMFCardTypeChanged);
|
||||
|
||||
ui->MF_keyWidget->installEventFilter(this);
|
||||
ui->MF_dataWidget->installEventFilter(this);
|
||||
@@ -837,7 +1024,7 @@ void MainWindow::uiInit()
|
||||
settings->beginGroup("UI_grpbox_preference");
|
||||
|
||||
QStringList boxNames = settings->allKeys();
|
||||
QGroupBox* boxptr;
|
||||
QGroupBox * boxptr;
|
||||
foreach(QString name, boxNames)
|
||||
{
|
||||
boxptr = this->findChild<QGroupBox*>(name);
|
||||
@@ -860,11 +1047,31 @@ void MainWindow::uiInit()
|
||||
ui->PM3_pathEdit->setText(settings->value("path", "proxmark3").toString());
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Client_Args");
|
||||
ui->Set_Client_startArgsEdit->setText(settings->value("args", "<port> -f").toString());
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Client_forceButtonsEnabled");
|
||||
keepButtonsEnabled = settings->value("state", false).toBool();
|
||||
ui->Set_Client_forceEnabledBox->setChecked(keepButtonsEnabled);
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Client_keepClientActive");
|
||||
keepClientActive = settings->value("state", false).toBool();
|
||||
ui->Set_Client_keepClientActiveBox->setChecked(keepClientActive);
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginGroup("Client_Env");
|
||||
ui->Set_Client_envScriptEdit->setText(settings->value("scriptPath").toString());
|
||||
ui->Set_Client_workingDirEdit->setText(settings->value("workingDir", "../data").toString());
|
||||
ui->Set_Client_configPathEdit->setText(settings->value("configPath", "config.json").toString());
|
||||
settings->endGroup();
|
||||
|
||||
ui->MF_RW_keyTypeBox->addItem("A", Mifare::KEY_A);
|
||||
ui->MF_RW_keyTypeBox->addItem("B", Mifare::KEY_B);
|
||||
|
||||
on_Raw_CMDHistoryBox_stateChanged(Qt::Unchecked);
|
||||
on_PM3_refreshPortButton_clicked();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::signalInit()
|
||||
@@ -874,8 +1081,14 @@ void MainWindow::signalInit()
|
||||
connect(util, &Util::refreshOutput, this, &MainWindow::refreshOutput);
|
||||
|
||||
connect(this, &MainWindow::connectPM3, pm3, &PM3Process::connectPM3);
|
||||
connect(this, &MainWindow::reconnectPM3, pm3, &PM3Process::reconnectPM3);
|
||||
connect(pm3, &PM3Process::PM3StatedChanged, this, &MainWindow::onPM3StateChanged);
|
||||
connect(this, &MainWindow::killPM3, pm3, &PM3Process::kill);
|
||||
connect(pm3, &PM3Process::PM3StatedChanged, util, &Util::setRunningState);
|
||||
connect(this, &MainWindow::killPM3, pm3, &PM3Process::killPM3);
|
||||
connect(this, &MainWindow::setProcEnv, pm3, &PM3Process::setProcEnv);
|
||||
connect(this, &MainWindow::setWorkingDir, pm3, &PM3Process::setWorkingDir);
|
||||
connect(this, QOverload<bool>::of(&MainWindow::setSerialListener), pm3, QOverload<bool>::of(&PM3Process::setSerialListener));
|
||||
connect(this, QOverload<const QString&, bool>::of(&MainWindow::setSerialListener), pm3, QOverload<const QString&, bool>::of(&PM3Process::setSerialListener));
|
||||
|
||||
connect(util, &Util::write, pm3, &PM3Process::write);
|
||||
|
||||
@@ -886,9 +1099,11 @@ void MainWindow::signalInit()
|
||||
connect(ui->MF_UIDGroupBox, &QGroupBox::clicked, this, &MainWindow::on_GroupBox_clicked);
|
||||
connect(ui->MF_simGroupBox, &QGroupBox::clicked, this, &MainWindow::on_GroupBox_clicked);
|
||||
connect(ui->MF_sniffGroupBox, &QGroupBox::clicked, this, &MainWindow::on_GroupBox_clicked);
|
||||
|
||||
connect(stopButton, &QPushButton::clicked, this, &MainWindow::on_stopButton_clicked);
|
||||
}
|
||||
|
||||
void MainWindow::setStatusBar(QLabel * target, const QString & text)
|
||||
void MainWindow::setStatusBar(QLabel * target, const QString& text)
|
||||
{
|
||||
if(target == PM3VersionBar)
|
||||
target->setText(tr("HW Version:") + text);
|
||||
@@ -898,7 +1113,7 @@ void MainWindow::setStatusBar(QLabel * target, const QString & text)
|
||||
target->setText(tr("State:") + text);
|
||||
}
|
||||
|
||||
void MainWindow::setTableItem(QTableWidget * widget, int row, int column, const QString & text)
|
||||
void MainWindow::setTableItem(QTableWidget * widget, int row, int column, const QString& text)
|
||||
{
|
||||
if(widget->item(row, column) == nullptr)
|
||||
widget->setItem(row, column, new QTableWidgetItem());
|
||||
@@ -956,6 +1171,11 @@ void MainWindow::setState(bool st)
|
||||
{
|
||||
setStatusBar(programStatusBar, tr("Idle"));
|
||||
}
|
||||
setButtonsEnabled(st || keepButtonsEnabled);
|
||||
}
|
||||
|
||||
void MainWindow::setButtonsEnabled(bool st)
|
||||
{
|
||||
ui->MF_attackGroupBox->setEnabled(st);
|
||||
ui->MF_normalGroupBox->setEnabled(st);
|
||||
ui->MF_UIDGroupBox->setEnabled(st);
|
||||
@@ -963,6 +1183,8 @@ void MainWindow::setState(bool st)
|
||||
ui->MF_sniffGroupBox->setEnabled(st);
|
||||
ui->Raw_CMDEdit->setEnabled(st);
|
||||
ui->Raw_sendCMDButton->setEnabled(st);
|
||||
ui->LF_LFconfigGroupBox->setEnabled(st);
|
||||
ui->LF_operationGroupBox->setEnabled(st);
|
||||
}
|
||||
|
||||
void MainWindow::on_GroupBox_clicked(bool checked)
|
||||
@@ -983,10 +1205,203 @@ void MainWindow::on_GroupBox_clicked(bool checked)
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::saveClientPath(const QString & path)
|
||||
void MainWindow::saveClientPath(const QString& path)
|
||||
{
|
||||
settings->beginGroup("Client_Path");
|
||||
settings->setValue("path", path);
|
||||
settings->endGroup();
|
||||
}
|
||||
// ***********************************************
|
||||
|
||||
|
||||
|
||||
void MainWindow::on_MF_Attack_darksideButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
mifare->darkside();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_Client_startArgsEdit_editingFinished()
|
||||
{
|
||||
settings->beginGroup("Client_Args");
|
||||
settings->setValue("args", ui->Set_Client_startArgsEdit->text());
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_Client_forceEnabledBox_stateChanged(int arg1)
|
||||
{
|
||||
settings->beginGroup("Client_forceButtonsEnabled");
|
||||
keepButtonsEnabled = (arg1 == Qt::Checked);
|
||||
settings->setValue("state", keepButtonsEnabled);
|
||||
settings->endGroup();
|
||||
if(keepButtonsEnabled)
|
||||
setButtonsEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_GUI_setLanguageButton_clicked()
|
||||
{
|
||||
Util::chooseLanguage(settings, this);
|
||||
}
|
||||
|
||||
void MainWindow::on_PM3_refreshPortButton_clicked()
|
||||
{
|
||||
on_portSearchTimer_timeout();
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_Client_envScriptEdit_editingFinished()
|
||||
{
|
||||
settings->beginGroup("Client_Env");
|
||||
settings->setValue("scriptPath", ui->Set_Client_envScriptEdit->text());
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_Client_workingDirEdit_editingFinished()
|
||||
{
|
||||
settings->beginGroup("Client_Env");
|
||||
settings->setValue("workingDir", ui->Set_Client_workingDirEdit->text());
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_Set_Client_configPathEdit_editingFinished()
|
||||
{
|
||||
settings->beginGroup("Client_Env");
|
||||
settings->setValue("configPath", ui->Set_Client_configPathEdit->text());
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1)
|
||||
{
|
||||
settings->beginGroup("Client_keepClientActive");
|
||||
keepClientActive = (arg1 == Qt::Checked);
|
||||
settings->setValue("state", keepClientActive);
|
||||
settings->endGroup();
|
||||
emit setSerialListener(!keepClientActive);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_freqSlider_valueChanged(int value)
|
||||
{
|
||||
onLFfreqConfChanged(value, true);
|
||||
}
|
||||
|
||||
void MainWindow::onLFfreqConfChanged(int value, bool isCustomized)
|
||||
{
|
||||
ui->LF_LFConf_freqDivisorBox->blockSignals(true);
|
||||
ui->LF_LFConf_freqSlider->blockSignals(true);
|
||||
|
||||
if(isCustomized)
|
||||
ui->LF_LFConf_freqOtherButton->setChecked(true);
|
||||
ui->LF_LFConf_freqLabel->setText(tr("Actural Freq: ") + QString("%1kHz").arg(LF::divisor2Freq(value), 0, 'f', 3));
|
||||
ui->LF_LFConf_freqDivisorBox->setValue(value);
|
||||
ui->LF_LFConf_freqSlider->setValue(value);
|
||||
|
||||
ui->LF_LFConf_freqDivisorBox->blockSignals(false);
|
||||
ui->LF_LFConf_freqSlider->blockSignals(false);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_freqDivisorBox_valueChanged(int arg1)
|
||||
{
|
||||
onLFfreqConfChanged(arg1, true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_freq125kButton_clicked()
|
||||
{
|
||||
onLFfreqConfChanged(95, false);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_freq134kButton_clicked()
|
||||
{
|
||||
onLFfreqConfChanged(88, false);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_Op_searchButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->search();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_Op_readButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->read();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_Op_tuneButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->tune();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_Op_sniffButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->sniff();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::dockInit()
|
||||
{
|
||||
setDockNestingEnabled(true);
|
||||
QDockWidget* dock;
|
||||
QWidget* widget;
|
||||
int count = ui->funcTab->count();
|
||||
qDebug() << "dock count" << count;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
dock = new QDockWidget(ui->funcTab->tabText(0), this);
|
||||
qDebug() << "dock name" << ui->funcTab->tabText(0);
|
||||
dock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable);// movable is necessary, otherwise the dock cannot be dragged
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
dock->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
widget = ui->funcTab->widget(0);
|
||||
dock->setWidget(widget);
|
||||
if(widget->objectName() == "rawTab")
|
||||
Util::setRawTab(dock, i);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
||||
if(!dockList.isEmpty())
|
||||
tabifyDockWidget(dockList[0], dock);
|
||||
dockList.append(dock);
|
||||
}
|
||||
ui->funcTab->setVisible(false);
|
||||
dockList[0]->setVisible(true);
|
||||
dockList[0]->raise();
|
||||
}
|
||||
|
||||
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
contextMenu->exec(event->globalPos());
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_getButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->getLFConfig();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_setButton_clicked()
|
||||
{
|
||||
LF::LFConfig config;
|
||||
setState(false);
|
||||
config.divisor = ui->LF_LFConf_freqDivisorBox->value();
|
||||
config.bitsPerSample = ui->LF_LFConf_bitsPerSampleBox->value();
|
||||
config.decimation = ui->LF_LFConf_decimationBox->value();
|
||||
config.averaging = ui->LF_LFConf_averagingBox->isChecked();
|
||||
config.triggerThreshold = ui->LF_LFConf_thresholdBox->value();
|
||||
config.samplesToSkip = ui->LF_LFConf_skipsBox->value();
|
||||
lf->setLFConfig(config);
|
||||
Util::gotoRawTab();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_LF_LFConf_resetButton_clicked()
|
||||
{
|
||||
setState(false);
|
||||
lf->resetLFConfig();
|
||||
setState(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,18 @@
|
||||
#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 "module/mifare.h"
|
||||
#include "module/lf.h"
|
||||
#include "common/util.h"
|
||||
#include "ui/mf_trailerdecoderdialog.h"
|
||||
|
||||
@@ -43,11 +52,13 @@ public:
|
||||
void initUI();
|
||||
bool eventFilter(QObject *watched, QEvent *event);
|
||||
public slots:
|
||||
void refreshOutput(const QString &output);
|
||||
void refreshCMD(const QString &cmd);
|
||||
void setStatusBar(QLabel* target, const QString & text);
|
||||
void onPM3StateChanged(bool st, QString info);
|
||||
void MF_onTypeChanged(int id, bool st);
|
||||
void refreshOutput(const QString& output);
|
||||
void refreshCMD(const QString& cmd);
|
||||
void setStatusBar(QLabel* target, const QString& text);
|
||||
void onPM3StateChanged(bool st, const QString& info);
|
||||
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:
|
||||
|
||||
void on_PM3_connectButton_clicked();
|
||||
@@ -59,7 +70,8 @@ private slots:
|
||||
void on_Raw_clearOutputButton_clicked();
|
||||
|
||||
void sendMSG();
|
||||
void on_PM3_refreshPortButton_clicked();
|
||||
|
||||
void on_portSearchTimer_timeout();
|
||||
|
||||
void on_Raw_CMDHistoryBox_stateChanged(int arg1);
|
||||
|
||||
@@ -87,7 +99,6 @@ private slots:
|
||||
|
||||
void on_MF_RW_writeSelectedButton_clicked();
|
||||
|
||||
|
||||
void on_MF_RW_dumpButton_clicked();
|
||||
|
||||
void on_MF_RW_restoreButton_clicked();
|
||||
@@ -142,42 +153,114 @@ private slots:
|
||||
|
||||
void on_MF_fillKeysButton_clicked();
|
||||
|
||||
void on_MF_Sniff_snoopButton_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:
|
||||
Ui::MainWindow* ui;
|
||||
QButtonGroup* typeBtnGroup;
|
||||
QButtonGroup* MFCardTypeBtnGroup;
|
||||
QLabel* connectStatusBar;
|
||||
QLabel* programStatusBar;
|
||||
QLabel* PM3VersionBar;
|
||||
QPushButton* stopButton;
|
||||
QAction* dockAllWindows;
|
||||
QAction* myInfo;
|
||||
QAction* currVersion;
|
||||
QAction* checkUpdate;
|
||||
QSettings* settings;
|
||||
MyEventFilter* keyEventFilter;
|
||||
MyEventFilter* resizeEventFilter;
|
||||
|
||||
QString stashedCMDEditText;
|
||||
int stashedIndex = -1;
|
||||
|
||||
void uiInit();
|
||||
|
||||
PM3Process* pm3;
|
||||
bool pm3state;
|
||||
bool keepButtonsEnabled;
|
||||
bool keepClientActive;
|
||||
QThread* pm3Thread;
|
||||
QTimer* portSearchTimer;
|
||||
QStringList portList;
|
||||
QStringList clientEnv;
|
||||
QDir* clientWorkingDir;
|
||||
|
||||
Mifare* mifare;
|
||||
LF* lf;
|
||||
Util* util;
|
||||
|
||||
QList<QDockWidget*> dockList;
|
||||
QMenu* contextMenu;
|
||||
|
||||
MF_trailerDecoderDialog* decDialog;
|
||||
|
||||
|
||||
void signalInit();
|
||||
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 saveClientPath(const QString &path);
|
||||
void saveClientPath(const QString& path);
|
||||
void onLFfreqConfChanged(int value, bool isCustomized);
|
||||
void dockInit();
|
||||
void loadConfig();
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
signals:
|
||||
void connectPM3(const QString path, const QString port);
|
||||
void connectPM3(const QString& path, const QStringList args);
|
||||
void reconnectPM3();
|
||||
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
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#include "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),
|
||||
ui(new Ui::MF_Attack_hardnestedDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
for(int i = 0; i < blocks; i++)
|
||||
{
|
||||
ui->knownKeySectorBox->addItem(QString::number(i));
|
||||
ui->targetKeySectorBox->addItem(QString::number(i));
|
||||
ui->knownKeyBlockBox->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()
|
||||
{
|
||||
emit sendCMD("hf mf hardnested "
|
||||
+ ui->knownKeySectorBox->currentText()
|
||||
+ " "
|
||||
+ ui->knownKeyTypeBox->currentText()
|
||||
+ " "
|
||||
+ ui->knownKeyBox->text()
|
||||
+ " "
|
||||
+ ui->targetKeySectorBox->currentText()
|
||||
+ " "
|
||||
+ ui->targetKeyTypeBox->currentText());
|
||||
QString cmd = config["cmd"].toString();
|
||||
cmd.replace("<known key block>", ui->knownKeyBlockBox->currentText());
|
||||
cmd.replace("<known key type>", config["known key type"].toMap()[ui->knownKeyTypeBox->currentText()].toString());
|
||||
cmd.replace("<known key>", ui->knownKeyBox->text());
|
||||
cmd.replace("<target key block>", ui->targetKeyBlockBox->currentText());
|
||||
cmd.replace("<target key type>", config["target key type"].toMap()[ui->targetKeyTypeBox->currentText()].toString());
|
||||
emit sendCMD(cmd);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define MF_ATTACK_HARDNESTEDDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "common/util.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MF_Attack_hardnestedDialog;
|
||||
}
|
||||
|
||||
@@ -12,14 +14,15 @@ class MF_Attack_hardnestedDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
|
||||
private:
|
||||
Ui::MF_Attack_hardnestedDialog *ui;
|
||||
QVariantMap config;
|
||||
signals:
|
||||
void sendCMD(QString cmd);
|
||||
void sendCMD(const QString& cmd);
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="knownKeySectorBox">
|
||||
<widget class="QComboBox" name="knownKeyBlockBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
@@ -106,7 +106,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="targetKeySectorBox">
|
||||
<widget class="QComboBox" name="targetKeyBlockBox">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
|
||||
@@ -1,12 +1,34 @@
|
||||
#include "mf_sim_simdialog.h"
|
||||
#include "ui_mf_sim_simdialog.h"
|
||||
|
||||
MF_Sim_simDialog::MF_Sim_simDialog(int cardType, QWidget *parent) :
|
||||
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()
|
||||
@@ -55,12 +77,27 @@ void MF_Sim_simDialog::on_fBox_clicked(bool checked)
|
||||
void MF_Sim_simDialog::on_buttonBox_accepted()
|
||||
{
|
||||
QString paras;
|
||||
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());
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDebug>
|
||||
#include "common/util.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -14,7 +15,7 @@ class MF_Sim_simDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MF_Sim_simDialog(int cardType, QWidget *parent = nullptr);
|
||||
explicit MF_Sim_simDialog(int cardType, QString cardTypeText, QWidget *parent = nullptr);
|
||||
~MF_Sim_simDialog();
|
||||
|
||||
private slots:
|
||||
@@ -25,8 +26,9 @@ private slots:
|
||||
private:
|
||||
Ui::MF_Sim_simDialog *ui;
|
||||
int cardType;
|
||||
QString cardTypeText;
|
||||
signals:
|
||||
void sendCMD(QString cmd);
|
||||
void sendCMD(const QString& cmd);
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
};
|
||||
|
||||
@@ -7,309 +7,598 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>461</width>
|
||||
<height>456</height>
|
||||
<height>524</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Simulate</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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 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="line_6">
|
||||
<widget class="Line" name="uLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<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 <numreads> blocks have been read by reader. 0 = infinite</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<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="line_5">
|
||||
<widget class="Line" name="atqaLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<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 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="line_4">
|
||||
<widget class="Line" name="sakLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<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 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 <numreads> 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="line_3">
|
||||
<widget class="Line" name="nLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<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 and i)</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<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="line_2">
|
||||
<widget class="Line" name="iLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<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 <filename.txt>' (implies x and i)</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<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="line">
|
||||
<widget class="Line" name="xLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<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 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="line_7">
|
||||
<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 <filename.txt>' (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>
|
||||
|
||||
@@ -15,10 +15,10 @@ MF_trailerDecoderDialog::MF_trailerDecoderDialog(QWidget *parent) :
|
||||
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, &QSpinBox::textChanged, this, &MF_trailerDecoderDialog::on_boxChanged);
|
||||
connect(ui->C1Box, &QSpinBox::textChanged, this, &MF_trailerDecoderDialog::on_boxChanged);
|
||||
connect(ui->C2Box, &QSpinBox::textChanged, this, &MF_trailerDecoderDialog::on_boxChanged);
|
||||
connect(ui->C3Box, &QSpinBox::textChanged, this, &MF_trailerDecoderDialog::on_boxChanged);
|
||||
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);
|
||||
@@ -123,7 +123,7 @@ void MF_trailerDecoderDialog::setTableItem(QTableWidget* widget, int row, int co
|
||||
widget->item(row, column)->setText(text);
|
||||
}
|
||||
|
||||
void MF_trailerDecoderDialog::on_boxChanged(const QString &arg1)
|
||||
void MF_trailerDecoderDialog::on_boxChanged()
|
||||
{
|
||||
quint8 ACBits[4];
|
||||
ACBits[0] = ui->C0Box->value();
|
||||
|
||||
@@ -23,11 +23,11 @@ public:
|
||||
|
||||
private slots:
|
||||
|
||||
void on_accessBitsEdit_textChanged(const QString &arg1);
|
||||
void on_accessBitsEdit_textChanged(const QString& arg1);
|
||||
|
||||
void on_blockSizeChanged(int id, bool st);
|
||||
|
||||
void on_boxChanged(const QString &arg1);
|
||||
void on_boxChanged();
|
||||
private:
|
||||
Ui::MF_trailerDecoderDialog *ui;
|
||||
QRegularExpressionValidator* validator;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "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),
|
||||
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->ATQALineEdit->setText(atqa);
|
||||
ui->SAKLineEdit->setText(sak);
|
||||
this->config = config;
|
||||
}
|
||||
|
||||
MF_UID_parameterDialog::~MF_UID_parameterDialog()
|
||||
@@ -18,10 +19,9 @@ MF_UID_parameterDialog::~MF_UID_parameterDialog()
|
||||
|
||||
void MF_UID_parameterDialog::on_buttonBox_accepted()
|
||||
{
|
||||
emit sendCMD("hf mf csetuid "
|
||||
+ ui->UIDLineEdit->text()
|
||||
+ " "
|
||||
+ ui->ATQALineEdit->text()
|
||||
+ " "
|
||||
+ ui->SAKLineEdit->text());
|
||||
QString cmd = config["cmd"].toString();
|
||||
cmd.replace("<uid>", ui->UIDLineEdit->text());
|
||||
cmd.replace("<atqa>", ui->ATQALineEdit->text());
|
||||
cmd.replace("<sak>", ui->SAKLineEdit->text());
|
||||
emit sendCMD(cmd);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define MF_UID_PARAMETERDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "common/util.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class MF_UID_parameterDialog;
|
||||
}
|
||||
|
||||
@@ -12,13 +14,14 @@ class MF_UID_parameterDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
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();
|
||||
|
||||
private:
|
||||
Ui::MF_UID_parameterDialog *ui;
|
||||
QVariantMap config;
|
||||
signals:
|
||||
void sendCMD(QString cmd);
|
||||
void sendCMD(const QString& cmd);
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
};
|
||||
|
||||