|
|
@ -102,31 +102,78 @@ void Mifare::chk()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data_syncWithKeyWidget();
|
|
|
|
data_syncWithKeyWidget();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Mifare::nested()
|
|
|
|
void Mifare::nested()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QString result = util->execCMDWithOutput(
|
|
|
|
QRegularExpressionMatch reMatch;
|
|
|
|
|
|
|
|
QString result;
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
QString data;
|
|
|
|
|
|
|
|
if(util->getClientType() == Util::CLIENTTYPE_OFFICIAL)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = util->execCMDWithOutput(
|
|
|
|
|
|
|
|
"hf mf nested "
|
|
|
|
|
|
|
|
+ QString::number(cardType.type)
|
|
|
|
|
|
|
|
+ " *", 10000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(util->getClientType() == Util::CLIENTTYPE_ICEMAN)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QString knownKeyInfo = "";
|
|
|
|
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(data_isKeyValid(keyAList->at(i)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
knownKeyInfo = " " + QString::number(i * 4) + " A " + keyAList->at(i);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(knownKeyInfo == "")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(data_isKeyValid(keyBList->at(i)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
knownKeyInfo = " " + QString::number(i * 4) + " B " + keyBList->at(i);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(knownKeyInfo != "")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = util->execCMDWithOutput(
|
|
|
|
"hf mf nested "
|
|
|
|
"hf mf nested "
|
|
|
|
+ QString::number(cardType.type)
|
|
|
|
+ QString::number(cardType.type)
|
|
|
|
+ " *");
|
|
|
|
+ knownKeyInfo, 10000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QMessageBox::information(parent, tr("Info"), tr("Plz provide at least one known key"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int offset = 0;
|
|
|
|
}
|
|
|
|
QString tmp;
|
|
|
|
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// offset = nestedKeyPattern->indexIn(result, offset);
|
|
|
|
reMatch = keyPattern_res->match(result, offset);
|
|
|
|
// offset = result.indexOf(*nestedKeyPattern, offset);
|
|
|
|
offset = reMatch.capturedStart();
|
|
|
|
tmp = result.mid(offset, 47).toUpper();
|
|
|
|
if(reMatch.hasMatch())
|
|
|
|
offset += 47;
|
|
|
|
{
|
|
|
|
if(tmp.at(23) == '1')
|
|
|
|
data = reMatch.captured().toUpper();
|
|
|
|
keyAList->replace(i, tmp.mid(7, 12).trimmed());
|
|
|
|
offset += data.length();
|
|
|
|
if(tmp.at(44) == '1')
|
|
|
|
QStringList cells = data.remove(" ").split("|");
|
|
|
|
keyBList->replace(i, tmp.mid(28, 12).trimmed());
|
|
|
|
if(cells.at(3) == "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
keyAList->replace(i, cells.at(2));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cells.at(5) == "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
keyBList->replace(i, cells.at(4));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data_syncWithKeyWidget();
|
|
|
|
data_syncWithKeyWidget();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Mifare::hardnested()
|
|
|
|
void Mifare::hardnested()
|
|
|
@ -288,7 +335,6 @@ void Mifare::readAll() // note:cannot handle some situations(special trailer blo
|
|
|
|
QString result;
|
|
|
|
QString result;
|
|
|
|
bool isKeyAValid;
|
|
|
|
bool isKeyAValid;
|
|
|
|
bool isKeyBValid;
|
|
|
|
bool isKeyBValid;
|
|
|
|
const int waitTime = 150;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QString tmp;
|
|
|
|
QString tmp;
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|
for(int i = 0; i < cardType.sector_size; i++)
|
|
|
|