chg: 'hf mf chkkeys' - now uses NG

This commit is contained in:
iceman1001 2019-04-29 02:07:40 +02:00
parent 7cc6975e52
commit 7454a4dcf2
5 changed files with 16 additions and 8 deletions

View file

@ -949,7 +949,7 @@ static void PacketReceived(PacketCommandNG *packet) {
MifareNested(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes);
break;
case CMD_MIFARE_CHKKEYS: {
MifareChkKeys(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes);
MifareChkKeys(packet->oldarg[0], packet->oldarg[1], packet->oldarg[2], packet->data.asBytes, packet->ng);
break;
}
case CMD_MIFARE_CHKKEYS_FAST: {

View file

@ -153,7 +153,7 @@ void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain);
void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, uint8_t *datain);
void MifareAcquireNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, uint8_t *datain);
void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain, bool ng);
void MifareChkKeys_fast(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);
void MifareSetDbgLvl(uint16_t arg0);
void MifareEMemClr(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain);

View file

@ -1516,7 +1516,7 @@ OUT:
}
}
void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) {
void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain, bool ng) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
@ -1592,8 +1592,13 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) {
}
LED_B_ON();
reply_old(CMD_ACK, isOK, 0, 0, datain + i * 6, 6);
if (ng) {
reply_ng(CMD_MIFARE_CHKKEYS, PM3_SUCCESS, datain + i * 6, 6);
} else {
reply_mix(CMD_ACK, isOK, 0, 0, datain + i * 6, 6);
}
// reply_old(CMD_ACK, isOK, 0, 0, datain + i * 6, 6);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();

View file

@ -13,7 +13,10 @@
-- Loads the commands-library
local taglib = require('taglib')
local cmds = require('commands')
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
-- Shouldn't take longer than 2 seconds
local TIMEOUT = 2000
local ISO14A_COMMAND = {
ISO14A_CONNECT = 1,
ISO14A_NO_DISCONNECT = 2,
@ -99,7 +102,7 @@ local function read14443a(dont_disconnect, no_rats)
if arg0 == 0 then
return nil, 'iso14443a card select failed'
end
data = string.sub(result,count)
data = string.sub(result, count)
info, err = parse14443a(data)
else
err = 'No response from card'

View file

@ -84,11 +84,11 @@ local function checkBlock(blockno, testkeys, keytype)
core.clearCommandBuffer()
print(("Testing block %d, keytype %d, with %d keys"):format(blockno, keytype, chunksize))
local c = Command:newMIX{cmd = cmds.CMD_MIFARE_CHKKEYS,
local c = Command:newNG{cmd = cmds.CMD_MIFARE_CHKKEYS,
arg1 = arg1,
arg3 = chunksize,
data = d1}
status, err = checkCommand(c:sendMIX(false, TIMEOUT))
status, err = checkCommand(c:sendNG(false, TIMEOUT))
if status then return status, blockno end
start = start + chunksize