Fix saving/loading trace(sniff) files

Fix file extension for RRG repo
Fix overwriting existing file
Add support for RRG v4.16717(path in prefs)
This commit is contained in:
wh201906
2023-06-27 21:09:08 +08:00
parent 0738aff2bf
commit 184a9ed5f2
4 changed files with 57 additions and 10 deletions
+15
View File
@@ -1375,3 +1375,18 @@ quint16 Mifare::getTrailerBlockId(quint8 sectorId, qint8 cardTypeId)
// other cardTypeId: use current cardtype(include default -1)
return (cardType.blks[sectorId] + cardType.blk[sectorId] - 1);
}
QString Mifare::getTraceSavePath()
{
QVariantMap config = configMap["save sniff"].toMap();
QString pathCmd = config["path cmd"].toString();
QString patternText = config["path pattern"].toString();
QRegularExpression pattern = QRegularExpression(patternText, QRegularExpression::MultilineOption);
if(pathCmd.isEmpty() || patternText.isEmpty())
return QString();
QString result = util->execCMDWithOutput(pathCmd, 500);
QRegularExpressionMatch reMatch = pattern.match(result);
if(!reMatch.hasMatch())
return QString();
return reMatch.captured(1).trimmed();
}