From: Oleg Moiseenko Date: Sat, 10 Feb 2018 17:19:56 +0000 (+0200) Subject: added get parity X-Git-Tag: v3.1.0~70^2~18 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/b957bcd382bf718f766c0774839752eb99f668af added get parity --- diff --git a/client/cmdhf.c b/client/cmdhf.c index 2557607b..3256b69a 100644 --- a/client/cmdhf.c +++ b/client/cmdhf.c @@ -400,7 +400,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui EndOfTransmissionTimestamp = timestamp + duration; if (protocol == PROTO_MIFARE) - annotateMifare(explanation, sizeof(explanation), frame, data_len, isResponse); + annotateMifare(explanation, sizeof(explanation), frame, data_len, parityBytes, parity_len, isResponse); if(!isResponse) { @@ -430,6 +430,9 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui (j == num_lines-1) ? explanation : ""); } } + +// if (DecodeMifareData(frame, data_len, isResponse)) { +// }; if (is_last_record(tracepos, trace, traceLen)) return traceLen; diff --git a/client/cmdhflist.c b/client/cmdhflist.c index 8e7b7f6e..5ff3192b 100644 --- a/client/cmdhflist.c +++ b/client/cmdhflist.c @@ -186,7 +186,7 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) return; } -void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse) { +void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse) { // get UID if (MifareAuthState == masNone) { if (cmdsize == 7 && cmd[0] == ISO14443A_CMD_ANTICOLL_OR_SELECT && cmd[1] == 0x70) { @@ -208,6 +208,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool AuthData.nt = bytes_to_num(cmd, cmdsize); else AuthData.nt_enc = bytes_to_num(cmd, cmdsize); + AuthData.nt_enc_par = parity[0]; return; } else { MifareAuthState = masError; @@ -219,6 +220,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool MifareAuthState = masAt; AuthData.nr_enc = bytes_to_num(cmd, cmdsize); AuthData.ar_enc = bytes_to_num(&cmd[3], cmdsize); + AuthData.ar_enc_par = parity[0] << 4; return; } else { MifareAuthState = masError; @@ -229,6 +231,7 @@ void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool snprintf(exp,size,"AUTH: at (enc)"); MifareAuthState = masFirstData; AuthData.at_enc = bytes_to_num(cmd, cmdsize); + AuthData.at_enc_par = parity[0]; return; } else { MifareAuthState = masError; diff --git a/client/cmdhflist.h b/client/cmdhflist.h index 6ec2f6fc..329df7db 100644 --- a/client/cmdhflist.h +++ b/client/cmdhflist.h @@ -31,7 +31,7 @@ extern void ClearAuthData(); extern uint8_t iso14443A_CRC_check(bool isResponse, uint8_t* data, uint8_t len); extern uint8_t mifare_CRC_check(bool isResponse, uint8_t* data, uint8_t len); extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize); -extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, bool isResponse); +extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse); #endif // CMDHFLIST