Complete Mifare module

pull/3/head
wh201906 5 years ago
parent fe8b9d6161
commit 5816d1b1b6

@ -570,6 +570,17 @@ void Mifare::simulate()
ui->funcTab->setCurrentIndex(1);
}
void Mifare::loadSniff(const QString& file)
{
util->execCMD("hf list mf -l " + file);
ui->funcTab->setCurrentIndex(1);
}
void Mifare::saveSniff(const QString& file)
{
util->execCMD("hf list mf -s " + file);
ui->funcTab->setCurrentIndex(1);
}
void Mifare::data_syncWithDataWidget(bool syncAll, int block)
{

@ -110,6 +110,8 @@ public:
void readAllE();
void wipeE();
void simulate();
void loadSniff(const QString& file);
void saveSniff(const QString& file);
public slots:
signals:

@ -7,7 +7,7 @@ MainWindow::MainWindow(QWidget *parent):
{
ui->setupUi(this);
// ui->MF_simGroupBox->setVisible(false); // developing...
ui->MF_sniffGroupBox->setVisible(false); // developing...
// ui->MF_sniffGroupBox->setVisible(false); // developing...
myInfo = new QAction("wh201906", this);
connect(myInfo, &QAction::triggered, [ = ]()
{
@ -678,3 +678,46 @@ void MainWindow::on_MF_Sim_simButton_clicked()
{
mifare->simulate();
}
void MainWindow::on_MF_Sniff_loadButton_clicked() // use a tmp file to support complicated path
{
QString title = "";
QString filename = "";
title = tr("Plz select the trace file:");
filename = QFileDialog::getOpenFileName(this, title, "./", 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))
{
mifare->loadSniff(tmpFile);
QFile::remove("./" + tmpFile);
}
else
{
QMessageBox::information(this, tr("Info"), tr("Failed to open") + "\n" + filename);
}
}
}
void MainWindow::on_MF_Sniff_saveButton_clicked()
{
QString title = "";
QString filename = "";
title = tr("Plz select the location to save trace file:");
filename = QFileDialog::getSaveFileName(this, title, "./", 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))
{
QMessageBox::information(this, tr("Info"), tr("Failed to save to") + "\n" + filename);
}
}
}

@ -128,6 +128,10 @@ private slots:
void on_MF_Sim_simButton_clicked();
void on_MF_Sniff_loadButton_clicked();
void on_MF_Sniff_saveButton_clicked();
private:
Ui::MainWindow* ui;
QButtonGroup* typeBtnGroup;

Loading…
Cancel
Save