From 643c298662174f391f9d9683afb56bcd1e39baf0 Mon Sep 17 00:00:00 2001 From: wh201906 <62299611+wh201906@users.noreply.github.com> Date: Tue, 7 Apr 2020 23:57:56 +0800 Subject: [PATCH] dev commit --- Proxmark3GUI.pro | 2 + mainwindow.cpp | 19 +++-- mainwindow.h | 4 + mainwindow.ui | 207 ++++++++++++++++++++++++++++++++++++++--------- mifare.cpp | 44 ++++++++++ mifare.h | 40 +++++++++ 6 files changed, 272 insertions(+), 44 deletions(-) create mode 100644 mifare.cpp create mode 100644 mifare.h diff --git a/Proxmark3GUI.pro b/Proxmark3GUI.pro index b5635cf..44bdaa5 100644 --- a/Proxmark3GUI.pro +++ b/Proxmark3GUI.pro @@ -18,10 +18,12 @@ DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp \ mainwindow.cpp \ + mifare.cpp \ pm3process.cpp HEADERS += \ mainwindow.h \ + mifare.h \ pm3process.h FORMS += \ diff --git a/mainwindow.cpp b/mainwindow.cpp index 909b785..be30e8a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7,13 +7,10 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); pm3=new PM3Process; + mifare=new Mifare; connect(pm3,&PM3Process::readyRead,this,&MainWindow::refresh); connect(ui->commandEdit,&QLineEdit::editingFinished,this,&MainWindow::sendMSG); - ui->portBox->addItem(""); - foreach(QString port,pm3->findPort()) - { - ui->portBox->addItem(port); - } + dataModel=new QStandardItemModel; dataModel->setColumnCount(3); @@ -70,7 +67,7 @@ void MainWindow::on_sendButton_clicked() void MainWindow::refresh() { - QByteArray btay=pm3->readLine(); + QString btay=pm3->readLine(); while(btay!="") { qDebug()<outputEdit->clear(); } + +void MainWindow::on_portButton_clicked() +{ + ui->portBox->clear(); + ui->portBox->addItem(""); + foreach(QString port,pm3->findPort()) + { + ui->portBox->addItem(port); + } +} diff --git a/mainwindow.h b/mainwindow.h index d2077ab..c695d92 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -7,6 +7,7 @@ #include #include #include "pm3process.h" +#include "mifare.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -32,9 +33,12 @@ private slots: void on_clearButton_clicked(); void sendMSG(); + void on_portButton_clicked(); + private: Ui::MainWindow *ui; PM3Process* pm3; + Mifare* mifare; QStandardItemModel* dataModel; QStandardItemModel* keyModel; }; diff --git a/mainwindow.ui b/mainwindow.ui index 92ddb47..693bc0f 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -49,6 +49,13 @@ + + + + Refresh + + + @@ -80,44 +87,168 @@ Mifare - - - - - - - - 2 - 0 - - - - 20 - - - 20 - - - - - - - - 1 - 0 - - - - 20 - - - 20 - - - - - - + + + + 90 + 290 + 320 + 80 + + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + + + 150 + 410 + 338 + 55 + + + + Read/Write + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + + + 170 + 480 + 338 + 55 + + + + Attack + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + PushButton + + + + + + + + + + + + 2 + 0 + + + + 20 + + + 20 + + + + + + + + 1 + 0 + + + + 20 + + + 20 + + + + + diff --git a/mifare.cpp b/mifare.cpp new file mode 100644 index 0000000..80f9c5a --- /dev/null +++ b/mifare.cpp @@ -0,0 +1,44 @@ +#include "mifare.h" + +Mifare::Mifare(QObject *parent) : QObject(parent) +{ + isProcessingData=false; + isProcessingKey=false; +} + +void Mifare::processData(const QString str) +{ + if(isProcessingData) + { + if(inputType==FROM_RDBL) + } +} +void Mifare::processKey(const QString str) +{ + if(isProcessingKey) + { + + } +} +void Mifare::setProcessingState(ProcessingState st) +{ + if(st==Mifare::NONE) + { + isProcessingKey=false; + isProcessingData=false; + } + else if(st==Mifare::KEY) + { + isProcessingKey=true; + isProcessingData=false; + } + else if(st==Mifare::DATA) + { + isProcessingKey=false; + isProcessingData=true; + } +} +void Mifare::setInputType(InputType tp) +{ + inputType=tp; +} diff --git a/mifare.h b/mifare.h new file mode 100644 index 0000000..7d447f3 --- /dev/null +++ b/mifare.h @@ -0,0 +1,40 @@ +#ifndef MIFARE_H +#define MIFARE_H + +#include + +class Mifare : public QObject +{ + Q_OBJECT +public: + explicit Mifare(QObject *parent = nullptr); + enum ProcessingState + { + NONE, + DATA, + KEY, + }; + enum InputType + { + FROM_RDBL, + FROM_RDSC, + FROM_CHK, + FROM_NESTED, + }; + + void setProcessingState(ProcessingState st); + void setInputType(InputType tp); +public slots: + void processData(const QString str); + void processKey(const QString str); +signals: + +private: + bool isProcessingData=false; + bool isProcessingKey=false; + InputType inputType; + QStringList dataList; + QStringList keyList[2]; +}; + +#endif // MIFARE_H