added -1k+ param to allow for gdm and the extra sectors dump to be loaded

This commit is contained in:
iceman1001 2025-01-14 23:01:17 +01:00
commit e59385a44b
3 changed files with 24 additions and 12 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased]
- Changed `hf mf cload` - now accepts MFC Ev1 sized dumps (@iceman1001)
- Changed `hf mfu info` - now properly identify ULEv1 AES 50pF (@iceman1001)
- Changed `hf mf info` - now differentiates between full USCUID and cut down ZUID chips (@nvx)
- Changed `lf hitag chk` - added key counter, client side abort and minor delay (@iceman1001)

View file

@ -5335,11 +5335,12 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
arg_param_begin,
arg_str0("f", "file", "<fn>", "Specify a filename for dump file"),
arg_lit0(NULL, "mini", "MIFARE Classic Mini / S20"),
arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"),
arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"),
arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"),
arg_lit0(NULL, "emu", "from emulator memory"),
arg_lit0(NULL, "gdm", "use gdm alt (20/23) magic wakeup"),
arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"),
arg_lit0(NULL, "1k+", "MIFARE Classic Ev1 1k / S50"),
arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"),
arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"),
arg_lit0(NULL, "emu", "from emulator memory"),
arg_lit0(NULL, "gdm", "use gdm alt (20/23) magic wakeup"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
@ -5350,21 +5351,22 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
bool m0 = arg_get_lit(ctx, 2);
bool m1 = arg_get_lit(ctx, 3);
bool m2 = arg_get_lit(ctx, 4);
bool m4 = arg_get_lit(ctx, 5);
bool fill_from_emulator = arg_get_lit(ctx, 6);
bool gdm = arg_get_lit(ctx, 7);
bool m1ev1 = arg_get_lit(ctx, 4);
bool m2 = arg_get_lit(ctx, 5);
bool m4 = arg_get_lit(ctx, 6);
bool fill_from_emulator = arg_get_lit(ctx, 7);
bool gdm = arg_get_lit(ctx, 8);
CLIParserFree(ctx);
if ((m0 + m1 + m2 + m4) > 1) {
if ((m0 + m1 + m2 + m4 + m1ev1) > 1) {
PrintAndLogEx(WARNING, "Only specify one MIFARE Type");
return PM3_EINVARG;
} else if ((m0 + m1 + m2 + m4) == 0) {
} else if ((m0 + m1 + m2 + m4 + m1ev1) == 0) {
m1 = true;
}
char s[6];
char s[8];
memset(s, 0, sizeof(s));
uint16_t block_cnt = MIFARE_1K_MAXBLOCK;
if (m0) {
@ -5373,6 +5375,9 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
} else if (m1) {
block_cnt = MIFARE_1K_MAXBLOCK;
strncpy(s, "1K", 3);
} else if (m1ev1) {
block_cnt = MIFARE_1K_EV1_MAXBLOCK;
strncpy(s, "1K Ev1", 7);
} else if (m2) {
block_cnt = MIFARE_2K_MAXBLOCK;
strncpy(s, "2K", 3);
@ -5384,6 +5389,10 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
return PM3_EINVARG;
}
if (gdm == false && m1ev1) {
PrintAndLogEx(ERR, "Normally only a GDM / UMC card will handle the extra sectors");
return PM3_EINVARG;
}
if (fill_from_emulator) {

View file

@ -33,6 +33,7 @@
#define MIFARE_4K_MAXBLOCK 256
#define MIFARE_2K_MAXBLOCK 128
#define MIFARE_1K_MAXBLOCK 64
#define MIFARE_1K_EV1_MAXBLOCK (MIFARE_1K_MAXBLOCK + 8)
#define MIFARE_MINI_MAXBLOCK 20
#define MIFARE_4K_MAXSECTOR 40
@ -44,6 +45,7 @@
#define MIFARE_4K_MAX_BYTES 4096
#define MIFARE_2K_MAX_BYTES 2048
#define MIFARE_1K_MAX_BYTES 1024
#define MIFARE_1K_EV1_MAX_BYTES (MIFARE_1K_MAX_BYTES + 128)
#define MIFARE_MINI_MAX_BYTES 320
#define MIFARE_KEY_SIZE 6