Merge branch 'master' into hf-mf-ultimatecard-script-auto-set-maxblock
Signed-off-by: Iceman <iceman@iuse.se>
This commit is contained in:
9 files changed
+255
-103
No files matched your search
@@ -12,62 +12,118 @@ except ModuleNotFoundError:
|
||||
return str(s)
|
||||
|
||||
spi = {
|
||||
0x68:{
|
||||
"manufacturer": "Boya",
|
||||
"jedec" : {
|
||||
0x40: {
|
||||
0x15: {
|
||||
"part": "BY25Q16BS",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
0x85:{
|
||||
"manufacturer": "Puya",
|
||||
0x60: {
|
||||
0x15: {
|
||||
"part": "P25Q16H",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
"jedec" : {
|
||||
0x60: {
|
||||
0x15: {
|
||||
"part": "P25Q16H",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
0x16: {
|
||||
"part": "P25Q32H",
|
||||
"size": "32mbits",
|
||||
"sizeB": "4MB",
|
||||
},
|
||||
0x17: {
|
||||
"part": "P25Q64H",
|
||||
"size": "64mbits",
|
||||
"sizeB": "8MB",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
0xEF:{
|
||||
"manufacturer": "Winbond",
|
||||
0x30: {
|
||||
0x11: {
|
||||
"part": "W25X10BV",
|
||||
"size": "1mbits",
|
||||
"sizeB": "128KB",
|
||||
"jedec" : {
|
||||
0x30: {
|
||||
0x11: {
|
||||
"part": "W25X10BV",
|
||||
"size": "1mbits",
|
||||
"sizeB": "128KB",
|
||||
},
|
||||
0x12: {
|
||||
"part": "W25X20BV",
|
||||
"size": "2mbits",
|
||||
"sizeB": "256KB",
|
||||
},
|
||||
0x13: {
|
||||
"part": "W25X40BV",
|
||||
"size": "4mbits",
|
||||
"sizeB": "512KB",
|
||||
},
|
||||
},
|
||||
0x12: {
|
||||
"part": "W25X20BV",
|
||||
"size": "2mbits",
|
||||
"sizeB": "256KB",
|
||||
0x40: {
|
||||
0x12: {
|
||||
"part": "W25Q20BV",
|
||||
"size": "2mbits",
|
||||
"sizeB": "256KB",
|
||||
},
|
||||
0x13: {
|
||||
"part": "W25Q40BV",
|
||||
"size": "4mbits",
|
||||
"sizeB": "512KB",
|
||||
},
|
||||
0x14: {
|
||||
"part": "W25Q80BV",
|
||||
"size": "8mbits",
|
||||
"sizeB": "1MB",
|
||||
},
|
||||
0x15: {
|
||||
"part": "W25Q16BV",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
0x16: {
|
||||
"part": "W25Q32BV",
|
||||
"size": "32mbits",
|
||||
"sizeB": "4MB",
|
||||
},
|
||||
0x17: {
|
||||
"part": "W25Q64BV",
|
||||
"size": "64mbits",
|
||||
"sizeB": "8MB",
|
||||
},
|
||||
},
|
||||
0x13: {
|
||||
"part": "W25X40BV",
|
||||
"size": "4mbits",
|
||||
"sizeB": "512KB",
|
||||
},
|
||||
},
|
||||
0x40: {
|
||||
0x13: {
|
||||
"part": "W25Q40BV",
|
||||
"size": "4mbits",
|
||||
"sizeB": "512KB",
|
||||
},
|
||||
0x14: {
|
||||
"part": "W25Q80BV",
|
||||
"size": "8mbits",
|
||||
"sizeB": "1MB",
|
||||
},
|
||||
0x15: {
|
||||
"part": "W25Q16BV",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
0x16: {
|
||||
"part": "W25Q32BV",
|
||||
"size": "32mbits",
|
||||
"sizeB": "4MB",
|
||||
},
|
||||
},
|
||||
0x70: {
|
||||
0x22: {
|
||||
"part": "W25Q02JV-IM",
|
||||
"size": "2mbits",
|
||||
"sizeB": "256KB",
|
||||
0x70: {
|
||||
0x14: {
|
||||
"part": "W25Q80JV",
|
||||
"size": "8mbits",
|
||||
"sizeB": "1MB",
|
||||
},
|
||||
0x15: {
|
||||
"part": "W25Q16JV",
|
||||
"size": "16mbits",
|
||||
"sizeB": "2MB",
|
||||
},
|
||||
0x16: {
|
||||
"part": "W25Q32JV",
|
||||
"size": "32mbits",
|
||||
"sizeB": "4MB",
|
||||
},
|
||||
0x17: {
|
||||
"part": "W25Q64JV",
|
||||
"size": "64mbits",
|
||||
"sizeB": "8MB",
|
||||
},
|
||||
0x22: {
|
||||
"part": "W25Q02JV-IM",
|
||||
"size": "2mbits",
|
||||
"sizeB": "256KB",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -90,16 +146,16 @@ for line in p.grabbed_output.split('\n'):
|
||||
did_h = did >> 8
|
||||
did_l = did & 0xff
|
||||
t = None
|
||||
|
||||
print(f"\n JEDEC ID....... 0x{mid:X} / 0x{did:X}")
|
||||
if mid in spi:
|
||||
|
||||
mfr = spi[mid]['manufacturer']
|
||||
|
||||
if did_h in spi[mid]:
|
||||
if did_h in spi[mid]['jedec']:
|
||||
|
||||
if did_l in spi[mid][did_h]:
|
||||
if did_l in spi[mid]['jedec'][did_h]:
|
||||
|
||||
t = spi[mid][did_h][did_l]
|
||||
t = spi[mid]['jedec'][did_h][did_l]
|
||||
print("\n Manufacturer... " + color(f"{mfr}", fg="green") +
|
||||
"\n Device......... " + color(f"{t['part']}", fg="green") +
|
||||
"\n Size........... " + color(f"{t['size']} ({t['sizeB']})", fg="yellow")
|
||||
|
||||
@@ -1065,10 +1065,10 @@
|
||||
},
|
||||
{
|
||||
"AID": "DD00DD",
|
||||
"Vendor": "Regional Transporation District (RTD) via masabi justride",
|
||||
"Vendor": "Regional Transporation District (RTD) via Masabi Ltd",
|
||||
"Country": "US",
|
||||
"Name": "MyRide Card (DEN)",
|
||||
"Description": "DEN MyRide Card",
|
||||
"Description": "DEN MyRide Card; Masabi Justride Tap and Ride DESFire Smartcard",
|
||||
"Type": "transport"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -7202,7 +7202,8 @@ static int CmdHf14AGen3Block(const char *Cmd) {
|
||||
" - You can specify part of manufacturer block as\n"
|
||||
" 4/7-bytes for UID change only\n"
|
||||
"\n"
|
||||
"NOTE: BCC, SAK, ATQA will be calculated automatically"
|
||||
"NOTE: BCC and ATQA will be calculated automatically\n"
|
||||
"SAK will be automatically set to default values if not specified"
|
||||
,
|
||||
"hf mf gen3blk --> print current data\n"
|
||||
"hf mf gen3blk -d 01020304 --> set 4 byte uid\n"
|
||||
|
||||
@@ -444,6 +444,96 @@ static int CmdLFHitagSRead(const char *Cmd) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdLFHitagSDump(const char *Cmd) {
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf hitag hts dump",
|
||||
"Read all Hitag S memory and save to file\n"
|
||||
" Crypto mode: \n"
|
||||
" - key format ISK high + ISK low\n"
|
||||
" - default key 4F4E4D494B52 (ONMIKR)\n\n"
|
||||
" 8268/8310 password mode: \n"
|
||||
" - default password BBDD3399\n",
|
||||
"lf hitag hts dump --82xx -k BBDD3399 -> pwd mode\n"
|
||||
"lf hitag hts dump --crypto -> use def crypto\n"
|
||||
"lf hitag hts dump -k 4F4E4D494B52 -> crypto mode\n"
|
||||
"lf hitag hts dump --nrar 0102030411223344\n"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("8", "82xx", "8268/8310 mode"),
|
||||
arg_str0(NULL, "nrar", "<hex>", "nonce / answer writer, 8 hex bytes"),
|
||||
arg_lit0(NULL, "crypto", "crypto mode"),
|
||||
arg_str0("k", "key", "<hex>", "pwd or key, 4 or 6 hex bytes"),
|
||||
arg_int0("m", "mode", "<dec>", "response protocol mode. 0 (Standard 00110), 1 (Advanced 11000), 2 (Advanced 11001), 3 (Fast Advanced 11010) (def: 3)"),
|
||||
arg_str0("f", "file", "<fn>", "specify file name"),
|
||||
arg_lit0(NULL, "ns", "no save to file"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
lf_hitag_data_t packet;
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
||||
if (process_hitags_common_args(ctx, &packet) < 0) {
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 6), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
|
||||
bool nosave = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
// read all pages
|
||||
packet.page = 0;
|
||||
packet.page_count = 0;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_HITAGS_READ, (uint8_t *) &packet, sizeof(packet));
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_LF_HITAGS_READ, &resp, 5000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
print_error(resp.reason);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
lf_hts_read_response_t *card = (lf_hts_read_response_t *)resp.data.asBytes;
|
||||
|
||||
const int hts_mem_sizes[] = {1, 8, 64, 64};
|
||||
int mem_size = hts_mem_sizes[card->config_page.s.MEMT] * HITAGS_PAGE_SIZE;
|
||||
|
||||
hitags_config_t config = card->config_page.s;
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
|
||||
hitags_config_print(config);
|
||||
|
||||
if (nosave) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "Called with no save option");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
if (fnlen < 1) {
|
||||
char *fptr = filename;
|
||||
fptr += snprintf(filename, sizeof(filename), "lf-hitags-");
|
||||
FillFileNameByUID(fptr, card->pages[HITAGS_UID_PADR], "-dump", HITAGS_PAGE_SIZE);
|
||||
}
|
||||
|
||||
pm3_save_dump(filename, (uint8_t *)card->pages, mem_size, jsfHitag);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int CmdLFHitagSWrite(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf hitag hts wrbl",
|
||||
@@ -615,6 +705,7 @@ static command_t CommandTable[] = {
|
||||
{"-----------", CmdHelp, IfPm3Hitag, "----------------------- " _CYAN_("General") " ------------------------"},
|
||||
{"reader", CmdLFHitagSReader, IfPm3Hitag, "Act like a Hitag S reader"},
|
||||
{"rdbl", CmdLFHitagSRead, IfPm3Hitag, "Read Hitag S page"},
|
||||
{"dump", CmdLFHitagSDump, IfPm3Hitag, "Dump Hitag S pages to a file"},
|
||||
{"wrbl", CmdLFHitagSWrite, IfPm3Hitag, "Write Hitag S page"},
|
||||
{"-----------", CmdHelp, IfPm3Hitag, "----------------------- " _CYAN_("Simulation") " -----------------------"},
|
||||
{"sim", CmdLFHitagSSim, IfPm3Hitag, "Simulate Hitag S transponder"},
|
||||
|
||||
Reference in new issue
Block a user