mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-17 06:31:33 +08:00
Support Iceman fork(Command Line only)
This commit is contained in:
parent
6f860111df
commit
ef6ebea568
@ -16,16 +16,25 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
|
|||||||
|
|
||||||
void PM3Process::connectPM3(const QString path, const QString port)
|
void PM3Process::connectPM3(const QString path, const QString port)
|
||||||
{
|
{
|
||||||
|
QString result;
|
||||||
setRequiringOutput(true);
|
setRequiringOutput(true);
|
||||||
|
|
||||||
// using "-f" option to make the client output flushed after every print.
|
// using "-f" option to make the client output flushed after every print.
|
||||||
start(path, QStringList() << port << "-f", QProcess::Unbuffered | QProcess::ReadWrite);
|
start(path, QStringList() << port << "-f", QProcess::Unbuffered | QProcess::ReadWrite);
|
||||||
if(waitForStarted(10000))
|
if(waitForStarted(10000))
|
||||||
{
|
{
|
||||||
while(waitForReadyRead(1000))
|
waitForReadyRead(1000);
|
||||||
;
|
|
||||||
setRequiringOutput(false);
|
setRequiringOutput(false);
|
||||||
QString result = *requiredOutput;
|
result = *requiredOutput;
|
||||||
|
if(result.indexOf("[=]") != -1)
|
||||||
|
{
|
||||||
|
emit changeClientType(Util::CLIENTTYPE_ICEMAN);
|
||||||
|
setRequiringOutput(true);
|
||||||
|
write("hw version\r\n");
|
||||||
|
waitForReadyRead(1000);
|
||||||
|
result = *requiredOutput;
|
||||||
|
setRequiringOutput(false);
|
||||||
|
}
|
||||||
if(result.indexOf("os: ") != -1) // make sure the PM3 is connected
|
if(result.indexOf("os: ") != -1) // make sure the PM3 is connected
|
||||||
{
|
{
|
||||||
result = result.mid(result.indexOf("os: "));
|
result = result.mid(result.indexOf("os: "));
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <QtSerialPort/QSerialPortInfo>
|
#include <QtSerialPort/QSerialPortInfo>
|
||||||
#include <QtSerialPort/QSerialPort>
|
#include <QtSerialPort/QSerialPort>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
class PM3Process : public QProcess
|
class PM3Process : public QProcess
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -34,6 +36,7 @@ private:
|
|||||||
signals:
|
signals:
|
||||||
void PM3StatedChanged(bool st, QString info = "");
|
void PM3StatedChanged(bool st, QString info = "");
|
||||||
void newOutput(QString output);
|
void newOutput(QString output);
|
||||||
|
void changeClientType(Util::ClientType);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PM3PROCESS_H
|
#endif // PM3PROCESS_H
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
Util::Util(Util::ClientType clientType, QObject *parent) : QObject(parent)
|
Util::Util(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
isRequiringOutput = false;
|
isRequiringOutput = false;
|
||||||
requiredOutput = new QString();
|
requiredOutput = new QString();
|
||||||
timeStamp = QTime::currentTime();
|
timeStamp = QTime::currentTime();
|
||||||
this->clientType = clientType;
|
this->clientType = CLIENTTYPE_OFFICIAL;
|
||||||
|
qRegisterMetaType<Util::ClientType>("Util::ClientType");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Util::processOutput(QString output)
|
void Util::processOutput(QString output)
|
||||||
@ -55,3 +56,8 @@ Util::ClientType Util::getClientType()
|
|||||||
{
|
{
|
||||||
return this->clientType;
|
return this->clientType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Util::setClientType(Util::ClientType clientType)
|
||||||
|
{
|
||||||
|
this->clientType = clientType;
|
||||||
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QMetaType>
|
||||||
|
|
||||||
class Util : public QObject
|
class Util : public QObject
|
||||||
{
|
{
|
||||||
@ -15,10 +16,13 @@ class Util : public QObject
|
|||||||
public:
|
public:
|
||||||
enum ClientType
|
enum ClientType
|
||||||
{
|
{
|
||||||
OFFICIAL,
|
CLIENTTYPE_OFFICIAL,
|
||||||
ICEMAN,
|
CLIENTTYPE_ICEMAN,
|
||||||
};
|
};
|
||||||
explicit Util(Util::ClientType clientType, QObject *parent = nullptr);
|
|
||||||
|
Q_ENUM(Util::ClientType)
|
||||||
|
|
||||||
|
explicit Util(QObject *parent = nullptr);
|
||||||
|
|
||||||
void execCMD(QString cmd);
|
void execCMD(QString cmd);
|
||||||
QString execCMDWithOutput(QString cmd, unsigned long timeout = 2000);
|
QString execCMDWithOutput(QString cmd, unsigned long timeout = 2000);
|
||||||
@ -26,6 +30,7 @@ public:
|
|||||||
ClientType getClientType();
|
ClientType getClientType();
|
||||||
public slots:
|
public slots:
|
||||||
void processOutput(QString output);
|
void processOutput(QString output);
|
||||||
|
void setClientType(Util::ClientType clientType);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isRequiringOutput;
|
bool isRequiringOutput;
|
||||||
|
@ -131,7 +131,7 @@ QString Mifare::_readblk(int blockId, KeyType keyType, const QString& key, int w
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(util->getClientType() == Util::OFFICIAL)
|
if(util->getClientType() == Util::CLIENTTYPE_OFFICIAL)
|
||||||
{
|
{
|
||||||
// use the given key type to read the target block
|
// use the given key type to read the target block
|
||||||
result = util->execCMDWithOutput(
|
result = util->execCMDWithOutput(
|
||||||
@ -205,7 +205,7 @@ QStringList Mifare::_readsec(int sectorId, KeyType keyType, const QString& key,
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(util->getClientType() == Util::OFFICIAL)
|
if(util->getClientType() == Util::CLIENTTYPE_OFFICIAL)
|
||||||
{
|
{
|
||||||
result = util->execCMDWithOutput(
|
result = util->execCMDWithOutput(
|
||||||
"hf mf rdsc "
|
"hf mf rdsc "
|
||||||
|
@ -24,7 +24,7 @@ MainWindow::MainWindow(QWidget *parent):
|
|||||||
pm3Thread->start();
|
pm3Thread->start();
|
||||||
pm3state = false;
|
pm3state = false;
|
||||||
|
|
||||||
util = new Util(Util::OFFICIAL, this);
|
util = new Util(this);
|
||||||
mifare = new Mifare(ui, util, this);
|
mifare = new Mifare(ui, util, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -784,6 +784,7 @@ void MainWindow::uiInit()
|
|||||||
void MainWindow::signalInit()
|
void MainWindow::signalInit()
|
||||||
{
|
{
|
||||||
connect(pm3, &PM3Process::newOutput, util, &Util::processOutput);
|
connect(pm3, &PM3Process::newOutput, util, &Util::processOutput);
|
||||||
|
connect(pm3, &PM3Process::changeClientType, util, &Util::setClientType);
|
||||||
connect(util, &Util::refreshOutput, this, &MainWindow::refreshOutput);
|
connect(util, &Util::refreshOutput, this, &MainWindow::refreshOutput);
|
||||||
|
|
||||||
connect(this, &MainWindow::connectPM3, pm3, &PM3Process::connectPM3);
|
connect(this, &MainWindow::connectPM3, pm3, &PM3Process::connectPM3);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Trailer Decoder</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user