Use regex to process output

pull/2/head
wh201906 5 years ago
parent 23eb3f8ab3
commit 05d44604a4

@ -34,6 +34,10 @@ FORMS += \
ui/mainwindow.ui \
ui/mf_attack_hardnesteddialog.ui
TRANSLATIONS += \
lang/zh_CN.ts \
lang/en_US.ts
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
@ -43,3 +47,5 @@ VERSION = 0.0.1
QMAKE_TARGET_PRODUCT = "Proxmark3GUI"
QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI"
QMAKE_TARGET_COMPANY = "wh201906"
LANGUAGES

@ -0,0 +1,382 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MF_Attack_hardnestedDialog</name>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="14"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="20"/>
<source>Known Key:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="29"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="104"/>
<source>Block:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="68"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="143"/>
<source>A</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="73"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="148"/>
<source>B</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="86"/>
<source>FFFFFFFFFFFF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="95"/>
<source>Target Key: </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../ui/mainwindow.ui" line="20"/>
<source>Proxmark3GUI</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="38"/>
<source>Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="45"/>
<source>E:\Documents\source\qt\pm3\win64\proxmark3</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="62"/>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="69"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="76"/>
<source>Disconnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="95"/>
<source>Mifare</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="166"/>
<source>&gt;&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="191"/>
<source>&lt;&lt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="241"/>
<source>Card Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="253"/>
<source>1K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="263"/>
<source>2K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="270"/>
<source>4K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="280"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="298"/>
<location filename="../ui/mainwindow.ui" line="839"/>
<source>Load</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="311"/>
<location filename="../ui/mainwindow.ui" line="852"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="318"/>
<location filename="../ui/mainwindow.cpp" line="243"/>
<source>Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="328"/>
<source>Key</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="341"/>
<source>Attack</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="366"/>
<source>Card Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="379"/>
<source>Check Default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="392"/>
<source>Nested</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="399"/>
<source>Hardnested</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="424"/>
<source>Read/Write</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="434"/>
<source>Block:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="460"/>
<source>Key:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="472"/>
<source>FFFFFFFFFFFF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="479"/>
<source>Key Type:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="499"/>
<source>A</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="504"/>
<source>B</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="527"/>
<source>Normal(Require Password)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="542"/>
<location filename="../ui/mainwindow.ui" line="631"/>
<source>Read Block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="549"/>
<location filename="../ui/mainwindow.ui" line="638"/>
<source>Write Block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="556"/>
<location filename="../ui/mainwindow.ui" line="645"/>
<location filename="../ui/mainwindow.ui" line="745"/>
<source>Read All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="563"/>
<location filename="../ui/mainwindow.ui" line="652"/>
<source>Write All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="582"/>
<source>Dump</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="595"/>
<source>Restore</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="605"/>
<source>Chinese Magic Card(Without Password)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="617"/>
<source>Lock UFUID Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="624"/>
<source>About UID Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="665"/>
<source>Write UID</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="684"/>
<source>Wipe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="710"/>
<location filename="../ui/mainwindow.ui" line="765"/>
<source>Simulate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="738"/>
<source>Load from data above</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="758"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="788"/>
<location filename="../ui/mainwindow.ui" line="819"/>
<source>Sniff</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="826"/>
<source>List Sniff Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="878"/>
<source>RawCommand</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="910"/>
<location filename="../ui/mainwindow.cpp" line="129"/>
<source>History:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="939"/>
<source>ClearHistory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="958"/>
<source>Send</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="965"/>
<source>ClearOutput</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="65"/>
<source>Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="65"/>
<source>Plz choose a port first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="78"/>
<source>Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="82"/>
<location filename="../ui/mainwindow.cpp" line="91"/>
<location filename="../ui/mainwindow.cpp" line="232"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="233"/>
<source>Idle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="241"/>
<location filename="../ui/mainwindow.cpp" line="258"/>
<source>Sec</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="242"/>
<source>Blk</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="259"/>
<source>KeyA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="260"/>
<source>KeyB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="296"/>
<source>HW Version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="298"/>
<source>PM3:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="300"/>
<source>State:</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -0,0 +1,382 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MF_Attack_hardnestedDialog</name>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="14"/>
<source>Dialog</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="20"/>
<source>Known Key:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="29"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="104"/>
<source>Block:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="68"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="143"/>
<source>A</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="73"/>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="148"/>
<source>B</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="86"/>
<source>FFFFFFFFFFFF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mf_attack_hardnesteddialog.ui" line="95"/>
<source>Target Key: </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../ui/mainwindow.ui" line="20"/>
<source>Proxmark3GUI</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="38"/>
<source>Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="45"/>
<source>E:\Documents\source\qt\pm3\win64\proxmark3</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="62"/>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="69"/>
<source>Connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="76"/>
<source>Disconnect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="95"/>
<source>Mifare</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="166"/>
<source>&gt;&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="191"/>
<source>&lt;&lt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="241"/>
<source>Card Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="253"/>
<source>1K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="263"/>
<source>2K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="270"/>
<source>4K</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="280"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="298"/>
<location filename="../ui/mainwindow.ui" line="839"/>
<source>Load</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="311"/>
<location filename="../ui/mainwindow.ui" line="852"/>
<source>Save</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="318"/>
<location filename="../ui/mainwindow.cpp" line="243"/>
<source>Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="328"/>
<source>Key</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="341"/>
<source>Attack</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="366"/>
<source>Card Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="379"/>
<source>Check Default</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="392"/>
<source>Nested</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="399"/>
<source>Hardnested</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="424"/>
<source>Read/Write</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="434"/>
<source>Block:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="460"/>
<source>Key:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="472"/>
<source>FFFFFFFFFFFF</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="479"/>
<source>Key Type:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="499"/>
<source>A</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="504"/>
<source>B</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="527"/>
<source>Normal(Require Password)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="542"/>
<location filename="../ui/mainwindow.ui" line="631"/>
<source>Read Block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="549"/>
<location filename="../ui/mainwindow.ui" line="638"/>
<source>Write Block</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="556"/>
<location filename="../ui/mainwindow.ui" line="645"/>
<location filename="../ui/mainwindow.ui" line="745"/>
<source>Read All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="563"/>
<location filename="../ui/mainwindow.ui" line="652"/>
<source>Write All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="582"/>
<source>Dump</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="595"/>
<source>Restore</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="605"/>
<source>Chinese Magic Card(Without Password)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="617"/>
<source>Lock UFUID Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="624"/>
<source>About UID Card</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="665"/>
<source>Write UID</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="684"/>
<source>Wipe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="710"/>
<location filename="../ui/mainwindow.ui" line="765"/>
<source>Simulate</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="738"/>
<source>Load from data above</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="758"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="788"/>
<location filename="../ui/mainwindow.ui" line="819"/>
<source>Sniff</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="826"/>
<source>List Sniff Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="878"/>
<source>RawCommand</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="910"/>
<location filename="../ui/mainwindow.cpp" line="129"/>
<source>History:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="939"/>
<source>ClearHistory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="958"/>
<source>Send</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.ui" line="965"/>
<source>ClearOutput</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="65"/>
<source>Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="65"/>
<source>Plz choose a port first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="78"/>
<source>Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="82"/>
<location filename="../ui/mainwindow.cpp" line="91"/>
<location filename="../ui/mainwindow.cpp" line="232"/>
<source>Not Connected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="233"/>
<source>Idle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="241"/>
<location filename="../ui/mainwindow.cpp" line="258"/>
<source>Sec</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="242"/>
<source>Blk</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="259"/>
<source>KeyA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="260"/>
<source>KeyB</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="296"/>
<source>HW Version:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="298"/>
<source>PM3:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/mainwindow.cpp" line="300"/>
<source>State:</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

@ -4,12 +4,15 @@ Mifare::Mifare(Ui::MainWindow *ui, Util *addr, QObject *parent) : QObject(parent
{
util = addr;
this->ui = ui;
cardType = card_1k;
keyAList = new QStringList();
keyBList = new QStringList();
dataList = new QStringList();
data_clearKey(); // fill with blank Qstring
data_clearData(); // fill with blank Qstring
dataPattern = new QRegExp("([0-9a-fA-F]{2} ){15}[0-9a-fA-F]{2}");
chkKeyPattern = new QRegExp("\\|\\d{3}\\|.+\\|.+\\|");
nestedKeyPattern = new QRegExp("\\|\\d{3}\\|.+\\|.+\\|.+\\|.+\\|");
}
@ -22,36 +25,43 @@ void Mifare::info()
void Mifare::chk()
{
QString result = util->execCMDWithOutput("hf mf chk *1 ?");
result = result.mid(result.indexOf("|---|----------------|----------------|"));
QStringList keys = result.split("\r\n");
for(int i = 0; i < 16; i++)
{
keyAList->replace(i, keys[i + 3].mid(7, 12).trimmed().toUpper());
if(keyAList->at(i) == "?")
keyAList->replace(i, "");
keyBList->replace(i, keys[i + 3].mid(24, 12).trimmed().toUpper());
if(keyBList->at(i) == "?")
keyBList->replace(i, "");
QString result = util->execCMDWithOutput("hf mf chk *" + QString::number(cardType.type) + " ?");
int offset = 0;
QString tmp, tmp2;
for(int i = 0; i < cardType.sectors; i++)
{
offset = result.indexOf(*chkKeyPattern, offset);
tmp = result.mid(offset, 39).toUpper();
offset += 39;
qDebug() << tmp << offset;
tmp2 = tmp.mid(7, 12).trimmed();
if(tmp2 != "?")
keyAList->replace(i, tmp2);
tmp2 = tmp.mid(24, 12).trimmed();
if(tmp2 != "?")
keyBList->replace(i, tmp2);
}
data_syncWithKeyWidget();
qDebug() << "***********\n" << keys << "***********\n";
}
void Mifare::nested()
{
QString result = util->execCMDWithOutput("hf mf nested 1 *");
result = result.mid(result.indexOf("|---|----------------|---|----------------|---|"));
QStringList keys = result.split("\r\n");
for(int i = 0; i < 16; i++)
QString result = util->execCMDWithOutput("hf mf nested " + QString::number(cardType.type) + " *");
int offset = 0;
QString tmp;
for(int i = 0; i < cardType.sectors; i++)
{
if(keys[i + 3].at(23) == '1')
keyAList->replace(i, keys[i + 3].mid(7, 12).trimmed().toUpper());
if(keys[i + 3].at(44) == '1')
keyBList->replace(i, keys[i + 3].mid(28, 12).trimmed().toUpper());
offset = result.indexOf(*nestedKeyPattern, offset);
tmp = result.mid(offset, 47).toUpper();
offset += 47;
if(tmp.at(23) == '1')
keyAList->replace(i, tmp.mid(7, 12).trimmed());
if(tmp.at(44) == '1')
keyBList->replace(i, tmp.mid(28, 12).trimmed());
}
data_syncWithKeyWidget();
qDebug() << "***********\n" << keys << "***********\n";
}
void Mifare::hardnested()
@ -126,12 +136,13 @@ void Mifare::read()
void Mifare::readAll()
{
QString result;
QString tmp;
int offset = 0;
bool isKeyAValid;
bool isKeyBValid;
const int waitTime = 150;
for(int i = 0; i < sectors; i++)
QString tmp;
int offset = 0;
for(int i = 0; i < cardType.sectors; i++)
{
result = "";
isKeyAValid = false;
@ -149,9 +160,10 @@ void Mifare::readAll()
if(offset != -1)
{
isKeyAValid = true;
for(int j = 0; j < 4; j++)
for(int j = 0; j < cardType.blk[i]; j++)
{
tmp = result.mid(result.indexOf(*dataPattern, offset), 47).toUpper();
offset = result.indexOf(*dataPattern, offset);
tmp = result.mid(offset, 47).toUpper();
offset += 47;
qDebug() << tmp;
tmp.replace(" ", "");
@ -173,7 +185,8 @@ void Mifare::readAll()
isKeyBValid = true;
for(int j = 0; j < 4; j++)
{
tmp = result.mid(result.indexOf(*dataPattern, offset), 47).toUpper();
offset = result.indexOf(*dataPattern, offset);
tmp = result.mid(offset, 47).toUpper();
offset += 47;
qDebug() << tmp;
tmp.replace(" ", "");
@ -301,7 +314,7 @@ void Mifare::data_syncWithDataWidget(bool syncAll, int block)
QString tmp = "";
if(syncAll)
{
for(int i = 0; i < blocks; i++)
for(int i = 0; i < cardType.blk[block]; i++)
{
tmp += dataList->at(i).mid(0, 2);
for(int j = 1; j < 16; j++)
@ -328,7 +341,7 @@ void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, bool isKeyA)
{
if(syncAll)
{
for(int i = 0; i < sectors; i++)
for(int i = 0; i < cardType.sectors; i++)
{
ui->MF_keyWidget->item(i, 1)->setText(keyAList->at(i));
ui->MF_keyWidget->item(i, 2)->setText(keyBList->at(i));
@ -346,7 +359,7 @@ void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, bool isKeyA)
void Mifare::data_clearData()
{
dataList->clear();
for(int i = 0; i < blocks; i++)
for(int i = 0; i < 40; i++)
dataList->append("");
}
@ -354,7 +367,7 @@ void Mifare::data_clearKey()
{
keyAList->clear();
keyBList->clear();
for(int i = 0; i < sectors; i++)
for(int i = 0; i < cardType.sectors; i++)
{
keyAList->append("");
keyBList->append("");

@ -34,6 +34,43 @@ public:
DATA_NOSPACE,
};
struct CardType
{
int type;
int sectors;
int blk[40];
int blks[40];
};
const CardType card_mini =
{
0,
5,
{4, 4, 4, 4, 4},
{0, 4, 8, 12, 16}
};
const CardType card_1k =
{
1,
16,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60}
};
const CardType card_2k =
{
2,
32,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124}
};
const CardType card_4k =
{
4,
40,
{4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16, 16, 16, 16, 16, 16, 16, 16},
{0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 144, 160, 176, 192, 208, 224, 240}
};
void data_clearData();
void data_clearKey();
bool data_isKeyValid(const QString &key);
@ -51,9 +88,10 @@ private:
QStringList* keyBList;
QStringList* dataList;
QRegExp* dataPattern;
QRegExp* chkKeyPattern;
QRegExp* nestedKeyPattern;
int sectors = 16;
int blocks = 64;
CardType cardType;
};
#endif // MIFARE_H

@ -62,7 +62,7 @@ void MainWindow::on_PM3_connectButton_clicked()
qDebug() << "Main:" << QThread::currentThread();
QString port = ui->PM3_portBox->currentText();
if(port == "")
QMessageBox::information(NULL, "Info", "Plz choose a port first", QMessageBox::Ok);
QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
else
{
emit connectPM3(ui->PM3_pathEdit->text(), port);
@ -75,11 +75,11 @@ void MainWindow::onPM3StateChanged(bool st, QString info)
if(st == true)
{
setStatusBar(PM3VersionBar, info);
setStatusBar(connectStatusBar, "Connected");
setStatusBar(connectStatusBar, tr("Connected"));
}
else
{
setStatusBar(connectStatusBar, "Not Connected");
setStatusBar(connectStatusBar, tr("Not Connected"));
}
}
@ -88,7 +88,7 @@ void MainWindow::on_PM3_disconnectButton_clicked()
pm3state = false;
emit killPM3();
emit setSerialListener("", false);
setStatusBar(connectStatusBar, "Not Connected");
setStatusBar(connectStatusBar, tr("Not Connected"));
}
void MainWindow::refreshOutput(const QString& output)
@ -126,7 +126,7 @@ void MainWindow::on_Raw_CMDHistoryBox_stateChanged(int arg1)
{
ui->Raw_CMDHistoryWidget->setVisible(true);
ui->Raw_clearHistoryButton->setVisible(true);
ui->Raw_CMDHistoryBox->setText("History:");
ui->Raw_CMDHistoryBox->setText(tr("History:"));
}
else
{
@ -229,8 +229,8 @@ void MainWindow::uiInit()
connectStatusBar = new QLabel(this);
programStatusBar = new QLabel(this);
PM3VersionBar = new QLabel(this);
setStatusBar(connectStatusBar, "Not Connected");
setStatusBar(programStatusBar, "Idle");
setStatusBar(connectStatusBar, tr("Not Connected"));
setStatusBar(programStatusBar, tr("Idle"));
setStatusBar(PM3VersionBar, "");
ui->statusbar->addPermanentWidget(PM3VersionBar, 1);
ui->statusbar->addPermanentWidget(connectStatusBar, 1);
@ -238,9 +238,9 @@ void MainWindow::uiInit()
ui->MF_dataWidget->setColumnCount(3);
ui->MF_dataWidget->setRowCount(64);
ui->MF_dataWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Sec"));
ui->MF_dataWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("Blk"));
ui->MF_dataWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Data"));
ui->MF_dataWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Sec")));
ui->MF_dataWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Blk")));
ui->MF_dataWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Data")));
for(int i = 0; i < 64; i++)
{
ui->MF_dataWidget->setItem(i, 1, new QTableWidgetItem(QString::number(i)));
@ -255,9 +255,9 @@ void MainWindow::uiInit()
ui->MF_keyWidget->setColumnCount(3);
ui->MF_keyWidget->setRowCount(16);
ui->MF_keyWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Sec"));
ui->MF_keyWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("KeyA"));
ui->MF_keyWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("KeyB"));
ui->MF_keyWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Sec")));
ui->MF_keyWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("KeyA")));
ui->MF_keyWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("KeyB")));
for(int i = 0; i < 16; i++)
{
ui->MF_keyWidget->setItem(i, 0, new QTableWidgetItem(QString::number(i)));
@ -293,11 +293,11 @@ void MainWindow::signalInit()
void MainWindow::setStatusBar(QLabel* target, const QString & text)
{
if(target == PM3VersionBar)
target->setText("HW Version:" + text);
target->setText(tr("HW Version:") + text);
else if(target == connectStatusBar)
target->setText("PM3:" + text);
target->setText(tr("PM3:") + text);
else if(target == programStatusBar)
target->setText("State:" + text);
target->setText(tr("State:") + text);
}
// ***********************************************

@ -113,6 +113,9 @@
<family>Courier</family>
</font>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<attribute name="verticalHeaderMinimumSectionSize">
<number>20</number>
</attribute>
@ -449,6 +452,12 @@
<property name="editable">
<bool>true</bool>
</property>
<property name="currentText">
<string>0</string>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
<item>

Loading…
Cancel
Save