This commit is contained in:
iceman1001 2024-02-21 22:49:59 +01:00
commit 26fda45837
3 changed files with 27 additions and 10 deletions

View file

@ -1921,7 +1921,7 @@ static int CmdHF14BRestore(const char *Cmd) {
int blockno = 0; int blockno = 0;
while (bytes_read) { while (bytes_read) {
int status = write_sr_block(blockno, ST25TB_SR_BLOCK_SIZE, data+blockno*ST25TB_SR_BLOCK_SIZE); int status = write_sr_block(blockno, ST25TB_SR_BLOCK_SIZE, data + blockno * ST25TB_SR_BLOCK_SIZE);
if (status != PM3_SUCCESS) { if (status != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Write failed"); PrintAndLogEx(FAILED, "Write failed");
free(data); free(data);
@ -1932,16 +1932,16 @@ static int CmdHF14BRestore(const char *Cmd) {
uint8_t out[ST25TB_SR_BLOCK_SIZE] = {0}; uint8_t out[ST25TB_SR_BLOCK_SIZE] = {0};
status = read_sr_block(blockno, out); status = read_sr_block(blockno, out);
if (status == PM3_SUCCESS) { if (status == PM3_SUCCESS) {
if (memcmp(data+blockno*ST25TB_SR_BLOCK_SIZE, out, ST25TB_SR_BLOCK_SIZE) == 0) { if (memcmp(data + blockno * ST25TB_SR_BLOCK_SIZE, out, ST25TB_SR_BLOCK_SIZE) == 0) {
printf("\33[2K\r"); printf("\33[2K\r");
PrintAndLogEx(INFO, "SRx write block %d/%d ( " _GREEN_("ok") " )" NOLF, blockno, block_cnt-1); PrintAndLogEx(INFO, "SRx write block %d/%d ( " _GREEN_("ok") " )" NOLF, blockno, block_cnt - 1);
}else { } else {
printf("\n"); printf("\n");
PrintAndLogEx(INFO, "SRx write block %d/%d ( " _RED_("different") " )",blockno, block_cnt-1); PrintAndLogEx(INFO, "SRx write block %d/%d ( " _RED_("different") " )", blockno, block_cnt - 1);
} }
}else{ } else {
printf("\n"); printf("\n");
PrintAndLogEx(INFO, "Verifying block %d/%d ( " _RED_("failed") " )",blockno, block_cnt-1); PrintAndLogEx(INFO, "Verifying block %d/%d ( " _RED_("failed") " )", blockno, block_cnt - 1);
} }
fflush(stdout); fflush(stdout);

View file

@ -1513,6 +1513,22 @@
], ],
"usage": "hf 14b reader [-hv@]" "usage": "hf 14b reader [-hv@]"
}, },
"hf 14b restore": {
"command": "hf 14b restore",
"description": "Restore data from (bin/eml/json) dump file to tag If the dump file includes the special block at the end it will be ignored",
"notes": [
"hf 14b restore --4k -f myfilename",
"hf 14b restore --512 -f myfilename"
],
"offline": false,
"options": [
"-h, --help This help",
"-f, --file <fn> (optional) filename, if no <name> UID will be used as filename",
"--512 target SRI 512 tag",
"--4k target SRIX 4k tag (def)"
],
"usage": "hf 14b restore [-h] [-f <fn>] [--512] [--4k]"
},
"hf 14b sim": { "hf 14b sim": {
"command": "hf 14b sim", "command": "hf 14b sim",
"description": "Simulate a ISO/IEC 14443 type B tag with 4 byte UID / PUPI", "description": "Simulate a ISO/IEC 14443 type B tag with 4 byte UID / PUPI",
@ -1580,7 +1596,7 @@
"-b, --block <dec> block number", "-b, --block <dec> block number",
"-d, --data <hex> 4 hex bytes", "-d, --data <hex> 4 hex bytes",
"--512 target SRI 512 tag", "--512 target SRI 512 tag",
"--4k target SRIX 4k tag", "--4k target SRIX 4k tag (def)",
"--sb special block write at end of memory (0xFF)", "--sb special block write at end of memory (0xFF)",
"--force overrides block range checks" "--force overrides block range checks"
], ],
@ -12497,8 +12513,8 @@
} }
}, },
"metadata": { "metadata": {
"commands_extracted": 721, "commands_extracted": 722,
"extracted_by": "PM3Help2JSON v1.00", "extracted_by": "PM3Help2JSON v1.00",
"extracted_on": "2024-02-21T16:14:11" "extracted_on": "2024-02-21T21:49:16"
} }
} }

View file

@ -216,6 +216,7 @@ Check column "offline" for their availability.
|`hf 14b raw `|N |`Send raw hex data to tag` |`hf 14b raw `|N |`Send raw hex data to tag`
|`hf 14b rdbl `|N |`Read SRI512/SRIX4 block` |`hf 14b rdbl `|N |`Read SRI512/SRIX4 block`
|`hf 14b reader `|N |`Act as a ISO-14443-B reader to identify a tag` |`hf 14b reader `|N |`Act as a ISO-14443-B reader to identify a tag`
|`hf 14b restore `|N |`Restore from file to all memory pages of an ISO-14443-B tag`
|`hf 14b sim `|N |`Fake ISO ISO-14443-B tag` |`hf 14b sim `|N |`Fake ISO ISO-14443-B tag`
|`hf 14b sniff `|N |`Eavesdrop ISO-14443-B` |`hf 14b sniff `|N |`Eavesdrop ISO-14443-B`
|`hf 14b wrbl `|N |`Write data to a SRI512/SRIX4 tag` |`hf 14b wrbl `|N |`Write data to a SRI512/SRIX4 tag`