add a pwd to ntag215 sim if empty

This commit is contained in:
iceman1001 2022-07-30 10:03:51 +02:00
parent 4f27d2c026
commit 834023b132
3 changed files with 22 additions and 3 deletions

View file

@ -152,7 +152,8 @@ THUMBSRC = start.c \
BigBuf.c \
ticks.c \
clocks.c \
hfsnoop.c
hfsnoop.c \
generator.c
# These are to be compiled in ARM mode

View file

@ -34,6 +34,7 @@
#include "commonutil.h"
#include "crc16.h"
#include "protocols.h"
#include "generator.h"
#define MAX_ISO14A_TIMEOUT 524288
@ -1104,6 +1105,7 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data, tag_r
// READ_SIG
memcpy(rSIGN, mfu_header->signature, 32);
AddCrc14A(rSIGN, sizeof(rSIGN) - 2);
}
break;
case 8: { // MIFARE Classic 4k
@ -1642,7 +1644,13 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_
// PWD stored in dump now
uint8_t pwd[4];
emlGetMemBt(pwd, (pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(pwd));
if (memcmp(pwd, "\x00\x00\x00\x00", 4) == 0) {
Uint4byteToMemLe(pwd, ul_ev1_pwdgenB(data));
Dbprintf("Calc pwd... %02X %02X %02X %02X", pwd[0], pwd[1], pwd[2] ,pwd[3]);
}
if (memcmp(receivedCmd + 1, pwd, 4) == 0) {
uint8_t pack[4];
emlGetMemBt(pack, pages * 4 + MFU_DUMP_PREFIX_LENGTH, 2);
if (memcmp(pack, "\x00\x00\x00\x00", 4) == 0) {

View file

@ -27,10 +27,20 @@
#include "common.h" //BSWAP_32/64
#include "util.h"
#include "pm3_cmd.h"
#include "ui.h"
#include "crc16.h" // crc16 ccitt
#include "mbedtls/sha1.h"
#include "mbedtls/md5.h"
#include "crc16.h" // crc16 ccitt
#include "mbedtls/cmac.h"
#include "mbedtls/cipher.h"
#include "mbedtls/md.h"
#ifndef ON_DEVICE
#include "ui.h"
# define prnt(args...) PrintAndLogEx(DEBUG, ## args );
#else
# include "dbprint.h"
# define prnt Dbprintf
#endif
// Implementation tips:
// For each implementation of the algos, I recommend adding a self test for easy "simple unit" tests when Travis CI / Appveyor runs.