mirror of
https://github.com/wh201906/Proxmark3GUI.git
synced 2025-02-17 06:31:33 +08:00
Fix a small bug
This commit is contained in:
parent
41bbcd2c4a
commit
fbe8a5e51d
@ -12,7 +12,7 @@ A GUI for [Proxmark3](https://github.com/Proxmark/proxmark3) client
|
|||||||
+ Have a friendly UI to test Mifare cards
|
+ Have a friendly UI to test Mifare cards
|
||||||
+ Support different card size(MINI, 1K, 2K, 4K)
|
+ Support different card size(MINI, 1K, 2K, 4K)
|
||||||
+ Easy to edit Mifare data files
|
+ Easy to edit Mifare data files
|
||||||
+ Easy to read all blocks with well-designed read logic
|
+ Easy to read all/selected blocks with well-designed read logic
|
||||||
+ Support binary(.bin .dump) files and text(.eml) files
|
+ Support binary(.bin .dump) files and text(.eml) files
|
||||||
+ Analyze Access Bits
|
+ Analyze Access Bits
|
||||||
+ Support Chinese Magic Card
|
+ Support Chinese Magic Card
|
||||||
|
@ -833,23 +833,53 @@ void Mifare::data_syncWithKeyWidget(bool syncAll, int sector, KeyType keyType)
|
|||||||
ui->MF_keyWidget->blockSignals(false);
|
ui->MF_keyWidget->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mifare::data_clearData()
|
void Mifare::data_clearData(bool clearAll)
|
||||||
|
{
|
||||||
|
if(clearAll)
|
||||||
{
|
{
|
||||||
dataList->clear();
|
dataList->clear();
|
||||||
for(int i = 0; i < cardType.block_size; i++)
|
|
||||||
dataList->append("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mifare::data_clearKey()
|
int delta = cardType.block_size - dataList->length() ;
|
||||||
|
if(delta >= 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < delta; i++)
|
||||||
|
dataList->append("");
|
||||||
|
}
|
||||||
|
else if(delta < 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < -delta; i++)
|
||||||
|
|
||||||
|
dataList->removeLast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Mifare::data_clearKey(bool clearAll)
|
||||||
|
{
|
||||||
|
if(clearAll)
|
||||||
{
|
{
|
||||||
keyAList->clear();
|
keyAList->clear();
|
||||||
keyBList->clear();
|
keyBList->clear();
|
||||||
for(int i = 0; i < cardType.sector_size; i++)
|
}
|
||||||
|
|
||||||
|
int delta = cardType.sector_size - keyAList->length() ;
|
||||||
|
if(delta >= 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < delta; i++)
|
||||||
{
|
{
|
||||||
keyAList->append("");
|
keyAList->append("");
|
||||||
keyBList->append("");
|
keyBList->append("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(delta < 0)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < -delta; i++)
|
||||||
|
{
|
||||||
|
keyAList->removeLast();
|
||||||
|
keyBList->removeLast();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Mifare::data_isKeyValid(const QString &key)
|
bool Mifare::data_isKeyValid(const QString &key)
|
||||||
{
|
{
|
||||||
@ -912,8 +942,8 @@ void Mifare::setCardType(int type)
|
|||||||
cardType = card_2k;
|
cardType = card_2k;
|
||||||
else if(type == 4)
|
else if(type == 4)
|
||||||
cardType = card_4k;
|
cardType = card_4k;
|
||||||
data_clearKey();
|
data_clearKey(false);
|
||||||
data_clearData();
|
data_clearData(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ public:
|
|||||||
|
|
||||||
struct CardType
|
struct CardType
|
||||||
{
|
{
|
||||||
int type;
|
quint8 type;
|
||||||
int sector_size;
|
quint8 sector_size;
|
||||||
int block_size;
|
quint16 block_size;
|
||||||
int blk[40];
|
quint8 blk[40];
|
||||||
int blks[40];
|
quint8 blks[40];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AccessType
|
enum AccessType
|
||||||
@ -70,8 +70,8 @@ public:
|
|||||||
static const AccessType trailerReadCondition[8][3];
|
static const AccessType trailerReadCondition[8][3];
|
||||||
static const AccessType trailerWriteCondition[8][3];
|
static const AccessType trailerWriteCondition[8][3];
|
||||||
|
|
||||||
void data_clearData();
|
void data_clearData(bool clearAll = true);
|
||||||
void data_clearKey();
|
void data_clearKey(bool clearAll = true);
|
||||||
static bool data_isKeyValid(const QString& key);
|
static bool data_isKeyValid(const QString& key);
|
||||||
static Mifare::DataType data_isDataValid(const QString& data);
|
static Mifare::DataType data_isDataValid(const QString& data);
|
||||||
void data_syncWithDataWidget(bool syncAll = true, int block = 0);
|
void data_syncWithDataWidget(bool syncAll = true, int block = 0);
|
||||||
|
@ -181,7 +181,7 @@ void MainWindow::MF_onTypeChanged(int id, bool st)
|
|||||||
int result;
|
int result;
|
||||||
if(id > typeBtnGroup->checkedId()) // id is specified in uiInit() with a proper order, so I can compare the size by id.
|
if(id > typeBtnGroup->checkedId()) // id is specified in uiInit() with a proper order, so I can compare the size by id.
|
||||||
{
|
{
|
||||||
result = QMessageBox::question(this, tr("Info"), tr("When Changeing card type, the data and keys in this app will be cleard.") + "\n" + tr("Continue?"), QMessageBox::Yes | QMessageBox::No);
|
result = QMessageBox::question(this, tr("Info"), tr("Some of the data and key will be cleared.") + "\n" + tr("Continue?"), QMessageBox::Yes | QMessageBox::No);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -192,6 +192,8 @@ void MainWindow::MF_onTypeChanged(int id, bool st)
|
|||||||
qDebug() << "Yes";
|
qDebug() << "Yes";
|
||||||
mifare->setCardType(typeBtnGroup->checkedId());
|
mifare->setCardType(typeBtnGroup->checkedId());
|
||||||
MF_widgetReset();
|
MF_widgetReset();
|
||||||
|
mifare->data_syncWithDataWidget();
|
||||||
|
mifare->data_syncWithKeyWidget();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -698,6 +700,7 @@ void MainWindow::MF_widgetReset()
|
|||||||
ui->MF_dataWidget->setRowCount(blks);
|
ui->MF_dataWidget->setRowCount(blks);
|
||||||
|
|
||||||
ui->MF_dataWidget->blockSignals(true);
|
ui->MF_dataWidget->blockSignals(true);
|
||||||
|
ui->MF_keyWidget->blockSignals(true);
|
||||||
ui->MF_selectAllBox->blockSignals(true);
|
ui->MF_selectAllBox->blockSignals(true);
|
||||||
|
|
||||||
for(int i = 0; i < blks; i++)
|
for(int i = 0; i < blks; i++)
|
||||||
@ -720,6 +723,7 @@ void MainWindow::MF_widgetReset()
|
|||||||
ui->MF_selectAllBox->setCheckState(Qt::Checked);
|
ui->MF_selectAllBox->setCheckState(Qt::Checked);
|
||||||
|
|
||||||
ui->MF_dataWidget->blockSignals(false);
|
ui->MF_dataWidget->blockSignals(false);
|
||||||
|
ui->MF_keyWidget->blockSignals(false);
|
||||||
ui->MF_selectAllBox->blockSignals(false);
|
ui->MF_selectAllBox->blockSignals(false);
|
||||||
}
|
}
|
||||||
// ************************************************
|
// ************************************************
|
||||||
@ -746,7 +750,7 @@ void MainWindow::uiInit()
|
|||||||
ui->MF_dataWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Blk")));
|
ui->MF_dataWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Blk")));
|
||||||
ui->MF_dataWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Data")));
|
ui->MF_dataWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(tr("Data")));
|
||||||
ui->MF_dataWidget->verticalHeader()->setVisible(false);
|
ui->MF_dataWidget->verticalHeader()->setVisible(false);
|
||||||
ui->MF_dataWidget->setColumnWidth(0, 45);
|
ui->MF_dataWidget->setColumnWidth(0, 55);
|
||||||
ui->MF_dataWidget->setColumnWidth(1, 55);
|
ui->MF_dataWidget->setColumnWidth(1, 55);
|
||||||
ui->MF_dataWidget->setColumnWidth(2, 430);
|
ui->MF_dataWidget->setColumnWidth(2, 430);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user