diff --git a/lang/en_US.ts b/lang/en_US.ts
index 729092e..80fd2cf 100644
--- a/lang/en_US.ts
+++ b/lang/en_US.ts
@@ -31,11 +31,6 @@
-
-
-
-
-
@@ -82,11 +77,6 @@
-
-
-
-
-
@@ -149,19 +139,19 @@
-
+
-
+
-
+
@@ -171,250 +161,283 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
+
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -422,22 +445,22 @@ Continue?
Mifare
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
diff --git a/lang/zh_CN.ts b/lang/zh_CN.ts
index 1dddb58..eb7e8a3 100644
--- a/lang/zh_CN.ts
+++ b/lang/zh_CN.ts
@@ -35,11 +35,6 @@
-
-
-
-
-
@@ -86,11 +81,6 @@
路径:
-
-
-
-
-
@@ -153,19 +143,19 @@
-
+
加载
-
+
保存
-
+
@@ -175,250 +165,283 @@
-
+
破解
-
+
读卡片信息
-
+
验证默认密码
-
+
Nested攻击
-
+
Hardested攻击
-
+
读/写
-
+
-
+
-
-
-
-
-
-
+
Key类型:
-
+
-
+
-
+
普通卡(需要密码)
-
-
+
+
读单个块
-
-
+
+
写单个块
-
-
-
+
+
+
读所有块
-
-
+
+
写所有块
-
+
Dump命令
-
+
Restore命令
-
+
UID卡(不需要密码)
-
+
锁定UFUID卡
-
+
关于UID卡
-
+
设置卡参数
-
+
擦除
-
-
+
+
模拟
-
+
从上方数据导入
-
+
清空
-
-
+
+
嗅探
-
+
列出嗅探数据
-
+
原始命令
-
-
+
+
命令历史:
-
+
清空历史
-
+
发送
-
+
清空输出
-
-
+
+
+
+
信息
-
+
请先选择端口
-
+
已连接
-
-
-
+
+
+
未连接
-
+
更改卡容量后,窗口中的data和key会被清空\n要继续吗?
-
+
+
+ 请选择data文件:
+
+
+
+
+ 二进制Data文件(*.bin *.dump);;文本Data文件(*.txt *.eml);;所有文件(*.*)
+
+
+
+
+
+ 打开失败:
+
+
+
+
+ 请选择key文件:
+
+
+
+
+ 二进制Key文件(*.bin *.dump);;所有文件(*.*)
+
+
+
+
+ 保存数据至
+
+
+
+
+
+
+
+
空闲
-
-
+
+
-
+
-
+
-
+
-
+
固件版本:
-
+
连接状态:
-
+
运行状态:
@@ -430,22 +453,22 @@ Continue?
信息:
-
-
+
+
成功!
-
-
-
-
+
+
+
+
信息
-
-
+
+
失败!
diff --git a/module/mifare.cpp b/module/mifare.cpp
index 6a75d04..2230dbe 100644
--- a/module/mifare.cpp
+++ b/module/mifare.cpp
@@ -422,6 +422,7 @@ void Mifare::data_syncWithDataWidget(bool syncAll, int block)
{
for(int i = 0; i < cardType.blocks; i++)
{
+ tmp = "";
tmp += dataList->at(i).mid(0, 2);
for(int j = 1; j < 16; j++)
{
@@ -545,3 +546,99 @@ void Mifare::setCardType(int type)
data_clearData();
}
}
+
+bool Mifare::data_loadDataFile(const QString& filename)
+{
+ QFile file(filename, this);
+ if(file.open(QIODevice::ReadOnly))
+ {
+ QByteArray buff;
+ buff = file.read(8192);
+ bool isBin = false;
+ for(int i = 0; i < cardType.blocks * 16; i++) // Detect the file type
+ {
+// qDebug() << (unsigned char)buff[i];
+ if(!((buff[i] >= 'A' && buff[i] <= 'F') ||
+ (buff[i] >= 'a' && buff[i] <= 'f') ||
+ (buff[i] >= '0' && buff[i] <= '9') ||
+ buff[i] == '\n' ||
+ buff[i] == '\r'))
+ {
+ isBin = true;
+ break;
+ }
+ }
+ if(isBin)
+ {
+ char LByte, RByte;
+ char map[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ for(int i = 0; i < cardType.blocks; i++)
+ {
+ QString tmp = "";
+ for(int j = 0; j < 16; j++)
+ {
+ LByte = map[(unsigned char)buff[i * 16 + j] >> 4];
+ RByte = map[(unsigned char)buff[i * 16 + j] & 0xF];
+ tmp += LByte;
+ tmp += RByte;
+ }
+ qDebug() << tmp;
+ dataList->replace(i, tmp.toUpper());
+ }
+ }
+ else
+ {
+ QString tmp = buff.left(cardType.blocks * 34);
+ QStringList tmpList = tmp.split("\r\n");
+ for(int i = 0; i < cardType.blocks; i++)
+ {
+ dataList->replace(i, tmpList[i].toUpper());
+ qDebug() << tmpList[i];
+ }
+ }
+ file.close();
+ data_syncWithDataWidget();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool Mifare::data_loadKeyFile(const QString& filename)
+{
+ QFile file(filename, this);
+ if(file.open(QIODevice::ReadOnly))
+ {
+ QByteArray buff;
+ buff = file.read(960);
+ bool isBin = true;
+ if(isBin)
+ {
+ char LByte, RByte;
+ char map[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ for(int i = 0; i < cardType.sectors; i++)
+ {
+ QString tmp = "";
+ for(int j = 0; j < 12; j++)
+ {
+ LByte = map[(unsigned char)buff[i * 12 + j] >> 4];
+ RByte = map[(unsigned char)buff[i * 12 + j] & 0xF];
+ tmp += LByte;
+ tmp += RByte;
+ }
+ qDebug() << tmp;
+ keyAList->replace(i, tmp.left(12).toUpper());
+ keyBList->replace(i, tmp.right(12).toUpper());
+ }
+ }
+ file.close();
+ data_syncWithKeyWidget();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
diff --git a/module/mifare.h b/module/mifare.h
index ede29a6..6877c9b 100644
--- a/module/mifare.h
+++ b/module/mifare.h
@@ -93,6 +93,12 @@ public:
void readC();
void wipeC();
void setParameterC();
+
+ QStringList* keyAList;
+ QStringList* keyBList;
+ QStringList* dataList;
+ bool data_loadDataFile(const QString &filename);
+ bool data_loadKeyFile(const QString &filename);
public slots:
signals:
@@ -101,9 +107,7 @@ private:
Ui::MainWindow *ui;
Util* util;
- QStringList* keyAList;
- QStringList* keyBList;
- QStringList* dataList;
+
QRegExp* dataPattern;
QRegExp* chkKeyPattern;
QRegExp* nestedKeyPattern;
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index 5e93ffa..8d46c8c 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -17,7 +17,6 @@ MainWindow::MainWindow(QWidget *parent)
util = new Util(this);
mifare = new Mifare(ui, util, this);
-
}
MainWindow::~MainWindow()
@@ -30,7 +29,7 @@ MainWindow::~MainWindow()
delete pm3Thread;
}
-void MainWindow::initUI()
+void MainWindow::initUI() // will be called by main.app
{
ui->retranslateUi(this);
uiInit();
@@ -183,6 +182,47 @@ void MainWindow::MF_onTypeChanged(int id, bool st)
typeBtnGroup->blockSignals(false);
}
+void MainWindow::on_MF_File_loadButton_clicked()
+{
+ QString title = "";
+ QString filename = "";
+ if(ui->MF_File_dataBox->isChecked())
+ {
+ title = tr("Plz choose the data file:");
+ filename = QFileDialog::getOpenFileName(this, title, "./", tr("Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml);;All Files(*.*)"));
+ qDebug() << filename;
+ if(filename != "")
+ {
+ if(!mifare->data_loadDataFile(filename))
+ {
+ QMessageBox::information(this, tr("Info"), tr("Failed to open") + "\n" + filename);
+ }
+ }
+ }
+ else if(ui->MF_File_keyBox->isChecked())
+ {
+ title = tr("Plz choose the key file:");
+ filename = QFileDialog::getOpenFileName(this, title, "./", tr("Binary Key Files(*.bin *.dump);;All Files(*.*)"));
+ qDebug() << filename;
+ if(filename != "")
+ {
+ if(!mifare->data_loadKeyFile(filename))
+ {
+ QMessageBox::information(this, tr("Info"), tr("Failed to open") + "\n" + filename);
+ }
+ }
+ }
+
+}
+
+void MainWindow::on_MF_File_saveButton_clicked()
+{
+ QString title = tr("Save data to");
+ QString selectedType = "";
+ QString filename = QFileDialog::getSaveFileName(this, title, "./", tr("Bin Files(*.bin *.dump);;Text Files(*.txt *.eml)"), &selectedType);
+ qDebug() << filename << selectedType;
+}
+
void MainWindow::on_MF_Attack_infoButton_clicked()
{
mifare->info();
@@ -314,12 +354,6 @@ void MainWindow::uiInit()
ui->MF_dataWidget->setColumnWidth(0, 35);
ui->MF_dataWidget->setColumnWidth(1, 35);
ui->MF_dataWidget->setColumnWidth(2, 400);
-// for(int i = 0; i < 256; i++)
-// {
-// ui->MF_dataWidget->setItem(i, 0, new QTableWidgetItem());
-// ui->MF_dataWidget->setItem(i, 1, new QTableWidgetItem());
-// ui->MF_dataWidget->setItem(i, 2, new QTableWidgetItem());
-// }
ui->MF_keyWidget->setColumnCount(3);
ui->MF_keyWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Sec")));
@@ -329,12 +363,6 @@ void MainWindow::uiInit()
ui->MF_keyWidget->setColumnWidth(0, 35);
ui->MF_keyWidget->setColumnWidth(1, 110);
ui->MF_keyWidget->setColumnWidth(2, 110);
-// for(int i = 0; i < 40; i++)
-// {
-// ui->MF_keyWidget->setItem(i, 0, new QTableWidgetItem());
-// ui->MF_keyWidget->setItem(i, 1, new QTableWidgetItem());
-// ui->MF_keyWidget->setItem(i, 2, new QTableWidgetItem());
-// }
MF_widgetReset();
typeBtnGroup = new QButtonGroup(this);
diff --git a/ui/mainwindow.h b/ui/mainwindow.h
index 0aaf37d..d707eb0 100644
--- a/ui/mainwindow.h
+++ b/ui/mainwindow.h
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
#include
#include
@@ -89,12 +90,17 @@ private slots:
void on_MF_UID_writeBlockButton_clicked();
+ void on_MF_File_loadButton_clicked();
+
+ void on_MF_File_saveButton_clicked();
+
private:
- Ui::MainWindow *ui;
+ Ui::MainWindow* ui;
QButtonGroup* typeBtnGroup;
QLabel* connectStatusBar;
QLabel* programStatusBar;
QLabel* PM3VersionBar;
+
void uiInit();
PM3Process* pm3;
diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui
index 08f8714..63adddc 100644
--- a/ui/mainwindow.ui
+++ b/ui/mainwindow.ui
@@ -6,7 +6,7 @@
0
0
- 800
+ 820
770
@@ -323,7 +323,7 @@
-
-
+
Data
@@ -333,13 +333,10 @@
-
-
+
Key
-
- true
-