allow setting of UID for special 'chinese' ultralight cards
This commit is contained in:
parent
f6fff26f0f
commit
07c54cd91b
2 changed files with 17 additions and 5 deletions
|
@ -20,6 +20,9 @@ Be cautious that some parts of a Ultralight memory can be written only once
|
|||
and some parts are used as lock bits, so please read the tag documentation
|
||||
before experimenting too much!
|
||||
|
||||
To set the UID of a special writeable UID card, edit the first 7 bytes of a dump file and
|
||||
then write it back, answering 'Y' to the question 'Write UID bytes?'.
|
||||
|
||||
.SH OPTIONS
|
||||
.BR r " | " w
|
||||
Perform read from (
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* Copyright (C) 2012-2013 Ludovic Rousseau
|
||||
* See AUTHORS file for a more comprehensive list of contributors.
|
||||
* Additional contributors of this file:
|
||||
* Copyright (C) 2013 Adam Laurie
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
|
@ -112,11 +113,12 @@ write_card(void)
|
|||
uint32_t uiBlock = 0;
|
||||
bool bFailure = false;
|
||||
uint32_t uiWritenPages = 0;
|
||||
uint32_t uiSkippedPages;
|
||||
uint32_t uiSkippedPages = 0;
|
||||
|
||||
char buffer[BUFSIZ];
|
||||
bool write_otp;
|
||||
bool write_lock;
|
||||
bool write_uid;
|
||||
|
||||
printf("Write OTP bytes ? [yN] ");
|
||||
if (!fgets(buffer, BUFSIZ, stdin)) {
|
||||
|
@ -128,13 +130,20 @@ write_card(void)
|
|||
ERR("Unable to read standard input.");
|
||||
}
|
||||
write_lock = ((buffer[0] == 'y') || (buffer[0] == 'Y'));
|
||||
printf("Write UID bytes (only for special writeable UID cards) ? [yN] ");
|
||||
if (!fgets(buffer, BUFSIZ, stdin)) {
|
||||
ERR("Unable to read standard input.");
|
||||
}
|
||||
write_uid = ((buffer[0] == 'y') || (buffer[0] == 'Y'));
|
||||
|
||||
printf("Writing %d pages |", uiBlocks + 1);
|
||||
/* We need to skip 2 first pages. */
|
||||
printf("ss");
|
||||
uiSkippedPages = 2;
|
||||
/* We may need to skip 2 first pages. */
|
||||
if(!write_uid) {
|
||||
printf("ss");
|
||||
uiSkippedPages = 2;
|
||||
}
|
||||
|
||||
for (int page = 0x2; page <= 0xF; page++) {
|
||||
for (int page = uiSkippedPages; page <= 0xF; page++) {
|
||||
if ((page == 0x2) && (!write_lock)) {
|
||||
printf("s");
|
||||
uiSkippedPages++;
|
||||
|
|
Loading…
Reference in a new issue