mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
clean up
This commit is contained in:
parent
713301226d
commit
e055858fb8
1 changed files with 21 additions and 18 deletions
|
@ -200,6 +200,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
data_len = hdr->data_len;
|
data_len = hdr->data_len;
|
||||||
|
|
||||||
if (tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr) > traceLen) {
|
if (tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr) > traceLen) {
|
||||||
|
PrintAndLogEx(DEBUG, "trace pos offset %d larger than reported tracelen %d", tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr), traceLen);
|
||||||
return traceLen;
|
return traceLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,6 +391,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (protocol == PROTO_MIFARE) {
|
||||||
if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen)) {
|
if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen)) {
|
||||||
memset(explanation, 0x00, sizeof(explanation));
|
memset(explanation, 0x00, sizeof(explanation));
|
||||||
if (!hdr->isResponse) {
|
if (!hdr->isResponse) {
|
||||||
|
@ -401,8 +403,11 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
(crcc == 0 ? "!crc" : (crcc == 1 ? " ok " : " ")),
|
(crcc == 0 ? "!crc" : (crcc == 1 ? " ok " : " ")),
|
||||||
explanation);
|
explanation);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_last_record(tracepos, traceLen)) return traceLen;
|
if (is_last_record(tracepos, traceLen)) {
|
||||||
|
return traceLen;
|
||||||
|
}
|
||||||
|
|
||||||
if (showWaitCycles && !hdr->isResponse && next_record_is_response(tracepos, trace)) {
|
if (showWaitCycles && !hdr->isResponse && next_record_is_response(tracepos, trace)) {
|
||||||
|
|
||||||
|
@ -420,7 +425,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
|
|
||||||
static int download_trace(void) {
|
static int download_trace(void) {
|
||||||
|
|
||||||
if (!IfPm3Present()) {
|
if (IfPm3Present() == false) {
|
||||||
PrintAndLogEx(FAILED, "You requested a trace upload in offline mode, consider using parameter '1' for working from Tracebuffer");
|
PrintAndLogEx(FAILED, "You requested a trace upload in offline mode, consider using parameter '1' for working from Tracebuffer");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
@ -437,7 +442,7 @@ static int download_trace(void) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "downloading tracelog from device");
|
PrintAndLogEx(INFO, "downloading tracelog data from device");
|
||||||
|
|
||||||
// Query for the size of the trace, downloading PM3_CMD_DATA_SIZE
|
// Query for the size of the trace, downloading PM3_CMD_DATA_SIZE
|
||||||
PacketResponseNG response;
|
PacketResponseNG response;
|
||||||
|
@ -533,11 +538,6 @@ int CmdTraceList(const char *Cmd) {
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
uint8_t protocol = 0;
|
uint8_t protocol = 0;
|
||||||
char type[10] = {0};
|
char type[10] = {0};
|
||||||
|
|
||||||
//int tlen = param_getstr(Cmd,0,type);
|
|
||||||
//char param1 = param_getchar(Cmd, 1);
|
|
||||||
//char param2 = param_getchar(Cmd, 2);
|
|
||||||
|
|
||||||
char cmdp = 0;
|
char cmdp = 0;
|
||||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||||
|
|
||||||
|
@ -651,7 +651,10 @@ int CmdTraceList(const char *Cmd) {
|
||||||
PrintAndLogEx(NORMAL, " Start | End | Src | Data (! denotes parity error) | CRC | Annotation");
|
PrintAndLogEx(NORMAL, " Start | End | Src | Data (! denotes parity error) | CRC | Annotation");
|
||||||
PrintAndLogEx(NORMAL, "------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------");
|
PrintAndLogEx(NORMAL, "------------+------------+-----+-------------------------------------------------------------------------+-----+--------------------");
|
||||||
|
|
||||||
|
// clean authentication data used with the mifare classic decrypt fct
|
||||||
|
if (protocol == ISO_14443A || protocol == PROTO_MIFARE)
|
||||||
ClearAuthData();
|
ClearAuthData();
|
||||||
|
|
||||||
while (tracepos < g_traceLen) {
|
while (tracepos < g_traceLen) {
|
||||||
tracepos = printTraceLine(tracepos, g_traceLen, g_trace, protocol, showWaitCycles, markCRCBytes);
|
tracepos = printTraceLine(tracepos, g_traceLen, g_trace, protocol, showWaitCycles, markCRCBytes);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue