make style
This commit is contained in:
1 parent
e04b094cd2
commit
3ae9070dd8
15 files changed
+126
-121
No files matched your search
+24
-24
@@ -79,7 +79,7 @@ static bool merge_topaz_reader_frames(uint32_t timestamp, uint32_t *duration, ui
|
||||
|
||||
return true;
|
||||
}
|
||||
static uint8_t calc_pos(uint8_t *d){
|
||||
static uint8_t calc_pos(uint8_t *d) {
|
||||
// PCB [CID] [NAD] [INF] CRC CRC
|
||||
uint8_t pos = 1;
|
||||
if ((d[0] & 0x08) == 0x08) // cid byte following
|
||||
@@ -88,7 +88,7 @@ static uint8_t calc_pos(uint8_t *d){
|
||||
if ((d[0] & 0x04) == 0x04) // nad byte following
|
||||
pos++;
|
||||
|
||||
return pos;
|
||||
return pos;
|
||||
}
|
||||
|
||||
static uint8_t extract_uid[10] = {0};
|
||||
@@ -99,7 +99,7 @@ static uint8_t extract_epurse[8] = {0};
|
||||
|
||||
static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t *trace) {
|
||||
|
||||
// sanity check
|
||||
// sanity check
|
||||
if (is_last_record(tracepos, traceLen)) {
|
||||
return traceLen;
|
||||
}
|
||||
@@ -111,9 +111,9 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
// sanity check tracking position is less then available trace size
|
||||
if (tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr) > traceLen) {
|
||||
PrintAndLogEx(DEBUG, "trace pos offset %"PRIu64 " larger than reported tracelen %u",
|
||||
tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr),
|
||||
traceLen
|
||||
);
|
||||
tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr),
|
||||
traceLen
|
||||
);
|
||||
return traceLen;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
// extract MFU-C
|
||||
// extract MFU-C
|
||||
switch (frame[0]) {
|
||||
case MIFARE_ULC_AUTH_1: {
|
||||
if (data_len != 4) {
|
||||
@@ -154,7 +154,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
}
|
||||
|
||||
if (next_hdr->frame[0] != MIFARE_ULC_AUTH_2) {
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "MFU-C AUTH");
|
||||
@@ -166,16 +166,16 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
if (next_hdr->frame[0] == MIFARE_ULC_AUTH_2 && next_hdr->data_len == 19) {
|
||||
PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + 1, 16));
|
||||
}
|
||||
|
||||
|
||||
return tracepos;
|
||||
}
|
||||
}
|
||||
|
||||
// extract iCLASS
|
||||
// --csn 9655a400f8ff12e0 --epurse f0ffffffffffffff --macs 0000000089cb984b
|
||||
|
||||
|
||||
if (hdr->isResponse == false) {
|
||||
|
||||
|
||||
uint8_t c = frame[0] & 0x0F;
|
||||
switch (c) {
|
||||
case ICLASS_CMD_SELECT: {
|
||||
@@ -208,7 +208,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
if (extract_uidlen == 8) {
|
||||
PrintAndLogEx(INFO, "hf iclass lookup --csn %s " NOLF, sprint_hex_inrow(extract_uid, extract_uidlen));
|
||||
PrintAndLogEx(NORMAL, "--epurse %s " NOLF, sprint_hex_inrow(extract_epurse, 8));
|
||||
PrintAndLogEx(NORMAL, "--macs %s " NOLF, sprint_hex_inrow(frame + 1, 8) );
|
||||
PrintAndLogEx(NORMAL, "--macs %s " NOLF, sprint_hex_inrow(frame + 1, 8));
|
||||
PrintAndLogEx(NORMAL, "-f iclass_default_keys.dic");
|
||||
return tracepos;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
memcpy(extract_uid + extract_uidlen, frame + 2, 4);
|
||||
extract_uidlen += 4;
|
||||
PrintAndLogEx(INFO, "UID... " _YELLOW_("%s"), sprint_hex_inrow(extract_uid, extract_uidlen));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -279,9 +279,9 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
switch (frame[pos]) {
|
||||
|
||||
case MFDES_AUTHENTICATE: {
|
||||
// Assume wrapped or unwrapped
|
||||
// Assume wrapped or unwrapped
|
||||
PrintAndLogEx(INFO, "AUTH NATIVE (keyNo %d)", frame[pos + long_jmp]);
|
||||
|
||||
|
||||
if (hdr->isResponse == false && next_record_is_response(tracepos, trace)) {
|
||||
|
||||
tracelog_hdr_t *next_hdr = (tracelog_hdr_t *)(trace + tracepos);
|
||||
@@ -299,12 +299,12 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + pos + long_jmp, 16));
|
||||
}
|
||||
return tracepos;
|
||||
}
|
||||
}
|
||||
break; // AUTHENTICATE_NATIVE
|
||||
}
|
||||
case MFDES_AUTHENTICATE_ISO: {
|
||||
|
||||
// Assume wrapped or unwrapped
|
||||
// Assume wrapped or unwrapped
|
||||
PrintAndLogEx(INFO, "AUTH ISO (keyNo %d)", frame[pos + long_jmp]);
|
||||
if (hdr->isResponse == false && next_record_is_response(tracepos, trace)) {
|
||||
|
||||
@@ -326,7 +326,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
tracepos += TRACELOG_HDR_LEN + next_hdr->data_len + TRACELOG_PARITY_LEN(next_hdr);
|
||||
|
||||
if (next_hdr->frame[pos] == MFDES_ADDITIONAL_FRAME) {
|
||||
PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + pos + long_jmp, (tdea<<1)));
|
||||
PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + pos + long_jmp, (tdea << 1)));
|
||||
}
|
||||
return tracepos;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
break; // AUTHENTICATE_STANDARD
|
||||
}
|
||||
case MFDES_AUTHENTICATE_AES: {
|
||||
// Assume wrapped or unwrapped
|
||||
// Assume wrapped or unwrapped
|
||||
PrintAndLogEx(INFO, "AUTH AES (keyNo %d)", frame[pos + long_jmp]);
|
||||
if (hdr->isResponse == false && next_record_is_response(tracepos, trace)) {
|
||||
|
||||
@@ -368,7 +368,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tracepos;
|
||||
}
|
||||
@@ -455,9 +455,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
|
||||
if (tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr) > traceLen) {
|
||||
PrintAndLogEx(DEBUG, "trace pos offset %"PRIu64 " larger than reported tracelen %u",
|
||||
tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr),
|
||||
traceLen
|
||||
);
|
||||
tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr),
|
||||
traceLen
|
||||
);
|
||||
return traceLen;
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@ static int CmdTraceExtract(const char *Cmd) {
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("1", "buffer", "use data from trace buffer"),
|
||||
arg_lit0("1", "buffer", "use data from trace buffer"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
Reference in new issue
Block a user