diff --git a/Proxmark3GUI.pro b/Proxmark3GUI.pro index fdbaca3..b5635cf 100644 --- a/Proxmark3GUI.pro +++ b/Proxmark3GUI.pro @@ -1,4 +1,4 @@ -QT += core gui +QT += core gui serialport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -31,3 +31,8 @@ FORMS += \ qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +VERSION = 0.0.1 +QMAKE_TARGET_PRODUCT = "Proxmark3GUI" +QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI" +QMAKE_TARGET_COMPANY = "wh201906" diff --git a/README.md b/README.md index 51ee18a..7492642 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # Proxmark3GUI -Developing... +A GUI for Proxmark3 client + +*** + +Update Log: + +## V0.0.1 ++ a dumb version with a useless GUI and a serial choose box. \ No newline at end of file diff --git a/mainwindow.cpp b/mainwindow.cpp index b2a2107..3f9c961 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7,7 +7,13 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); pm3=new PM3Process; - connect(pm3,PM3Process::readyReadStandardError,this,MainWindow::on_pushButton_3_clicked); + 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); + } } MainWindow::~MainWindow() @@ -16,21 +22,46 @@ MainWindow::~MainWindow() } -void MainWindow::on_pushButton_clicked() +void MainWindow::on_connectButton_clicked() { - qDebug()<init("E:/Documents/source/qt/pm3/win64/proxmark3.exe","COM4"); + QString port=ui->portBox->currentText(); + if(port=="") + QMessageBox::information(NULL, "Info", "Plz choose a port first", QMessageBox::Ok); + else + qDebug()<start(ui->PM3PathEdit->text(),port); } -void MainWindow::on_pushButton_2_clicked() +void MainWindow::on_sendButton_clicked() { - qDebug()<plainTextEdit_2->toPlainText().toLocal8Bit(); - pm3->write(ui->plainTextEdit_2->toPlainText().toLocal8Bit()); + qDebug()<<(ui->commandEdit->text().toLocal8Bit()); + pm3->write((ui->commandEdit->text()+"\r\n").toLocal8Bit()); pm3->waitForBytesWritten(3000); } -void MainWindow::on_pushButton_3_clicked() +void MainWindow::refresh() { - QByteArray btay=pm3->readAllStandardOutput(); - qDebug()<plainTextEdit->appendPlainText(btay); + QByteArray btay=pm3->readLine(); + while(btay!="") + { + qDebug()<outputEdit->insertPlainText(btay); + btay=pm3->readLine(); + } + ui->outputEdit->moveCursor(QTextCursor::End); +} + +void MainWindow::sendMSG() +{ + if(ui->commandEdit->hasFocus()) + on_sendButton_clicked(); +} + +void MainWindow::on_disconnectButton_clicked() +{ + pm3->kill(); +} + +void MainWindow::on_clearButton_clicked() +{ + ui->outputEdit->clear(); } diff --git a/mainwindow.h b/mainwindow.h index d5ee2cd..469e98c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "pm3process.h" QT_BEGIN_NAMESPACE @@ -18,13 +19,18 @@ public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); +public slots: + void refresh(); private slots: - void on_pushButton_clicked(); + void on_connectButton_clicked(); - void on_pushButton_2_clicked(); + void on_sendButton_clicked(); - void on_pushButton_3_clicked(); + void on_disconnectButton_clicked(); + void on_clearButton_clicked(); + + void sendMSG(); private: Ui::MainWindow *ui; PM3Process* pm3; diff --git a/mainwindow.ui b/mainwindow.ui index 8a3b849..b807653 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,80 +6,135 @@ 0 0 - 800 - 600 + 450 + 310 + + + 450 + 300 + + - MainWindow + Proxmark3GUI - - - - 440 - 120 - 83 - 23 - - - - Connect - - - - - - 110 - 120 - 281 - 181 - - - - - - - 100 - 340 - 291 - 31 - - - - - - - 450 - 350 - 83 - 23 - - - - Send - - - - - - 560 - 350 - 83 - 23 - - - - Read - - + + + 0 + 0 + + + + + + + QLayout::SetMaximumSize + + + + + Path: + + + + + + + proxmark3 + + + + + + + + + + Connect + + + + + + + Disconnect + + + + + + + + + + 0 + 0 + + + + 1 + + + + Tab 1 + + + + + RawCommand + + + + + + Qt::ScrollBarAlwaysOn + + + QAbstractScrollArea::AdjustIgnored + + + true + + + + + + + QLayout::SetMaximumSize + + + + + + + + Send + + + + + + + ClearOutput + + + + + + + + + + 0 0 - 800 + 450 22 diff --git a/pm3process.cpp b/pm3process.cpp index 16bb480..59e6ca7 100644 --- a/pm3process.cpp +++ b/pm3process.cpp @@ -2,14 +2,28 @@ PM3Process::PM3Process(QObject* parent): QProcess(parent) { + setProcessChannelMode(PM3Process::MergedChannels); +} +QStringList PM3Process::findPort() +{ + QSerialPort serial; + QStringList retList; + foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) + { + serial.setPort(info); + if(serial.open(QIODevice::ReadWrite)) + { + retList<start(path, QStringList(port)); - qDebug()< #include #include +#include +#include class PM3Process : public QProcess { Q_OBJECT public: explicit PM3Process(QObject* parent=nullptr); - bool init(const QString path, const QString port); + bool start(const QString path, const QString port); + QStringList findPort(); }; #endif // PM3PROCESS_H