mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-16 22:21:30 +08:00
Choose config file path
This commit is contained in:
parent
0c339e91af
commit
222f271a31
@ -59,7 +59,7 @@ Great thanks to him.
|
|||||||
make
|
make
|
||||||
make clean
|
make clean
|
||||||
cp -r ../lang ./
|
cp -r ../lang ./
|
||||||
cp ../configs.json ./
|
cp -r ../config ./
|
||||||
./Proxmark3GUI
|
./Proxmark3GUI
|
||||||
|
|
||||||
***
|
***
|
||||||
|
@ -108,7 +108,7 @@ void PM3Process::setSerialListener(bool 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);
|
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);
|
||||||
{
|
{
|
||||||
// isBusy() is a deprecated function because it will block the serial port when the port is not in use.
|
// isBusy() is a deprecated function because it will block the serial port when the port is not in use.
|
||||||
// However, the PM3 client is supposed to use the serial port exclusively, so it should be fine
|
// However, the PM3 client is supposed to use the target serial port exclusively, so it should be fine
|
||||||
// isBusy() will always return false on Raspbian, in this case, check "Keep the client active" in the Settings panel.
|
// isBusy() will always return false on Raspbian, in this case, check "Keep the client active" in the Settings panel.
|
||||||
//
|
//
|
||||||
// qDebug()<<portInfo->isBusy();
|
// qDebug()<<portInfo->isBusy();
|
||||||
|
@ -40,16 +40,6 @@ MainWindow::MainWindow(QWidget *parent):
|
|||||||
mifare = new Mifare(ui, util, this);
|
mifare = new Mifare(ui, util, this);
|
||||||
lf = new LF(ui, util, this);
|
lf = new LF(ui, util, this);
|
||||||
|
|
||||||
QFile configList("configs.json");
|
|
||||||
if(!configList.open(QFile::ReadOnly | QFile::Text))
|
|
||||||
{
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray configData = configList.readAll();
|
|
||||||
QJsonDocument configJson(QJsonDocument::fromJson(configData));
|
|
||||||
mifare->setConfigMap(configJson.object()["mifare classic"].toObject().toVariantMap());
|
|
||||||
|
|
||||||
keyEventFilter = new MyEventFilter(QEvent::KeyPress);
|
keyEventFilter = new MyEventFilter(QEvent::KeyPress);
|
||||||
resizeEventFilter = new MyEventFilter(QEvent::Resize);
|
resizeEventFilter = new MyEventFilter(QEvent::Resize);
|
||||||
|
|
||||||
@ -82,6 +72,21 @@ MainWindow::~MainWindow()
|
|||||||
delete pm3Thread;
|
delete pm3Thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::loadConfig()
|
||||||
|
{
|
||||||
|
QFile configList(ui->Set_Client_configPathEdit->text());
|
||||||
|
if(!configList.open(QFile::ReadOnly | QFile::Text))
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("Info"), tr("Failed to load config file"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray configData = configList.readAll();
|
||||||
|
QJsonDocument configJson(QJsonDocument::fromJson(configData));
|
||||||
|
mifare->setConfigMap(configJson.object()["mifare classic"].toObject().toVariantMap());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::initUI() // will be called by main.app
|
void MainWindow::initUI() // will be called by main.app
|
||||||
{
|
{
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
@ -120,7 +125,7 @@ void MainWindow::on_PM3_connectButton_clicked()
|
|||||||
// on RRG repo, if no port is specified, the client will search the available port
|
// on RRG repo, if no port is specified, the client will search the available port
|
||||||
if(port == "" && startArgs.contains("<port>")) // has <port>, no port
|
if(port == "" && startArgs.contains("<port>")) // has <port>, no port
|
||||||
{
|
{
|
||||||
QMessageBox::information(NULL, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
|
QMessageBox::information(this, tr("Info"), tr("Plz choose a port first"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,6 +175,7 @@ void MainWindow::on_PM3_connectButton_clicked()
|
|||||||
qDebug() << clientWorkingDir->absolutePath();
|
qDebug() << clientWorkingDir->absolutePath();
|
||||||
emit setWorkingDir(clientWorkingDir->absolutePath());
|
emit setWorkingDir(clientWorkingDir->absolutePath());
|
||||||
|
|
||||||
|
loadConfig();
|
||||||
emit connectPM3(ui->PM3_pathEdit->text(), args);
|
emit connectPM3(ui->PM3_pathEdit->text(), args);
|
||||||
if(port != "" && !keepClientActive)
|
if(port != "" && !keepClientActive)
|
||||||
emit setSerialListener(port, true);
|
emit setSerialListener(port, true);
|
||||||
@ -1057,6 +1063,7 @@ void MainWindow::uiInit()
|
|||||||
settings->beginGroup("Client_Env");
|
settings->beginGroup("Client_Env");
|
||||||
ui->Set_Client_envScriptEdit->setText(settings->value("scriptPath").toString());
|
ui->Set_Client_envScriptEdit->setText(settings->value("scriptPath").toString());
|
||||||
ui->Set_Client_workingDirEdit->setText(settings->value("workingDir", "../data").toString());
|
ui->Set_Client_workingDirEdit->setText(settings->value("workingDir", "../data").toString());
|
||||||
|
ui->Set_Client_configPathEdit->setText(settings->value("configPath", "config.json").toString());
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
|
|
||||||
ui->MF_RW_keyTypeBox->addItem("A", Mifare::KEY_A);
|
ui->MF_RW_keyTypeBox->addItem("A", Mifare::KEY_A);
|
||||||
@ -1248,13 +1255,21 @@ void MainWindow::on_Set_Client_envScriptEdit_editingFinished()
|
|||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_Set_Client_saveWorkingDirButton_clicked()
|
void MainWindow::on_Set_Client_workingDirEdit_editingFinished()
|
||||||
{
|
{
|
||||||
settings->beginGroup("Client_Env");
|
settings->beginGroup("Client_Env");
|
||||||
settings->setValue("workingDir", ui->Set_Client_workingDirEdit->text());
|
settings->setValue("workingDir", ui->Set_Client_workingDirEdit->text());
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_Set_Client_configPathEdit_editingFinished()
|
||||||
|
{
|
||||||
|
settings->beginGroup("Client_Env");
|
||||||
|
settings->setValue("configPath", ui->Set_Client_configPathEdit->text());
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1)
|
void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1)
|
||||||
{
|
{
|
||||||
settings->beginGroup("Client_keepClientActive");
|
settings->beginGroup("Client_keepClientActive");
|
||||||
@ -1388,3 +1403,4 @@ void MainWindow::on_LF_Conf_resetButton_clicked()
|
|||||||
lf->resetConfig();
|
lf->resetConfig();
|
||||||
setState(true);
|
setState(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +177,6 @@ private slots:
|
|||||||
|
|
||||||
void on_Set_Client_envScriptEdit_editingFinished();
|
void on_Set_Client_envScriptEdit_editingFinished();
|
||||||
|
|
||||||
void on_Set_Client_saveWorkingDirButton_clicked();
|
|
||||||
|
|
||||||
void on_Set_Client_keepClientActiveBox_stateChanged(int arg1);
|
void on_Set_Client_keepClientActiveBox_stateChanged(int arg1);
|
||||||
|
|
||||||
void on_LF_Conf_freqSlider_valueChanged(int value);
|
void on_LF_Conf_freqSlider_valueChanged(int value);
|
||||||
@ -203,6 +201,10 @@ private slots:
|
|||||||
|
|
||||||
void on_LF_Conf_resetButton_clicked();
|
void on_LF_Conf_resetButton_clicked();
|
||||||
|
|
||||||
|
void on_Set_Client_workingDirEdit_editingFinished();
|
||||||
|
|
||||||
|
void on_Set_Client_configPathEdit_editingFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
QButtonGroup* MFCardTypeBtnGroup;
|
QButtonGroup* MFCardTypeBtnGroup;
|
||||||
@ -249,6 +251,7 @@ private:
|
|||||||
void saveClientPath(const QString& path);
|
void saveClientPath(const QString& path);
|
||||||
void onLFfreqConfChanged(int value, bool isCustomized);
|
void onLFfreqConfChanged(int value, bool isCustomized);
|
||||||
void dockInit();
|
void dockInit();
|
||||||
|
void loadConfig();
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
signals:
|
signals:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1050</width>
|
<width>1050</width>
|
||||||
<height>700</height>
|
<height>750</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -2650,7 +2650,7 @@ or the communication between a tag and a reader.</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Preload script path:</string>
|
<string>Preload script path(Reconnect to apply):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -2664,9 +2664,7 @@ or the communication between a tag and a reader.</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_13">
|
<widget class="QLabel" name="label_13">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Note:
|
<string>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.</string>
|
||||||
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</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -2683,33 +2681,21 @@ then put the path of the script there</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QLabel" name="label_19">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Client working directory:</string>
|
<string>Client working directory(Reconnect to apply):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
<widget class="QLineEdit" name="Set_Client_workingDirEdit">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QLineEdit" name="Set_Client_workingDirEdit">
|
<string>../data</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>../data</string>
|
</widget>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="Set_Client_saveWorkingDirButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_20">
|
<widget class="QLabel" name="label_20">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Note:
|
<string>On Windows, the client working directory should not be identical to the path of GUI, otherwise the client will use the wrong .dll file.</string>
|
||||||
On Windows, the client working directory should not be identical to the path of GUI, otherwise the client will use the wrong .dll file.</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -2726,7 +2712,7 @@ On Windows, the client working directory should not be identical to the path of
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_12">
|
<widget class="QLabel" name="label_12">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Start arguments</string>
|
<string>Start arguments(Reconnect to apply):</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -2740,10 +2726,7 @@ On Windows, the client working directory should not be identical to the path of
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Note:
|
<string>-f is necessary because the GUI need to handle the output in time. In some cases, the arguments should be set to "-p /dev/<port> -f" or "-p <port> -f".</string>
|
||||||
-f is necessary because the GUI need to handle the output in time
|
|
||||||
In some cases the arguments should be set to "-p /dev/<port> -f"
|
|
||||||
or "-p <port> -f"</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -2757,6 +2740,37 @@ or "-p <port> -f"</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_63">
|
||||||
|
<property name="text">
|
||||||
|
<string>Config file path(Reconnect to apply):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="Set_Client_configPathEdit">
|
||||||
|
<property name="text">
|
||||||
|
<string>config.json</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_64">
|
||||||
|
<property name="text">
|
||||||
|
<string>Different clients require different config files. You can change the content of config file if the command format changes.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||||
<item>
|
<item>
|
||||||
@ -2912,6 +2926,9 @@ or "-p <port> -f"</string>
|
|||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Minimum</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user