make style

This commit is contained in:
merlokk 2023-12-12 01:11:10 +02:00
commit 2517e8b345
10 changed files with 65 additions and 33 deletions

View file

@ -180,7 +180,7 @@ void RunMod(void) {
char *config_buffer = &config_buffer_array[0];
uint32_t config_size = size_in_spiffs(HF_UNISNIFF_CONFIG);
if (config_size > HF_UNISNIFF_CONFIG_SIZE) config_size = HF_UNISNIFF_CONFIG_SIZE;
rdv40_spiffs_read_as_filetype(HF_UNISNIFF_CONFIG, (uint8_t *)config_buffer,
rdv40_spiffs_read_as_filetype(HF_UNISNIFF_CONFIG, (uint8_t *)config_buffer,
config_size, RDV40_SPIFFS_SAFETY_SAFE);
// This parser is terrible but I think fairly memory efficient? Maybe better to use JSON?
char *x = config_buffer;

View file

@ -1873,7 +1873,7 @@ static void PacketReceived(PacketCommandNG *packet) {
uint8_t key[6];
} PACKED;
struct p *payload = (struct p *) packet->data.asBytes;
MifareHasStaticEncryptedNonce(payload->block_no, payload->key_type, payload->key);
break;
}

View file

@ -2724,7 +2724,7 @@ void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *
goto OUT;
};
if (g_dbglevel >= DBG_INFO)
if (g_dbglevel >= DBG_INFO)
Dbprintf("nt: %x, nt encoded: %x", nt, ntenc);
if (oldntenc == 0)

View file

@ -3392,7 +3392,7 @@ static int CmdNumCon(const char *Cmd) {
PrintAndLogEx(SUCCESS, _CYAN_("Inverted"));
for (uint8_t i = 0; i < ARRAYLEN(radix); i++) {
MBEDTLS_MPI_CHK(mbedtls_mpi_write_string(&N, radix[i].radix, s, sizeof(s), &slen));
if (slen == 0) {
if (slen == 0) {
continue;
}

View file

@ -798,7 +798,7 @@ static int CmdHFMFPRdbl(const char *Cmd) {
PrintAndLogEx(ERR, "Error return length: %d", datalen);
return PM3_ESOFT;
}
if (!plain) data_crypt(&mf4session, &data[1], &data[1], true);
uint8_t sector = mfSectorNum(blockn);
mf_print_sector_hdr(sector);
@ -1061,9 +1061,9 @@ static int CmdHFMFPChKey(const char *Cmd) {
bool verbose = arg_get_lit(ctx, 1);
bool nomacres = arg_get_lit(ctx, 2);
uint8_t keyn[250] = {0};
uint8_t ki[250] = {0};
int kilen = 0;
CLIGetHexWithReturn(ctx, 3, ki, &kilen);
@ -1076,7 +1076,7 @@ static int CmdHFMFPChKey(const char *Cmd) {
uint8_t datain[250] = {0};
int datainlen = 0;
CLIGetHexWithReturn(ctx, 6, datain, &datainlen);
CLIParserFree(ctx);
mfpSetVerboseMode(verbose);
@ -1177,7 +1177,7 @@ static int CmdHFMFPChConf(const char *Cmd) {
bool verbose = arg_get_lit(ctx, 1);
bool nomacres = arg_get_lit(ctx, 2);
uint8_t keyn[250] = {0};
uint32_t blockNum = arg_get_int(ctx, 3);
@ -1185,11 +1185,11 @@ static int CmdHFMFPChConf(const char *Cmd) {
int keylen = 0;
CLIGetHexWithReturn(ctx, 4, key, &keylen);
bool usecck = arg_get_lit(ctx, 5);
uint8_t datain[250] = {0};
int datainlen = 0;
CLIGetHexWithReturn(ctx, 6, datain, &datainlen);
CLIParserFree(ctx);
mfpSetVerboseMode(verbose);
@ -1208,7 +1208,7 @@ static int CmdHFMFPChConf(const char *Cmd) {
PrintAndLogEx(ERR, "<data> must be 16 bytes. Got %d", datainlen);
return PM3_EINVARG;
}
if (blockNum > 3) {
PrintAndLogEx(ERR, "<config number> must be in range [0..3]. Got %d", blockNum);
return PM3_EINVARG;

View file

@ -322,6 +322,7 @@ const static vocabulary_t vocabulary[] = {
{ 0, "hf lto wrbl" },
{ 1, "hf mf help" },
{ 1, "hf mf list" },
{ 0, "hf mf info" },
{ 0, "hf mf darkside" },
{ 0, "hf mf nested" },
{ 1, "hf mf hardnested" },
@ -390,6 +391,8 @@ const static vocabulary_t vocabulary[] = {
{ 0, "hf mfp rdbl" },
{ 0, "hf mfp rdsc" },
{ 0, "hf mfp wrbl" },
{ 0, "hf mfp chkey" },
{ 0, "hf mfp chconf" },
{ 0, "hf mfp commitp" },
{ 0, "hf mfp initp" },
{ 0, "hf mfp wrp" },

View file

@ -104,7 +104,7 @@ static char inv_b2s(char v, bool uppercase) {
'7', '6', '5', '4',
'3', '2', '1', '0'
};
uint8_t tmp = (tolower(v) - 'a' + 10);
if (isdigit(v)) {
tmp = (v - 0x30);
@ -112,7 +112,7 @@ static char inv_b2s(char v, bool uppercase) {
if (uppercase)
return toupper(lut[tmp]);
else
else
return lut[tmp];
}
@ -1254,7 +1254,7 @@ void str_inverse_bin(char *buf, size_t len) {
buf[i] = '0';
else if ( c == '0')
buf[i] = '1';
else
else
buf[i] = '.';
}
}

View file

@ -354,7 +354,7 @@ int mfc_algo_saflok_one(uint8_t *uid, uint8_t sector, uint8_t keytype, uint64_t
uint64_t id = (bytes_to_num(uid, 4) << 8);
*key = (h + (id + m + ((uint64_t)h << 40ULL))) & 0xFFFFFFFFFFFFULL;
} else {
*key = 0xFFFFFFFFFFFF;
}

View file

@ -608,9 +608,10 @@
"--dec <dec> decimal value",
"--hex <hex> hexadecimal value",
"--bin <bin> binary value",
"-i print inverted value"
"-i print inverted value",
"-r print reversed value"
],
"usage": "data num [-hi] [--dec <dec>] [--hex <hex>] [--bin <bin>]"
"usage": "data num [-hir] [--dec <dec>] [--hex <hex>] [--bin <bin>]"
},
"data plot": {
"command": "data plot",
@ -4706,6 +4707,25 @@
],
"usage": "hf mf hardnested [-habrstw] [-k <hex>] [--blk <dec>] [--tblk <dec>] [--ta] [--tb] [--tk <hex>] [-u <hex>] [-f <fn>] [--in] [--im] [--is] [--ia] [--i2] [--i5]"
},
"hf mf info": {
"command": "hf mf info",
"description": "Information and check vulnerabilities in a MIFARE Classic card Some cards in order to extract information you need to specify key and/or specific keys in the copmmand line",
"notes": [
"hf mf info",
"hf mf info -k ffffffff -n -v"
],
"offline": false,
"options": [
"-h, --help This help",
"--blk <dec> block number",
"-a input key type is key A (def)",
"-b input key type is key B",
"-k, --key <hex> key, 6 hex bytes",
"-n, --nack do nack test",
"-v, --verbose verbose output"
],
"usage": "hf mf info [-habnv] [--blk <dec>] [-k <hex>]"
},
"hf mf list": {
"command": "hf mf list",
"description": "Alias of `trace list -t mf -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
@ -6257,7 +6277,7 @@
"* Block B001 (01; CCK): Installation identifier for Virtual Card. Please consult NXP for data.",
"* Block B002 (02; CCK): ATS data.",
"* Block B003 (03; CCK): Use Random ID in SL3, decide whether proximity check is mandatory.",
" * DO NOT WRITE THIS BLOCK UNDER ANY CIRCUMSTANCES! Risk of bricking.",
"* DO NOT WRITE THIS BLOCK UNDER ANY CIRCUMSTANCES! Risk of bricking.",
"More configuration tips to follow. Check JMY600 Series IC Card Module.",
"hf mfp chconf -c 00 -d 10ffffffffffffffffffffffffffffff --key A0A1A2A3A4A5A6A7A0A1A2A3A4A5A6A7 -> Allow 16 commands without MAC in a single transaction."
],
@ -6312,11 +6332,11 @@
"options": [
"-h, --help This help",
"-v, --verbose Verbose mode",
"--nmr Do not expect MAC in response",
"--ki <hex> Key Index, 2 hex bytes",
"-k, --key <hex> Current sector key, 16 hex bytes",
"-b, --typeb Sector key is key B",
"-d, --data <hex> New key, 16 hex bytes"
"--nmr Do not expect MAC in response",
"--ki <hex> Key Index, 2 hex bytes",
"-k, --key <hex> Current sector key, 16 hex bytes",
"-b, --typeb Sector key is key B",
"-d, --data <hex> New key, 16 hex bytes"
],
"usage": "hf mfp chkey [-hvb] [--nmr] --ki <hex> [-k <hex>] -d <hex>"
},
@ -6482,7 +6502,7 @@
"-v, --verbose Verbose mode",
"-n, --count <dec> Blocks count (def: 1)",
"-b, --keyb Use key B (def: keyA)",
"-p, --plain Do not use encrypted transmission between reader and card",
"-p, --plain Do not use encrypted communication mode between reader and card",
"--nmc Do not append MAC to command",
"--nmr Do not expect MAC in reply",
"--blk <0..255> Block number",
@ -6502,7 +6522,7 @@
"-h, --help This help",
"-v, --verbose Verbose mode",
"-b, --keyb Use key B (def: keyA)",
"-p, --plain Do not use encrypted transmission between reader and card",
"-p, --plain Do not use encrypted communication mode between reader and card",
"--nmc Do not append MAC to command",
"--nmr Do not expect MAC in reply",
"-s, --sn <0..255> Sector number",
@ -6534,10 +6554,18 @@
"command": "hf mfp wrp",
"description": "Executes Write Perso command. Can be used in SL0 mode only.",
"notes": [
"Use this command to program AES keys, as well as personalize other data on the tag.",
"You can program:",
"* Address 00 [00-FF]: Memory blocks (as well as ACLs and Crypto1 keys)",
"* Address 40 [00-40]: AES sector keys",
"* Address 90 [00-04]: AES administrative keys",
"* Address A0 [00, 01, 80, 81]: Virtual Card keys",
"* Address B0 [00-03]: Configuration data (DO NOT TOUCH B003)",
"Examples:",
"hf mfp wrp --adr 4000 --data 000102030405060708090a0b0c0d0e0f -> write key (00..0f) to key number 4000",
"hf mfp wrp --adr 4000 -> write default key(0xff..0xff) to key number 4000",
"hf mfp wrp -a b000 -d 20FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> allow 32 commands without MAC in configuration block (B000)",
"hf mfp wrp -a 0003 -d 1234561234567F078869B0B1B2B3B4B5 -> write crypto1 keys A: 123456123456 and B: B0B1B2B3B4B5 to block 3"
"hf mfp wrp --adr b000 -d FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> allow 255 commands without MAC in configuration block (B000)",
"hf mfp wrp --adr 0003 -d 1234561234567F078869B0B1B2B3B4B5 -> write crypto1 keys A: 123456123456 and B: B0B1B2B3B4B5 to block 3"
],
"offline": false,
"options": [
@ -7446,7 +7474,7 @@
},
"hf tune": {
"command": "hf tune",
"description": "Continuously measure HF antenna tuning. Press button or <Enter> to interrupt.",
"description": "Continuously measure HF antenna tuning. Press pm3 button or <Enter> to interrupt.",
"notes": [
"hf tune",
"hf tune --mix"
@ -9027,7 +9055,7 @@
"-1, --ht1 Card type Hitag 1",
"-2, --ht2 Card type Hitag 2",
"-s, --hts Card type Hitag S",
"-m, --htm Card type Hitag \u03bc"
"-m, --htm Card type Hitag \u041e\u0458"
],
"usage": "lf hitag eload [-h12sm] -f <fn>"
},
@ -12118,8 +12146,8 @@
}
},
"metadata": {
"commands_extracted": 699,
"commands_extracted": 702,
"extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2023-12-01T14:06:40"
"extracted_on": "2023-12-11T23:10:13"
}
}
}

View file

@ -485,6 +485,7 @@ Check column "offline" for their availability.
|------- |------- |-----------
|`hf mf help `|Y |`This help`
|`hf mf list `|Y |`List MIFARE history`
|`hf mf info `|N |`mfc card Info`
|`hf mf darkside `|N |`Darkside attack`
|`hf mf nested `|N |`Nested attack`
|`hf mf hardnested `|Y |`Nested attack for hardened MIFARE Classic cards`