Merge pull request #1713 from merlokk/mst

make style
This commit is contained in:
Oleg Moiseenko 2022-07-08 00:19:46 +03:00 committed by GitHub
commit 2697effe4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 65 additions and 39 deletions

View file

@ -372,7 +372,7 @@ static void TexcomReverseCode(const uint8_t *code, int length, uint8_t *reverse_
} }
}; };
static int texkom_get_type(texkom_card_select_t* card, bool verbose) { static int texkom_get_type(texkom_card_select_t *card, bool verbose) {
if (card == NULL) { if (card == NULL) {
return PM3_EINVARG; return PM3_EINVARG;
@ -531,13 +531,13 @@ int read_texkom_uid(bool loop, bool verbose) {
PrintAndLogEx(INFO, "TYPE..... TK13"); PrintAndLogEx(INFO, "TYPE..... TK13");
PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4)); PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4));
if (verbose) { if (verbose) {
PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail"));
} }
} else if (card.tcode[2] == 0xCA) { } else if (card.tcode[2] == 0xCA) {
PrintAndLogEx(INFO, "TYPE..... TK17"); PrintAndLogEx(INFO, "TYPE..... TK17");
PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4)); PrintAndLogEx(INFO, "UID...... " _GREEN_("%s"), sprint_hex(&card.tcode[3], 4));
if (verbose) { if (verbose) {
PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(INFO, "CRC...... %s", (crc) ? _GREEN_("ok") : _RED_("fail"));
} }
} }
if (verbose) { if (verbose) {
@ -557,7 +557,7 @@ static int CmdHFTexkomReader(const char *Cmd) {
"Read a texkom tag", "Read a texkom tag",
"hf texkom reader\n" "hf texkom reader\n"
"hf texkom reader -@ -> continuous reader mode" "hf texkom reader -@ -> continuous reader mode"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -813,7 +813,7 @@ static int CmdHFTexkomSim(const char *Cmd) {
memcpy(payload.data, rawdata, 8); memcpy(payload.data, rawdata, 8);
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_HF_TEXKOM_SIMULATE, (uint8_t*)&payload, sizeof(payload)); SendCommandNG(CMD_HF_TEXKOM_SIMULATE, (uint8_t *)&payload, sizeof(payload));
if (payload.timeout > 0 && payload.timeout < 2800) { if (payload.timeout > 0 && payload.timeout < 2800) {
PrintAndLogEx(INFO, "simulate command started"); PrintAndLogEx(INFO, "simulate command started");

View file

@ -156,6 +156,7 @@ const static vocabulory_t vocabulory[] = {
{ 0, "hf 14b sniff" }, { 0, "hf 14b sniff" },
{ 0, "hf 14b rdbl" }, { 0, "hf 14b rdbl" },
{ 0, "hf 14b sriwrite" }, { 0, "hf 14b sriwrite" },
{ 1, "hf 14b view" },
{ 1, "hf 15 help" }, { 1, "hf 15 help" },
{ 1, "hf 15 list" }, { 1, "hf 15 list" },
{ 1, "hf 15 demod" }, { 1, "hf 15 demod" },
@ -427,6 +428,7 @@ const static vocabulory_t vocabulory[] = {
{ 0, "hf topaz raw" }, { 0, "hf topaz raw" },
{ 1, "hf texkom help" }, { 1, "hf texkom help" },
{ 0, "hf texkom reader" }, { 0, "hf texkom reader" },
{ 0, "hf texkom sim" },
{ 1, "hf xerox help" }, { 1, "hf xerox help" },
{ 0, "hf xerox info" }, { 0, "hf xerox info" },
{ 0, "hf xerox dump" }, { 0, "hf xerox dump" },

View file

@ -94,13 +94,19 @@ static char b2s(uint8_t v, bool uppercase) {
// clear higher bits // clear higher bits
v &= 0xF; v &= 0xF;
switch(v) { switch (v) {
case 0xA : return (uppercase ? 'A' : 'a') ; case 0xA :
case 0xB : return (uppercase ? 'B' : 'b') ; return (uppercase ? 'A' : 'a') ;
case 0xC : return (uppercase ? 'C' : 'c') ; case 0xB :
case 0xD : return (uppercase ? 'D' : 'd') ; return (uppercase ? 'B' : 'b') ;
case 0xE : return (uppercase ? 'E' : 'e') ; case 0xC :
case 0xF : return (uppercase ? 'F' : 'f') ; return (uppercase ? 'C' : 'c') ;
case 0xD :
return (uppercase ? 'D' : 'd') ;
case 0xE :
return (uppercase ? 'E' : 'e') ;
case 0xF :
return (uppercase ? 'F' : 'f') ;
default: default:
return (char)(v + 0x30); return (char)(v + 0x30);
} }
@ -206,7 +212,7 @@ void hex_to_buffer(uint8_t *buf, const uint8_t *hex_data, const size_t hex_len,
// //
size_t max_byte_len = (hex_len > hex_max_len) ? hex_max_len : hex_len; size_t max_byte_len = (hex_len > hex_max_len) ? hex_max_len : hex_len;
size_t max_str_len = (max_byte_len * ( 2 + spaces_between )) + 1; size_t max_str_len = (max_byte_len * (2 + spaces_between)) + 1;
char *tmp_base = (char *)buf; char *tmp_base = (char *)buf;
char *tmp = tmp_base; char *tmp = tmp_base;
@ -459,7 +465,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) {
size_t max_len = (len > 1010) ? 1010 : len; size_t max_len = (len > 1010) ? 1010 : len;
int ret = snprintf(buf, sizeof(buf) - 1, "%s| ", sprint_hex(data, max_len)); int ret = snprintf(buf, sizeof(buf) - 1, "%s| ", sprint_hex(data, max_len));
if ( ret < 0) { if (ret < 0) {
goto out; goto out;
} }

View file

@ -1295,7 +1295,7 @@
}, },
"hf 14b help": { "hf 14b help": {
"command": "hf 14b help", "command": "hf 14b help",
"description": "help This help list List ISO-14443-B history", "description": "help This help list List ISO-14443-B history view Display content from tag dump file",
"notes": [], "notes": [],
"offline": true, "offline": true,
"options": [], "options": [],
@ -1446,6 +1446,20 @@
], ],
"usage": "hf 14b sriwrite [-h] [-b <dec>] -d <hex> [--512] [--4k] [--sb]" "usage": "hf 14b sriwrite [-h] [-b <dec>] -d <hex> [--512] [--4k] [--sb]"
}, },
"hf 14b view": {
"command": "hf 14b view",
"description": "Print a ISO14443-B dump file (bin/eml/json)",
"notes": [
"hf 14b view -f hf-14b-01020304-dump.bin"
],
"offline": true,
"options": [
"-h, --help This help",
"-f, --file <fn> filename of dump",
"-v, --verbose verbose output"
],
"usage": "hf 14b view [-hv] -f <fn>"
},
"hf 15 csetuid": { "hf 15 csetuid": {
"command": "hf 15 csetuid", "command": "hf 15 csetuid",
"description": "Set UID for magic Chinese card (only works with such cards)", "description": "Set UID for magic Chinese card (only works with such cards)",
@ -6315,14 +6329,16 @@
"command": "hf texkom reader", "command": "hf texkom reader",
"description": "Read a texkom tag", "description": "Read a texkom tag",
"notes": [ "notes": [
"hf texkom reader" "hf texkom reader",
"hf texkom reader -@ -> continuous reader mode"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help This help", "-h, --help This help",
"-v, --verbose Verbose scan and output" "-v, --verbose Verbose scan and output",
"-@ optional - continuous reader mode"
], ],
"usage": "hf texkom reader [-hv]" "usage": "hf texkom reader [-hv@]"
}, },
"hf texkom sim": { "hf texkom sim": {
"command": "hf texkom sim", "command": "hf texkom sim",
@ -6341,9 +6357,10 @@
"-v, --verbose Verbose work", "-v, --verbose Verbose work",
"-t, --tk17 Use TK-17 modulation (TK-13 by default)", "-t, --tk17 Use TK-17 modulation (TK-13 by default)",
"--raw <hex 8 bytes> Raw data for texkom card, 8 bytes. Manual modulation select.", "--raw <hex 8 bytes> Raw data for texkom card, 8 bytes. Manual modulation select.",
"--id <hex 4 bytes> Raw data for texkom card, 8 bytes. Manual modulation select." "--id <hex 4 bytes> Raw data for texkom card, 8 bytes. Manual modulation select.",
"--timeout <dec, ms> Simulation timeout in the ms. If not specified or 0 - infinite. Command can be skipped by pressing the button"
], ],
"usage": "hf texkom sim [-hvt] [--raw <hex 8 bytes>] [--id <hex 4 bytes>]" "usage": "hf texkom sim [-hvt] [--raw <hex 8 bytes>] [--id <hex 4 bytes>] [--timeout <dec, ms>]"
}, },
"hf thinfilm help": { "hf thinfilm help": {
"command": "hf thinfilm help", "command": "hf thinfilm help",
@ -11076,8 +11093,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 699, "commands_extracted": 700,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2022-07-03T21:31:15" "extracted_on": "2022-07-07T21:17:54"
} }
} }

View file

@ -207,6 +207,7 @@ Check column "offline" for their availability.
|`hf 14b sniff `|N |`Eavesdrop ISO-14443-B` |`hf 14b sniff `|N |`Eavesdrop ISO-14443-B`
|`hf 14b rdbl `|N |`Read SRI512/SRIX4x block` |`hf 14b rdbl `|N |`Read SRI512/SRIX4x block`
|`hf 14b sriwrite `|N |`Write data to a SRI512 or SRIX4K tag` |`hf 14b sriwrite `|N |`Write data to a SRI512 or SRIX4K tag`
|`hf 14b view `|Y |`Display content from tag dump file`
### hf 15 ### hf 15