diff --git a/.gitignore b/.gitignore index fb50266..a3c9a94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,72 +1,2 @@ -# This file is used to ignore files which are generated -# ---------------------------------------------------------------------------- - -*~ -*.autosave -*.a -*.core -*.moc -*.o -*.obj -*.orig -*.rej -*.so -*.so.* -*_pch.h.cpp -*_resource.rc -.#* -*.*# -core -!core/ -tags -.DS_Store -.directory -*.debug -Makefile* -*.prl -*.app -moc_*.cpp -ui_*.h -qrc_*.cpp -Thumbs.db -*.res -*.rc -/.qmake.cache -/.qmake.stash - -# qtcreator generated files -*.pro.user* - -# xemacs temporary files -*.flc - -# Vim temporary files -.*.swp - -# Visual Studio generated files -*.ib_pdb_index -*.idb -*.ilk -*.pdb -*.sln -*.suo -*.vcproj -*vcproj.*.*.user -*.ncb -*.sdf -*.opensdf -*.vcxproj -*vcxproj.* - -# MinGW generated files -*.Debug -*.Release - -# Python byte code -*.pyc - -# Binaries -# -------- -*.dll -*.exe - +/build* +/data \ No newline at end of file diff --git a/README.md b/README.md index 7324f09..db089ae 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,9 @@ Great thanks to him. sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1 cd Proxmark3GUI - mkdir build - cd build - qmake ../ - make - make clean - cp -r ../lang ./ + mkdir build && cd build + qmake ../src + make -j4 && make clean cp -r ../config ./ ./Proxmark3GUI @@ -73,6 +70,9 @@ Great thanks to him. ## Update Log: +### V0.2.4 ++ Clone EM410x card to T55xx card + ### V0.2.3 + Fix bug [#27](https://github.com/wh201906/Proxmark3GUI/issues/27) + Try to support Non-ASCII path diff --git a/config/config_official.json b/config/config_official.json index 37ed8e2..0438ed8 100644 --- a/config/config_official.json +++ b/config/config_official.json @@ -191,5 +191,15 @@ "cmd": "lf config q b d a t s ", "divisor cmd": "hw setlfdivisor " } + }, + "t55xx":{ + "clone em410x":{ + "read":"lf search", + "successful read flag":"Valid EM410x ID", + "pattern":"EM TAG ID\\s*:\\s\\K[0-9a-fA-F]{10}", + "clone cmd":"lf em 410xwrite ", + "t5555 flag":"0", + "t55x7 flag":"1" + } } } \ No newline at end of file diff --git a/config/config_rrgv4.13.json b/config/config_rrgv4.13.json index eab77c1..8d5680d 100644 --- a/config/config_rrgv4.13.json +++ b/config/config_rrgv4.13.json @@ -199,5 +199,15 @@ "cmd": "lf config --divisor --bps --dec --avg --trig --skip ", "divisor cmd": "hw setlfdivisor -d " } + }, + "t55xx":{ + "clone em410x":{ + "read":"lf em 410x reader", + "successful read flag":"EM 410x ID", + "pattern":"EM 410x ID\\s*\\K[0-9a-fA-F]{10}", + "clone cmd":"lf em 410x clone --id ", + "t5555 flag":"--q5", + "t55x7 flag":"" + } } } \ No newline at end of file diff --git a/doc/README/README_zh_CN.md b/doc/README/README_zh_CN.md index 980ea88..d477aa3 100644 --- a/doc/README/README_zh_CN.md +++ b/doc/README/README_zh_CN.md @@ -54,12 +54,9 @@ release页面中有含客户端的GUI。这个GUI也可以搭配你自己的客 sudo apt-get install qt5-default libqt5serialport5 libqt5serialport5-dev git clone https://github.com/wh201906/Proxmark3GUI.git --depth=1 cd Proxmark3GUI - mkdir build - cd build - qmake ../ - make - make clean - cp -r ../lang ./ + mkdir build && cd build + qmake ../src + make -j4 && make clean cp -r ../config ./ ./Proxmark3GUI @@ -70,6 +67,9 @@ release页面中有含客户端的GUI。这个GUI也可以搭配你自己的客 *** ## 更新日志: +### V0.2.4 ++ 复制EM410x卡(一种常见的低频ID卡) + ### V0.2.3 + 修复 [#27](https://github.com/wh201906/Proxmark3GUI/issues/27) + 尝试支持中文启动路径 diff --git a/lang/languages.ini b/lang/languages.ini deleted file mode 100644 index d9a11e4..0000000 --- a/lang/languages.ini +++ /dev/null @@ -1,3 +0,0 @@ -[Languages] -en_US=English -zh_CN=简体中文 \ No newline at end of file diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..6e844ee --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,72 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/Proxmark3GUI.pro b/src/Proxmark3GUI.pro similarity index 91% rename from Proxmark3GUI.pro rename to src/Proxmark3GUI.pro index 4c9b689..6fca549 100644 --- a/Proxmark3GUI.pro +++ b/src/Proxmark3GUI.pro @@ -22,6 +22,7 @@ SOURCES += \ common/util.cpp \ module/lf.cpp \ module/mifare.cpp \ + module/t55xxtab.cpp \ ui/mf_trailerdecoderdialog.cpp \ ui/mf_sim_simdialog.cpp \ ui/mf_uid_parameterdialog.cpp \ @@ -34,6 +35,7 @@ HEADERS += \ common/util.h \ module/lf.h \ module/mifare.h \ + module/t55xxtab.h \ ui/mf_trailerdecoderdialog.h \ ui/mf_sim_simdialog.h \ ui/mf_uid_parameterdialog.h \ @@ -41,6 +43,7 @@ HEADERS += \ ui/mf_attack_hardnesteddialog.h \ FORMS += \ + ui/t55xxtab.ui \ ui/mf_trailerdecoderdialog.ui \ ui/mf_sim_simdialog.ui \ ui/mf_uid_parameterdialog.ui \ @@ -48,15 +51,18 @@ FORMS += \ ui/mf_attack_hardnesteddialog.ui TRANSLATIONS += \ - lang/zh_CN.ts \ - lang/en_US.ts + i18n/zh_CN.ts \ + i18n/en_US.ts # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target -VERSION = 0.2.3 +VERSION = 0.2.4 QMAKE_TARGET_PRODUCT = "Proxmark3GUI" QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI" QMAKE_TARGET_COMPANY = "wh201906" + +RESOURCES += \ + i18n/language.qrc diff --git a/common/myeventfilter.cpp b/src/common/myeventfilter.cpp similarity index 100% rename from common/myeventfilter.cpp rename to src/common/myeventfilter.cpp diff --git a/common/myeventfilter.h b/src/common/myeventfilter.h similarity index 100% rename from common/myeventfilter.h rename to src/common/myeventfilter.h diff --git a/common/pm3process.cpp b/src/common/pm3process.cpp similarity index 100% rename from common/pm3process.cpp rename to src/common/pm3process.cpp diff --git a/common/pm3process.h b/src/common/pm3process.h similarity index 100% rename from common/pm3process.h rename to src/common/pm3process.h diff --git a/common/util.cpp b/src/common/util.cpp similarity index 88% rename from common/util.cpp rename to src/common/util.cpp index ef8c692..9f3199b 100644 --- a/common/util.cpp +++ b/src/common/util.cpp @@ -78,7 +78,13 @@ QString Util::execCMDWithOutput(const QString& cmd, ReturnTrigger trigger, bool } } isRequiringOutput = false; - return (isResultFound || trigger.expectedOutputs.isEmpty() || rawOutput ? *requiredOutput : ""); + + // For functions without expected outputs in the return trigger, the result is the raw output. + // For functions with expected outputs in the return trigger, + // if rawOutput=true, the result is the raw output, + // otherwise, if the raw output contains one of the expected outputs, the result is the raw output, + // otherwise, the result is empty(as a failed flag). + return (trigger.expectedOutputs.isEmpty() || isResultFound || rawOutput ? *requiredOutput : ""); } void Util::delay(unsigned int msec) @@ -106,7 +112,7 @@ void Util::setRunningState(bool st) bool Util::chooseLanguage(QSettings* guiSettings, QMainWindow* window) { // make sure the GUISettings is not in any group - QSettings* langSettings = new QSettings("lang/languages.ini", QSettings::IniFormat); + QSettings* langSettings = new QSettings(":/i18n/languages.ini", QSettings::IniFormat); QMap langMap; langSettings->setIniCodec("UTF-8"); langSettings->beginGroup("Languages"); diff --git a/common/util.h b/src/common/util.h similarity index 100% rename from common/util.h rename to src/common/util.h diff --git a/lang/en_US.qm b/src/i18n/en_US.qm similarity index 100% rename from lang/en_US.qm rename to src/i18n/en_US.qm diff --git a/lang/en_US.ts b/src/i18n/en_US.ts similarity index 89% rename from lang/en_US.ts rename to src/i18n/en_US.ts index a4224b7..ab3a8ae 100644 --- a/lang/en_US.ts +++ b/src/i18n/en_US.ts @@ -536,7 +536,7 @@ It could make the whole sector blocked irreversibly! - + About UID Card @@ -738,6 +738,7 @@ or the communication between a tag and a reader. + T55xx @@ -939,7 +940,7 @@ or the communication between a tag and a reader. - + History: @@ -1054,46 +1055,46 @@ or the communication between a tag and a reader. - - - - - - - - - - - - + + + + + + + + + + + + Info - + Plz choose a port first - + Connected - - + + Not Connected - - - + + + Failed to open - + Continue? @@ -1113,194 +1114,194 @@ or the communication between a tag and a reader. - + Failed to load config file - + Some of the data and key will be cleared. - + Plz select the font of data widget and key widget - + Data must consists of 32 Hex symbols(Whitespace is allowed) - - + + Key must consists of 12 Hex symbols(Whitespace is allowed) - + Plz select the data file: - - - + + + Binary Data Files(*.bin *.dump) - - - + + + All Files(*.*) - + Plz select the key file: - + Plz select the location to save data file: - - - + + + Failed to save to - + Plz select the location to save key file: - - - + + + Binary Key Files(*.bin *.dump) - - + + Text Data Files(*.txt *.eml) - + 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. - + Chinese Magic Cards(aka UID Cards) are some special cards whose Block 0 are writeable. And you can change UID by writing to it. - + There are two versions of Chinese Magic Cards, the Gen1 and the Gen2. - + Gen1: - + 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. - + Gen2: - + doesn'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. - + There are some types of Chinese Magic Card Gen2. - + CUID Card: - + the Block 0 is writeable, you can write to this block repeatedly by normal wrbl command. - + (hf mf wrbl 0 A FFFFFFFFFFFF <the data you want to write>) - + FUID Card: - + you can only write to Block 0 once. After that, it seems like a typical Mifare card(Block 0 cannot be written to). - + (some readers might try changing the Block 0, which could detect the CUID Card. In that case, you should use FUID card.) - + UFUID Card: - + It behaves like a CUID card(or UID card? I'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). - + Seemingly, these Chinese Magic Cards are more easily to be compromised by Nested Attack(it takes little time to get an unknown key). - + Plz select the trace file: - + Plz select the location to save trace file: - - + + Trace Files(*.trc) - - + + Idle - + Stop @@ -1326,27 +1327,27 @@ or the communication between a tag and a reader. - + HW Version: - + PM3: - + State: - + Running - + Actural Freq: @@ -1354,58 +1355,96 @@ or the communication between a tag and a reader. Mifare - + Success! - - - - - - - + + + + + + + Info - + Plz provide at least one known key - - + + Failed! - + The Access Bits is invalid! It could make the whole sector blocked irreversibly! Continue to write? - + Successful! - + Failed to write to these blocks: - + Select them? - + Failed to read card. + + T55xxTab + + + Clone to T55xx + + + + + Target Type: + + + + + T5555 + + + + + T55x7 + + + + + EM410x + + + + + Read + + + + + Clone + + + diff --git a/src/i18n/language.qrc b/src/i18n/language.qrc new file mode 100644 index 0000000..1207c10 --- /dev/null +++ b/src/i18n/language.qrc @@ -0,0 +1,7 @@ + + + en_US.qm + languages.ini + zh_CN.qm + + diff --git a/src/i18n/languages.ini b/src/i18n/languages.ini new file mode 100644 index 0000000..10c2e3f --- /dev/null +++ b/src/i18n/languages.ini @@ -0,0 +1,4 @@ +[Languages] +en_US=English +zh_CN=简体中文 +ext=Load from external file diff --git a/lang/zh_CN.qm b/src/i18n/zh_CN.qm similarity index 89% rename from lang/zh_CN.qm rename to src/i18n/zh_CN.qm index bf66fd3..f2a0336 100644 Binary files a/lang/zh_CN.qm and b/src/i18n/zh_CN.qm differ diff --git a/lang/zh_CN.ts b/src/i18n/zh_CN.ts similarity index 89% rename from lang/zh_CN.ts rename to src/i18n/zh_CN.ts index ebe5e59..ba372a9 100644 --- a/lang/zh_CN.ts +++ b/src/i18n/zh_CN.ts @@ -500,7 +500,7 @@ It could make the whole sector blocked irreversibly! - + About UID Card 关于UID卡 @@ -694,7 +694,7 @@ Use this to get raw data from a tag. If the antenna voltage has a obvious drop after putting card on the antenna, it is likely that the tag is a LF tag. On Iceman/RRG repo, press the button on PM3 to stop measuring 测量低频天线谐振频率。 -如果天线电压在放置卡片后出现明显下降,则该卡片很可能是低频卡。 +如果天线电压在放置卡片后明显下降,则该卡片很可能是低频卡。 在冰人版固件下,如果需要停止测量,请按下PM3侧面的按钮 @@ -708,6 +708,7 @@ or the communication between a tag and a reader. + T55xx @@ -909,7 +910,7 @@ or the communication between a tag and a reader. - + History: 命令历史: @@ -1064,46 +1065,46 @@ or the communication between a tag and a reader. 图形化界面 - - - - - - - - - - - - + + + + + + + + + + + + Info 信息 - + Plz choose a port first 请先选择端口 - + Connected 已连接 - - + + Not Connected 未连接 - - - + + + Failed to open 无法打开 - + Continue? 确定? @@ -1123,82 +1124,82 @@ or the communication between a tag and a reader. 检查更新 - + Failed to load config file 无法打开配置文件 - + Some of the data and key will be cleared. 部分数据和密码将被清除 - + Plz select the font of data widget and key widget 请选择数据窗口和密钥窗口的字体 - + Data must consists of 32 Hex symbols(Whitespace is allowed) 数据必须由32个十六进制字符组成(中间可含有空格) - - + + Key must consists of 12 Hex symbols(Whitespace is allowed) 密钥必须由12个十六进制字符组成(中间可含有空格) - + Plz select the data file: 请选择数据文件: - - - + + + Binary Data Files(*.bin *.dump) 二进制数据文件(*.bin *.dump) - - - + + + All Files(*.*) 所有文件(*.*) - + Plz select the key file: 请选择密钥文件: - + Plz select the location to save data file: 请选择数据文件保存的位置: - - - + + + Failed to save to 无法保存至 - + Plz select the location to save key file: 请选择密钥文件保存的位置: - - - + + + Binary Key Files(*.bin *.dump) 二进制密码文件(*.bin *.dump) - - + + Text Data Files(*.txt *.eml) 文本数据文件(*.txt *.eml) @@ -1207,114 +1208,114 @@ or the communication between a tag and a reader. 文本密码文件(*.txt *.eml) - + 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. 普通Mifare卡的块0无法写入,卡号也不能更改 - + Chinese Magic Cards(aka UID Cards) are some special cards whose Block 0 are writeable. And you can change UID by writing to it. UID卡(在国外叫Chinese Magic Card)的块0可写,卡号可变。 - + There are two versions of Chinese Magic Cards, the Gen1 and the Gen2. 国外把UID卡分为Chinese Magic Card Gen1和Gen2 - + Gen1: - + 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. 指通常所说的UID卡,可以通过后门指令直接读写块而无需密码,在PM3和此GUI中有特殊命令处理这类卡片 - + Gen2: - + doesn'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. 这个叫法在国内比较罕见,在国外指CUID/FUID/UFUID这类对后门指令不响应的卡(防火墙卡) - + There are some types of Chinese Magic Card Gen2. 以下是Gen2卡的详细介绍 - + CUID Card: CUID卡: - + the Block 0 is writeable, you can write to this block repeatedly by normal wrbl command. 可通过普通的写块命令来写块0,可重复擦写 - + (hf mf wrbl 0 A FFFFFFFFFFFF <the data you want to write>) (hf mf wrbl 0 A FFFFFFFFFFFF <待写入数据>) - + FUID Card: FUID卡: - + you can only write to Block 0 once. After that, it seems like a typical Mifare card(Block 0 cannot be written to). 块0只能写入一次 - + (some readers might try changing the Block 0, which could detect the CUID Card. In that case, you should use FUID card.) (更高级的穿防火墙卡,可以过一些能识别出CUID卡的读卡器) - + UFUID Card: UFUID卡: - + It behaves like a CUID card(or UID card? I'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). 锁卡前和普通UID/CUID卡一样可以反复读写块0,用特殊命令锁卡后就和FUID卡一样了 - + Seemingly, these Chinese Magic Cards are more easily to be compromised by Nested Attack(it takes little time to get an unknown key). 所有UID卡都似乎更容易被Nested攻击破解 - + Plz select the trace file: 请选择trace文件: - + Plz select the location to save trace file: 请选择trace文件保存的位置: - - + + Trace Files(*.trc) Trace文件(*.trc) - - + + Idle 空闲 - + Stop 停止 @@ -1340,27 +1341,27 @@ or the communication between a tag and a reader. 密钥B - + HW Version: 固件版本: - + PM3: 连接状态: - + State: 运行状态: - + Running 正在运行 - + Actural Freq: 实际频率: @@ -1368,34 +1369,34 @@ or the communication between a tag and a reader. Mifare - + Success! 成功! - - - - - - - + + + + + + + Info 信息 - + Plz provide at least one known key 请至少提供一个已知密码 - - + + Failed! 失败! - + The Access Bits is invalid! It could make the whole sector blocked irreversibly! Continue to write? @@ -1404,24 +1405,62 @@ Continue to write? 确定要写入吗? - + Successful! 成功! - + Failed to write to these blocks: 写入以下块失败: - + Select them? 选中这些块? - + Failed to read card. 读卡失败。 + + T55xxTab + + + Clone to T55xx + 复制到T55xx卡 + + + + Target Type: + 目标卡片类型: + + + + T5555 + + + + + T55x7 + + + + + EM410x + + + + + Read + 读卡 + + + + Clone + 复制 + + diff --git a/main.cpp b/src/main.cpp similarity index 88% rename from main.cpp rename to src/main.cpp index 7ac5c30..40b577b 100644 --- a/main.cpp +++ b/src/main.cpp @@ -1,63 +1,63 @@ -#include "ui/mainwindow.h" - -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - // A trick to handle non-ascii path - // The application cannot find the plugins when the path contains non ascii characters. - // However, the plugins will be load after creating MainWindow(or QApplication?). - // QDir will handle the path correctly. - QDir* pluginDir = new QDir; - if(pluginDir->cd("plugins")) // has plugins folder - { - qputenv("QT_PLUGIN_PATH", pluginDir->absolutePath().toLocal8Bit()); - } - delete pluginDir; - - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); - QDir *langPath = new QDir(); - QApplication a(argc, argv); - MainWindow w; - - QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat); - settings->setIniCodec("UTF-8"); - settings->beginGroup("lang"); - QString currLang = settings->value("language", "").toString(); - settings->endGroup(); - if(currLang == "") - { - if(Util::chooseLanguage(settings, &w)) - { - settings->beginGroup("lang"); - currLang = settings->value("language", "").toString(); - settings->endGroup(); - } - else - currLang = "en_US"; - } - currLang += ".qm"; - langPath->cd("lang"); - QTranslator* translator = new QTranslator(&w); - if(translator->load(currLang, langPath->absolutePath())) - { - a.installTranslator(translator); - } - else - { - QMessageBox::information(&w, "Error", "Can't load " + currLang + " as translation file."); - } - delete settings; - delete langPath; - w.initUI(); - w.show(); - return a.exec(); -} - - +#include "ui/mainwindow.h" + +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + // A trick to handle non-ascii path + // The application cannot find the plugins when the path contains non ascii characters. + // However, the plugins will be load after creating MainWindow(or QApplication?). + // QDir will handle the path correctly. + QDir* pluginDir = new QDir; + if(pluginDir->cd("plugins")) // has plugins folder + { + qputenv("QT_PLUGIN_PATH", pluginDir->absolutePath().toLocal8Bit()); + } + delete pluginDir; + + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); + QApplication a(argc, argv); + MainWindow w; + + QSettings* settings = new QSettings("GUIsettings.ini", QSettings::IniFormat); + settings->setIniCodec("UTF-8"); + settings->beginGroup("lang"); + QString currLang = settings->value("language", "").toString(); + settings->endGroup(); + if(currLang == "") + { + if(Util::chooseLanguage(settings, &w)) + { + settings->beginGroup("lang"); + currLang = settings->value("language", "").toString(); + settings->endGroup(); + } + else + currLang = "en_US"; + } + if(currLang == "ext") + currLang = QFileDialog::getOpenFileName(nullptr, "Select the translation file:"); + else + currLang = ":/i18n/" + currLang + ".qm"; + QTranslator* translator = new QTranslator(&w); + if(translator->load(currLang)) + { + a.installTranslator(translator); + } + else + { + QMessageBox::information(&w, "Error", "Can't load " + currLang + " as translation file."); + } + delete settings; + w.initUI(); + w.show(); + return a.exec(); +} + + diff --git a/module/lf.cpp b/src/module/lf.cpp similarity index 99% rename from module/lf.cpp rename to src/module/lf.cpp index 97f6dd3..758f0f8 100644 --- a/module/lf.cpp +++ b/src/module/lf.cpp @@ -154,5 +154,4 @@ void LF::syncWithUI() void LF::setConfigMap(const QVariantMap& configMap) { this->configMap = configMap; - qDebug() << configMap; } diff --git a/module/lf.h b/src/module/lf.h similarity index 100% rename from module/lf.h rename to src/module/lf.h diff --git a/module/mifare.cpp b/src/module/mifare.cpp similarity index 99% rename from module/mifare.cpp rename to src/module/mifare.cpp index 0cdb019..7f7398e 100644 --- a/module/mifare.cpp +++ b/src/module/mifare.cpp @@ -91,7 +91,6 @@ Mifare::Mifare(Ui::MainWindow *ui, Util *addr, QWidget *parent): QObject(parent) void Mifare::setConfigMap(const QVariantMap& configMap) { this->configMap = configMap; - qDebug() << configMap; } QMap Mifare::info(bool isRequiringOutput) diff --git a/module/mifare.h b/src/module/mifare.h similarity index 100% rename from module/mifare.h rename to src/module/mifare.h diff --git a/src/module/t55xxtab.cpp b/src/module/t55xxtab.cpp new file mode 100644 index 0000000..5101d77 --- /dev/null +++ b/src/module/t55xxtab.cpp @@ -0,0 +1,68 @@ +#include "t55xxtab.h" +#include "ui_t55xxtab.h" + +T55xxTab::T55xxTab(Util *addr, QWidget *parent) : + QWidget(parent), + ui(new Ui::T55xxTab) +{ + ui->setupUi(this); + util = addr; +} + +T55xxTab::~T55xxTab() +{ + delete ui; +} + +void T55xxTab::setConfigMap(const QVariantMap &configMap) +{ + this->configMap = configMap; +} + +void T55xxTab::setGUIState(bool st) +{ + ui->cloneGroupBox->setEnabled(st); + emit setParentGUIState(st); +} + +void T55xxTab::on_Clone_EM410xReadButton_clicked() +{ + setGUIState(false); + + QVariantMap config = configMap["clone em410x"].toMap(); + QString result; + QRegularExpressionMatch reMatch; + + result = util->execCMDWithOutput( + config["read"].toString(), + Util::ReturnTrigger(6000, {config["successful read flag"].toString()})); + if(result.isEmpty()) + { + setGUIState(true); + return; + } + reMatch = QRegularExpression(config["pattern"].toString()).match(result); + ui->Clone_EM410xIDEdit->setText(reMatch.captured()); + + setGUIState(true); +} + +void T55xxTab::on_Clone_EM410xCloneButton_clicked() +{ + if(ui->Clone_EM410xIDEdit->text().isEmpty()) + return; + setGUIState(false); + + QVariantMap config = configMap["clone em410x"].toMap(); + QString cmd = config["clone cmd"].toString(); + cmd.replace("", ui->Clone_EM410xIDEdit->text()); + if(ui->Clone_T5555Button->isChecked()) + cmd.replace("", config["t5555 flag"].toString()); + else + cmd.replace("", config["t55x7 flag"].toString()); + util->execCMD(cmd); + Util::gotoRawTab(); + + setGUIState(true); +} + diff --git a/src/module/t55xxtab.h b/src/module/t55xxtab.h new file mode 100644 index 0000000..5fbec81 --- /dev/null +++ b/src/module/t55xxtab.h @@ -0,0 +1,36 @@ +#ifndef T55XXTAB_H +#define T55XXTAB_H + +#include "common/util.h" +#include + +namespace Ui +{ +class T55xxTab; +} + +class T55xxTab : public QWidget +{ + Q_OBJECT + +public: + explicit T55xxTab(Util *addr, QWidget *parent = nullptr); + ~T55xxTab(); + + void setConfigMap(const QVariantMap& configMap); +private slots: + void on_Clone_EM410xReadButton_clicked(); + + void on_Clone_EM410xCloneButton_clicked(); + +private: + Ui::T55xxTab *ui; + Util* util; + QVariantMap configMap; + + void setGUIState(bool st); +signals: + void setParentGUIState(bool st); +}; + +#endif // T55XXTAB_H diff --git a/ui/mainwindow.cpp b/src/ui/mainwindow.cpp similarity index 98% rename from ui/mainwindow.cpp rename to src/ui/mainwindow.cpp index 3321520..35584ea 100644 --- a/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -39,13 +39,16 @@ MainWindow::MainWindow(QWidget *parent): Util::setUI(ui); mifare = new Mifare(ui, util, this); lf = new LF(ui, util, this); + t55xxTab = new T55xxTab(util); + connect(t55xxTab, &T55xxTab::setParentGUIState, this, &MainWindow::setState); + ui->funcTab->insertTab(2, t55xxTab, tr("T55xx")); keyEventFilter = new MyEventFilter(QEvent::KeyPress); resizeEventFilter = new MyEventFilter(QEvent::Resize); // hide unused tabs // ui->funcTab->removeTab(1); - ui->funcTab->removeTab(2); + ui->funcTab->removeTab(3); portSearchTimer = new QTimer(this); portSearchTimer->setInterval(2000); @@ -85,7 +88,7 @@ void MainWindow::loadConfig() QJsonDocument configJson(QJsonDocument::fromJson(configData)); mifare->setConfigMap(configJson.object()["mifare classic"].toObject().toVariantMap()); lf->setConfigMap(configJson.object()["lf"].toObject().toVariantMap()); - + t55xxTab->setConfigMap(configJson.object()["t55xx"].toObject().toVariantMap()); } void MainWindow::initUI() // will be called by main.app @@ -636,7 +639,7 @@ void MainWindow::on_MF_File_loadButton_clicked() { QString title = ""; QString filename = ""; - if(ui->MF_File_dataBox->isChecked()) + if(ui->MF_File_dataButton->isChecked()) { title = tr("Plz select the data file:"); filename = QFileDialog::getOpenFileName(this, title, "./", tr("Binary Data Files(*.bin *.dump)") + ";;" + tr("Text Data Files(*.txt *.eml)") + ";;" + tr("All Files(*.*)")); @@ -649,7 +652,7 @@ void MainWindow::on_MF_File_loadButton_clicked() } } } - else if(ui->MF_File_keyBox->isChecked()) + else if(ui->MF_File_keyButton->isChecked()) { title = tr("Plz select the key file:"); filename = QFileDialog::getOpenFileName(this, title, "./", tr("Binary Key Files(*.bin *.dump)") + ";;" + tr("All Files(*.*)")); @@ -676,7 +679,7 @@ void MainWindow::on_MF_File_saveButton_clicked() defaultName += "_"; defaultName += QDateTime::currentDateTime().toString("yyyy-MM-dd-hh-mm-ss"); - if(ui->MF_File_dataBox->isChecked()) + if(ui->MF_File_dataButton->isChecked()) { title = tr("Plz select the location to save data file:"); filename = QFileDialog::getSaveFileName(this, title, "./data_" + defaultName, tr("Binary Data Files(*.bin *.dump)") + ";;" + tr("Text Data Files(*.txt *.eml)"), &selectedType); @@ -689,7 +692,7 @@ void MainWindow::on_MF_File_saveButton_clicked() } } } - else if(ui->MF_File_keyBox->isChecked()) + else if(ui->MF_File_keyButton->isChecked()) { title = tr("Plz select the location to save key file:"); filename = QFileDialog::getSaveFileName(this, title, "./key_" + defaultName, tr("Binary Key Files(*.bin *.dump)"), &selectedType); @@ -707,12 +710,12 @@ void MainWindow::on_MF_File_saveButton_clicked() void MainWindow::on_MF_File_clearButton_clicked() { - if(ui->MF_File_keyBox->isChecked()) + if(ui->MF_File_keyButton->isChecked()) { mifare->data_clearKey(); mifare->data_syncWithKeyWidget(); } - else if(ui->MF_File_dataBox->isChecked()) + else if(ui->MF_File_keyButton->isChecked()) { mifare->data_clearData(); mifare->data_syncWithDataWidget(); diff --git a/ui/mainwindow.h b/src/ui/mainwindow.h similarity index 99% rename from ui/mainwindow.h rename to src/ui/mainwindow.h index 43a4c34..5eaef2f 100644 --- a/ui/mainwindow.h +++ b/src/ui/mainwindow.h @@ -31,6 +31,7 @@ #include "common/pm3process.h" #include "module/mifare.h" #include "module/lf.h" +#include "module/t55xxtab.h" #include "common/util.h" #include "ui/mf_trailerdecoderdialog.h" @@ -205,6 +206,7 @@ private slots: void on_Set_Client_configPathEdit_editingFinished(); + void setState(bool st); private: Ui::MainWindow* ui; QButtonGroup* MFCardTypeBtnGroup; @@ -235,6 +237,7 @@ private: QStringList clientEnv; QDir* clientWorkingDir; + T55xxTab* t55xxTab; Mifare* mifare; LF* lf; Util* util; @@ -247,7 +250,6 @@ private: void signalInit(); void MF_widgetReset(); void setTableItem(QTableWidget *widget, int row, int column, const QString& text); - void setState(bool st); void saveClientPath(const QString& path); void onLFfreqConfChanged(int value, bool isCustomized); void dockInit(); diff --git a/ui/mainwindow.ui b/src/ui/mainwindow.ui similarity index 99% rename from ui/mainwindow.ui rename to src/ui/mainwindow.ui index 241b18f..df5e334 100644 --- a/ui/mainwindow.ui +++ b/src/ui/mainwindow.ui @@ -21,7 +21,7 @@ - + 0 0 @@ -524,7 +524,7 @@ - + Data @@ -534,7 +534,7 @@ - + Key diff --git a/ui/mf_attack_hardnesteddialog.cpp b/src/ui/mf_attack_hardnesteddialog.cpp similarity index 100% rename from ui/mf_attack_hardnesteddialog.cpp rename to src/ui/mf_attack_hardnesteddialog.cpp diff --git a/ui/mf_attack_hardnesteddialog.h b/src/ui/mf_attack_hardnesteddialog.h similarity index 100% rename from ui/mf_attack_hardnesteddialog.h rename to src/ui/mf_attack_hardnesteddialog.h diff --git a/ui/mf_attack_hardnesteddialog.ui b/src/ui/mf_attack_hardnesteddialog.ui similarity index 100% rename from ui/mf_attack_hardnesteddialog.ui rename to src/ui/mf_attack_hardnesteddialog.ui diff --git a/ui/mf_sim_simdialog.cpp b/src/ui/mf_sim_simdialog.cpp similarity index 100% rename from ui/mf_sim_simdialog.cpp rename to src/ui/mf_sim_simdialog.cpp diff --git a/ui/mf_sim_simdialog.h b/src/ui/mf_sim_simdialog.h similarity index 100% rename from ui/mf_sim_simdialog.h rename to src/ui/mf_sim_simdialog.h diff --git a/ui/mf_sim_simdialog.ui b/src/ui/mf_sim_simdialog.ui similarity index 100% rename from ui/mf_sim_simdialog.ui rename to src/ui/mf_sim_simdialog.ui diff --git a/ui/mf_trailerdecoderdialog.cpp b/src/ui/mf_trailerdecoderdialog.cpp similarity index 100% rename from ui/mf_trailerdecoderdialog.cpp rename to src/ui/mf_trailerdecoderdialog.cpp diff --git a/ui/mf_trailerdecoderdialog.h b/src/ui/mf_trailerdecoderdialog.h similarity index 100% rename from ui/mf_trailerdecoderdialog.h rename to src/ui/mf_trailerdecoderdialog.h diff --git a/ui/mf_trailerdecoderdialog.ui b/src/ui/mf_trailerdecoderdialog.ui similarity index 100% rename from ui/mf_trailerdecoderdialog.ui rename to src/ui/mf_trailerdecoderdialog.ui diff --git a/ui/mf_uid_parameterdialog.cpp b/src/ui/mf_uid_parameterdialog.cpp similarity index 100% rename from ui/mf_uid_parameterdialog.cpp rename to src/ui/mf_uid_parameterdialog.cpp diff --git a/ui/mf_uid_parameterdialog.h b/src/ui/mf_uid_parameterdialog.h similarity index 100% rename from ui/mf_uid_parameterdialog.h rename to src/ui/mf_uid_parameterdialog.h diff --git a/ui/mf_uid_parameterdialog.ui b/src/ui/mf_uid_parameterdialog.ui similarity index 100% rename from ui/mf_uid_parameterdialog.ui rename to src/ui/mf_uid_parameterdialog.ui diff --git a/src/ui/t55xxtab.ui b/src/ui/t55xxtab.ui new file mode 100644 index 0000000..7ead35a --- /dev/null +++ b/src/ui/t55xxtab.ui @@ -0,0 +1,107 @@ + + + T55xxTab + + + + 0 + 0 + 400 + 300 + + + + + + + Clone to T55xx + + + + + + + + Target Type: + + + + + + + T5555 + + + + + + + T55x7 + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + EM410x + + + + + + Read + + + + + + + + + + Clone + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + +