New experimental feature

Keep client active even the PM3 hardware is disconnected
pull/33/head
wh201906 4 years ago
parent 90e4fde882
commit fb8e1a6e1b

@ -12,9 +12,10 @@ PM3Process::PM3Process(QThread* thread, QObject* parent): QProcess(parent)
serialListener->setTimerType(Qt::VeryCoarseTimer);
connect(serialListener, &QTimer::timeout, this, &PM3Process::onTimeout);
connect(this, &PM3Process::readyRead, this, &PM3Process::onReadyRead);
portInfo = nullptr;
}
void PM3Process::connectPM3(const QString& path, const QString& port, const QStringList args)
void PM3Process::connectPM3(const QString& path, const QStringList args)
{
QString result;
Util::ClientType clientType;
@ -22,7 +23,6 @@ void PM3Process::connectPM3(const QString& path, const QString& port, const QStr
// stash for reconnect
currPath = path;
currPort = port;
currArgs = args;
// using "-f" option to make the client output flushed after every print.
@ -55,11 +55,6 @@ void PM3Process::connectPM3(const QString& path, const QString& port, const QStr
result = result.left(result.indexOf("\r\n"));
result = result.mid(3, result.lastIndexOf(" ") - 3);
emit PM3StatedChanged(true, result);
// if the arguments don't contain <port>, then disable the port listener
// useful when using offline sniff
if(args.indexOf(port) != -1)
setSerialListener(port, true);
}
else
kill();
@ -68,7 +63,7 @@ void PM3Process::connectPM3(const QString& path, const QString& port, const QStr
void PM3Process::reconnectPM3()
{
connectPM3(currPath, currPort, currArgs);
connectPM3(currPath, currArgs);
}
void PM3Process::setRequiringOutput(bool st)
@ -87,6 +82,7 @@ void PM3Process::setSerialListener(const QString& name, bool state)
{
if(state)
{
currPort = name;
portInfo = new QSerialPortInfo(name);
serialListener->start();
qDebug() << serialListener->thread();
@ -94,10 +90,19 @@ void PM3Process::setSerialListener(const QString& name, bool state)
else
{
serialListener->stop();
delete portInfo;
if(portInfo != nullptr)
{
delete portInfo;
portInfo = nullptr;
}
}
}
void PM3Process::setSerialListener(bool state)
{
setSerialListener(currPort, state);
}
void PM3Process::onTimeout() //when the proxmark3 client is unexpectedly terminated or the PM3 hardware is removed, the isBusy() will return false(only tested on Windows);
{
// qDebug()<<portInfo->isBusy();
@ -105,7 +110,7 @@ void PM3Process::onTimeout() //when the proxmark3 client is unexpectedly termina
{
kill();
emit PM3StatedChanged(false);
setSerialListener("", false);
setSerialListener(false);
}
}

@ -23,8 +23,9 @@ public:
void testThread();
public slots:
void connectPM3(const QString& path, const QString& port, const QStringList args);
void connectPM3(const QString& path, const QStringList args);
void setSerialListener(const QString& name, bool state);
void setSerialListener(bool state);
qint64 write(QString data);
void reconnectPM3();
void setProcEnv(const QStringList* env);
@ -39,7 +40,7 @@ private:
QTimer* serialListener;
QSerialPortInfo* portInfo;
QString currPath;
QString currPort;
QString currPort = "";
QStringList currArgs;
signals:

@ -377,13 +377,13 @@ It could make the whole sector blocked irreversibly!</source>
<message>
<location filename="../ui/mainwindow.ui" line="473"/>
<location filename="../ui/mainwindow.ui" line="1179"/>
<location filename="../ui/mainwindow.ui" line="1602"/>
<location filename="../ui/mainwindow.ui" line="1599"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="493"/>
<location filename="../ui/mainwindow.cpp" line="932"/>
<location filename="../ui/mainwindow.cpp" line="959"/>
<source>Data</source>
<translation type="unfinished"></translation>
</message>
@ -479,7 +479,7 @@ It could make the whole sector blocked irreversibly!</source>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="878"/>
<location filename="../ui/mainwindow.cpp" line="760"/>
<location filename="../ui/mainwindow.cpp" line="786"/>
<source>About UID Card</source>
<translation type="unfinished"></translation>
</message>
@ -658,76 +658,76 @@ It could make the whole sector blocked irreversibly!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1471"/>
<location filename="../ui/mainwindow.cpp" line="204"/>
<location filename="../ui/mainwindow.ui" line="1468"/>
<location filename="../ui/mainwindow.cpp" line="218"/>
<source>History:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1503"/>
<location filename="../ui/mainwindow.ui" line="1500"/>
<source>ClearHistory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1522"/>
<location filename="../ui/mainwindow.ui" line="1519"/>
<source>Send</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1529"/>
<location filename="../ui/mainwindow.ui" line="1526"/>
<source>ClearOutput</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1539"/>
<location filename="../ui/mainwindow.ui" line="1536"/>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1547"/>
<location filename="../ui/mainwindow.ui" line="1544"/>
<source>Client</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1553"/>
<location filename="../ui/mainwindow.ui" line="1550"/>
<source>Preload script path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1567"/>
<location filename="../ui/mainwindow.ui" line="1564"/>
<source>Note:
If the client requires some enviroment variables, you can make a script file(*.bat on Windows or *.sh on Linux) to configure them,
then put the path of the script there</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1586"/>
<location filename="../ui/mainwindow.ui" line="1583"/>
<source>Client working directory:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1595"/>
<location filename="../ui/mainwindow.ui" line="1592"/>
<source>../data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1611"/>
<location filename="../ui/mainwindow.ui" line="1608"/>
<source>Note:
On Windows, the client working directory should not be identical to the path of GUI, otherwise the client will use the wrong .dll file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1629"/>
<location filename="../ui/mainwindow.ui" line="1626"/>
<source>Start arguments</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1636"/>
<location filename="../ui/mainwindow.ui" line="1633"/>
<source>&lt;port&gt; -f</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1643"/>
<location filename="../ui/mainwindow.ui" line="1640"/>
<source>Note:
-f is necessary because the GUI need to handle the output in time
In some cases the arguments should be set to &quot;-p /dev/&lt;port&gt; -f&quot;
@ -735,75 +735,80 @@ or &quot;-p &lt;port&gt; -f&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1690"/>
<location filename="../ui/mainwindow.ui" line="1687"/>
<source>Keep buttons enabled even the client is running or disconnected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1712"/>
<location filename="../ui/mainwindow.ui" line="1733"/>
<source>Keep te client active even the PM3 hardware is disconnected.(Experimental)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1748"/>
<source>GUI</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1720"/>
<location filename="../ui/mainwindow.ui" line="1756"/>
<source>Language: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1727"/>
<location filename="../ui/mainwindow.ui" line="1763"/>
<source>Choose Language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1734"/>
<location filename="../ui/mainwindow.ui" line="1770"/>
<source>(Restart this app to use new language)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="93"/>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="525"/>
<location filename="../ui/mainwindow.cpp" line="545"/>
<location filename="../ui/mainwindow.cpp" line="558"/>
<location filename="../ui/mainwindow.cpp" line="577"/>
<location filename="../ui/mainwindow.cpp" line="590"/>
<location filename="../ui/mainwindow.cpp" line="613"/>
<location filename="../ui/mainwindow.cpp" line="626"/>
<location filename="../ui/mainwindow.cpp" line="817"/>
<location filename="../ui/mainwindow.cpp" line="836"/>
<location filename="../ui/mainwindow.cpp" line="97"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<location filename="../ui/mainwindow.cpp" line="547"/>
<location filename="../ui/mainwindow.cpp" line="567"/>
<location filename="../ui/mainwindow.cpp" line="580"/>
<location filename="../ui/mainwindow.cpp" line="599"/>
<location filename="../ui/mainwindow.cpp" line="612"/>
<location filename="../ui/mainwindow.cpp" line="639"/>
<location filename="../ui/mainwindow.cpp" line="652"/>
<location filename="../ui/mainwindow.cpp" line="843"/>
<location filename="../ui/mainwindow.cpp" line="862"/>
<source>Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="93"/>
<location filename="../ui/mainwindow.cpp" line="97"/>
<source>Plz choose a port first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="139"/>
<location filename="../ui/mainwindow.cpp" line="152"/>
<source>Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="145"/>
<location filename="../ui/mainwindow.cpp" line="920"/>
<location filename="../ui/mainwindow.cpp" line="158"/>
<location filename="../ui/mainwindow.cpp" line="947"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="571"/>
<location filename="../ui/mainwindow.cpp" line="593"/>
<source>Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml);;All Files(*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="577"/>
<location filename="../ui/mainwindow.cpp" line="590"/>
<location filename="../ui/mainwindow.cpp" line="817"/>
<location filename="../ui/mainwindow.cpp" line="599"/>
<location filename="../ui/mainwindow.cpp" line="612"/>
<location filename="../ui/mainwindow.cpp" line="843"/>
<source>Failed to open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<source>Continue?</source>
<translation type="unfinished"></translation>
</message>
@ -813,222 +818,222 @@ or &quot;-p &lt;port&gt; -f&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<source>Some of the data and key will be cleared.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="412"/>
<location filename="../ui/mainwindow.cpp" line="434"/>
<source>Plz select the font of data widget and key widget</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="525"/>
<location filename="../ui/mainwindow.cpp" line="547"/>
<source>Data must consists of 32 Hex symbols(Whitespace is allowed)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="545"/>
<location filename="../ui/mainwindow.cpp" line="558"/>
<location filename="../ui/mainwindow.cpp" line="567"/>
<location filename="../ui/mainwindow.cpp" line="580"/>
<source>Key must consists of 12 Hex symbols(Whitespace is allowed)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="570"/>
<location filename="../ui/mainwindow.cpp" line="592"/>
<source>Plz select the data file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="583"/>
<location filename="../ui/mainwindow.cpp" line="605"/>
<source>Plz select the key file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="584"/>
<location filename="../ui/mainwindow.cpp" line="606"/>
<source>Binary Key Files(*.bin *.dump);;Binary Data Files(*.bin *.dump);;All Files(*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="606"/>
<location filename="../ui/mainwindow.cpp" line="632"/>
<source>Plz select the location to save data file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="607"/>
<location filename="../ui/mainwindow.cpp" line="633"/>
<source>Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="613"/>
<location filename="../ui/mainwindow.cpp" line="626"/>
<location filename="../ui/mainwindow.cpp" line="836"/>
<location filename="../ui/mainwindow.cpp" line="639"/>
<location filename="../ui/mainwindow.cpp" line="652"/>
<location filename="../ui/mainwindow.cpp" line="862"/>
<source>Failed to save to</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="619"/>
<location filename="../ui/mainwindow.cpp" line="645"/>
<source>Plz select the location to save key file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="620"/>
<location filename="../ui/mainwindow.cpp" line="646"/>
<source>Binary Key Files(*.bin *.dump)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="745"/>
<location filename="../ui/mainwindow.cpp" line="771"/>
<source> Normally, the Block 0 of a typical Mifare card, which contains the UID, is locked during the manufacture. Users cannot write anything to Block 0 or set a new UID to a normal Mifare card.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="746"/>
<location filename="../ui/mainwindow.cpp" line="772"/>
<source> Chinese Magic Cards(aka UID Cards) are some special cards whose Block 0 are writeable. And you can change UID by writing to it.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="748"/>
<location filename="../ui/mainwindow.cpp" line="774"/>
<source>There are two versions of Chinese Magic Cards, the Gen1 and the Gen2.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="749"/>
<location filename="../ui/mainwindow.cpp" line="775"/>
<source> Gen1:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="749"/>
<location filename="../ui/mainwindow.cpp" line="775"/>
<source> also called UID card in China. It responses to some backdoor commands so you can access any blocks without password. The Proxmark3 has a bunch of related commands(csetblk, cgetblk, ...) to deal with this type of card, and my GUI also support these commands.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="750"/>
<location filename="../ui/mainwindow.cpp" line="776"/>
<source> Gen2:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="750"/>
<location filename="../ui/mainwindow.cpp" line="776"/>
<source> doesn&apos;t response to the backdoor commands, which means that a reader cannot detect whether it is a Chinese Magic Card or not by sending backdoor commands.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="752"/>
<location filename="../ui/mainwindow.cpp" line="778"/>
<source>There are some types of Chinese Magic Card Gen2.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="753"/>
<location filename="../ui/mainwindow.cpp" line="779"/>
<source> CUID Card:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="753"/>
<location filename="../ui/mainwindow.cpp" line="779"/>
<source> the Block 0 is writeable, you can write to this block repeatedly by normal wrbl command.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="754"/>
<location filename="../ui/mainwindow.cpp" line="780"/>
<source> (hf mf wrbl 0 A FFFFFFFFFFFF &lt;the data you want to write&gt;)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="755"/>
<location filename="../ui/mainwindow.cpp" line="781"/>
<source> FUID Card:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="755"/>
<location filename="../ui/mainwindow.cpp" line="781"/>
<source> you can only write to Block 0 once. After that, it seems like a typical Mifare card(Block 0 cannot be written to).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="756"/>
<location filename="../ui/mainwindow.cpp" line="782"/>
<source> (some readers might try changing the Block 0, which could detect the CUID Card. In that case, you should use FUID card.)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="757"/>
<location filename="../ui/mainwindow.cpp" line="783"/>
<source> UFUID Card:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="757"/>
<location filename="../ui/mainwindow.cpp" line="783"/>
<source> It behaves like a CUID card(or UID card? I&apos;m not sure) before you send some special command to lock it. Once it is locked, you cannot change its Block 0(just like a typical Mifare card).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="759"/>
<location filename="../ui/mainwindow.cpp" line="785"/>
<source> Seemingly, these Chinese Magic Cards are more easily to be compromised by Nested Attack(it takes little time to get an unknown key).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="804"/>
<location filename="../ui/mainwindow.cpp" line="830"/>
<source>Plz select the trace file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="805"/>
<location filename="../ui/mainwindow.cpp" line="831"/>
<source>Trace Files(*.trc);;All Files(*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="827"/>
<location filename="../ui/mainwindow.cpp" line="853"/>
<source>Plz select the location to save trace file:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="828"/>
<location filename="../ui/mainwindow.cpp" line="854"/>
<source>Trace Files(*.trc)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="921"/>
<location filename="../ui/mainwindow.cpp" line="1092"/>
<location filename="../ui/mainwindow.cpp" line="948"/>
<location filename="../ui/mainwindow.cpp" line="1127"/>
<source>Idle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="923"/>
<location filename="../ui/mainwindow.cpp" line="950"/>
<source>Stop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="930"/>
<location filename="../ui/mainwindow.cpp" line="937"/>
<location filename="../ui/mainwindow.cpp" line="957"/>
<location filename="../ui/mainwindow.cpp" line="964"/>
<source>Sec</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="931"/>
<location filename="../ui/mainwindow.cpp" line="958"/>
<source>Blk</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="938"/>
<location filename="../ui/mainwindow.cpp" line="965"/>
<source>KeyA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="939"/>
<location filename="../ui/mainwindow.cpp" line="966"/>
<source>KeyB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1029"/>
<location filename="../ui/mainwindow.cpp" line="1064"/>
<source>HW Version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1031"/>
<location filename="../ui/mainwindow.cpp" line="1066"/>
<source>PM3:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1033"/>
<location filename="../ui/mainwindow.cpp" line="1068"/>
<source>State:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1088"/>
<location filename="../ui/mainwindow.cpp" line="1123"/>
<source>Running</source>
<translation type="unfinished"></translation>
</message>

Binary file not shown.

@ -381,13 +381,13 @@ It could make the whole sector blocked irreversibly!</source>
<message>
<location filename="../ui/mainwindow.ui" line="473"/>
<location filename="../ui/mainwindow.ui" line="1179"/>
<location filename="../ui/mainwindow.ui" line="1602"/>
<location filename="../ui/mainwindow.ui" line="1599"/>
<source>Save</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="493"/>
<location filename="../ui/mainwindow.cpp" line="932"/>
<location filename="../ui/mainwindow.cpp" line="959"/>
<source>Data</source>
<translation></translation>
</message>
@ -483,7 +483,7 @@ It could make the whole sector blocked irreversibly!</source>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="878"/>
<location filename="../ui/mainwindow.cpp" line="760"/>
<location filename="../ui/mainwindow.cpp" line="786"/>
<source>About UID Card</source>
<translation>UID</translation>
</message>
@ -662,43 +662,43 @@ It could make the whole sector blocked irreversibly!</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1471"/>
<location filename="../ui/mainwindow.cpp" line="204"/>
<location filename="../ui/mainwindow.ui" line="1468"/>
<location filename="../ui/mainwindow.cpp" line="218"/>
<source>History:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1503"/>
<location filename="../ui/mainwindow.ui" line="1500"/>
<source>ClearHistory</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1522"/>
<location filename="../ui/mainwindow.ui" line="1519"/>
<source>Send</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1529"/>
<location filename="../ui/mainwindow.ui" line="1526"/>
<source>ClearOutput</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1539"/>
<location filename="../ui/mainwindow.ui" line="1536"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1547"/>
<location filename="../ui/mainwindow.ui" line="1544"/>
<source>Client</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1553"/>
<location filename="../ui/mainwindow.ui" line="1550"/>
<source>Preload script path:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1567"/>
<location filename="../ui/mainwindow.ui" line="1564"/>
<source>Note:
If the client requires some enviroment variables, you can make a script file(*.bat on Windows or *.sh on Linux) to configure them,
then put the path of the script there</source>
@ -706,34 +706,34 @@ then put the path of the script there</source>
(Windows*.batlinux*.sh)</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1586"/>
<location filename="../ui/mainwindow.ui" line="1583"/>
<source>Client working directory:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1595"/>
<location filename="../ui/mainwindow.ui" line="1592"/>
<source>../data</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1611"/>
<location filename="../ui/mainwindow.ui" line="1608"/>
<source>Note:
On Windows, the client working directory should not be identical to the path of GUI, otherwise the client will use the wrong .dll file.</source>
<translation>
WindowsGUI使.dll</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1629"/>
<location filename="../ui/mainwindow.ui" line="1626"/>
<source>Start arguments</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1636"/>
<location filename="../ui/mainwindow.ui" line="1633"/>
<source>&lt;port&gt; -f</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1643"/>
<location filename="../ui/mainwindow.ui" line="1640"/>
<source>Note:
-f is necessary because the GUI need to handle the output in time
In some cases the arguments should be set to &quot;-p /dev/&lt;port&gt; -f&quot;
@ -744,75 +744,80 @@ or &quot;-p &lt;port&gt; -f&quot;</source>
&quot;-p &lt;port&gt; -f&quot;</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1720"/>
<location filename="../ui/mainwindow.ui" line="1733"/>
<source>Keep te client active even the PM3 hardware is disconnected.(Experimental)</source>
<translation>PM3</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1756"/>
<source>Language: </source>
<translation> </translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1727"/>
<location filename="../ui/mainwindow.ui" line="1763"/>
<source>Choose Language</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1734"/>
<location filename="../ui/mainwindow.ui" line="1770"/>
<source>(Restart this app to use new language)</source>
<translation>使</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1690"/>
<location filename="../ui/mainwindow.ui" line="1687"/>
<source>Keep buttons enabled even the client is running or disconnected</source>
<translation>使</translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="1712"/>
<location filename="../ui/mainwindow.ui" line="1748"/>
<source>GUI</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="93"/>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="525"/>
<location filename="../ui/mainwindow.cpp" line="545"/>
<location filename="../ui/mainwindow.cpp" line="558"/>
<location filename="../ui/mainwindow.cpp" line="577"/>
<location filename="../ui/mainwindow.cpp" line="590"/>
<location filename="../ui/mainwindow.cpp" line="613"/>
<location filename="../ui/mainwindow.cpp" line="626"/>
<location filename="../ui/mainwindow.cpp" line="817"/>
<location filename="../ui/mainwindow.cpp" line="836"/>
<location filename="../ui/mainwindow.cpp" line="97"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<location filename="../ui/mainwindow.cpp" line="547"/>
<location filename="../ui/mainwindow.cpp" line="567"/>
<location filename="../ui/mainwindow.cpp" line="580"/>
<location filename="../ui/mainwindow.cpp" line="599"/>
<location filename="../ui/mainwindow.cpp" line="612"/>
<location filename="../ui/mainwindow.cpp" line="639"/>
<location filename="../ui/mainwindow.cpp" line="652"/>
<location filename="../ui/mainwindow.cpp" line="843"/>
<location filename="../ui/mainwindow.cpp" line="862"/>
<source>Info</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="93"/>
<location filename="../ui/mainwindow.cpp" line="97"/>
<source>Plz choose a port first</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="139"/>
<location filename="../ui/mainwindow.cpp" line="152"/>
<source>Connected</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="145"/>
<location filename="../ui/mainwindow.cpp" line="920"/>
<location filename="../ui/mainwindow.cpp" line="158"/>
<location filename="../ui/mainwindow.cpp" line="947"/>
<source>Not Connected</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="571"/>
<location filename="../ui/mainwindow.cpp" line="593"/>
<source>Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml);;All Files(*.*)</source>
<translation>(*.bin *.dump);;(*.txt *.eml);;(*.*)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="577"/>
<location filename="../ui/mainwindow.cpp" line="590"/>
<location filename="../ui/mainwindow.cpp" line="817"/>
<location filename="../ui/mainwindow.cpp" line="599"/>
<location filename="../ui/mainwindow.cpp" line="612"/>
<location filename="../ui/mainwindow.cpp" line="843"/>
<source>Failed to open</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<source>Continue?</source>
<translation></translation>
</message>
@ -822,222 +827,222 @@ or &quot;-p &lt;port&gt; -f&quot;</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="299"/>
<location filename="../ui/mainwindow.cpp" line="321"/>
<source>Some of the data and key will be cleared.</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="412"/>
<location filename="../ui/mainwindow.cpp" line="434"/>
<source>Plz select the font of data widget and key widget</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="525"/>
<location filename="../ui/mainwindow.cpp" line="547"/>
<source>Data must consists of 32 Hex symbols(Whitespace is allowed)</source>
<translation>32</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="545"/>
<location filename="../ui/mainwindow.cpp" line="558"/>
<location filename="../ui/mainwindow.cpp" line="567"/>
<location filename="../ui/mainwindow.cpp" line="580"/>
<source>Key must consists of 12 Hex symbols(Whitespace is allowed)</source>
<translation>12</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="570"/>
<location filename="../ui/mainwindow.cpp" line="592"/>
<source>Plz select the data file:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="583"/>
<location filename="../ui/mainwindow.cpp" line="605"/>
<source>Plz select the key file:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="584"/>
<location filename="../ui/mainwindow.cpp" line="606"/>
<source>Binary Key Files(*.bin *.dump);;Binary Data Files(*.bin *.dump);;All Files(*.*)</source>
<translation>(*.bin *.dump)(*.bin *.dump);(*.*)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="606"/>
<location filename="../ui/mainwindow.cpp" line="632"/>
<source>Plz select the location to save data file:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="607"/>
<location filename="../ui/mainwindow.cpp" line="633"/>
<source>Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)</source>
<translation>(*.bin *.dump);(*.txt *.eml)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="613"/>
<location filename="../ui/mainwindow.cpp" line="626"/>
<location filename="../ui/mainwindow.cpp" line="836"/>
<location filename="../ui/mainwindow.cpp" line="639"/>
<location filename="../ui/mainwindow.cpp" line="652"/>
<location filename="../ui/mainwindow.cpp" line="862"/>
<source>Failed to save to</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="619"/>
<location filename="../ui/mainwindow.cpp" line="645"/>
<source>Plz select the location to save key file:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="620"/>
<location filename="../ui/mainwindow.cpp" line="646"/>
<source>Binary Key Files(*.bin *.dump)</source>
<translation>(*.bin *.dump)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="745"/>
<location filename="../ui/mainwindow.cpp" line="771"/>
<source> Normally, the Block 0 of a typical Mifare card, which contains the UID, is locked during the manufacture. Users cannot write anything to Block 0 or set a new UID to a normal Mifare card.</source>
<translation> Mifare0</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="746"/>
<location filename="../ui/mainwindow.cpp" line="772"/>
<source> Chinese Magic Cards(aka UID Cards) are some special cards whose Block 0 are writeable. And you can change UID by writing to it.</source>
<translation> UIDChinese Magic Card0</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="748"/>
<location filename="../ui/mainwindow.cpp" line="774"/>
<source>There are two versions of Chinese Magic Cards, the Gen1 and the Gen2.</source>
<translation>UIDChinese Magic Card Gen1Gen2</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="749"/>
<location filename="../ui/mainwindow.cpp" line="775"/>
<source> Gen1:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="749"/>
<location filename="../ui/mainwindow.cpp" line="775"/>
<source> also called UID card in China. It responses to some backdoor commands so you can access any blocks without password. The Proxmark3 has a bunch of related commands(csetblk, cgetblk, ...) to deal with this type of card, and my GUI also support these commands.</source>
<translation> UIDPM3GUI</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="750"/>
<location filename="../ui/mainwindow.cpp" line="776"/>
<source> Gen2:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="750"/>
<location filename="../ui/mainwindow.cpp" line="776"/>
<source> doesn&apos;t response to the backdoor commands, which means that a reader cannot detect whether it is a Chinese Magic Card or not by sending backdoor commands.</source>
<translation> CUID/FUID/UFUID</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="752"/>
<location filename="../ui/mainwindow.cpp" line="778"/>
<source>There are some types of Chinese Magic Card Gen2.</source>
<translation>Gen2</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="753"/>
<location filename="../ui/mainwindow.cpp" line="779"/>
<source> CUID Card:</source>
<translation> CUID</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="753"/>
<location filename="../ui/mainwindow.cpp" line="779"/>
<source> the Block 0 is writeable, you can write to this block repeatedly by normal wrbl command.</source>
<translation> 0</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="754"/>
<location filename="../ui/mainwindow.cpp" line="780"/>
<source> (hf mf wrbl 0 A FFFFFFFFFFFF &lt;the data you want to write&gt;)</source>
<translation> (hf mf wrbl 0 A FFFFFFFFFFFF &lt;&gt;)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="755"/>
<location filename="../ui/mainwindow.cpp" line="781"/>
<source> FUID Card:</source>
<translation> FUID</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="755"/>
<location filename="../ui/mainwindow.cpp" line="781"/>
<source> you can only write to Block 0 once. After that, it seems like a typical Mifare card(Block 0 cannot be written to).</source>
<translation> 0</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="756"/>
<location filename="../ui/mainwindow.cpp" line="782"/>
<source> (some readers might try changing the Block 0, which could detect the CUID Card. In that case, you should use FUID card.)</source>
<translation> (穿CUID)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="757"/>
<location filename="../ui/mainwindow.cpp" line="783"/>
<source> UFUID Card:</source>
<translation> UFUID</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="757"/>
<location filename="../ui/mainwindow.cpp" line="783"/>
<source> It behaves like a CUID card(or UID card? I&apos;m not sure) before you send some special command to lock it. Once it is locked, you cannot change its Block 0(just like a typical Mifare card).</source>
<translation> UID/CUID0FUID</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="759"/>
<location filename="../ui/mainwindow.cpp" line="785"/>
<source> Seemingly, these Chinese Magic Cards are more easily to be compromised by Nested Attack(it takes little time to get an unknown key).</source>
<translation> UIDNested</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="804"/>
<location filename="../ui/mainwindow.cpp" line="830"/>
<source>Plz select the trace file:</source>
<translation>trace</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="805"/>
<location filename="../ui/mainwindow.cpp" line="831"/>
<source>Trace Files(*.trc);;All Files(*.*)</source>
<translation>Trace(*.trc);;(*.*)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="827"/>
<location filename="../ui/mainwindow.cpp" line="853"/>
<source>Plz select the location to save trace file:</source>
<translation>trace</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="828"/>
<location filename="../ui/mainwindow.cpp" line="854"/>
<source>Trace Files(*.trc)</source>
<translation>Trace(*.trc)</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="921"/>
<location filename="../ui/mainwindow.cpp" line="1092"/>
<location filename="../ui/mainwindow.cpp" line="948"/>
<location filename="../ui/mainwindow.cpp" line="1127"/>
<source>Idle</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="923"/>
<location filename="../ui/mainwindow.cpp" line="950"/>
<source>Stop</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="930"/>
<location filename="../ui/mainwindow.cpp" line="937"/>
<location filename="../ui/mainwindow.cpp" line="957"/>
<location filename="../ui/mainwindow.cpp" line="964"/>
<source>Sec</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="931"/>
<location filename="../ui/mainwindow.cpp" line="958"/>
<source>Blk</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="938"/>
<location filename="../ui/mainwindow.cpp" line="965"/>
<source>KeyA</source>
<translation>A</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="939"/>
<location filename="../ui/mainwindow.cpp" line="966"/>
<source>KeyB</source>
<translation>B</translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1029"/>
<location filename="../ui/mainwindow.cpp" line="1064"/>
<source>HW Version:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1031"/>
<location filename="../ui/mainwindow.cpp" line="1066"/>
<source>PM3:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1033"/>
<location filename="../ui/mainwindow.cpp" line="1068"/>
<source>State:</source>
<translation></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="1088"/>
<location filename="../ui/mainwindow.cpp" line="1123"/>
<source>Running</source>
<translation></translation>
</message>

@ -1341,3 +1341,10 @@ QList<quint8> Mifare::data_getACBits(const QString& text) //return empty QList i
return result;
}
QString Mifare::data_getUID()
{
if(data_isDataValid(dataList->at(0)))
return dataList->at(0).left(8);
else
return "";
}

@ -111,6 +111,7 @@ public:
static QList<quint8> data_getACBits(const QString& text);
static int data_b2s(int block);
static bool data_isACBitsValid(const QString& text, QList<quint8> *returnHalfBytes = nullptr);
QString data_getUID();
public slots:
signals:

@ -89,43 +89,56 @@ void MainWindow::on_PM3_connectButton_clicked()
qDebug() << "Main:" << QThread::currentThread();
QString port = ui->PM3_portBox->currentText();
if(port == "")
QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
else
QString startArgs = ui->Set_Client_startArgsEdit->text();
// on RRG repo, if no port is specified, the client will search the available port
if(port == "" && startArgs.contains("<port>")) // has <port>, no port
{
QStringList args = ui->Set_Client_startArgsEdit->text().replace("<port>", port).split(' ');
saveClientPath(ui->PM3_pathEdit->text());
QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
return;
}
QProcess envSetProcess;
QFileInfo envScriptPath(ui->Set_Client_envScriptEdit->text());
if(envScriptPath.exists())
{
qDebug() << envScriptPath.absoluteFilePath();
if(!startArgs.contains("<port>")) // no <port>
port = ""; // a symbol
QStringList args = startArgs.replace("<port>", port).split(' ');
saveClientPath(ui->PM3_pathEdit->text());
QProcess envSetProcess;
QFileInfo envScriptPath(ui->Set_Client_envScriptEdit->text());
if(envScriptPath.exists())
{
qDebug() << envScriptPath.absoluteFilePath();
#ifdef Q_OS_WIN
// cmd /c "<path>">>nul && set
envSetProcess.start("cmd /c \"" + envScriptPath.absoluteFilePath() + "\">>nul && set");
// cmd /c "<path>">>nul && set
envSetProcess.start("cmd /c \"" + envScriptPath.absoluteFilePath() + "\">>nul && set");
#else
// sh -c '. "<path>">>/dev/null && env'
envSetProcess.start("sh -c \' . \"" + envScriptPath.absoluteFilePath() + "\">>/dev/null && env");
// sh -c '. "<path>">>/dev/null && env'
envSetProcess.start("sh -c \' . \"" + envScriptPath.absoluteFilePath() + "\">>/dev/null && env");
#endif
envSetProcess.waitForReadyRead(10000);
clientEnv = QString(envSetProcess.readAll()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
// qDebug() << "Get Env List" << clientEnv;
}
else
clientEnv.clear();
emit setProcEnv(&clientEnv);
clientWorkingDir->setPath(QApplication::applicationDirPath());
qDebug() << clientWorkingDir->absolutePath();
clientWorkingDir->mkpath(ui->Set_Client_workingDirEdit->text());
qDebug() << clientWorkingDir->absolutePath();
clientWorkingDir->cd(ui->Set_Client_workingDirEdit->text());
qDebug() << clientWorkingDir->absolutePath();
emit setWorkingDir(clientWorkingDir->absolutePath());
emit connectPM3(ui->PM3_pathEdit->text(), port, args);
envSetProcess.waitForReadyRead(10000);
clientEnv = QString(envSetProcess.readAll()).split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
// qDebug() << "Get Env List" << clientEnv;
}
else
clientEnv.clear();
emit setProcEnv(&clientEnv);
clientWorkingDir->setPath(QApplication::applicationDirPath());
qDebug() << clientWorkingDir->absolutePath();
clientWorkingDir->mkpath(ui->Set_Client_workingDirEdit->text());
qDebug() << clientWorkingDir->absolutePath();
clientWorkingDir->cd(ui->Set_Client_workingDirEdit->text());
qDebug() << clientWorkingDir->absolutePath();
emit setWorkingDir(clientWorkingDir->absolutePath());
emit connectPM3(ui->PM3_pathEdit->text(), args);
if(port != "" && !keepClientActive)
emit setSerialListener(port, true);
else if(!keepClientActive)
emit setSerialListener(false);
}
void MainWindow::onPM3StateChanged(bool st, const QString& info)
@ -149,7 +162,7 @@ void MainWindow::onPM3StateChanged(bool st, const QString& info)
void MainWindow::on_PM3_disconnectButton_clicked()
{
emit killPM3();
emit setSerialListener("", false);
emit setSerialListener(false);
}
void MainWindow::refreshOutput(const QString& output)
@ -173,6 +186,7 @@ void MainWindow::on_stopButton_clicked()
break;
}
emit reconnectPM3();
emit setSerialListener(!keepClientActive);
}
}
// *********************************************************
@ -608,11 +622,15 @@ void MainWindow::on_MF_File_saveButton_clicked()
QString title = "";
QString filename = "";
QString selectedType = "";
QString defaultName = mifare->data_getUID();
if(defaultName != "")
defaultName += "_";
defaultName += QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss");
if(ui->MF_File_dataBox->isChecked())
{
title = tr("Plz select the location to save data file:");
filename = QFileDialog::getSaveFileName(this, title, "./", tr("Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)"), &selectedType);
filename = QFileDialog::getSaveFileName(this, title, "./data_" + defaultName, tr("Binary Data Files(*.bin *.dump);;Text Data Files(*.txt *.eml)"), &selectedType);
qDebug() << filename;
if(filename != "")
{
@ -625,7 +643,7 @@ void MainWindow::on_MF_File_saveButton_clicked()
else if(ui->MF_File_keyBox->isChecked())
{
title = tr("Plz select the location to save key file:");
filename = QFileDialog::getSaveFileName(this, title, "./", tr("Binary Key Files(*.bin *.dump)"), &selectedType);
filename = QFileDialog::getSaveFileName(this, title, "./key_" + defaultName, tr("Binary Key Files(*.bin *.dump)"), &selectedType);
qDebug() << filename;
if(filename != "")
{
@ -994,6 +1012,11 @@ void MainWindow::uiInit()
ui->Set_Client_forceEnabledBox->setChecked(keepButtonsEnabled);
settings->endGroup();
settings->beginGroup("Client_keepClientActive");
keepClientActive = settings->value("state", false).toBool();
ui->Set_Client_keepClientActiveBox->setChecked(keepClientActive);
settings->endGroup();
settings->beginGroup("Client_Env");
ui->Set_Client_envScriptEdit->setText(settings->value("scriptPath").toString());
ui->Set_Client_workingDirEdit->setText(settings->value("workingDir", "../data").toString());
@ -1019,6 +1042,8 @@ void MainWindow::signalInit()
connect(this, &MainWindow::killPM3, pm3, &PM3Process::kill);
connect(this, &MainWindow::setProcEnv, pm3, &PM3Process::setProcEnv);
connect(this, &MainWindow::setWorkingDir, pm3, &PM3Process::setWorkingDir);
connect(this, QOverload<bool>::of(&MainWindow::setSerialListener), pm3, QOverload<bool>::of(&PM3Process::setSerialListener));
connect(this, QOverload<const QString&, bool>::of(&MainWindow::setSerialListener), pm3, QOverload<const QString&, bool>::of(&PM3Process::setSerialListener));
connect(util, &Util::write, pm3, &PM3Process::write);
@ -1190,3 +1215,12 @@ void MainWindow::on_Set_Client_saveWorkingDirButton_clicked()
settings->setValue("workingDir", ui->Set_Client_workingDirEdit->text());
settings->endGroup();
}
void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1)
{
settings->beginGroup("Client_keepClientActive");
keepClientActive = (arg1 == Qt::Checked);
settings->setValue("state", keepClientActive);
settings->endGroup();
emit setSerialListener(!keepClientActive);
}

@ -23,6 +23,7 @@
#include <QProcessEnvironment>
#include <QScrollBar>
#include <QTimer>
#include <QDateTime>
#include "common/myeventfilter.h"
#include "common/pm3process.h"
@ -175,6 +176,8 @@ private slots:
void on_Set_Client_saveWorkingDirButton_clicked();
void on_Set_Client_keepClientActiveBox_stateChanged(int arg1);
private:
Ui::MainWindow* ui;
QButtonGroup* MFCardTypeBtnGroup;
@ -197,6 +200,7 @@ private:
PM3Process* pm3;
bool pm3state;
bool keepButtonsEnabled;
bool keepClientActive;
QThread* pm3Thread;
QTimer* portSearchTimer;
QStringList portList;
@ -214,9 +218,10 @@ private:
void setState(bool st);
void saveClientPath(const QString& path);
signals:
void connectPM3(const QString& path, const QString& port, const QStringList args);
void connectPM3(const QString& path, const QStringList args);
void reconnectPM3();
void killPM3();
void setSerialListener(bool state);
void setSerialListener(const QString& name, bool state);
void setProcEnv(const QStringList *env);
void setWorkingDir(const QString& dir);

@ -1535,7 +1535,7 @@
<attribute name="title">
<string>Settings</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
@ -1700,6 +1700,45 @@ or &quot;-p &lt;port&gt; -f&quot;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QCheckBox" name="Set_Client_keepClientActiveBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Keep te client active even the PM3 hardware is disconnected.(Experimental)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save