From 62a9a46cc75814ee906548e347bd9ec50cd7082f Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:28:40 +0300 Subject: [PATCH] make style --- client/src/cmdhfmfdes.c | 8 +++---- client/src/mifare/desfirecrypto.c | 6 +++--- doc/commands.json | 35 ++++++++++++++++++++----------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index d7582869d..09317ddb0 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -4050,7 +4050,7 @@ static int CmdHF14ADesCreateTrMACFile(const char *Cmd) { if (verbose) PrintAndLogEx(INFO, "%s. File num: 0x%02x type: 0x%02x data[%zu]: %s", DesfireWayIDStr(selectway, id), data[0], filetype, datalen, sprint_hex(data, datalen)); - + DesfirePrintCreateFileSettings(filetype, data, datalen); res = DesfireCreateFile(&dctx, filetype, data, datalen, true); @@ -4378,10 +4378,10 @@ static int CmdHF14ADesClearRecordFile(const char *Cmd) { DropField(); return PM3_ESOFT; } - + if (verbose) PrintAndLogEx(INFO, "File cleared"); - + DesfireSetCommMode(&dctx, DCMMACed); res = DesfireCommitTransaction(&dctx, false, 0); if (res != PM3_SUCCESS) { @@ -4497,7 +4497,7 @@ static int DesfileReadFileAndPrint(DesfireContext *dctx, uint8_t fnum, int filet int res = 0; // length of record for record file size_t reclen = 0; - + // iso chaining works in the lrp mode dctx->isoChaining |= (dctx->secureChannel == DACLRP); diff --git a/client/src/mifare/desfirecrypto.c b/client/src/mifare/desfirecrypto.c index 9a37f107a..4342e8ee1 100644 --- a/client/src/mifare/desfirecrypto.c +++ b/client/src/mifare/desfirecrypto.c @@ -691,11 +691,11 @@ void DesfireDecodePrevReaderID(DesfireContext *ctx, uint8_t *key, uint32_t trCnt uint8_t sessionkey[16] = {0}; uint8_t uid[7] = {0}; memcpy(uid, ctx->uid, MAX(ctx->uidlen, 7)); - + if (ctx->secureChannel == DACEV2) { DesfireGenTransSessionKeyEV2(key, trCntr, uid, false, sessionkey); - - aes_decode(NULL, sessionkey, encPrevReaderID, prevReaderID, CRYPTO_AES_BLOCK_SIZE); + + aes_decode(NULL, sessionkey, encPrevReaderID, prevReaderID, CRYPTO_AES_BLOCK_SIZE); } else if (ctx->secureChannel == DACLRP) { DesfireGenTransSessionKeyLRP(key, trCntr, uid, false, sessionkey); diff --git a/doc/commands.json b/doc/commands.json index bc1d747cd..f42ebc62d 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -973,7 +973,7 @@ }, "help": { "command": "help", - "description": "help use ` help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log e:\\proxspace\\pm3/.proxmark3/logs/log_20210819.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save", + "description": "help use ` help` for details of a command prefs { edit client/device preferences... } -------- ----------------------- technology ----------------------- analyse { analyse utils... } data { plot window / data buffer manipulation... } emv { emv iso-14443 / iso-7816... } hf { high frequency commands... } hw { hardware commands... } lf { low frequency commands... } nfc { nfc commands... } reveng { crc calculations from reveng software... } smart { smart card iso-7816 commands... } script { scripting commands... } trace { trace manipulation... } wiegand { wiegand format manipulation... } -------- ----------------------- general ----------------------- clear clear screen hints turn hints on / off msleep add a pause in milliseconds rem add a text line in log file quit exit exit program [=] session log e:\\proxspace\\pm3/.proxmark3/logs/log_20210821.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save", "notes": [ "auto" ], @@ -4115,7 +4115,8 @@ "command": "hf mfdes clearrecfile", "description": "clear record file. master key needs to be provided or flag --no-auth set (depend on cards settings).", "notes": [ - "hf mfdes clearrecfile --aid 123456 --fid 01 -> clear record file for: app=123456, file=01 with defaults from `default` command" + "hf mfdes clearrecfile --aid 123456 --fid 01 -> clear record file for: app=123456, file=01 with defaults from `default` command", + "hf mfdes clearrecfile --appisoid df01 --fid 01 -s lrp -t aes -n 3 -> clear record file for lrp channel with key number 3" ], "offline": false, "options": [ @@ -4131,10 +4132,11 @@ "-c, --ccset communicaton command set: native/niso/iso", "-s, --schann secure channel: d40/ev1/ev2/lrp", "--aid application id (3 hex bytes, big endian)", + "--appisoid application iso id (iso df id) (2 hex bytes, big endian).", "--fid file id for clearing (1 hex byte)", "--no-auth execute without authentication" ], - "usage": "hf mfdes clearrecfile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth]" + "usage": "hf mfdes clearrecfile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--appisoid ] [--fid ] [--no-auth]" }, "hf mfdes createapp": { "command": "hf mfdes createapp", @@ -4249,7 +4251,9 @@ "", "hf mfdes createmacfile --aid 123456 --fid 01 --rawrights 0ff0 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file with parameters. rights from default. authentication with defaults from `default` command", "hf mfdes createmacfile --aid 123456 --fid 01 --amode plain --rrights free --wrights deny --rwrights free --chrights key0 --mackey 00112233445566778899aabbccddeeff -> create file app=123456, file=01, with key, and mentioned rights with defaults from `default` command", - "hf mfdes createmacfile -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> execute with default factory setup. key and keyver == 0x00..00" + "hf mfdes createmacfile -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> execute with default factory setup. key and keyver == 0x00..00", + "hf mfdes createmacfile --appisoid df01 --fid 0f -s lrp -t aes --rawrights 0ff0 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel", + "hf mfdes createmacfile --appisoid df01 --fid 0f -s lrp -t aes --rawrights 0f10 --mackey 00112233445566778899aabbccddeeff --mackeyver 01 -> create transaction mac file via lrp channel with commitreaderid command enable" ], "offline": false, "options": [ @@ -4265,6 +4269,7 @@ "-c, --ccset communicaton command set: native/niso/iso", "-s, --schann secure channel: d40/ev1/ev2/lrp", "--aid application id (3 hex bytes, big endian)", + "--appisoid application iso id (iso df id) (2 hex bytes, big endian).", "--fid file id (1 hex byte)", "--amode file access mode: plain/mac/encrypt", "--rawrights access rights for file (hex 2 byte) r/w/rw/chg, 0x0 - 0xd key, 0xe free, 0xf denied", @@ -4276,7 +4281,7 @@ "--mackey aes-128 key for mac (16 hex bytes, big endian). default 0x00..00", "--mackeyver aes key version for mac (1 hex byte). default 0x00" ], - "usage": "hf mfdes createmacfile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--amode ] [--rawrights ] [--rrights ] [--wrights ] [--rwrights ] [--chrights ] [--no-auth] [--mackey ] [--mackeyver ]" + "usage": "hf mfdes createmacfile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--appisoid ] [--fid ] [--amode ] [--rawrights ] [--rrights ] [--wrights ] [--rwrights ] [--chrights ] [--no-auth] [--mackey ] [--mackeyver ]" }, "hf mfdes createrecordfile": { "command": "hf mfdes createrecordfile", @@ -4403,7 +4408,8 @@ "command": "hf mfdes deletefile", "description": "delete file from application. master key needs to be provided or flag --no-auth set (depend on cards settings).", "notes": [ - "hf mfdes deletefile --aid 123456 --fid 01 -> delete file for: app=123456, file=01 with defaults from `default` command" + "hf mfdes deletefile --aid 123456 --fid 01 -> delete file for: app=123456, file=01 with defaults from `default` command", + "hf mfdes deletefile --appisoid df01 --fid 0f -s lrp -t aes -> delete file for lrp channel" ], "offline": false, "options": [ @@ -4419,10 +4425,11 @@ "-c, --ccset communicaton command set: native/niso/iso", "-s, --schann secure channel: d40/ev1/ev2/lrp", "--aid application id (3 hex bytes, big endian)", + "--appisoid application iso id (iso df id) (2 hex bytes, big endian).", "--fid file id (1 hex byte)", "--no-auth execute without authentication" ], - "usage": "hf mfdes deletefile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth]" + "usage": "hf mfdes deletefile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--appisoid ] [--fid ] [--no-auth]" }, "hf mfdes detect": { "command": "hf mfdes detect", @@ -4856,7 +4863,9 @@ "hf mfdes read --aid 123456 --fileisoid 1000 --type data -c iso -> read file via iso channel: app=123456, iso id=1000, offset=0. select via native iso wrapper", "hf mfdes read --appisoid 0102 --fileisoid 1000 --type data -c iso -> read file via iso channel: app iso id=0102, iso id=1000, offset=0. select via iso commands", "hf mfdes read --appisoid 0102 --fileisoid 1100 --type record -c iso --offset 000005 --length 000001 -> get one record (number 5) from file 1100 via iso commands", - "hf mfdes read --appisoid 0102 --fileisoid 1100 --type record -c iso --offset 000005 --length 000000 -> get all record (from 5 to 1) from file 1100 via iso commands" + "hf mfdes read --appisoid 0102 --fileisoid 1100 --type record -c iso --offset 000005 --length 000000 -> get all record (from 5 to 1) from file 1100 via iso commands", + "hf mfdes read --appisoid df01 --fid 00 -s lrp -t aes --length 000010 -> read via lrp channel", + "hf mfdes read --appisoid df01 --fid 00 -s ev2 -t aes --length 000010 --isochain -> read desfire light via ev2 channel" ], "offline": false, "options": [ @@ -4878,9 +4887,10 @@ "-o, --offset file offset (3 hex bytes, big endian). for records - record number (0 - lastest record). default 0", "-l, --length length to read (3 hex bytes, big endian -> 000000 = read all data). for records - records count (0 - all). default 0.", "--appisoid application iso id (iso df id) (2 hex bytes, big endian).", - "--fileisoid file iso id (iso df id) (2 hex bytes, big endian). works only for iso read commands." + "--fileisoid file iso id (iso df id) (2 hex bytes, big endian). works only for iso read commands.", + "--isochain use iso chaining commands. switched on by default if secure channel = lrp" ], - "usage": "hf mfdes read [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth] [--type ] [-o ] [-l ] [--appisoid ] [--fileisoid ]" + "usage": "hf mfdes read [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth] [--type ] [-o ] [-l ] [--appisoid ] [--fileisoid ] [--isochain]" }, "hf mfdes selectapp": { "command": "hf mfdes selectapp", @@ -4990,12 +5000,13 @@ "-c, --ccset communicaton command set: native/niso/iso", "-s, --schann secure channel: d40/ev1/ev2/lrp", "--aid application id (3 hex bytes, big endian)", + "--appisoid application iso id (iso df id) (2 hex bytes, big endian).", "--fid file id (1 hex byte)", "-o, --op operation: get(default)/credit/limcredit(limited credit)/debit/clear. operation clear: get-getopt-debit to min value", "-d, --data value for operation (hex 4 bytes)", "--no-auth execute without authentication" ], - "usage": "hf mfdes value [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [-o ] [-d ] [--no-auth]" + "usage": "hf mfdes value [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--appisoid ] [--fid ] [-o ] [-d ] [--no-auth]" }, "hf mfdes write": { "command": "hf mfdes write", @@ -9981,6 +9992,6 @@ "metadata": { "commands_extracted": 589, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2021-08-19T16:54:30" + "extracted_on": "2021-08-21T11:28:11" } } \ No newline at end of file