Merge pull request #1387 from merlokk/make_style

make style
This commit is contained in:
Oleg Moiseenko 2021-07-26 18:06:49 +03:00 committed by GitHub
commit f28da26cd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 403 additions and 239 deletions

View file

@ -44,125 +44,125 @@
#define LF_HIDCOLLECT_LOGFILE "lf_hid_fcbrute.log" #define LF_HIDCOLLECT_LOGFILE "lf_hid_fcbrute.log"
static void append(uint8_t *entry, size_t entry_len) { static void append(uint8_t *entry, size_t entry_len) {
LED_B_ON(); LED_B_ON();
DbpString("Writing... "); DbpString("Writing... ");
DbpString((char *)entry); DbpString((char *)entry);
rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, entry_len, RDV40_SPIFFS_SAFETY_SAFE); rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, entry_len, RDV40_SPIFFS_SAFETY_SAFE);
LED_B_OFF(); LED_B_OFF();
} }
void ModInfo(void) { void ModInfo(void) {
DbpString(_YELLOW_(" LF - HID facility code bruteforce - (ss23)")); DbpString(_YELLOW_(" LF - HID facility code bruteforce - (ss23)"));
} }
void RunMod(void) { void RunMod(void) {
FpgaDownloadAndGo(FPGA_BITSTREAM_LF); FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
LFSetupFPGAForADC(LF_DIVISOR_125, true); LFSetupFPGAForADC(LF_DIVISOR_125, true);
BigBuf_Clear(); BigBuf_Clear();
StandAloneMode(); StandAloneMode();
WDT_HIT(); WDT_HIT();
LEDsoff(); LEDsoff();
LED_A_ON(); LED_A_ON();
LED_B_ON(); LED_B_ON();
LED_C_ON(); LED_C_ON();
rdv40_spiffs_lazy_mount(); rdv40_spiffs_lazy_mount();
// Buffer for writing to log // Buffer for writing to log
uint8_t entry[81]; uint8_t entry[81];
memset(entry, 0, sizeof(entry)); memset(entry, 0, sizeof(entry));
sprintf((char *)entry, "%s\n", "HID FC brute start"); sprintf((char *)entry, "%s\n", "HID FC brute start");
// Create the log file // Create the log file
if (exists_in_spiffs(LF_HIDCOLLECT_LOGFILE)) { if (exists_in_spiffs(LF_HIDCOLLECT_LOGFILE)) {
rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE);
} else { } else {
rdv40_spiffs_write(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); rdv40_spiffs_write(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE);
} }
LED_B_OFF(); LED_B_OFF();
Dbprintf("Waiting to begin bruteforce"); Dbprintf("Waiting to begin bruteforce");
// Wait until the user presses the button to begin the bruteforce // Wait until the user presses the button to begin the bruteforce
for (;;) { for (;;) {
// Hit the watchdog timer regularly // Hit the watchdog timer regularly
WDT_HIT(); WDT_HIT();
int button_pressed = BUTTON_HELD(10); int button_pressed = BUTTON_HELD(10);
if ((button_pressed == BUTTON_HOLD) || (button_pressed == BUTTON_SINGLE_CLICK)) { if ((button_pressed == BUTTON_HOLD) || (button_pressed == BUTTON_SINGLE_CLICK)) {
break; break;
} }
} }
Dbprintf("Running Bruteforce"); Dbprintf("Running Bruteforce");
LEDsoff(); LEDsoff();
LED_A_ON(); LED_A_ON();
// Buffer for HID data // Buffer for HID data
uint32_t high, low; uint32_t high, low;
for (uint32_t fc = 0; fc < 256; fc++) { for (uint32_t fc = 0; fc < 256; fc++) {
// Hit the watchdog timer regularly // Hit the watchdog timer regularly
WDT_HIT(); WDT_HIT();
LEDsoff(); LEDsoff();
// Toggle LED_C // Toggle LED_C
if ((fc % 2) == 1) { if ((fc % 2) == 1) {
LED_C_ON(); LED_C_ON();
} }
// If we get USB data, break out // If we get USB data, break out
if (data_available()) break; if (data_available()) break;
// If a user attempts to hold button, abort the run // If a user attempts to hold button, abort the run
/* /*
int button_pressed = BUTTON_HELD(1000); // 1 second int button_pressed = BUTTON_HELD(1000); // 1 second
if (button_pressed == BUTTON_HOLD) { if (button_pressed == BUTTON_HOLD) {
break; break;
} }
*/ */
// If a user pressed the button once, briefly, output the current FC to the log file // If a user pressed the button once, briefly, output the current FC to the log file
if (BUTTON_PRESS()) { if (BUTTON_PRESS()) {
memset(entry, 0, sizeof(entry)); memset(entry, 0, sizeof(entry));
sprintf((char *)entry, "FC: %li\n", fc); sprintf((char *)entry, "FC: %li\n", fc);
append(entry, strlen((char *)entry)); append(entry, strlen((char *)entry));
} }
// Calculate data required for a HID card // Calculate data required for a HID card
hid_calculate_checksum_and_set(&high, &low, 1, fc); hid_calculate_checksum_and_set(&high, &low, 1, fc);
// Print actual code to brute // Print actual code to brute
Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high, low, (low >> 1) & 0xFFFF, fc, 1); Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high, low, (low >> 1) & 0xFFFF, fc, 1);
LED_A_ON(); LED_A_ON();
LED_D_ON(); LED_D_ON();
StartTicks(); StartTicks();
CmdHIDsimTAGEx(0, high, low, 0, 1, 40000); CmdHIDsimTAGEx(0, high, low, 0, 1, 40000);
LED_D_OFF(); LED_D_OFF();
StartTicks(); StartTicks();
WaitMS(50); WaitMS(50);
StopTicks(); StopTicks();
LED_A_OFF(); LED_A_OFF();
} }
LEDsoff(); LEDsoff();
} }
void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) { void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) {
uint32_t newhigh = 0; uint32_t newhigh = 0;
uint32_t newlow = 0; uint32_t newlow = 0;
newlow = 0; newlow = 0;
newlow |= (cardnum & 0xFFFF) << 1; newlow |= (cardnum & 0xFFFF) << 1;
newlow |= (fc & 0xFF) << 17; newlow |= (fc & 0xFF) << 17;
newlow |= oddparity32((newlow >> 1) & 0xFFF); newlow |= oddparity32((newlow >> 1) & 0xFFF);
newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25; newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25;
newhigh |= 0x20; // Bit 37; standard header newhigh |= 0x20; // Bit 37; standard header
newlow |= 1U << 26; // leading 1: start bit newlow |= 1U << 26; // leading 1: start bit
*low = newlow; *low = newlow;
*high = newhigh; *high = newhigh;
} }

View file

@ -5581,8 +5581,8 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) {
arg_str0(NULL, "amode", "<plain/mac/encrypt>", "File access mode: plain/mac/encrypt"), arg_str0(NULL, "amode", "<plain/mac/encrypt>", "File access mode: plain/mac/encrypt"),
arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"),
arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "rwrights","<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"), arg_str0(NULL, "rwrights", "<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "chrights","<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"), arg_str0(NULL, "chrights", "<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"),
arg_lit0(NULL, "no-auth", "execute without authentication"), arg_lit0(NULL, "no-auth", "execute without authentication"),
arg_param_end arg_param_end
}; };
@ -5721,16 +5721,16 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) {
} }
static int DesfireCreateFileParameters( static int DesfireCreateFileParameters(
CLIParserContext *ctx, CLIParserContext *ctx,
uint8_t pfileid, uint8_t pisofileid, uint8_t pfileid, uint8_t pisofileid,
uint8_t amodeid, uint8_t amodeid,
uint8_t frightsid, uint8_t frightsid,
uint8_t r_modeid, uint8_t w_modeid, uint8_t rw_modeid, uint8_t ch_modeid, uint8_t r_modeid, uint8_t w_modeid, uint8_t rw_modeid, uint8_t ch_modeid,
uint8_t *data, uint8_t *data,
size_t *datalen size_t *datalen
) { ) {
*datalen = 0; *datalen = 0;
int res = 0; int res = 0;
@ -5857,8 +5857,8 @@ static int CmdHF14ADesCreateFile(const char *Cmd) {
arg_str0(NULL, "rawrights", "<access rights HEX>", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"), arg_str0(NULL, "rawrights", "<access rights HEX>", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"),
arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"),
arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "rwrights","<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"), arg_str0(NULL, "rwrights", "<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "chrights","<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"), arg_str0(NULL, "chrights", "<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"),
arg_lit0(NULL, "no-auth", "execute without authentication"), arg_lit0(NULL, "no-auth", "execute without authentication"),
arg_str0(NULL, "size", "<hex>", "File size (3 hex bytes, big endian)"), arg_str0(NULL, "size", "<hex>", "File size (3 hex bytes, big endian)"),
arg_lit0(NULL, "backup", "Create backupfile instead of standard file"), arg_lit0(NULL, "backup", "Create backupfile instead of standard file"),
@ -6005,8 +6005,8 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) {
arg_str0(NULL, "rawrights", "<access rights HEX>", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"), arg_str0(NULL, "rawrights", "<access rights HEX>", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"),
arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "rrights", "<key0/../key13/free/deny>", "Read file access mode: the specified key, free, deny"),
arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "<key0/../key13/free/deny>", "Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "rwrights","<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"), arg_str0(NULL, "rwrights", "<key0/../key13/free/deny>", "Read/Write file access mode: the specified key, free, deny"),
arg_str0(NULL, "chrights","<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"), arg_str0(NULL, "chrights", "<key0/../key13/free/deny>", "Change file settings access mode: the specified key, free, deny"),
arg_lit0(NULL, "no-auth", "execute without authentication"), arg_lit0(NULL, "no-auth", "execute without authentication"),
arg_str0(NULL, "lower", "<hex>", "Lower limit (4 hex bytes, big endian)"), arg_str0(NULL, "lower", "<hex>", "Lower limit (4 hex bytes, big endian)"),
arg_str0(NULL, "upper", "<hex>", "Upper limit (4 hex bytes, big endian)"), arg_str0(NULL, "upper", "<hex>", "Upper limit (4 hex bytes, big endian)"),

View file

@ -973,7 +973,7 @@
}, },
"help": { "help": {
"command": "help", "command": "help",
"description": "help use `<command> 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_20210720.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save", "description": "help use `<command> 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_20210726.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save",
"notes": [ "notes": [
"auto" "auto"
], ],
@ -3208,7 +3208,7 @@
"-f, --file <fn> filename of dump", "-f, --file <fn> filename of dump",
"--emu from emulator memory" "--emu from emulator memory"
], ],
"usage": "hf mf cload [-h] -f <fn> [--emu]" "usage": "hf mf cload [-h] [-f <fn>] [--emu]"
}, },
"hf mf csave": { "hf mf csave": {
"command": "hf mf csave", "command": "hf mf csave",
@ -4009,21 +4009,38 @@
], ],
"usage": "hf mfdes changekey [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--oldalgo <des/2tdea/3tdea/aes>] [--oldkey <old key>] [--newkeyno <keyno>] [--newalgo <des/2tdea/3tdea/aes>] [--newkey <new key>] [--newver <version hex>]" "usage": "hf mfdes changekey [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--oldalgo <des/2tdea/3tdea/aes>] [--oldkey <old key>] [--newkeyno <keyno>] [--newalgo <des/2tdea/3tdea/aes>] [--newkey <new key>] [--newver <version hex>]"
}, },
"hf mfdes changevalue": { "hf mfdes chfilesettings": {
"command": "hf mfdes changevalue", "command": "hf mfdes chfilesettings",
"description": "change value (credit / limitedcredit / debit) make sure to select aid or authenticate aid before running this command.", "description": "get file settings from file from application. master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [ "notes": [
"hf mfdes changevalue -n 03 -m 0 -d 00000001" "hf mfdes chfilesettings --aid 123456 --fid 01 --amode plain --rrights free --wrights free --rwrights free --chrights key0 -> change file settings app=123456, file=01 with defaults from `default` command",
"hf mfdes chfilesettings -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 --rawdata 00eeee -> execute with default factory setup",
"hf mfdes chfilesettings --aid 123456 --fid 01 --rawdata 810000021f112f22 -> change file settings with additional rights for keys 1 and 2"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --fileno <dec> file number (0 - 31)", "-a, --apdu show apdu requests and responses",
"-d, --value <hex> value to increase (4 hex bytes, big endian)", "-v, --verbose show technical data",
"-m, --mode <dec> mode (0 = credit, 1 = limited credit, 2 = debit)", "-n, --keyno <keyno> key number",
"-a, --aid <hex> app id to select as hex bytes (3 bytes, big endian)" "-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte)",
"--rawdata <file settings hex> file settings (hex > 5 bytes)",
"--amode <plain/mac/encrypt> file access mode: plain/mac/encrypt",
"--rrights <key0/../key13/free/deny> read file access mode: the specified key, free, deny",
"--wrights <key0/../key13/free/deny> write file access mode: the specified key, free, deny",
"--rwrights <key0/../key13/free/deny> read/write file access mode: the specified key, free, deny",
"--chrights <key0/../key13/free/deny> change file settings access mode: the specified key, free, deny",
"--no-auth execute without authentication"
], ],
"usage": "hf mfdes changevalue [-h] [-n <dec>] [-d <hex>]... [-m <dec>] [-a <hex>]..." "usage": "hf mfdes chfilesettings [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [--rawdata <file settings hex>] [--amode <plain/mac/encrypt>] [--rrights <key0/../key13/free/deny>] [--wrights <key0/../key13/free/deny>] [--rwrights <key0/../key13/free/deny>] [--chrights <key0/../key13/free/deny>] [--no-auth]"
}, },
"hf mfdes chk": { "hf mfdes chk": {
"command": "hf mfdes chk", "command": "hf mfdes chk",
@ -4153,22 +4170,44 @@
}, },
"hf mfdes createfile": { "hf mfdes createfile": {
"command": "hf mfdes createfile", "command": "hf mfdes createfile",
"description": "create standard/backup file", "description": "create standard/backup file in the application. application master key needs to be provided or flag --no-auth set (depend on application settings).",
"notes": [ "notes": [
"hf mfdes createfile -f 0001 -n 01 -c 0 -r eeee -s 000100 -a 123456" "--rawtype/--rawdata have priority over the other settings. and with these parameters you can create any file. file id comes from parameters, all the rest data must be in the --rawdata parameter",
"--rawrights have priority over the separate rights settings.",
"key/mode/etc of the authentication depends on application settings",
"hf mfdes createfile --aid 123456 --fid 01 --rawtype 01 --rawdata 000100eeee000100 -> create file via sending rawdata to the card. can be used to create any type of file. authentication with defaults from `default` command",
"hf mfdes createfile --aid 123456 --fid 01 --amode plain --rrights free --wrights free --rwrights free --chrights key0 -> create file app=123456, file=01 and mentioned rights with defaults from `default` command",
"hf mfdes createfile -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 --rawtype 00 --rawdata 00eeee000100 -> execute with default factory setup"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --fileno <dec> file number (0 - 31)", "-a, --apdu show apdu requests and responses",
"-f, --fileid <hex> iso fid (2 hex bytes, big endian)", "-v, --verbose show technical data",
"-c, --com <dec> communication setting (0 = plain, 1 = plain + mac, 3 = enciphered)", "-n, --keyno <keyno> key number",
"-r, --rights <hex> access rights (2 hex bytes -> rw/chg/r/w, 0x0 - 0xd key, 0xe free, 0xf denied)", "-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-s, --filesize <hex> file size (3 hex bytes, big endian)", "-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-b, --backup create backupfile instead of standard file", "-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-a, --aid <hex> app id to select as hex bytes (3 bytes, big endian)" "-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte)",
"--isofid <iso file id hex> iso file id (2 hex bytes)",
"--rawtype <file type hex 1b> raw file type (hex 1 byte)",
"--rawdata <file settings hex> raw file settings (hex > 5 bytes)",
"--amode <plain/mac/encrypt> file access mode: plain/mac/encrypt",
"--rawrights <access rights hex> access rights for file (hex 2 byte) r/w/rw/chg, 0x0 - 0xd key, 0xe free, 0xf denied",
"--rrights <key0/../key13/free/deny> read file access mode: the specified key, free, deny",
"--wrights <key0/../key13/free/deny> write file access mode: the specified key, free, deny",
"--rwrights <key0/../key13/free/deny> read/write file access mode: the specified key, free, deny",
"--chrights <key0/../key13/free/deny> change file settings access mode: the specified key, free, deny",
"--no-auth execute without authentication",
"--size <hex> file size (3 hex bytes, big endian)",
"--backup create backupfile instead of standard file"
], ],
"usage": "hf mfdes createfile [-hb] [-n <dec>] [-f <hex>]... [-c <dec>] [-r <hex>]... [-s <hex>]... [-a <hex>]..." "usage": "hf mfdes createfile [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [--isofid <iso file id hex>] [--rawtype <file type hex 1b>] [--rawdata <file settings hex>] [--amode <plain/mac/encrypt>] [--rawrights <access rights hex>] [--rrights <key0/../key13/free/deny>] [--wrights <key0/../key13/free/deny>] [--rwrights <key0/../key13/free/deny>] [--chrights <key0/../key13/free/deny>] [--no-auth] [--size <hex>] [--backup]"
}, },
"hf mfdes createrecordfile": { "hf mfdes createrecordfile": {
"command": "hf mfdes createrecordfile", "command": "hf mfdes createrecordfile",
@ -4192,23 +4231,42 @@
}, },
"hf mfdes createvaluefile": { "hf mfdes createvaluefile": {
"command": "hf mfdes createvaluefile", "command": "hf mfdes createvaluefile",
"description": "create value file make sure to select aid or authenticate aid before running this command.", "description": "create value file in the application. application master key needs to be provided or flag --no-auth set (depend on application settings).",
"notes": [ "notes": [
"hf mfdes createvaluefile -n 03 -c 0 -r eeee -l 00000000 -u 00002000 --val 00000001 -m 02 -a 123456" "--rawrights have priority over the separate rights settings.",
"key/mode/etc of the authentication depends on application settings",
"hf mfdes createvaluefile --aid 123456 --fid 01 --lower 00000010 --upper 00010000 --value 00000100 -> create file with parameters. rights from default. authentication with defaults from `default` command",
"hf mfdes createvaluefile --aid 123456 --fid 01 --amode plain --rrights free --wrights free --rwrights free --chrights key0 -> create file app=123456, file=01 and mentioned rights with defaults from `default` command",
"hf mfdes createvaluefile -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> execute with default factory setup"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --fileno <dec> file number (0 - 31)", "-a, --apdu show apdu requests and responses",
"-c, --com <dec> communication setting (0 = plain, 1 = plain + mac, 3 = enciphered)", "-v, --verbose show technical data",
"-r, --rights <hex> access rights (2 hex bytes -> rw/chg/r/w, 0x0 - 0xd key, 0xe free, 0xf denied)", "-n, --keyno <keyno> key number",
"-l, --lower <hex> lower limit (4 hex bytes, big endian)", "-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-u, --upper <hex> upper limit (4 hex bytes, big endian)", "-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"--val <hex> value (4 hex bytes, big endian)", "-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-m <dec> limited credit enabled (bit 0 = limited credit, 1 = freevalue)", "-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-a, --aid <hex> app id to select as hex bytes (3 bytes,big endian,optional)" "-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte)",
"--amode <plain/mac/encrypt> file access mode: plain/mac/encrypt",
"--rawrights <access rights hex> access rights for file (hex 2 byte) r/w/rw/chg, 0x0 - 0xd key, 0xe free, 0xf denied",
"--rrights <key0/../key13/free/deny> read file access mode: the specified key, free, deny",
"--wrights <key0/../key13/free/deny> write file access mode: the specified key, free, deny",
"--rwrights <key0/../key13/free/deny> read/write file access mode: the specified key, free, deny",
"--chrights <key0/../key13/free/deny> change file settings access mode: the specified key, free, deny",
"--no-auth execute without authentication",
"--lower <hex> lower limit (4 hex bytes, big endian)",
"--upper <hex> upper limit (4 hex bytes, big endian)",
"--value <hex> value (4 hex bytes, big endian)",
"--lcredit <dec> limited credit enabled (bit 0 = limited credit, 1 = freevalue)"
], ],
"usage": "hf mfdes createvaluefile [-h] [-n <dec>] [-c <dec>] [-r <hex>]... [-l <hex>]... [-u <hex>]... [--val <hex>]... [-m <dec>] [-a <hex>]..." "usage": "hf mfdes createvaluefile [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [--amode <plain/mac/encrypt>] [--rawrights <access rights hex>] [--rrights <key0/../key13/free/deny>] [--wrights <key0/../key13/free/deny>] [--rwrights <key0/../key13/free/deny>] [--chrights <key0/../key13/free/deny>] [--no-auth] [--lower <hex>] [--upper <hex>] [--value <hex>] [--lcredit <dec>]"
}, },
"hf mfdes deleteapp": { "hf mfdes deleteapp": {
"command": "hf mfdes deleteapp", "command": "hf mfdes deleteapp",
@ -4235,17 +4293,28 @@
}, },
"hf mfdes deletefile": { "hf mfdes deletefile": {
"command": "hf mfdes deletefile", "command": "hf mfdes deletefile",
"description": "delete file", "description": "delete file from application. master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [ "notes": [
"hf mfdes deletefile -n 01 -> make sure to select aid or authenticate aid before running this command." "hf mfdes deletefile --aid 123456 --fid 01 -> delete file for: app=123456, file=01 with defaults from `default` command"
], ],
"offline": false, "offline": false,
"options": [ "options": [
"-h, --help this help", "-h, --help this help",
"-n, --fileno <dec> file number (0 - 31)", "-a, --apdu show apdu requests and responses",
"-a, --aid <hex> app id to select as hex bytes (3 bytes, big endian)" "-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte)",
"--no-auth execute without authentication"
], ],
"usage": "hf mfdes deletefile [-h] [-n <dec>] [-a <hex>]..." "usage": "hf mfdes deletefile [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [--no-auth]"
}, },
"hf mfdes dump": { "hf mfdes dump": {
"command": "hf mfdes dump", "command": "hf mfdes dump",
@ -4363,6 +4432,82 @@
], ],
"usage": "hf mfdes getappnames [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--no-auth]" "usage": "hf mfdes getappnames [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--no-auth]"
}, },
"hf mfdes getfileids": {
"command": "hf mfdes getfileids",
"description": "get file ids list from card. master key needs to be provided or flag --no-auth set.",
"notes": [
"hf mfdes getfileids --aid 123456 -> execute with defaults from `default` command",
"hf mfdes getfileids -n 0 -t des -k 0000000000000000 -f none --aid 123456 -> execute with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--no-auth execute without authentication"
],
"usage": "hf mfdes getfileids [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--no-auth]"
},
"hf mfdes getfileisoids": {
"command": "hf mfdes getfileisoids",
"description": "get file ids list from card. master key needs to be provided or flag --no-auth set.",
"notes": [
"hf mfdes getfileisoids --aid 123456 -> execute with defaults from `default` command",
"hf mfdes getfileisoids -n 0 -t des -k 0000000000000000 -f none --aid 123456 -> execute with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--no-auth execute without authentication"
],
"usage": "hf mfdes getfileisoids [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--no-auth]"
},
"hf mfdes getfilesettings": {
"command": "hf mfdes getfilesettings",
"description": "get file settings from file from application. master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [
"hf mfdes getfilesettings --aid 123456 --fid 01 -> execute with defaults from `default` command",
"hf mfdes getfilesettings -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> execute with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte). default: 1",
"--no-auth execute without authentication"
],
"usage": "hf mfdes getfilesettings [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [--no-auth]"
},
"hf mfdes getkeysettings": { "hf mfdes getkeysettings": {
"command": "hf mfdes getkeysettings", "command": "hf mfdes getkeysettings",
"description": "get key settings for card level or application level.", "description": "get key settings for card level or application level.",
@ -4436,20 +4581,6 @@
], ],
"usage": "hf mfdes getuid [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>]" "usage": "hf mfdes getuid [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>]"
}, },
"hf mfdes getvalue": {
"command": "hf mfdes getvalue",
"description": "get value from value file make sure to select aid or authenticate aid before running this command.",
"notes": [
"hf mfdes getvalue -n 03"
],
"offline": false,
"options": [
"-h, --help this help",
"-n, --fileno <dec> file number (0 - 31)",
"-a, --aid <hex> app id to select as hex bytes (3 bytes, big endian)"
],
"usage": "hf mfdes getvalue [-h] [-n <dec>] [-a <hex>]..."
},
"hf mfdes help": { "hf mfdes help": {
"command": "hf mfdes help", "command": "hf mfdes help",
"description": "help this help list list desfire (iso 14443a) history test test crypto --------------------------------------------------------------------------------------- hf mfdes default available offline: no set default parameters for access to desfire card.", "description": "help this help list list desfire (iso 14443a) history test test crypto --------------------------------------------------------------------------------------- hf mfdes default available offline: no set default parameters for access to desfire card.",
@ -4536,9 +4667,10 @@
}, },
"hf mfdes setconfig": { "hf mfdes setconfig": {
"command": "hf mfdes setconfig", "command": "hf mfdes setconfig",
"description": "set card configuration. danger zone! needs to provide card's master key and works if not blocked by config.", "description": "set card configuration. warning! danger zone! needs to provide card's master key and works if not blocked by config.",
"notes": [ "notes": [
"hf mfdes setconfig --param 03 --data 0428 -> set parameter with data value" "hf mfdes setconfig --param 03 --data 0428 -> set parameter 03",
"hf mfdes setconfig --param 02 --data 0875778102637264 -> set parameter 02"
], ],
"offline": false, "offline": false,
"options": [ "options": [
@ -4571,6 +4703,35 @@
], ],
"usage": "hf seos info [-h]" "usage": "hf seos info [-h]"
}, },
"hf mfdes value": {
"command": "hf mfdes value",
"description": "get file settings from file from application. master key needs to be provided or flag --no-auth set (depend on cards settings).",
"notes": [
"hf mfdes value --aid 123456 --fid 01 -> get value app=123456, file=01 with defaults from `default` command",
"hf mfdes value --aid 123456 --fid 01 --op credit -d 00000001 -> credit value app=123456, file=01 with defaults from `default` command",
"hf mfdes value -n 0 -t des -k 0000000000000000 -f none --aid 123456 --fid 01 -> get value with default factory setup"
],
"offline": false,
"options": [
"-h, --help this help",
"-a, --apdu show apdu requests and responses",
"-v, --verbose show technical data",
"-n, --keyno <keyno> key number",
"-t, --algo <des/2tdea/3tdea/aes> crypt algo: des, 2tdea, 3tdea, aes",
"-k, --key <key> key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)",
"-f, --kdf <none/an10922/gallagher> key derivation function (kdf): none, an10922, gallagher",
"-i, --kdfi <kdfi> kdf input (hex 1-31 bytes)",
"-m, --cmode <plain/mac/encrypt> communicaton mode: plain/mac/encrypt",
"-c, --ccset <native/niso/iso> communicaton command set: native/niso/iso",
"-s, --schann <d40/ev1/ev2> secure channel: d40/ev1/ev2",
"--aid <app id hex> application id (3 hex bytes, big endian)",
"--fid <file id hex> file id (1 hex byte)",
"-o, --op <get/credit/limcredit/debit/clear> operation: get(default)/credit/limcredit(limited credit)/debit/clear. operation clear: get-getopt-debit to min value",
"-d, --data <value hex> value for operation (hex 4 bytes)",
"--no-auth execute without authentication"
],
"usage": "hf mfdes value [-hav] [-n <keyno>] [-t <des/2tdea/3tdea/aes>] [-k <key>] [-f <none/an10922/gallagher>] [-i <kdfi>] [-m <plain/mac/encrypt>] [-c <native/niso/iso>] [-s <d40/ev1/ev2>] [--aid <app id hex>] [--fid <file id hex>] [-o <get/credit/limcredit/debit/clear>] [-d <value hex>] [--no-auth]"
},
"hf mfdes write": { "hf mfdes write": {
"command": "hf mfdes write", "command": "hf mfdes write",
"description": "write data to file make sure to select aid or authenticate aid before running this command.", "description": "write data to file make sure to select aid or authenticate aid before running this command.",
@ -9521,8 +9682,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 582, "commands_extracted": 585,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2021-07-20T20:36:37" "extracted_on": "2021-07-26T14:56:39"
} }
} }

View file

@ -523,14 +523,17 @@ Check column "offline" for their availability.
|`hf mfdes selectaid `|N |`Select Application ID` |`hf mfdes selectaid `|N |`Select Application ID`
|`hf mfdes getaids `|N |`[new]Get Application IDs list` |`hf mfdes getaids `|N |`[new]Get Application IDs list`
|`hf mfdes getappnames `|N |`[new]Get Applications list` |`hf mfdes getappnames `|N |`[new]Get Applications list`
|`hf mfdes changevalue `|N |`Write value of a value file (credit/debit/clear)` |`hf mfdes getfileids `|N |`[new]Get File IDs list`
|`hf mfdes getfileisoids `|N |`[new]Get File ISO IDs list`
|`hf mfdes getfilesettings`|N |`[new]Get file settings`
|`hf mfdes chfilesettings`|N |`[new]Change file settings`
|`hf mfdes clearfile `|N |`Clear record File` |`hf mfdes clearfile `|N |`Clear record File`
|`hf mfdes createfile `|N |`Create Standard/Backup File` |`hf mfdes createfile `|N |`[new]Create Standard/Backup File`
|`hf mfdes createvaluefile`|N |`Create Value File` |`hf mfdes createvaluefile`|N |`[new]Create Value File`
|`hf mfdes createrecordfile`|N |`Create Linear/Cyclic Record File` |`hf mfdes createrecordfile`|N |`Create Linear/Cyclic Record File`
|`hf mfdes deletefile `|N |`Create Delete File` |`hf mfdes deletefile `|N |`[new]Delete File`
|`hf mfdes dump `|N |`Dump all files` |`hf mfdes dump `|N |`Dump all files`
|`hf mfdes getvalue `|N |`Get value of file` |`hf mfdes value `|N |`[new]Operations with value file (get/credit/limited credit/debit/clear)`
|`hf mfdes read `|N |`Read data from standard/backup/record file` |`hf mfdes read `|N |`Read data from standard/backup/record file`
|`hf mfdes write `|N |`Write data to standard/backup/record file` |`hf mfdes write `|N |`Write data to standard/backup/record file`
|`hf mfdes test `|Y |`Test crypto` |`hf mfdes test `|Y |`Test crypto`