diff --git a/Proxmark3GUI.pro b/Proxmark3GUI.pro index 31f5966..7cca555 100644 --- a/Proxmark3GUI.pro +++ b/Proxmark3GUI.pro @@ -20,6 +20,7 @@ SOURCES += \ main.cpp \ common/pm3process.cpp \ common/util.cpp \ + module/lf.cpp \ module/mifare.cpp \ ui/mf_trailerdecoderdialog.cpp \ ui/mf_sim_simdialog.cpp \ @@ -31,6 +32,7 @@ HEADERS += \ common/myeventfilter.h \ common/pm3process.h \ common/util.h \ + module/lf.h \ module/mifare.h \ ui/mf_trailerdecoderdialog.h \ ui/mf_sim_simdialog.h \ diff --git a/common/util.h b/common/util.h index fed751e..96bd114 100644 --- a/common/util.h +++ b/common/util.h @@ -53,7 +53,7 @@ public: QString execCMDWithOutput(const QString& cmd, ReturnTrigger trigger = 10000); void delay(unsigned int msec); static ClientType getClientType(); - static const int rawTabIndex = 1; + static const int rawTabIndex = 2; static bool chooseLanguage(QSettings *guiSettings, QMainWindow *window); public slots: void processOutput(const QString& output); diff --git a/module/lf.cpp b/module/lf.cpp new file mode 100644 index 0000000..2907293 --- /dev/null +++ b/module/lf.cpp @@ -0,0 +1,47 @@ +#include "lf.h" + +LF::LF(Ui::MainWindow *ui, Util *addr, QWidget *parent): QObject(parent) +{ + this->parent = parent; + util = addr; + this->ui = ui; + +} + +void LF::read() +{ + if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL) + util->execCMD("lf read"); + else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN) + util->execCMD("lf read -v"); + ui->funcTab->setCurrentIndex(Util::rawTabIndex); + util->execCMD("data plot"); +} + +void LF::sniff() +{ + if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL) + util->execCMD("lf snoop"); + else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN) + util->execCMD("lf sniff -v"); + ui->funcTab->setCurrentIndex(Util::rawTabIndex); + util->execCMD("data plot"); +} + +void LF::search() +{ + if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL) + util->execCMD("lf search u"); + else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN) + util->execCMD("lf search -u"); + ui->funcTab->setCurrentIndex(Util::rawTabIndex); +} + +void LF::tune() +{ + if(Util::getClientType() == Util::CLIENTTYPE_OFFICIAL) + util->execCMD("hw tune l"); + else if(Util::getClientType() == Util::CLIENTTYPE_ICEMAN) + util->execCMD("lf tune"); // TODO: if freq is set, append it as a parameter + ui->funcTab->setCurrentIndex(Util::rawTabIndex); +} diff --git a/module/lf.h b/module/lf.h new file mode 100644 index 0000000..fca7f9f --- /dev/null +++ b/module/lf.h @@ -0,0 +1,28 @@ +#ifndef LF_H +#define LF_H + +#include + +#include "common/util.h" +#include "ui_mainwindow.h" + +class LF : public QObject +{ + Q_OBJECT +public: + explicit LF(Ui::MainWindow *ui, Util *addr, QWidget *parent = nullptr); + + void read(); + void sniff(); + void search(); + void tune(); +private: + QWidget* parent; + Ui::MainWindow *ui; + Util* util; + +signals: + +}; + +#endif // LF_H diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp index 9e1a015..9091e94 100644 --- a/ui/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -32,13 +32,14 @@ MainWindow::MainWindow(QWidget *parent): util = new Util(this); mifare = new Mifare(ui, util, this); + lf = new LF(ui, util, this); keyEventFilter = new MyEventFilter(QEvent::KeyPress); resizeEventFilter = new MyEventFilter(QEvent::Resize); // hide unused tabs - ui->funcTab->removeTab(1); - ui->funcTab->removeTab(1); +// ui->funcTab->removeTab(1); + ui->funcTab->removeTab(2); portSearchTimer = new QTimer(this); portSearchTimer->setInterval(2000); @@ -1224,3 +1225,66 @@ void MainWindow::on_Set_Client_keepClientActiveBox_stateChanged(int arg1) settings->endGroup(); emit setSerialListener(!keepClientActive); } + +void MainWindow::on_LF_Conf_freqSlider_valueChanged(int value) +{ + onLFfreqConfChanged(value, true); +} + +void MainWindow::onLFfreqConfChanged(int value, bool isCustomized) +{ + ui->LF_Conf_freqDivisorBox->blockSignals(true); + ui->LF_Conf_freqSlider->blockSignals(true); + + if(isCustomized) + ui->LF_Conf_freqOtherButton->setChecked(true); + ui->LF_Conf_freqLabel->setText(QString("Actural Freq: %1kHz").arg(12000.0 / (value + 1.0), 0, 'f', 3)); + ui->LF_Conf_freqDivisorBox->setValue(value); + ui->LF_Conf_freqSlider->setValue(value); + + ui->LF_Conf_freqDivisorBox->blockSignals(false); + ui->LF_Conf_freqSlider->blockSignals(false); +} + +void MainWindow::on_LF_Conf_freqDivisorBox_valueChanged(int arg1) +{ + onLFfreqConfChanged(arg1, true); +} + +void MainWindow::on_LF_Conf_freq125kButton_clicked() +{ + onLFfreqConfChanged(95, false); +} + +void MainWindow::on_LF_Conf_freq134kButton_clicked() +{ + onLFfreqConfChanged(88, false); +} + +void MainWindow::on_LF_Op_searchButton_clicked() +{ + setState(false); + lf->search(); + setState(true); +} + +void MainWindow::on_LF_Op_readButton_clicked() +{ + setState(false); + lf->read(); + setState(true); +} + +void MainWindow::on_LF_Op_tuneButton_clicked() +{ + setState(false); + lf->tune(); + setState(true); +} + +void MainWindow::on_LF_Op_sniffButton_clicked() +{ + setState(false); + lf->sniff(); + setState(true); +} diff --git a/ui/mainwindow.h b/ui/mainwindow.h index d179581..550f30e 100644 --- a/ui/mainwindow.h +++ b/ui/mainwindow.h @@ -28,6 +28,7 @@ #include "common/myeventfilter.h" #include "common/pm3process.h" #include "module/mifare.h" +#include "module/lf.h" #include "common/util.h" #include "ui/mf_trailerdecoderdialog.h" @@ -178,6 +179,22 @@ private slots: void on_Set_Client_keepClientActiveBox_stateChanged(int arg1); + void on_LF_Conf_freqSlider_valueChanged(int value); + + void on_LF_Conf_freqDivisorBox_valueChanged(int arg1); + + void on_LF_Conf_freq125kButton_clicked(); + + void on_LF_Conf_freq134kButton_clicked(); + + void on_LF_Op_searchButton_clicked(); + + void on_LF_Op_readButton_clicked(); + + void on_LF_Op_tuneButton_clicked(); + + void on_LF_Op_sniffButton_clicked(); + private: Ui::MainWindow* ui; QButtonGroup* MFCardTypeBtnGroup; @@ -208,6 +225,7 @@ private: QDir* clientWorkingDir; Mifare* mifare; + LF* lf; Util* util; MF_trailerDecoderDialog* decDialog; @@ -217,6 +235,7 @@ private: 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); signals: void connectPM3(const QString& path, const QStringList args); void reconnectPM3(); diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 3724b36..773fecc 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -130,7 +130,7 @@ - 4 + 1 @@ -1212,8 +1212,8 @@ 10 10 - 121 - 211 + 431 + 341 @@ -1240,7 +1240,7 @@ Frequency - + 5 @@ -1257,28 +1257,115 @@ 2 - - - - 0 - 0 - + + + + + + 0 + 0 + + + + 125k + + + true + + + + + + + + 0 + 0 + + + + 134k + + + + + + + + 0 + 0 + + + + other + + + + + + + Divisor: + + + + + + + 19 + + + 255 + + + 95 + + + + + + + Actural Freq: 125.000kHz + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + 19 - - 125k + + 255 + + + 95 + + + Qt::Horizontal - - - - 0 - 0 - - + - 134k + Note: +You might need a modified LF antenna if the freq is not 125k/134k. + + + true @@ -1286,60 +1373,98 @@ - - - - - BitRate: - - - - - - - Decimation: - - - - - - - - - - Averaging: - - - - - - - - - + + + + + + + Bit per sample: + + + + + + + Decimation: + + + + + + + 1 + + + 8 + + + + + + + Averaging: + + + + + + + + + + + + + + Trigger threshold: + + + + + + + 128 + + + + + + + Samples to skip: + + + + + + + + + + 1 + + + 8 + + + 8 + + + + - - - - Threshold: + + + + Qt::Horizontal - - - - - - - - - Skips: + + + 40 + 20 + - - - - - - - + @@ -1398,6 +1523,188 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 500 + 30 + 311 + 361 + + + + LF Operation + + + + + + + + Search + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Read and search for valid known tag. + + + true + + + + + + + + + Read + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Sniff low frequency signal with LF field ON. +Use this to get raw data from a tag. + + + true + + + + + + + + + Tune + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Measure LF antenna tuning. +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 + + + true + + + + + + + + + Sniff + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Sniff low frequency signal wit LF field OFF. +Use this to get raw data from a reader +or the communication between a tag and a reader. + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + +