Merge pull request #5 from wh201906/dev

V0.1.3
pull/10/head
wh201906 4 years ago committed by GitHub
commit 475580c342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -52,7 +52,7 @@ qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
VERSION = 0.1.2 VERSION = 0.1.3
QMAKE_TARGET_PRODUCT = "Proxmark3GUI" QMAKE_TARGET_PRODUCT = "Proxmark3GUI"
QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI" QMAKE_TARGET_DESCRIPTION = "Proxmark3GUI"
QMAKE_TARGET_COMPANY = "wh201906" QMAKE_TARGET_COMPANY = "wh201906"

@ -36,19 +36,19 @@ const Mifare::CardType Mifare::card_4k =
const Mifare::AccessType Mifare::dataCondition[8][4] = const Mifare::AccessType Mifare::dataCondition[8][4] =
{ {
{ACC_KEY_AB, ACC_KEY_AB, ACC_KEY_AB, ACC_KEY_AB}, {ACC_KEY_AB, ACC_KEY_AB, ACC_KEY_AB, ACC_KEY_AB},
{ACC_KEY_AB, ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_KEY_AB, ACC_KEY_B, ACC_NEVER, ACC_NEVER}, {ACC_KEY_AB, ACC_KEY_B, ACC_NEVER, ACC_NEVER},
{ACC_KEY_AB, ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_KEY_AB, ACC_KEY_B, ACC_KEY_B, ACC_KEY_AB}, {ACC_KEY_AB, ACC_KEY_B, ACC_KEY_B, ACC_KEY_AB},
{ACC_KEY_AB, ACC_NEVER, ACC_NEVER, ACC_KEY_AB}, {ACC_KEY_AB, ACC_NEVER, ACC_NEVER, ACC_KEY_AB},
{ACC_KEY_B, ACC_KEY_B, ACC_NEVER, ACC_NEVER},
{ACC_KEY_B, ACC_NEVER, ACC_NEVER, ACC_NEVER}, {ACC_KEY_B, ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_KEY_B, ACC_KEY_B, ACC_NEVER, ACC_NEVER},
{ACC_NEVER, ACC_NEVER, ACC_NEVER, ACC_NEVER}, {ACC_NEVER, ACC_NEVER, ACC_NEVER, ACC_NEVER},
}; };
const Mifare::AccessType Mifare::trailerReadCondition[8][3] = const Mifare::AccessType Mifare::trailerReadCondition[8][3] =
{ {
{ACC_NEVER, ACC_KEY_A, ACC_KEY_A},
{ACC_NEVER, ACC_KEY_A, ACC_KEY_A}, {ACC_NEVER, ACC_KEY_A, ACC_KEY_A},
{ACC_NEVER, ACC_KEY_AB, ACC_NEVER}, {ACC_NEVER, ACC_KEY_AB, ACC_NEVER},
{ACC_NEVER, ACC_KEY_A, ACC_KEY_A},
{ACC_NEVER, ACC_KEY_AB, ACC_NEVER}, {ACC_NEVER, ACC_KEY_AB, ACC_NEVER},
{ACC_NEVER, ACC_KEY_A, ACC_KEY_A}, {ACC_NEVER, ACC_KEY_A, ACC_KEY_A},
{ACC_NEVER, ACC_KEY_AB, ACC_NEVER}, {ACC_NEVER, ACC_KEY_AB, ACC_NEVER},
@ -58,12 +58,12 @@ const Mifare::AccessType Mifare::trailerReadCondition[8][3] =
const Mifare::AccessType Mifare::trailerWriteCondition[8][3] = const Mifare::AccessType Mifare::trailerWriteCondition[8][3] =
{ {
{ACC_KEY_A, ACC_NEVER, ACC_KEY_A}, {ACC_KEY_A, ACC_NEVER, ACC_KEY_A},
{ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_KEY_B, ACC_NEVER, ACC_KEY_B}, {ACC_KEY_B, ACC_NEVER, ACC_KEY_B},
{ACC_NEVER, ACC_NEVER, ACC_NEVER}, {ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_NEVER, ACC_NEVER, ACC_NEVER},
{ACC_KEY_A, ACC_KEY_A, ACC_KEY_A}, {ACC_KEY_A, ACC_KEY_A, ACC_KEY_A},
{ACC_KEY_B, ACC_KEY_B, ACC_KEY_B},
{ACC_NEVER, ACC_KEY_B, ACC_NEVER}, {ACC_NEVER, ACC_KEY_B, ACC_NEVER},
{ACC_KEY_B, ACC_KEY_B, ACC_KEY_B},
{ACC_NEVER, ACC_NEVER, ACC_NEVER}, {ACC_NEVER, ACC_NEVER, ACC_NEVER},
}; };
@ -597,7 +597,7 @@ void Mifare::writeOne(TargetType targetType)
} }
} }
QList<int> Mifare::writeSelected(TargetType targetType) void Mifare::writeSelected(TargetType targetType)
{ {
QList<int> failedBlocks; QList<int> failedBlocks;
QList<int> selectedBlocks; QList<int> selectedBlocks;
@ -630,7 +630,39 @@ QList<int> Mifare::writeSelected(TargetType targetType)
failedBlocks.append(item); failedBlocks.append(item);
} }
} }
return failedBlocks; if(failedBlocks.size() == 0)
QMessageBox::information(parent, tr("Info"), tr("Successful!"));
else
{
QString suffix = "";
int counter = 0;
for(int failedBlk : failedBlocks)
{
suffix += QString::number(failedBlk) + " ";
counter++;
counter %= 20;
if(counter == 0)
suffix += "\n";
}
QMessageBox::StandardButton res = QMessageBox::information(parent, tr("Info"), tr("Failed to write to these blocks:")
+ "\n"
+ suffix
+ "\n"
+ tr("Select them?"),
QMessageBox::Yes | QMessageBox::No);
if(res == QMessageBox::Yes)
{
for(int item : selectedBlocks)
{
ui->MF_dataWidget->item(item, 1)->setCheckState(Qt::Unchecked);
}
for(int failedBlk : failedBlocks)
{
ui->MF_dataWidget->item(failedBlk, 1)->setCheckState(Qt::Checked);
}
}
}
} }
void Mifare::dump() void Mifare::dump()

@ -73,7 +73,7 @@ public:
void readOne(TargetType targetType = TARGET_MIFARE); void readOne(TargetType targetType = TARGET_MIFARE);
void readSelected(TargetType targetType = TARGET_MIFARE); void readSelected(TargetType targetType = TARGET_MIFARE);
void writeOne(TargetType targetType = TARGET_MIFARE); void writeOne(TargetType targetType = TARGET_MIFARE);
QList<int> writeSelected(TargetType targetType = TARGET_MIFARE); void writeSelected(TargetType targetType = TARGET_MIFARE);
void dump(); void dump();
void restore(); void restore();

@ -580,9 +580,8 @@ void MainWindow::on_MF_RW_writeBlockButton_clicked()
void MainWindow::on_MF_RW_writeSelectedButton_clicked() void MainWindow::on_MF_RW_writeSelectedButton_clicked()
{ {
QList<int> failedBlocks;
setState(false); setState(false);
failedBlocks = mifare->writeSelected(Mifare::TARGET_MIFARE); mifare->writeSelected(Mifare::TARGET_MIFARE);
setState(true); setState(true);
} }
@ -612,9 +611,8 @@ void MainWindow::on_MF_UID_readBlockButton_clicked()
void MainWindow::on_MF_UID_writeSelectedButton_clicked() void MainWindow::on_MF_UID_writeSelectedButton_clicked()
{ {
QList<int> failedBlocks;
setState(false); setState(false);
failedBlocks = mifare->writeSelected(Mifare::TARGET_UID); mifare->writeSelected(Mifare::TARGET_UID);
setState(true); setState(true);
} }
@ -672,9 +670,8 @@ void MainWindow::on_MF_Sim_readSelectedButton_clicked()
void MainWindow::on_MF_Sim_writeSelectedButton_clicked() void MainWindow::on_MF_Sim_writeSelectedButton_clicked()
{ {
QList<int> failedBlocks;
setState(false); setState(false);
failedBlocks = mifare->writeSelected(Mifare::TARGET_EMULATOR); mifare->writeSelected(Mifare::TARGET_EMULATOR);
setState(true); setState(true);
} }

Loading…
Cancel
Save