style and text

This commit is contained in:
iceman1001 committed 2024-08-25 15:17:02 +02:00
1 parent 5b64df9247
commit 6a95f16102
11 files changed
+243 -219

No files matched your search

+3 -2
View File
@@ -2273,10 +2273,11 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
}
if (card.ats[0] != card.ats_len - 2) {
PrintAndLogEx(WARNING, _RED_("ATS may be corrupted.") " Length of ATS (%d bytes incl. 2 Bytes CRC) doesn't match TL", card.ats_len);
PrintAndLogEx(WARNING, _RED_("ATS may be corrupted."));
PrintAndLogEx(INFO, "Length of ATS (%d bytes incl. 2 Bytes CRC) doesn't match TL", card.ats_len);
}
PrintAndLogEx(SUCCESS, "ATS: " _YELLOW_("%s")"[ %02X %02X ]", sprint_hex(card.ats, card.ats_len - 2), card.ats[card.ats_len - 1], card.ats[card.ats_len]);
PrintAndLogEx(SUCCESS, "ATS: " _YELLOW_("%s")"[ %02X %02X ]", sprint_hex(card.ats, card.ats_len - 2), card.ats[card.ats_len - 2], card.ats[card.ats_len - 1]);
PrintAndLogEx(INFO, " " _YELLOW_("%02X") "............... TL length is " _GREEN_("%d") " bytes", card.ats[0], card.ats[0]);
if ((card.ats[0] > 1) && (card.ats_len > 3)) { // there is a format byte (T0)
+1 -1
View File
@@ -4653,7 +4653,7 @@ static int CmdHFiClassEncode(const char *Cmd) {
char format[16] = {0};
int format_len = 0;
CLIParamStrToBuf(arg_get_str(ctx, 10), (uint8_t *)format, sizeof(format), &format_len);
bool shallow_mod = arg_get_lit(ctx, 12);
+2 -2
View File
@@ -286,7 +286,7 @@ static int CmdHF14AJookiEncode(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf jooki encode",
"Encode a Jooki token to base64 NDEF URI format",
"hf jooki encode -t --> selftest\n"
"hf jooki encode --test --> self tests\n"
"hf jooki encode -r --dragon --> read uid from tag and use for encoding\n"
"hf jooki encode --uid 04010203040506 --dragon\n"
"hf jooki encode --uid 04010203040506 --tid 1 --fid 1"
@@ -296,7 +296,7 @@ static int CmdHF14AJookiEncode(const char *Cmd) {
arg_param_begin,
arg_str0("u", "uid", "<hex>", "uid bytes"),
arg_lit0("r", NULL, "read uid from tag instead"),
arg_lit0("t", NULL, "self test"),
arg_lit0(NULL, "test", "self test"),
arg_lit0("v", "verbose", "verbose output"),
arg_lit0(NULL, "dragon", "figurine type"),
arg_lit0(NULL, "fox", "figurine type"),
+8 -3
View File
@@ -767,9 +767,14 @@ static int CmdEM410xClone(const char *Cmd) {
// 64 -> 0x20 2 kBit/s
packet.data[1] = 0x04;
switch (clk) {
case 32: break;
case 16: packet.data[1] |= 0x10; break;
case 64: packet.data[1] |= 0x20; break;
case 32:
break;
case 16:
packet.data[1] |= 0x10;
break;
case 64:
packet.data[1] |= 0x20;
break;
}
packet.data[2] = 0;
packet.data[3] = 0; //TODO: keep PWDH0?
+3 -3
View File
@@ -1169,14 +1169,14 @@ int getIndalaBits(uint8_t fc, uint16_t cn, uint8_t *bits) {
// 92 = 62
// 93 = 63
bits[34] = 0; // parity for odd bits
bits[38] = 0; // parity for even bits
uint8_t p1 = 1;
uint8_t p2 = 1;
for (int i=33; i < 64; i++) {
if (i%2)
for (int i = 33; i < 64; i++) {
if (i % 2)
p1 ^= bits[i];
else
p2 ^= bits[i];
+7 -1
View File
@@ -1386,7 +1386,13 @@ int CmdTraceList(const char *Cmd) {
if (use_buffer == false) {
download_trace();
} else if (gs_traceLen == 0 || gs_trace == NULL) {
PrintAndLogEx(FAILED, "You requested a trace list in offline mode but there is no trace.");
if (IfPm3Present() == false) {
PrintAndLogEx(FAILED, "You requested a trace list in offline mode but there is no trace.");
} else {
PrintAndLogEx(FAILED, "You requested a trace list but there is no trace.");
}
PrintAndLogEx(FAILED, "Consider using `" _YELLOW_("trace load") "` or removing parameter `" _YELLOW_("-1") "`");
return PM3_EINVARG;
}
+6 -3
View File
@@ -2344,9 +2344,12 @@ int loadFileDICTIONARY_safe(const char *preferredName, void **pdata, uint8_t key
continue;
}
uint64_t key = strtoull(line, NULL, 16);
num_to_bytes(key, keylen >> 1, (uint8_t *)*pdata + (*keycnt * (keylen >> 1)));
if (hex_to_bytes(
line,
(uint8_t *)*pdata + (*keycnt * (keylen >> 1)),
keylen >> 1) != (keylen >> 1)) {
continue;
}
(*keycnt)++;
+17 -17
View File
@@ -24,7 +24,7 @@ static bool Pack_Defcon32(wiegand_card_t *card, wiegand_message_t *packed, bool
memset(packed, 0, sizeof(wiegand_message_t));
if (card->FacilityCode > 0x00FFFF) return false; // Can't encode FC.
if (card->CardNumber > 0x0fffff) return false; // Can't encode CN.
if (card->IssueLevel > 0x00000F) return false; // Can't encode Issue
if (card->IssueLevel > 0x00000F) return false; // Can't encode Issue
if (card->OEM > 0) return false; // Not used in this format
packed->Length = 42;
@@ -35,11 +35,11 @@ static bool Pack_Defcon32(wiegand_card_t *card, wiegand_message_t *packed, bool
|Mid part| | Bot part of the packed data |
PFFFFFFFFF FFFFFFFIIIICCCCCCCCCCCCCCCCCCCCP
1111111111 11111111111000000000000000001000
FC 111111111 1111111 = FF FF
//FC Mid 111111111 0000000 = FF 80 These where used to split data between bot/mid
//FC Bot 000000000 1111111 = 00 7F
Issuance 1111 = 0F
Card Number 11111111111111111111 = 0FFFFF
FC 111111111 1111111 = FF FF
//FC Mid 111111111 0000000 = FF 80 These where used to split data between bot/mid
//FC Bot 000000000 1111111 = 00 7F
Issuance 1111 = 0F
Card Number 11111111111111111111 = 0FFFFF
*/
@@ -51,14 +51,14 @@ Card Number 11111111111111111111 = 0FFFFF
// Parity calc
//0123456789|0123456789|0123456789|0123456789|01
//E E E E E |E E E E E |EO O O O O| O O O O O| O
set_bit_by_position(packed,
evenparity32(
get_nonlinear_field(packed, 10, (uint8_t[]) {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}))
set_bit_by_position(packed,
evenparity32(
get_nonlinear_field(packed, 10, (uint8_t[]) {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}))
, 0);
set_bit_by_position(packed,
oddparity32(
get_nonlinear_field(packed, 10, (uint8_t[]) {21, 23, 25, 27, 29, 31, 33, 35, 37, 39}))
set_bit_by_position(packed,
oddparity32(
get_nonlinear_field(packed, 10, (uint8_t[]) {21, 23, 25, 27, 29, 31, 33, 35, 37, 39}))
, 41);
if (preamble)
return add_HID_header(packed);
@@ -73,12 +73,12 @@ static bool Unpack_Defcon32(wiegand_message_t *packed, wiegand_card_t *card) {
card->FacilityCode = get_linear_field(packed, 1, 16);
card->IssueLevel = get_linear_field(packed, 17, 4);
card->CardNumber = get_linear_field(packed, 21, 20);
card->ParityValid =
card->ParityValid =
(get_bit_by_position(packed, 41) == oddparity32(
get_nonlinear_field(packed, 10, (uint8_t[]) {21, 23, 25, 27, 29, 31, 33, 35, 37, 39})))&&
(get_bit_by_position(packed, 0) ==
evenparity32(get_nonlinear_field(packed, 10, (uint8_t[]) {2, 4, 6, 8, 10, 12, 14, 16, 18, 20})));
get_nonlinear_field(packed, 10, (uint8_t[]) {21, 23, 25, 27, 29, 31, 33, 35, 37, 39}))) &&
(get_bit_by_position(packed, 0) ==
evenparity32(get_nonlinear_field(packed, 10, (uint8_t[]) {2, 4, 6, 8, 10, 12, 14, 16, 18, 20})));
return true;
}