diff --git a/armsrc/Standalone/lf_hidfcbrute.c b/armsrc/Standalone/lf_hidfcbrute.c index e92e50706..b98231512 100644 --- a/armsrc/Standalone/lf_hidfcbrute.c +++ b/armsrc/Standalone/lf_hidfcbrute.c @@ -6,7 +6,7 @@ * * Author: proxmark@ss23.geek.nz - ss23 * Based on lf_hidbrute - * + * * To retrieve log file from flash: * * 1. mem spiffs dump -s lf_hid_fcbrute.log -d lf_hid_fcbrute.log @@ -44,125 +44,125 @@ #define LF_HIDCOLLECT_LOGFILE "lf_hid_fcbrute.log" static void append(uint8_t *entry, size_t entry_len) { - LED_B_ON(); - DbpString("Writing... "); - DbpString((char *)entry); - rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, entry_len, RDV40_SPIFFS_SAFETY_SAFE); - LED_B_OFF(); + LED_B_ON(); + DbpString("Writing... "); + DbpString((char *)entry); + rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, entry_len, RDV40_SPIFFS_SAFETY_SAFE); + LED_B_OFF(); } void ModInfo(void) { - DbpString(_YELLOW_(" LF - HID facility code bruteforce - (ss23)")); + DbpString(_YELLOW_(" LF - HID facility code bruteforce - (ss23)")); } void RunMod(void) { - FpgaDownloadAndGo(FPGA_BITSTREAM_LF); - LFSetupFPGAForADC(LF_DIVISOR_125, true); - BigBuf_Clear(); - StandAloneMode(); - WDT_HIT(); + FpgaDownloadAndGo(FPGA_BITSTREAM_LF); + LFSetupFPGAForADC(LF_DIVISOR_125, true); + BigBuf_Clear(); + StandAloneMode(); + WDT_HIT(); - LEDsoff(); - LED_A_ON(); - LED_B_ON(); - LED_C_ON(); + LEDsoff(); + LED_A_ON(); + LED_B_ON(); + LED_C_ON(); - rdv40_spiffs_lazy_mount(); - // Buffer for writing to log - uint8_t entry[81]; - memset(entry, 0, sizeof(entry)); - sprintf((char *)entry, "%s\n", "HID FC brute start"); + rdv40_spiffs_lazy_mount(); + // Buffer for writing to log + uint8_t entry[81]; + memset(entry, 0, sizeof(entry)); + sprintf((char *)entry, "%s\n", "HID FC brute start"); - // Create the log file - if (exists_in_spiffs(LF_HIDCOLLECT_LOGFILE)) { - rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); - } else { - rdv40_spiffs_write(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); - } - LED_B_OFF(); + // Create the log file + if (exists_in_spiffs(LF_HIDCOLLECT_LOGFILE)) { + rdv40_spiffs_append(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); + } else { + rdv40_spiffs_write(LF_HIDCOLLECT_LOGFILE, entry, strlen((char *)entry), RDV40_SPIFFS_SAFETY_SAFE); + } + LED_B_OFF(); - Dbprintf("Waiting to begin bruteforce"); + Dbprintf("Waiting to begin bruteforce"); - // Wait until the user presses the button to begin the bruteforce - for (;;) { - // Hit the watchdog timer regularly - WDT_HIT(); - int button_pressed = BUTTON_HELD(10); - if ((button_pressed == BUTTON_HOLD) || (button_pressed == BUTTON_SINGLE_CLICK)) { - break; - } - } + // Wait until the user presses the button to begin the bruteforce + for (;;) { + // Hit the watchdog timer regularly + WDT_HIT(); + int button_pressed = BUTTON_HELD(10); + if ((button_pressed == BUTTON_HOLD) || (button_pressed == BUTTON_SINGLE_CLICK)) { + break; + } + } - Dbprintf("Running Bruteforce"); + Dbprintf("Running Bruteforce"); - LEDsoff(); - LED_A_ON(); + LEDsoff(); + LED_A_ON(); - // Buffer for HID data - uint32_t high, low; + // Buffer for HID data + uint32_t high, low; - for (uint32_t fc = 0; fc < 256; fc++) { - // Hit the watchdog timer regularly - WDT_HIT(); + for (uint32_t fc = 0; fc < 256; fc++) { + // Hit the watchdog timer regularly + WDT_HIT(); - LEDsoff(); + LEDsoff(); - // Toggle LED_C - if ((fc % 2) == 1) { - LED_C_ON(); - } + // Toggle LED_C + if ((fc % 2) == 1) { + LED_C_ON(); + } - // If we get USB data, break out - if (data_available()) break; + // If we get USB data, break out + if (data_available()) break; - // If a user attempts to hold button, abort the run - /* - int button_pressed = BUTTON_HELD(1000); // 1 second - if (button_pressed == BUTTON_HOLD) { - break; - } - */ - // If a user pressed the button once, briefly, output the current FC to the log file - if (BUTTON_PRESS()) { - memset(entry, 0, sizeof(entry)); + // If a user attempts to hold button, abort the run + /* + int button_pressed = BUTTON_HELD(1000); // 1 second + if (button_pressed == BUTTON_HOLD) { + break; + } + */ + // If a user pressed the button once, briefly, output the current FC to the log file + if (BUTTON_PRESS()) { + memset(entry, 0, sizeof(entry)); - sprintf((char *)entry, "FC: %li\n", fc); - append(entry, strlen((char *)entry)); - } + sprintf((char *)entry, "FC: %li\n", fc); + append(entry, strlen((char *)entry)); + } - // Calculate data required for a HID card - hid_calculate_checksum_and_set(&high, &low, 1, fc); + // Calculate data required for a HID card + hid_calculate_checksum_and_set(&high, &low, 1, fc); - // Print actual code to brute - Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high, low, (low >> 1) & 0xFFFF, fc, 1); + // Print actual code to brute + Dbprintf("[=] TAG ID: %x%08x (%d) - FC: %u - Card: %u", high, low, (low >> 1) & 0xFFFF, fc, 1); - LED_A_ON(); - LED_D_ON(); - StartTicks(); - CmdHIDsimTAGEx(0, high, low, 0, 1, 40000); - LED_D_OFF(); - StartTicks(); - WaitMS(50); - StopTicks(); - LED_A_OFF(); - } + LED_A_ON(); + LED_D_ON(); + StartTicks(); + CmdHIDsimTAGEx(0, high, low, 0, 1, 40000); + LED_D_OFF(); + StartTicks(); + WaitMS(50); + StopTicks(); + LED_A_OFF(); + } - LEDsoff(); + LEDsoff(); } void hid_calculate_checksum_and_set(uint32_t *high, uint32_t *low, uint32_t cardnum, uint32_t fc) { - uint32_t newhigh = 0; - uint32_t newlow = 0; + uint32_t newhigh = 0; + uint32_t newlow = 0; - newlow = 0; - newlow |= (cardnum & 0xFFFF) << 1; - newlow |= (fc & 0xFF) << 17; - newlow |= oddparity32((newlow >> 1) & 0xFFF); - newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25; + newlow = 0; + newlow |= (cardnum & 0xFFFF) << 1; + newlow |= (fc & 0xFF) << 17; + newlow |= oddparity32((newlow >> 1) & 0xFFF); + newlow |= (evenparity32((newlow >> 13) & 0xFFF)) << 25; - newhigh |= 0x20; // Bit 37; standard header - newlow |= 1U << 26; // leading 1: start bit + newhigh |= 0x20; // Bit 37; standard header + newlow |= 1U << 26; // leading 1: start bit - *low = newlow; - *high = newhigh; + *low = newlow; + *high = newhigh; } diff --git a/client/src/cmdhffelica.c b/client/src/cmdhffelica.c index 1a4cb3834..c933b698b 100644 --- a/client/src/cmdhffelica.c +++ b/client/src/cmdhffelica.c @@ -244,9 +244,9 @@ static const char *felica_model_name(uint8_t rom_type, uint8_t ic_type) { // odd findings case 0x00: return "FeliCa Standard RC-S830"; - case 0x02: + case 0x02: return "FeliCa Standard RC-S919"; - case 0x0B: + case 0x0B: return "FeliCa Suica RC-S???"; default: break; diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index dac0f5900..e74a7ae8e 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -5509,7 +5509,7 @@ static int CmdHF14ADesGetFileSettings(const char *Cmd) { CLIParserFree(ctx); return res; } - + uint32_t fileid = 1; res = arg_get_u32_hexstr_def_nlen(ctx, 12, 1, &fileid, 1, true); if (res == 2) { @@ -5548,7 +5548,7 @@ static int CmdHF14ADesGetFileSettings(const char *Cmd) { if (verbose) PrintAndLogEx(INFO, "app %06x file %02x settings[%zu]: %s", appid, fileid, buflen, sprint_hex(buf, buflen)); - + DesfirePrintFileSettings(buf, buflen); DropField(); @@ -5581,8 +5581,8 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { arg_str0(NULL, "amode", "", "File access mode: plain/mac/encrypt"), arg_str0(NULL, "rrights", "", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "", "Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "rwrights","", "Read/Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "chrights","", "Change file settings access mode: the specified key, free, deny"), + arg_str0(NULL, "rwrights", "", "Read/Write file access mode: the specified key, free, deny"), + arg_str0(NULL, "chrights", "", "Change file settings access mode: the specified key, free, deny"), arg_lit0(NULL, "no-auth", "execute without authentication"), arg_param_end }; @@ -5600,7 +5600,7 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { CLIParserFree(ctx); return res; } - + uint32_t fileid = 1; res = arg_get_u32_hexstr_def_nlen(ctx, 12, 1, &fileid, 1, true); if (res == 2) { @@ -5630,14 +5630,14 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { int cmode = DCMNone; if (CLIGetOptionList(arg_get_str(ctx, 14), DesfireCommunicationModeOpts, &cmode)) return PM3_ESOFT; - - if (cmode == DCMPlain) + + if (cmode == DCMPlain) settings[0] = 0x00; - if (cmode == DCMMACed) + if (cmode == DCMMACed) settings[0] = 0x01; - if (cmode == DCMEncrypted) + if (cmode == DCMEncrypted) settings[0] = 0x03; - + int r_mode = 0x0e; if (CLIGetOptionList(arg_get_str(ctx, 15), DesfireFileAccessModeOpts, &r_mode)) return PM3_ESOFT; @@ -5652,7 +5652,7 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { return PM3_ESOFT; DesfireEncodeFileAcessMode(&settings[1], r_mode, w_mode, rw_mode, ch_mode) ; - } + } SetAPDULogging(APDULogging); CLIParserFree(ctx); @@ -5684,13 +5684,13 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { DesfireDecodeFileAcessMode(&buf[2], NULL, NULL, NULL, &chright) ; if (verbose) PrintAndLogEx(INFO, "Current access right for change file settings: %s", GetDesfireAccessRightStr(chright)); - + if (chright == 0x0f) PrintAndLogEx(WARNING, "Change file settings disabled"); - + if (chright == 0x0e && (!(commMode == DCMPlain || commMode == DCMMACed || noauth))) PrintAndLogEx(WARNING, "File settings have free access for change. Change command must be sent via plain communications mode or without authentication (--no-auth option)"); - + if (chright < 0x0e && dctx.keyNum != chright) PrintAndLogEx(WARNING, "File settings must be changed with auth key=0x%02x but current auth with key 0x%02x", chright, dctx.keyNum); @@ -5721,19 +5721,19 @@ static int CmdHF14ADesChFileSettings(const char *Cmd) { } static int DesfireCreateFileParameters( - CLIParserContext *ctx, - - uint8_t pfileid, uint8_t pisofileid, - uint8_t amodeid, - uint8_t frightsid, - uint8_t r_modeid, uint8_t w_modeid, uint8_t rw_modeid, uint8_t ch_modeid, - - uint8_t *data, - size_t *datalen - ) { + CLIParserContext *ctx, + + uint8_t pfileid, uint8_t pisofileid, + uint8_t amodeid, + uint8_t frightsid, + uint8_t r_modeid, uint8_t w_modeid, uint8_t rw_modeid, uint8_t ch_modeid, + + uint8_t *data, + size_t *datalen +) { *datalen = 0; int res = 0; - + uint32_t fileid = 1; if (pfileid) { res = arg_get_u32_hexstr_def_nlen(ctx, pfileid, 1, &fileid, 1, true); @@ -5769,12 +5769,12 @@ static int DesfireCreateFileParameters( if (CLIGetOptionList(arg_get_str(ctx, amodeid), DesfireCommunicationModeOpts, &cmode)) { return PM3_ESOFT; } - - if (cmode == DCMPlain) + + if (cmode == DCMPlain) settings[0] = 0x00; - if (cmode == DCMMACed) + if (cmode == DCMMACed) settings[0] = 0x01; - if (cmode == DCMEncrypted) + if (cmode == DCMEncrypted) settings[0] = 0x03; (*datalen)++; } @@ -5799,7 +5799,7 @@ static int DesfireCreateFileParameters( if (CLIGetOptionList(arg_get_str(ctx, r_modeid), DesfireFileAccessModeOpts, &r_mode)) return PM3_ESOFT; } - + int w_mode = 0x0e; if (w_modeid) { if (CLIGetOptionList(arg_get_str(ctx, w_modeid), DesfireFileAccessModeOpts, &w_mode)) @@ -5817,11 +5817,11 @@ static int DesfireCreateFileParameters( if (CLIGetOptionList(arg_get_str(ctx, ch_modeid), DesfireFileAccessModeOpts, &ch_mode)) return PM3_ESOFT; } - + DesfireEncodeFileAcessMode(&settings[1], r_mode, w_mode, rw_mode, ch_mode) ; } *datalen += 2; - + return PM3_SUCCESS; } @@ -5857,8 +5857,8 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { arg_str0(NULL, "rawrights", "", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"), arg_str0(NULL, "rrights", "", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "", "Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "rwrights","", "Read/Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "chrights","", "Change file settings access mode: the specified key, free, deny"), + arg_str0(NULL, "rwrights", "", "Read/Write file access mode: the specified key, free, deny"), + arg_str0(NULL, "chrights", "", "Change file settings access mode: the specified key, free, deny"), arg_lit0(NULL, "no-auth", "execute without authentication"), arg_str0(NULL, "size", "", "File size (3 hex bytes, big endian)"), arg_lit0(NULL, "backup", "Create backupfile instead of standard file"), @@ -5880,7 +5880,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { CLIParserFree(ctx); return res; } - + if (appid == 0x000000) { PrintAndLogEx(ERR, "Can't create files at card level."); CLIParserFree(ctx); @@ -5904,7 +5904,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { CLIParserFree(ctx); return PM3_EINVARG; } - + uint8_t sdata[250] = {0}; int sdatalen = sizeof(sdata); CLIGetHexWithReturn(ctx, 15, sdata, &sdatalen); @@ -5913,7 +5913,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { CLIParserFree(ctx); return PM3_EINVARG; } - + if (useraw && sdatalen > 0) { filetype = rawftype; memcpy(&data[1], sdata, sdatalen); @@ -5936,10 +5936,10 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { CLIParserFree(ctx); return PM3_EINVARG; } - - Uint3byteToMemLe(&data[datalen], filesize); - datalen += 3; - } + + Uint3byteToMemLe(&data[datalen], filesize); + datalen += 3; + } SetAPDULogging(APDULogging); CLIParserFree(ctx); @@ -5958,12 +5958,12 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { return res; } } - + if (verbose) PrintAndLogEx(INFO, "App: %06x. File num: 0x%02x type: 0x%02x data[%zu]: %s", appid, data[0], filetype, datalen, sprint_hex(data, datalen)); DesfirePrintCreateFileSettings(filetype, data, datalen); - + res = DesfireCreateFile(&dctx, filetype, data, datalen, useraw == false); // check length only if we nont use raw mode if (res != PM3_SUCCESS) { PrintAndLogEx(ERR, "Desfire CreateFile command " _RED_("error") ". Result: %d", res); @@ -5972,7 +5972,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { } PrintAndLogEx(SUCCESS, "File %02x in the app %06x created " _GREEN_("successfully"), data[0], appid); - + DropField(); return PM3_SUCCESS; } @@ -6005,8 +6005,8 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { arg_str0(NULL, "rawrights", "", "Access rights for file (HEX 2 byte) R/W/RW/Chg, 0x0 - 0xD Key, 0xE Free, 0xF Denied"), arg_str0(NULL, "rrights", "", "Read file access mode: the specified key, free, deny"), arg_str0(NULL, "wrights", "", "Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "rwrights","", "Read/Write file access mode: the specified key, free, deny"), - arg_str0(NULL, "chrights","", "Change file settings access mode: the specified key, free, deny"), + arg_str0(NULL, "rwrights", "", "Read/Write file access mode: the specified key, free, deny"), + arg_str0(NULL, "chrights", "", "Change file settings access mode: the specified key, free, deny"), arg_lit0(NULL, "no-auth", "execute without authentication"), arg_str0(NULL, "lower", "", "Lower limit (4 hex bytes, big endian)"), arg_str0(NULL, "upper", "", "Upper limit (4 hex bytes, big endian)"), @@ -6019,7 +6019,7 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { bool APDULogging = arg_get_lit(ctx, 1); bool verbose = arg_get_lit(ctx, 2); bool noauth = arg_get_lit(ctx, 19); - + uint8_t filetype = 0x02; // value file DesfireContext dctx; @@ -6030,13 +6030,13 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { CLIParserFree(ctx); return res; } - + if (appid == 0x000000) { PrintAndLogEx(ERR, "Can't create files at card level."); CLIParserFree(ctx); return PM3_EINVARG; } - + uint8_t data[250] = {0}; size_t datalen = 0; @@ -6069,13 +6069,13 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { CLIParserFree(ctx); return PM3_EINVARG; } - + uint32_t lcredit = arg_get_int_def(ctx, 23, 0); SetAPDULogging(APDULogging); CLIParserFree(ctx); - - + + Uint4byteToMemLe(&data[datalen], lowerlimit); datalen += 4; Uint4byteToMemLe(&data[datalen], upperlimit); @@ -6099,13 +6099,13 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { return res; } } - + if (verbose) PrintAndLogEx(INFO, "App: %06x. File num: 0x%02x type: 0x%02x data[%zu]: %s", appid, data[0], filetype, datalen, sprint_hex(data, datalen)); DesfirePrintCreateFileSettings(filetype, data, datalen); - res = DesfireCreateFile(&dctx, filetype, data, datalen, true); + res = DesfireCreateFile(&dctx, filetype, data, datalen, true); if (res != PM3_SUCCESS) { PrintAndLogEx(ERR, "Desfire CreateFile command " _RED_("error") ". Result: %d", res); DropField(); @@ -6155,7 +6155,7 @@ static int CmdHF14ADesDeleteFile(const char *Cmd) { CLIParserFree(ctx); return res; } - + uint32_t fnum = 1; res = arg_get_u32_hexstr_def_nlen(ctx, 12, 1, &fnum, 1, true); if (res == 2) { @@ -6241,7 +6241,7 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { CLIParserFree(ctx); return res; } - + uint32_t fileid = 1; res = arg_get_u32_hexstr_def_nlen(ctx, 12, 1, &fileid, 1, true); if (res == 2) { @@ -6249,7 +6249,7 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { CLIParserFree(ctx); return PM3_EINVARG; } - + int op = MFDES_GET_VALUE; if (CLIGetOptionList(arg_get_str(ctx, 13), DesfireValueFileOperOpts, &op)) { CLIParserFree(ctx); @@ -6302,7 +6302,7 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { DropField(); return PM3_ESOFT; } - + PrintAndLogEx(SUCCESS, "Value changed " _GREEN_("successfully")); } } else { @@ -6314,10 +6314,10 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { } if (verbose) PrintAndLogEx(INFO, "current value: 0x%08x", value); - + uint8_t buf[250] = {0}; size_t buflen = 0; - + res = DesfireGetFileSettings(&dctx, fileid, buf, &buflen); if (res != PM3_SUCCESS) { PrintAndLogEx(ERR, "Desfire GetFileSettings command " _RED_("error") ". Result: %d", res); @@ -6327,13 +6327,13 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { if (verbose) PrintAndLogEx(INFO, "file settings[%d]: %s", buflen, sprint_hex(buf, buflen)); - + if (buflen < 8 || buf[0] != 0x02) { PrintAndLogEx(ERR, "Desfire GetFileSettings command returns " _RED_("wrong") " data"); DropField(); return PM3_ESOFT; } - + uint32_t minvalue = MemLeToUint4byte(&buf[4]); uint32_t delta = (value > minvalue) ? value - minvalue : 0; if (verbose) { @@ -6365,7 +6365,7 @@ static int CmdHF14ADesValueOperations(const char *Cmd) { if (verbose) PrintAndLogEx(INFO, "Nothing to clear. Vallue allready in the minimum level."); } - + PrintAndLogEx(SUCCESS, "Value cleared " _GREEN_("successfully")); } diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index fb8ffc1c6..70c872849 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -1089,12 +1089,12 @@ int DesfireValueFileOperations(DesfireContext *dctx, uint8_t fid, uint8_t operat size_t datalen = (operation == MFDES_GET_VALUE) ? 1 : 5; if (value) Uint4byteToMemLe(&data[1], *value); - + uint8_t resp[250] = {0}; size_t resplen = 0; - + int res = DesfireCommand(dctx, operation, data, datalen, resp, &resplen, -1); - + if (resplen == 4 && value) *value = MemLeToUint4byte(resp); return res; @@ -1248,17 +1248,17 @@ static const char *GetDesfireKeyType(uint8_t keytype) { const char *GetDesfireAccessRightStr(uint8_t right) { static char int_access_str[200]; memset(int_access_str, 0, sizeof(int_access_str)); - + if (right <= 0x0d) { sprintf(int_access_str, "key 0x%02x", right); return int_access_str; } if (right == 0x0e) return DesfireFreeStr; - + if (right == 0x0f) return DesfireDisabledStr; - + return DesfireUnknownStr; } @@ -1288,18 +1288,18 @@ void DesfirePrintAccessRight(uint8_t *data) { uint8_t rw = 0; uint8_t ch = 0; DesfireDecodeFileAcessMode(data, &r, &w, &rw, &ch); - PrintAndLogEx(SUCCESS, "read : %s", GetDesfireAccessRightStr(r)); + PrintAndLogEx(SUCCESS, "read : %s", GetDesfireAccessRightStr(r)); PrintAndLogEx(SUCCESS, "write : %s", GetDesfireAccessRightStr(w)); - PrintAndLogEx(SUCCESS, "readwrite: %s", GetDesfireAccessRightStr(rw)); + PrintAndLogEx(SUCCESS, "readwrite: %s", GetDesfireAccessRightStr(rw)); PrintAndLogEx(SUCCESS, "change : %s", GetDesfireAccessRightStr(ch)); } static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t datalen, uint8_t *dynlen, bool create) { switch (filetype) { - case 0x00: + case 0x00: case 0x01: { int filesize = MemLeToUint3byte(&data[0]); - + PrintAndLogEx(INFO, "File size : %d (0x%X) bytes", filesize, filesize); *dynlen = 3; @@ -1310,7 +1310,7 @@ static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t int upperlimit = MemLeToUint4byte(&data[4]); int value = MemLeToUint4byte(&data[8]); uint8_t limited_credit_enabled = data[12]; - + PrintAndLogEx(INFO, "Lower limit : %d (0x%08X)", lowerlimit, lowerlimit); PrintAndLogEx(INFO, "Upper limit : %d (0x%08X)", upperlimit, upperlimit); if (create) { @@ -1343,12 +1343,12 @@ static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t case 0x05: { PrintAndLogEx(INFO, "Key type [0x%02x] : %s", data[0], GetDesfireKeyType(data[0])); *dynlen = 1; - + if (create) { PrintAndLogEx(INFO, "Key : %s", sprint_hex(&data[1], 16)); *dynlen += 16; } - + PrintAndLogEx(INFO, "Key version : %d (0x%X)", data[*dynlen], data[*dynlen]); (*dynlen)++; break; @@ -1364,7 +1364,7 @@ void DesfirePrintFileSettings(uint8_t *data, size_t len) { PrintAndLogEx(ERR, "Wrong file settings length: %zu", len); return; } - + uint8_t filetype = data[0]; PrintAndLogEx(INFO, "---- " _CYAN_("File settings") " ----"); PrintAndLogEx(SUCCESS, "File type [0x%02x] : %s file", filetype, GetDesfireFileType(filetype)); @@ -1376,11 +1376,11 @@ void DesfirePrintFileSettings(uint8_t *data, size_t len) { } PrintAndLogEx(SUCCESS, "Access rights : %04x", MemLeToUint2byte(&data[2])); DesfirePrintAccessRight(&data[2]); //2 bytes - + uint8_t reclen = 0; DesfirePrintFileSettDynPart(filetype, &data[4], len - 4, &reclen, false); reclen += 4; // static part - + if (addaccess && filetype != 0x05 && reclen > 0 && len > reclen && len == reclen + data[reclen] * 2) { PrintAndLogEx(SUCCESS, "Add access records: %d", data[reclen]); for (int i = 0; i < data[reclen] * 2; i += 2) { @@ -1399,7 +1399,7 @@ void DesfirePrintSetFileSettings(uint8_t *data, size_t len) { PrintAndLogEx(SUCCESS, "Access rights : %04x", MemLeToUint2byte(&data[1])); DesfirePrintAccessRight(&data[1]); //2 bytes - + if (addaccess && len > 3 && len == 4 + data[3] * 2) { PrintAndLogEx(SUCCESS, "Add access records: %d", data[3]); for (int i = 0; i < data[3] * 2; i += 2) { @@ -1414,10 +1414,10 @@ void DesfirePrintCreateFileSettings(uint8_t filetype, uint8_t *data, size_t len) if (ftyperec == NULL) { PrintAndLogEx(WARNING, "Unknown file type 0x%02x", filetype); return; - } - + } + bool isoidpresent = ftyperec->mayHaveISOfid && (len == ftyperec->createlen + 2 + 1); - + PrintAndLogEx(INFO, "---- " _CYAN_("Create file settings") " ----"); PrintAndLogEx(SUCCESS, "File type : %s", ftyperec->text); PrintAndLogEx(SUCCESS, "File number : 0x%02x (%d)", data[0], data[0]); @@ -1428,12 +1428,12 @@ void DesfirePrintCreateFileSettings(uint8_t filetype, uint8_t *data, size_t len) } else { PrintAndLogEx(SUCCESS, "File ISO number : n/a"); } - + PrintAndLogEx(SUCCESS, "File comm mode : %s", GetDesfireCommunicationMode(data[xlen] & 0x03)); bool addaccess = ((data[xlen] & 0x80) != 0); PrintAndLogEx(SUCCESS, "Additional access: %s", (addaccess) ? "Yes" : "No"); xlen++; - + PrintAndLogEx(SUCCESS, "Access rights : %04x", MemLeToUint2byte(&data[xlen])); DesfirePrintAccessRight(&data[xlen]); xlen += 2; diff --git a/doc/commands.json b/doc/commands.json index 7c01e61d2..62dade65a 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_20210720.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_20210726.txt --------------------------------------------------------------------------------------- auto available offline: no run lf search / hf search / data plot / data save", "notes": [ "auto" ], @@ -3208,7 +3208,7 @@ "-f, --file filename of dump", "--emu from emulator memory" ], - "usage": "hf mf cload [-h] -f [--emu]" + "usage": "hf mf cload [-h] [-f ] [--emu]" }, "hf mf csave": { "command": "hf mf csave", @@ -4009,21 +4009,38 @@ ], "usage": "hf mfdes changekey [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--oldalgo ] [--oldkey ] [--newkeyno ] [--newalgo ] [--newkey ] [--newver ]" }, - "hf mfdes changevalue": { - "command": "hf mfdes changevalue", - "description": "change value (credit / limitedcredit / debit) make sure to select aid or authenticate aid before running this command.", + "hf mfdes chfilesettings": { + "command": "hf mfdes chfilesettings", + "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 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, "options": [ "-h, --help this help", - "-n, --fileno file number (0 - 31)", - "-d, --value value to increase (4 hex bytes, big endian)", - "-m, --mode mode (0 = credit, 1 = limited credit, 2 = debit)", - "-a, --aid app id to select as hex bytes (3 bytes, big endian)" + "-a, --apdu show apdu requests and responses", + "-v, --verbose show technical data", + "-n, --keyno key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--fid file id (1 hex byte)", + "--rawdata file settings (hex > 5 bytes)", + "--amode file access mode: plain/mac/encrypt", + "--rrights read file access mode: the specified key, free, deny", + "--wrights write file access mode: the specified key, free, deny", + "--rwrights read/write file access mode: the specified key, free, deny", + "--chrights change file settings access mode: the specified key, free, deny", + "--no-auth execute without authentication" ], - "usage": "hf mfdes changevalue [-h] [-n ] [-d ]... [-m ] [-a ]..." + "usage": "hf mfdes chfilesettings [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--rawdata ] [--amode ] [--rrights ] [--wrights ] [--rwrights ] [--chrights ] [--no-auth]" }, "hf mfdes chk": { "command": "hf mfdes chk", @@ -4153,22 +4170,44 @@ }, "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": [ - "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, "options": [ "-h, --help this help", - "-n, --fileno file number (0 - 31)", - "-f, --fileid iso fid (2 hex bytes, big endian)", - "-c, --com communication setting (0 = plain, 1 = plain + mac, 3 = enciphered)", - "-r, --rights access rights (2 hex bytes -> rw/chg/r/w, 0x0 - 0xd key, 0xe free, 0xf denied)", - "-s, --filesize file size (3 hex bytes, big endian)", - "-b, --backup create backupfile instead of standard file", - "-a, --aid app id to select as hex bytes (3 bytes, big endian)" + "-a, --apdu show apdu requests and responses", + "-v, --verbose show technical data", + "-n, --keyno key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--fid file id (1 hex byte)", + "--isofid iso file id (2 hex bytes)", + "--rawtype raw file type (hex 1 byte)", + "--rawdata raw file settings (hex > 5 bytes)", + "--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", + "--rrights read file access mode: the specified key, free, deny", + "--wrights write file access mode: the specified key, free, deny", + "--rwrights read/write file access mode: the specified key, free, deny", + "--chrights change file settings access mode: the specified key, free, deny", + "--no-auth execute without authentication", + "--size file size (3 hex bytes, big endian)", + "--backup create backupfile instead of standard file" ], - "usage": "hf mfdes createfile [-hb] [-n ] [-f ]... [-c ] [-r ]... [-s ]... [-a ]..." + "usage": "hf mfdes createfile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--isofid ] [--rawtype ] [--rawdata ] [--amode ] [--rawrights ] [--rrights ] [--wrights ] [--rwrights ] [--chrights ] [--no-auth] [--size ] [--backup]" }, "hf mfdes createrecordfile": { "command": "hf mfdes createrecordfile", @@ -4192,23 +4231,42 @@ }, "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": [ - "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, "options": [ "-h, --help this help", - "-n, --fileno file number (0 - 31)", - "-c, --com communication setting (0 = plain, 1 = plain + mac, 3 = enciphered)", - "-r, --rights access rights (2 hex bytes -> rw/chg/r/w, 0x0 - 0xd key, 0xe free, 0xf denied)", - "-l, --lower lower limit (4 hex bytes, big endian)", - "-u, --upper upper limit (4 hex bytes, big endian)", - "--val value (4 hex bytes, big endian)", - "-m limited credit enabled (bit 0 = limited credit, 1 = freevalue)", - "-a, --aid app id to select as hex bytes (3 bytes,big endian,optional)" + "-a, --apdu show apdu requests and responses", + "-v, --verbose show technical data", + "-n, --keyno key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 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", + "--rrights read file access mode: the specified key, free, deny", + "--wrights write file access mode: the specified key, free, deny", + "--rwrights read/write file access mode: the specified key, free, deny", + "--chrights change file settings access mode: the specified key, free, deny", + "--no-auth execute without authentication", + "--lower lower limit (4 hex bytes, big endian)", + "--upper upper limit (4 hex bytes, big endian)", + "--value value (4 hex bytes, big endian)", + "--lcredit limited credit enabled (bit 0 = limited credit, 1 = freevalue)" ], - "usage": "hf mfdes createvaluefile [-h] [-n ] [-c ] [-r ]... [-l ]... [-u ]... [--val ]... [-m ] [-a ]..." + "usage": "hf mfdes createvaluefile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--amode ] [--rawrights ] [--rrights ] [--wrights ] [--rwrights ] [--chrights ] [--no-auth] [--lower ] [--upper ] [--value ] [--lcredit ]" }, "hf mfdes deleteapp": { "command": "hf mfdes deleteapp", @@ -4235,17 +4293,28 @@ }, "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": [ - "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, "options": [ "-h, --help this help", - "-n, --fileno file number (0 - 31)", - "-a, --aid app id to select as hex bytes (3 bytes, big endian)" + "-a, --apdu show apdu requests and responses", + "-v, --verbose show technical data", + "-n, --keyno key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--fid file id (1 hex byte)", + "--no-auth execute without authentication" ], - "usage": "hf mfdes deletefile [-h] [-n ] [-a ]..." + "usage": "hf mfdes deletefile [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth]" }, "hf mfdes dump": { "command": "hf mfdes dump", @@ -4363,6 +4432,82 @@ ], "usage": "hf mfdes getappnames [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--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 key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--no-auth execute without authentication" + ], + "usage": "hf mfdes getfileids [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--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 key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--no-auth execute without authentication" + ], + "usage": "hf mfdes getfileisoids [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--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 key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 hex bytes, big endian)", + "--fid file id (1 hex byte). default: 1", + "--no-auth execute without authentication" + ], + "usage": "hf mfdes getfilesettings [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ] [--aid ] [--fid ] [--no-auth]" + }, "hf mfdes getkeysettings": { "command": "hf mfdes getkeysettings", "description": "get key settings for card level or application level.", @@ -4436,20 +4581,6 @@ ], "usage": "hf mfdes getuid [-hav] [-n ] [-t ] [-k ] [-f ] [-i ] [-m ] [-c ] [-s ]" }, - "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 file number (0 - 31)", - "-a, --aid app id to select as hex bytes (3 bytes, big endian)" - ], - "usage": "hf mfdes getvalue [-h] [-n ] [-a ]..." - }, "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.", @@ -4536,9 +4667,10 @@ }, "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": [ - "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, "options": [ @@ -4571,6 +4703,35 @@ ], "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 key number", + "-t, --algo crypt algo: des, 2tdea, 3tdea, aes", + "-k, --key key for authenticate (hex 8(des), 16(2tdea or aes) or 24(3tdea) bytes)", + "-f, --kdf key derivation function (kdf): none, an10922, gallagher", + "-i, --kdfi kdf input (hex 1-31 bytes)", + "-m, --cmode communicaton mode: plain/mac/encrypt", + "-c, --ccset communicaton command set: native/niso/iso", + "-s, --schann secure channel: d40/ev1/ev2", + "--aid application id (3 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]" + }, "hf mfdes write": { "command": "hf mfdes write", "description": "write data to file make sure to select aid or authenticate aid before running this command.", @@ -9521,8 +9682,8 @@ } }, "metadata": { - "commands_extracted": 582, + "commands_extracted": 585, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2021-07-20T20:36:37" + "extracted_on": "2021-07-26T14:56:39" } } \ No newline at end of file diff --git a/doc/commands.md b/doc/commands.md index da0e14334..5dab75938 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -523,14 +523,17 @@ Check column "offline" for their availability. |`hf mfdes selectaid `|N |`Select Application ID` |`hf mfdes getaids `|N |`[new]Get Application IDs 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 createfile `|N |`Create Standard/Backup File` -|`hf mfdes createvaluefile`|N |`Create Value File` +|`hf mfdes createfile `|N |`[new]Create Standard/Backup File` +|`hf mfdes createvaluefile`|N |`[new]Create Value 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 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 write `|N |`Write data to standard/backup/record file` |`hf mfdes test `|Y |`Test crypto`