From 7e4dedeff1ab35451d2736c6d3e8408eb28e3518 Mon Sep 17 00:00:00 2001 From: wh201906 Date: Fri, 7 Aug 2020 15:28:17 +0800 Subject: [PATCH] Save client path automatically --- module/mifare.cpp | 2 +- ui/mainwindow.cpp | 23 +++++++++++++++++------ ui/mainwindow.h | 1 + ui/mainwindow.ui | 6 +----- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/module/mifare.cpp b/module/mifare.cpp index 055b91b..8bc7baf 100644 --- a/module/mifare.cpp +++ b/module/mifare.cpp @@ -297,7 +297,7 @@ QString Mifare::_readblk(int blockId, KeyType keyType, const QString& key, int w data.remove(" "); // when the target block is a key block and the given key type is KeyA, try to check whether the KeyB is valid(by Access Bits) // if the given key type is KeyB, it will never get the KeyA from the key block - if(isKeyBlock && keyType == KEY_A) + if(isKeyBlock && keyType == KEY_A) // in this case, the Access Bits is always accessible { data.replace(0, 12, key); QList ACBits = data_getACBits(data.mid(12, 8)); diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index ef0dc3f..0777242 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -77,6 +77,7 @@ void MainWindow::on_PM3_connectButton_clicked() QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok); else { + saveClientPath(ui->PM3_pathEdit->text()); emit connectPM3(ui->PM3_pathEdit->text(), port); } } @@ -237,6 +238,12 @@ void MainWindow::on_MF_fillKeysButton_clicked() mifare->data_fillKeys(); } +void MainWindow::on_MF_trailerDecoderButton_clicked() +{ + decDialog = new MF_trailerDecoderDialog(this); + decDialog->show(); +} + void MainWindow::on_MF_fontButton_clicked() { bool isOK = false; @@ -773,6 +780,10 @@ void MainWindow::uiInit() } settings->endGroup(); + settings->beginGroup("Client_Path"); + ui->PM3_pathEdit->setText(settings->value("path", "proxmark3").toString()); + settings->endGroup(); + ui->MF_RW_keyTypeBox->addItem("A", Mifare::KEY_A); ui->MF_RW_keyTypeBox->addItem("B", Mifare::KEY_B); @@ -896,6 +907,12 @@ void MainWindow::on_GroupBox_clicked(bool checked) settings->endGroup(); } +void MainWindow::saveClientPath(const QString& path) +{ + settings->beginGroup("Client_Path"); + settings->setValue("path", path); + settings->endGroup(); +} // *********************************************** @@ -904,9 +921,3 @@ void MainWindow::on_testButton_clicked() { mifare->_readsec(0, Mifare::KEY_A, "FFFFFFFFFFFF"); } - -void MainWindow::on_MF_trailerDecoderButton_clicked() -{ - decDialog = new MF_trailerDecoderDialog(this); - decDialog->show(); -} diff --git a/ui/mainwindow.h b/ui/mainwindow.h index 1327e0a..3a02dd5 100644 --- a/ui/mainwindow.h +++ b/ui/mainwindow.h @@ -173,6 +173,7 @@ private: void MF_widgetReset(); void setTableItem(QTableWidget *widget, int row, int column, const QString &text); void setState(bool st); + void saveClientPath(const QString &path); signals: void connectPM3(const QString path, const QString port); void killPM3(); diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 7096074..454dd5a 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -58,11 +58,7 @@ - - - ../pm3/iceman-64/win64/proxmark3 - - +