mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
chg: hf mf nack - now uses NG
This commit is contained in:
parent
50c59fb6b2
commit
bfe2cff383
3 changed files with 25 additions and 12 deletions
|
@ -2806,8 +2806,8 @@ void DetectNACKbug() {
|
|||
uint8_t par[1] = {0}; // maximum 8 Bytes to be sent here, 1 byte parity is therefore enough
|
||||
|
||||
uint32_t nt = 0, previous_nt = 0, nt_attacked = 0, cuid = 0;
|
||||
int32_t isOK = 0, catch_up_cycles = 0, last_catch_up = 0;
|
||||
uint8_t cascade_levels = 0, num_nacks = 0;
|
||||
int32_t catch_up_cycles = 0, last_catch_up = 0;
|
||||
uint8_t cascade_levels = 0, num_nacks = 0, isOK = 0;
|
||||
uint16_t elapsed_prng_sequences = 1;
|
||||
uint16_t consecutive_resyncs = 0;
|
||||
uint16_t unexpected_random = 0;
|
||||
|
@ -2816,6 +2816,8 @@ void DetectNACKbug() {
|
|||
bool have_uid = false;
|
||||
bool received_nack;
|
||||
|
||||
int32_t status = PM3_SUCCESS;
|
||||
|
||||
// Mifare Classic's random generator repeats every 2^16 cycles (and so do the nonces).
|
||||
int32_t sync_cycles = PRNG_SEQUENCE_LENGTH;
|
||||
|
||||
|
@ -2843,7 +2845,7 @@ void DetectNACKbug() {
|
|||
|
||||
// Test if the action was cancelled
|
||||
if (BUTTON_PRESS()) {
|
||||
isOK = 99;
|
||||
status = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3001,6 +3003,7 @@ void DetectNACKbug() {
|
|||
|
||||
// tried all 256 possible parities without success.
|
||||
if (par[0] == 0) {
|
||||
// did we get one NACK?
|
||||
if (num_nacks == 1)
|
||||
isOK = 1;
|
||||
break;
|
||||
|
@ -3012,8 +3015,15 @@ void DetectNACKbug() {
|
|||
|
||||
// num_nacks = number of nacks recieved. should be only 1. if not its a clone card which always sends NACK (parity == 0) ?
|
||||
// i = number of authentications sent. Not always 256, since we are trying to sync but close to it.
|
||||
reply_mix(CMD_ACK, isOK, num_nacks, i, 0, 0);
|
||||
|
||||
uint8_t *data = BigBuf_malloc(4);
|
||||
data[0] = isOK;
|
||||
data[1] = num_nacks;
|
||||
num_to_bytes(i, 2, data + 2);
|
||||
reply_ng(CMD_MIFARE_NACK_DETECT, status, data, 4);
|
||||
|
||||
//reply_mix(CMD_ACK, isOK, num_nacks, i, 0, 0);
|
||||
BigBuf_free();
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
set_tracing(false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue