make style

This commit is contained in:
iceman1001 2022-07-25 08:00:30 +02:00
commit 6290d50564
10 changed files with 38 additions and 31 deletions

View file

@ -58,7 +58,7 @@ static void RAMFUNC skipSniff(uint8_t *dest, uint16_t dsize, uint8_t skipMode, u
case HF_SNOOP_SKIP_AVG: case HF_SNOOP_SKIP_AVG:
accum += (val & 0xff) + (val & 0xff); accum += (val & 0xff) + (val & 0xff);
break; break;
default: { // HF_SNOOP_SKIP_DROP and the rest default: { // HF_SNOOP_SKIP_DROP and the rest
if (ratioindx == 0) if (ratioindx == 0)
accum = val & 0xff; accum = val & 0xff;
} }

View file

@ -1850,17 +1850,17 @@ void iClass_WriteBlock(uint8_t *msg) {
if (payload->req.use_replay) { if (payload->req.use_replay) {
memcpy(write + 10, payload->mac, sizeof(payload->mac)); memcpy(write + 10, payload->mac, sizeof(payload->mac));
} else { } else {
// Secure tags uses MAC // Secure tags uses MAC
uint8_t wb[9]; uint8_t wb[9];
wb[0] = payload->req.blockno; wb[0] = payload->req.blockno;
memcpy(wb + 1, payload->data, 8); memcpy(wb + 1, payload->data, 8);
if (payload->req.use_credit_key) if (payload->req.use_credit_key)
doMAC_N(wb, sizeof(wb), hdr.key_c, mac); doMAC_N(wb, sizeof(wb), hdr.key_c, mac);
else else
doMAC_N(wb, sizeof(wb), hdr.key_d, mac); doMAC_N(wb, sizeof(wb), hdr.key_d, mac);
memcpy(write + 10, mac, sizeof(mac)); memcpy(write + 10, mac, sizeof(mac));
} }
} }

View file

@ -303,7 +303,7 @@ int CmdHFTune(const char *Cmd) {
typedef enum { typedef enum {
HF_SNOOP_SKIP_NONE = 0x00, HF_SNOOP_SKIP_NONE = 0x00,
HF_SNOOP_SKIP_DROP = 0x01, HF_SNOOP_SKIP_DROP = 0x01,
HF_SNOOP_SKIP_MAX = 0x02, HF_SNOOP_SKIP_MAX = 0x02,
HF_SNOOP_SKIP_MIN = 0x03, HF_SNOOP_SKIP_MIN = 0x03,
HF_SNOOP_SKIP_AVG = 0x04 HF_SNOOP_SKIP_AVG = 0x04
@ -364,10 +364,10 @@ int CmdHFSniff(const char *Cmd) {
CLIParserFree(ctx); CLIParserFree(ctx);
if (params.skipMode != HF_SNOOP_SKIP_NONE) { if (params.skipMode != HF_SNOOP_SKIP_NONE) {
PrintAndLogEx(INFO, "Skip mode. Function: %s, each: %d sample", PrintAndLogEx(INFO, "Skip mode. Function: %s, each: %d sample",
CLIGetOptionListStr(HFSnoopSkipModeOpts, params.skipMode), CLIGetOptionListStr(HFSnoopSkipModeOpts, params.skipMode),
params.skipRatio * 2 params.skipRatio * 2
); );
} }
clearCommandBuffer(); clearCommandBuffer();
@ -479,7 +479,7 @@ static command_t CommandTable[] = {
{"emrtd", CmdHFeMRTD, AlwaysAvailable, "{ Machine Readable Travel Document... }"}, {"emrtd", CmdHFeMRTD, AlwaysAvailable, "{ Machine Readable Travel Document... }"},
{"felica", CmdHFFelica, AlwaysAvailable, "{ ISO18092 / FeliCa RFIDs... }"}, {"felica", CmdHFFelica, AlwaysAvailable, "{ ISO18092 / FeliCa RFIDs... }"},
{"fido", CmdHFFido, AlwaysAvailable, "{ FIDO and FIDO2 authenticators... }"}, {"fido", CmdHFFido, AlwaysAvailable, "{ FIDO and FIDO2 authenticators... }"},
{"fudan", CmdHFFudan, AlwaysAvailable, "{ Fudan RFIDs... }"}, {"fudan", CmdHFFudan, AlwaysAvailable, "{ Fudan RFIDs... }"},
{"gallagher", CmdHFGallagher, AlwaysAvailable, "{ Gallagher DESFire RFIDs... }"}, {"gallagher", CmdHFGallagher, AlwaysAvailable, "{ Gallagher DESFire RFIDs... }"},
{"ksx6924", CmdHFKSX6924, AlwaysAvailable, "{ KS X 6924 (T-Money, Snapper+) RFIDs }"}, {"ksx6924", CmdHFKSX6924, AlwaysAvailable, "{ KS X 6924 (T-Money, Snapper+) RFIDs }"},
{"jooki", CmdHF_Jooki, AlwaysAvailable, "{ Jooki RFIDs... }"}, {"jooki", CmdHF_Jooki, AlwaysAvailable, "{ Jooki RFIDs... }"},

View file

@ -655,7 +655,7 @@ int CmdHF14ASim(const char *Cmd) {
"hf 14a sim -t 4 -> ISO/IEC 14443-4\n" "hf 14a sim -t 4 -> ISO/IEC 14443-4\n"
"hf 14a sim -t 5 -> MIFARE Tnp3xxx\n" "hf 14a sim -t 5 -> MIFARE Tnp3xxx\n"
"hf 14a sim -t 6 -> MIFARE Mini\n" "hf 14a sim -t 6 -> MIFARE Mini\n"
"hf 14a sim -t 7 -> AMIIBO (NTAG 215), pack 0x8080\n" "hf 14a sim -t 7 -> Amiibo (NTAG 215), pack 0x8080\n"
"hf 14a sim -t 8 -> MIFARE Classic 4k\n" "hf 14a sim -t 8 -> MIFARE Classic 4k\n"
"hf 14a sim -t 9 -> FM11RF005SH Shanghai Metro\n" "hf 14a sim -t 9 -> FM11RF005SH Shanghai Metro\n"
"hf 14a sim -t 10 -> ST25TA IKEA Rothult\n"); "hf 14a sim -t 10 -> ST25TA IKEA Rothult\n");
@ -663,7 +663,7 @@ int CmdHF14ASim(const char *Cmd) {
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_int1("t", "type", "<1-10> ", "Simulation type to use"), arg_int1("t", "type", "<1-10> ", "Simulation type to use"),
arg_str0("u", "uid", "<hex>", "4, 7 or 10 byte UID"), arg_str0("u", "uid", "<hex>", "<4|7|10> hex bytes UID"),
arg_int0("n", "num", "<dec>", "Exit simulation after <numreads> blocks have been read by reader. 0 = infinite"), arg_int0("n", "num", "<dec>", "Exit simulation after <numreads> blocks have been read by reader. 0 = infinite"),
arg_lit0("x", NULL, "Performs the 'reader attack', nr/ar attack against a reader"), arg_lit0("x", NULL, "Performs the 'reader attack', nr/ar attack against a reader"),
arg_lit0(NULL, "sk", "Fill simulator keys from found keys"), arg_lit0(NULL, "sk", "Fill simulator keys from found keys"),
@ -2379,7 +2379,7 @@ static uint32_t inc_sw_error_occurrence(uint16_t sw, uint32_t *all_sw) {
if (sw1 == 0x90 && sw2 == 0x00) { if (sw1 == 0x90 && sw2 == 0x00) {
return 0; return 0;
} }
// Always max "Instruction not supported" // Always max "Instruction not supported"
if (sw1 == 0x6D && sw2 == 0x00) { if (sw1 == 0x6D && sw2 == 0x00) {
return 0xFFFFFFFFUL; return 0xFFFFFFFFUL;

View file

@ -193,9 +193,9 @@ static uint8_t TexcomTK13CRC(const uint8_t *data) {
static uint8_t MMBITCRC(const uint8_t *data) { static uint8_t MMBITCRC(const uint8_t *data) {
return return
(( (data[0] & 0x0f) ^ ((data[0] >> 4) & 0x0f) ^ (((data[0] & 0x0f) ^ ((data[0] >> 4) & 0x0f) ^
(data[1] & 0x0f) ^ ((data[1] >> 4) & 0x0f) ^ (data[1] & 0x0f) ^ ((data[1] >> 4) & 0x0f) ^
(data[2] & 0x0f) ^ ((data[2] >> 4) & 0x0f) (data[2] & 0x0f) ^ ((data[2] >> 4) & 0x0f)
) ^ 0x0f ) ^ 0x0f
) & 0x0f; ) & 0x0f;
} }
@ -310,7 +310,7 @@ static bool TexcomTK15Decode(uint32_t *implengths, uint32_t implengthslen, char
int lastimplen = implengths[implengthslen - 1]; int lastimplen = implengths[implengthslen - 1];
bool prevbit = (implengths[implengthslen - 3] > implengths[implengthslen - 2]); bool prevbit = (implengths[implengthslen - 3] > implengths[implengthslen - 2]);
bool thesamebit = (abs(lastimplen - (int)implengths[implengthslen - 3]) < abs(lastimplen - (int)implengths[implengthslen - 2])); bool thesamebit = (abs(lastimplen - (int)implengths[implengthslen - 3]) < abs(lastimplen - (int)implengths[implengthslen - 2]));
if (prevbit ^ !thesamebit) { if (prevbit ^ !thesamebit) {
strcat(bitstring, "10"); strcat(bitstring, "10");
strcat(cbitstring, "1"); strcat(cbitstring, "1");

View file

@ -470,7 +470,7 @@ static int CmdHFXeroxReader(const char *Cmd) {
"Act as a 14443B reader to identify a tag", "Act as a 14443B reader to identify a tag",
"hf xerox reader\n" "hf xerox reader\n"
"hf xerox reader -@ \n" "hf xerox reader -@ \n"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -495,7 +495,7 @@ static int CmdHFXeroxInfo(const char *Cmd) {
CLIParserInit(&ctx, "hf xerox info", CLIParserInit(&ctx, "hf xerox info",
"Tag information for ISO/IEC 14443 type B / XEROX based tags", "Tag information for ISO/IEC 14443 type B / XEROX based tags",
"hf xerox info" "hf xerox info"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,

View file

@ -48,6 +48,7 @@ const static vocabulory_t vocabulory[] = {
{ 1, "prefs get savepaths" }, { 1, "prefs get savepaths" },
{ 1, "prefs get emoji" }, { 1, "prefs get emoji" },
{ 1, "prefs get hints" }, { 1, "prefs get hints" },
{ 1, "prefs get output" },
{ 1, "prefs get plotsliders" }, { 1, "prefs get plotsliders" },
{ 1, "prefs set help" }, { 1, "prefs set help" },
{ 1, "prefs set barmode" }, { 1, "prefs set barmode" },
@ -57,6 +58,7 @@ const static vocabulory_t vocabulory[] = {
{ 1, "prefs set emoji" }, { 1, "prefs set emoji" },
{ 1, "prefs set hints" }, { 1, "prefs set hints" },
{ 1, "prefs set savepaths" }, { 1, "prefs set savepaths" },
{ 1, "prefs set output" },
{ 1, "prefs set plotsliders" }, { 1, "prefs set plotsliders" },
{ 1, "analyse help" }, { 1, "analyse help" },
{ 1, "analyse lcr" }, { 1, "analyse lcr" },
@ -431,6 +433,7 @@ const static vocabulory_t vocabulory[] = {
{ 0, "hf texkom sim" }, { 0, "hf texkom sim" },
{ 1, "hf xerox help" }, { 1, "hf xerox help" },
{ 0, "hf xerox info" }, { 0, "hf xerox info" },
{ 0, "hf xerox reader" },
{ 0, "hf xerox dump" }, { 0, "hf xerox dump" },
{ 1, "hf waveshare help" }, { 1, "hf waveshare help" },
{ 0, "hf waveshare loadbmp" }, { 0, "hf waveshare loadbmp" },

View file

@ -1236,20 +1236,20 @@ inline uint64_t leadingzeros64(uint64_t a) {
} }
int byte_strstr(uint8_t* src, size_t srclen, uint8_t* pattern, size_t plen) { int byte_strstr(uint8_t *src, size_t srclen, uint8_t *pattern, size_t plen) {
size_t max = srclen - plen + 1; size_t max = srclen - plen + 1;
for (size_t i = 0; i < max; i++) { for (size_t i = 0; i < max; i++) {
// compare only first byte // compare only first byte
if (src[i] != pattern[0]) if (src[i] != pattern[0])
continue; continue;
// try to match rest of the pattern // try to match rest of the pattern
for (int j = plen - 1; j >= 1; j--) { for (int j = plen - 1; j >= 1; j--) {
if (src[i + j] != pattern[j]) if (src[i + j] != pattern[j])
break; break;
if (j == 1) if (j == 1)
@ -1257,4 +1257,4 @@ int byte_strstr(uint8_t* src, size_t srclen, uint8_t* pattern, size_t plen) {
} }
} }
return -1; return -1;
} }

View file

@ -145,5 +145,5 @@ uint64_t bitcount64(uint64_t a);
uint32_t leadingzeros32(uint32_t a); uint32_t leadingzeros32(uint32_t a);
uint64_t leadingzeros64(uint64_t a); uint64_t leadingzeros64(uint64_t a);
int byte_strstr(uint8_t* src, size_t srclen, uint8_t* pattern, size_t plen); int byte_strstr(uint8_t *src, size_t srclen, uint8_t *pattern, size_t plen);
#endif #endif

View file

@ -43,6 +43,7 @@ Check column "offline" for their availability.
|`prefs get savepaths `|Y |`Get file folder ` |`prefs get savepaths `|Y |`Get file folder `
|`prefs get emoji `|Y |`Get emoji display preference` |`prefs get emoji `|Y |`Get emoji display preference`
|`prefs get hints `|Y |`Get hint display preference` |`prefs get hints `|Y |`Get hint display preference`
|`prefs get output `|Y |`Get dump output style preference`
|`prefs get plotsliders `|Y |`Get plot slider display preference` |`prefs get plotsliders `|Y |`Get plot slider display preference`
@ -60,6 +61,7 @@ Check column "offline" for their availability.
|`prefs set emoji `|Y |`Set emoji display` |`prefs set emoji `|Y |`Set emoji display`
|`prefs set hints `|Y |`Set hint display` |`prefs set hints `|Y |`Set hint display`
|`prefs set savepaths `|Y |`... to be adjusted next ... ` |`prefs set savepaths `|Y |`... to be adjusted next ... `
|`prefs set output `|Y |`Set dump output style`
|`prefs set plotsliders `|Y |`Set plot slider display` |`prefs set plotsliders `|Y |`Set plot slider display`
@ -335,6 +337,7 @@ Check column "offline" for their availability.
|`hf gallagher clone `|N |`Add Gallagher credentials to a DESFire card` |`hf gallagher clone `|N |`Add Gallagher credentials to a DESFire card`
|`hf gallagher delete `|N |`Delete Gallagher credentials from a DESFire card` |`hf gallagher delete `|N |`Delete Gallagher credentials from a DESFire card`
|`hf gallagher diversifykey`|Y |`Diversify Gallagher key` |`hf gallagher diversifykey`|Y |`Diversify Gallagher key`
|`hf gallagher decode `|Y |`Decode Gallagher credential block`
### hf ksx6924 ### hf ksx6924
@ -666,6 +669,7 @@ Check column "offline" for their availability.
|------- |------- |----------- |------- |------- |-----------
|`hf xerox help `|Y |`This help` |`hf xerox help `|Y |`This help`
|`hf xerox info `|N |`Short info on Fuji/Xerox tag` |`hf xerox info `|N |`Short info on Fuji/Xerox tag`
|`hf xerox reader `|N |`Act like a Fuji/Xerox reader`
|`hf xerox dump `|N |`Read all memory pages of an Fuji/Xerox tag, save to file` |`hf xerox dump `|N |`Read all memory pages of an Fuji/Xerox tag, save to file`