Add UI for simulate function

pull/3/head
wh201906 5 years ago
parent 0995e529ad
commit afe2474fe3

@ -20,6 +20,7 @@ SOURCES += \
common/pm3process.cpp \
common/util.cpp \
module/mifare.cpp \
ui/mf_sim_simdialog.cpp \
ui/mf_uid_parameterdialog.cpp \
ui/mainwindow.cpp \
ui/mf_attack_hardnesteddialog.cpp \
@ -28,11 +29,13 @@ HEADERS += \
common/pm3process.h \
common/util.h \
module/mifare.h \
ui/mf_sim_simdialog.h \
ui/mf_uid_parameterdialog.h \
ui/mainwindow.h \
ui/mf_attack_hardnesteddialog.h \
FORMS += \
ui/mf_sim_simdialog.ui \
ui/mf_uid_parameterdialog.ui \
ui/mainwindow.ui \
ui/mf_attack_hardnesteddialog.ui

@ -445,6 +445,18 @@ void Mifare::writeAllC()
}
}
void Mifare::dump()
{
util->execCMD("hf mf dump");
ui->funcTab->setCurrentIndex(1);
}
void Mifare::restore()
{
util->execCMD("hf mf restore");
ui->funcTab->setCurrentIndex(1);
}
void Mifare::wipeC()
{
util->execCMD(
@ -550,17 +562,12 @@ void Mifare::wipeE()
util->execCMD("hf mf eclr");
}
void Mifare::dump()
void Mifare::simulate()
{
util->execCMD("hf mf dump");
ui->funcTab->setCurrentIndex(1);
MF_Sim_simDialog dialog;
dialog.exec();
}
void Mifare::restore()
{
util->execCMD("hf mf restore");
ui->funcTab->setCurrentIndex(1);
}
void Mifare::data_syncWithDataWidget(bool syncAll, int block)
{

@ -5,6 +5,7 @@
#include "ui_mainwindow.h"
#include "ui/mf_attack_hardnesteddialog.h"
#include "ui/mf_uid_parameterdialog.h"
#include "ui/mf_sim_simdialog.h"
#include <QObject>
#include <QString>
#include <QStringList>
@ -108,6 +109,7 @@ public:
void writeAllE();
void readAllE();
void wipeE();
void simulate();
public slots:
signals:

@ -673,3 +673,8 @@ void MainWindow::setState(bool st)
// ***********************************************
void MainWindow::on_MF_Sim_simButton_clicked()
{
mifare->simulate();
}

@ -126,6 +126,8 @@ private slots:
void on_MF_Sim_clearButton_clicked();
void on_MF_Sim_simButton_clicked();
private:
Ui::MainWindow* ui;
QButtonGroup* typeBtnGroup;

@ -0,0 +1,52 @@
#include "mf_sim_simdialog.h"
#include "ui_mf_sim_simdialog.h"
MF_Sim_simDialog::MF_Sim_simDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::MF_Sim_simDialog)
{
ui->setupUi(this);
}
MF_Sim_simDialog::~MF_Sim_simDialog()
{
delete ui;
}
void MF_Sim_simDialog::on_eBox_clicked(bool checked)
{
if(checked)
{
ui->iBox->setChecked(true);
ui->xBox->setChecked(true);
}
if(!ui->eBox->isChecked() && !ui->fBox->isChecked())
{
ui->iBox->setEnabled(true);
ui->xBox->setEnabled(true);
}
else
{
ui->iBox->setEnabled(false);
ui->xBox->setEnabled(false);
}
}
void MF_Sim_simDialog::on_fBox_clicked(bool checked)
{
if(checked)
{
ui->iBox->setChecked(true);
ui->xBox->setChecked(true);
}
if(!ui->eBox->isChecked() && !ui->fBox->isChecked())
{
ui->iBox->setEnabled(true);
ui->xBox->setEnabled(true);
}
else
{
ui->iBox->setEnabled(false);
ui->xBox->setEnabled(false);
}
}

@ -0,0 +1,28 @@
#ifndef MF_SIM_SIMDIALOG_H
#define MF_SIM_SIMDIALOG_H
#include <QDialog>
namespace Ui
{
class MF_Sim_simDialog;
}
class MF_Sim_simDialog : public QDialog
{
Q_OBJECT
public:
explicit MF_Sim_simDialog(QWidget *parent = nullptr);
~MF_Sim_simDialog();
private slots:
void on_eBox_clicked(bool checked);
void on_fBox_clicked(bool checked);
private:
Ui::MF_Sim_simDialog *ui;
};
#endif // MF_SIM_SIMDIALOG_H

@ -0,0 +1,360 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MF_Sim_simDialog</class>
<widget class="QDialog" name="MF_Sim_simDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>461</width>
<height>351</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="uBox">
<property name="text">
<string>u</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="uEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>UID 4 or 7 bytes. If not specified, the UID 4B from emulator memory will be used</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="nBox">
<property name="text">
<string>n</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Automatically exit simulation after &lt;numreads&gt; blocks have been read by reader. 0 = infinite</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="iBox">
<property name="text">
<string>i</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Interactive, means that console will not be returned until simulation finishes or is aborted</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="xBox">
<property name="text">
<string>x</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="eBox">
<property name="text">
<string>e</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>set keys found from 'reader attack' to emulator memory (implies x and i)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="fBox">
<property name="text">
<string>f</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>get UIDs to use for 'reader attack' from file 'f &lt;filename.txt&gt;' (implies x and i)</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QCheckBox" name="rBox">
<property name="text">
<string>r</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string> Generate random nonces instead of sequential nonces. Standard reader attack won't work with this option, only moebius attack works.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MF_Sim_simDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MF_Sim_simDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading…
Cancel
Save