mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
CHG: added possiblity to send <UID> into the "HF 15 SIM"
This commit is contained in:
parent
a61b4976bd
commit
3649b640e6
5 changed files with 91 additions and 128 deletions
|
@ -743,7 +743,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||||
ReaderIso15693(c->arg[0]);
|
ReaderIso15693(c->arg[0]);
|
||||||
break;
|
break;
|
||||||
case CMD_SIMTAG_ISO_15693:
|
case CMD_SIMTAG_ISO_15693:
|
||||||
SimTagIso15693(c->arg[0]);
|
SimTagIso15693(c->arg[0], c->d.asBytes);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ void cmac (const desfirekey_t key, uint8_t *ivect, const uint8_t *data, size
|
||||||
void RecordRawAdcSamplesIso15693(void);
|
void RecordRawAdcSamplesIso15693(void);
|
||||||
void AcquireRawAdcSamplesIso15693(void);
|
void AcquireRawAdcSamplesIso15693(void);
|
||||||
void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
|
void ReaderIso15693(uint32_t parameter); // Simulate an ISO15693 reader - greg
|
||||||
void SimTagIso15693(uint32_t parameter); // simulate an ISO15693 tag - greg
|
void SimTagIso15693(uint32_t parameter, uint8_t *uid); // simulate an ISO15693 tag - greg
|
||||||
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
|
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
|
||||||
void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
|
void DirectTag15693Command(uint32_t datalen,uint32_t speed, uint32_t recv, uint8_t data[]); // send arbitrary commands from CLI - atrox
|
||||||
void SetDebugIso15693(uint32_t flag);
|
void SetDebugIso15693(uint32_t flag);
|
||||||
|
|
|
@ -265,13 +265,10 @@ static void TransmitTo15693Tag(const uint8_t *cmd, int len, int *samples, int *w
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int *wait)
|
static void TransmitTo15693Reader(const uint8_t *cmd, int len, int *samples, int *wait)
|
||||||
{
|
{
|
||||||
int c;
|
int c = 0;
|
||||||
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR|FPGA_HF_SIMULATOR_MODULATE_424K);
|
||||||
// FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_TX);
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_SIMULATOR); // No requirement to energise my coils
|
|
||||||
if(*wait < 10) { *wait = 10; }
|
if(*wait < 10) { *wait = 10; }
|
||||||
|
|
||||||
c = 0;
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_TXRDY)) {
|
||||||
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
AT91C_BASE_SSC->SSC_THR = cmd[c];
|
||||||
|
@ -456,7 +453,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *receivedResponse, int maxLen, int
|
||||||
|
|
||||||
int8_t prev = 0;
|
int8_t prev = 0;
|
||||||
|
|
||||||
// NOW READ RESPONSE
|
// NOW READ RESPONSE
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
//spindelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
//spindelay(60); // greg - experiment to get rid of some of the 0 byte/failed reads
|
||||||
c = 0;
|
c = 0;
|
||||||
|
@ -838,7 +835,7 @@ static void BuildReadBlockRequest(uint8_t *uid, uint8_t blockNumber )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now the VICC>VCD responses when we are simulating a tag
|
// Now the VICC>VCD responses when we are simulating a tag
|
||||||
static void BuildInventoryResponse(void)
|
static void BuildInventoryResponse( uint8_t *uid)
|
||||||
{
|
{
|
||||||
uint8_t cmd[12];
|
uint8_t cmd[12];
|
||||||
|
|
||||||
|
@ -848,14 +845,14 @@ static void BuildReadBlockRequest(uint8_t *uid, uint8_t blockNumber )
|
||||||
cmd[0] = 0; //(1 << 2) | (1 << 5) | (1 << 1);
|
cmd[0] = 0; //(1 << 2) | (1 << 5) | (1 << 1);
|
||||||
cmd[1] = 0;
|
cmd[1] = 0;
|
||||||
// 64-bit UID
|
// 64-bit UID
|
||||||
cmd[2] = 0x32;
|
cmd[2] = uid[7]; //0x32;
|
||||||
cmd[3]= 0x4b;
|
cmd[3] = uid[6]; //0x4b;
|
||||||
cmd[4] = 0x03;
|
cmd[4] = uid[5]; //0x03;
|
||||||
cmd[5] = 0x01;
|
cmd[5] = uid[4]; //0x01;
|
||||||
cmd[6] = 0x00;
|
cmd[6] = uid[3]; //0x00;
|
||||||
cmd[7] = 0x10;
|
cmd[7] = uid[2]; //0x10;
|
||||||
cmd[8] = 0x05;
|
cmd[8] = uid[1]; //0x05;
|
||||||
cmd[9]= 0xe0;
|
cmd[9] = uid[0]; //0xe0;
|
||||||
//Now the CRC
|
//Now the CRC
|
||||||
crc = Crc(cmd, 10);
|
crc = Crc(cmd, 10);
|
||||||
cmd[10] = crc & 0xff;
|
cmd[10] = crc & 0xff;
|
||||||
|
@ -997,40 +994,41 @@ void SetDebugIso15693(uint32_t debug) {
|
||||||
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector
|
// Simulate an ISO15693 reader, perform anti-collision and then attempt to read a sector
|
||||||
// all demodulation performed in arm rather than host. - greg
|
// all demodulation performed in arm rather than host. - greg
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void ReaderIso15693(uint32_t parameter)
|
void ReaderIso15693(uint32_t parameter )
|
||||||
{
|
{
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
LED_C_OFF();
|
LED_C_OFF();
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
//DbpString(parameter);
|
|
||||||
|
|
||||||
//uint8_t *answer0 = (((uint8_t *)BigBuf) + 3560); // allow 100 bytes per reponse (way too much)
|
|
||||||
uint8_t *answer1 = (((uint8_t *)BigBuf) + 3660); //
|
uint8_t *answer1 = (((uint8_t *)BigBuf) + 3660); //
|
||||||
uint8_t *answer2 = (((uint8_t *)BigBuf) + 3760);
|
uint8_t *answer2 = (((uint8_t *)BigBuf) + 3760);
|
||||||
uint8_t *answer3 = (((uint8_t *)BigBuf) + 3860);
|
uint8_t *answer3 = (((uint8_t *)BigBuf) + 3860);
|
||||||
//uint8_t *TagUID= (((uint8_t *)BigBuf) + 3960); // where we hold the uid for hi15reader
|
|
||||||
// int answerLen0 = 0;
|
|
||||||
int answerLen1 = 0;
|
int answerLen1 = 0;
|
||||||
int answerLen2 = 0;
|
int answerLen2 = 0;
|
||||||
int answerLen3 = 0;
|
int answerLen3 = 0;
|
||||||
int i=0; // counter
|
int i = 0;
|
||||||
|
int samples = 0;
|
||||||
|
int tsamples = 0;
|
||||||
|
int wait = 0;
|
||||||
|
int elapsed = 0;
|
||||||
|
uint8_t TagUID[8] = {0x00};
|
||||||
|
|
||||||
|
|
||||||
// Blank arrays
|
// Blank arrays
|
||||||
memset(BigBuf + 3660, 0, 300);
|
memset(BigBuf + 3660, 0x00, 300);
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
|
|
||||||
|
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
||||||
// Setup SSC
|
// Setup SSC
|
||||||
FpgaSetupSsc();
|
FpgaSetupSsc();
|
||||||
|
|
||||||
// Start from off (no field generated)
|
// Start from off (no field generated)
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
SpinDelay(200);
|
SpinDelay(200);
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
|
||||||
FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Give the tags time to energize
|
// Give the tags time to energize
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);
|
||||||
SpinDelay(200);
|
SpinDelay(200);
|
||||||
|
@ -1040,44 +1038,19 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
LED_C_OFF();
|
LED_C_OFF();
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
int samples = 0;
|
|
||||||
int tsamples = 0;
|
|
||||||
int wait = 0;
|
|
||||||
int elapsed = 0;
|
|
||||||
|
|
||||||
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID
|
// FIRST WE RUN AN INVENTORY TO GET THE TAG UID
|
||||||
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
|
// THIS MEANS WE CAN PRE-BUILD REQUESTS TO SAVE CPU TIME
|
||||||
uint8_t TagUID[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // where we hold the uid for hi15reader
|
|
||||||
|
|
||||||
// BuildIdentifyRequest();
|
|
||||||
// //TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
|
|
||||||
// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
|
||||||
// // Now wait for a response
|
|
||||||
// responseLen0 = GetIso15693AnswerFromTag(receivedAnswer0, 100, &samples, &elapsed) ;
|
|
||||||
// if (responseLen0 >=12) // we should do a better check than this
|
|
||||||
// {
|
|
||||||
// // really we should check it is a valid mesg
|
|
||||||
// // but for now just grab what we think is the uid
|
|
||||||
// TagUID[0] = receivedAnswer0[2];
|
|
||||||
// TagUID[1] = receivedAnswer0[3];
|
|
||||||
// TagUID[2] = receivedAnswer0[4];
|
|
||||||
// TagUID[3] = receivedAnswer0[5];
|
|
||||||
// TagUID[4] = receivedAnswer0[6];
|
|
||||||
// TagUID[5] = receivedAnswer0[7];
|
|
||||||
// TagUID[6] = receivedAnswer0[8]; // IC Manufacturer code
|
|
||||||
// DbpIntegers(TagUID[6],TagUID[5],TagUID[4]);
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Now send the IDENTIFY command
|
// Now send the IDENTIFY command
|
||||||
BuildIdentifyRequest();
|
BuildIdentifyRequest();
|
||||||
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
|
|
||||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);
|
||||||
|
|
||||||
// Now wait for a response
|
// Now wait for a response
|
||||||
answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;
|
answerLen1 = GetIso15693AnswerFromTag(answer1, 100, &samples, &elapsed) ;
|
||||||
|
|
||||||
if (answerLen1 >=12) // we should do a better check than this
|
if (answerLen1 >=12) // we should do a better check than this
|
||||||
{
|
{
|
||||||
|
|
||||||
TagUID[0] = answer1[2];
|
TagUID[0] = answer1[2];
|
||||||
TagUID[1] = answer1[3];
|
TagUID[1] = answer1[3];
|
||||||
TagUID[2] = answer1[4];
|
TagUID[2] = answer1[4];
|
||||||
|
@ -1087,23 +1060,6 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
TagUID[6] = answer1[8]; // IC Manufacturer code
|
TagUID[6] = answer1[8]; // IC Manufacturer code
|
||||||
TagUID[7] = answer1[9]; // always E0
|
TagUID[7] = answer1[9]; // always E0
|
||||||
|
|
||||||
// Now send the SELECT command
|
|
||||||
// since the SELECT command is optional, we should not rely on it.
|
|
||||||
//// BuildSelectRequest(TagUID);
|
|
||||||
// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
|
||||||
// Now wait for a response
|
|
||||||
/// answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);
|
|
||||||
|
|
||||||
// Now send the MULTI READ command
|
|
||||||
// BuildArbitraryRequest(*TagUID,parameter);
|
|
||||||
/// BuildArbitraryCustomRequest(TagUID,parameter);
|
|
||||||
// BuildReadBlockRequest(*TagUID,parameter);
|
|
||||||
// BuildSysInfoRequest(*TagUID);
|
|
||||||
//TransmitTo15693Tag(ToSend,ToSendMax+3,&tsamples, &wait);
|
|
||||||
/// TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait); // No longer ToSendMax+3
|
|
||||||
// Now wait for a response
|
|
||||||
/// answerLen3 = GetIso15693AnswerFromTag(answer3, 100, &samples, &elapsed) ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbprintf("%d octets read from IDENTIFY request:", answerLen1);
|
Dbprintf("%d octets read from IDENTIFY request:", answerLen1);
|
||||||
|
@ -1111,10 +1067,10 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
Dbhexdump(answerLen1,answer1,true);
|
Dbhexdump(answerLen1,answer1,true);
|
||||||
|
|
||||||
// UID is reverse
|
// UID is reverse
|
||||||
if (answerLen1>=12)
|
if (answerLen1 >= 12)
|
||||||
//Dbprintf("UID = %*D",8,TagUID," ");
|
Dbprintf("UID = %02hX%02hX%02hX%02hX%02hX%02hX%02hX%02hX",
|
||||||
Dbprintf("UID = %02hX%02hX%02hX%02hX%02hX%02hX%02hX%02hX",TagUID[7],TagUID[6],TagUID[5],
|
TagUID[7],TagUID[6],TagUID[5],TagUID[4],
|
||||||
TagUID[4],TagUID[3],TagUID[2],TagUID[1],TagUID[0]);
|
TagUID[3],TagUID[2],TagUID[1],TagUID[0]);
|
||||||
|
|
||||||
|
|
||||||
Dbprintf("%d octets read from SELECT request:", answerLen2);
|
Dbprintf("%d octets read from SELECT request:", answerLen2);
|
||||||
|
@ -1125,15 +1081,14 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
DbdecodeIso15693Answer(answerLen3,answer3);
|
DbdecodeIso15693Answer(answerLen3,answer3);
|
||||||
Dbhexdump(answerLen3,answer3,true);
|
Dbhexdump(answerLen3,answer3,true);
|
||||||
|
|
||||||
|
// read all pages
|
||||||
// read all pages
|
if (answerLen1 >= 12 && DEBUG) {
|
||||||
if (answerLen1>=12 && DEBUG) {
|
|
||||||
i=0;
|
i=0;
|
||||||
while (i<32) { // sanity check, assume max 32 pages
|
while (i < 32) { // sanity check, assume max 32 pages
|
||||||
BuildReadBlockRequest(TagUID,i);
|
BuildReadBlockRequest(TagUID,i);
|
||||||
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);
|
TransmitTo15693Tag(ToSend,ToSendMax,&tsamples, &wait);
|
||||||
answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);
|
answerLen2 = GetIso15693AnswerFromTag(answer2, 100, &samples, &elapsed);
|
||||||
if (answerLen2>0) {
|
if (answerLen2 > 0) {
|
||||||
Dbprintf("READ SINGLE BLOCK %d returned %d octets:",i,answerLen2);
|
Dbprintf("READ SINGLE BLOCK %d returned %d octets:",i,answerLen2);
|
||||||
DbdecodeIso15693Answer(answerLen2,answer2);
|
DbdecodeIso15693Answer(answerLen2,answer2);
|
||||||
Dbhexdump(answerLen2,answer2,true);
|
Dbhexdump(answerLen2,answer2,true);
|
||||||
|
@ -1143,13 +1098,6 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// str2[0]=0;
|
|
||||||
// for(i = 0; i < responseLen3; i++) {
|
|
||||||
// itoa(str1,receivedAnswer3[i]);
|
|
||||||
// strncat(str2,str1,8);
|
|
||||||
// }
|
|
||||||
// DbpString(str2);
|
|
||||||
|
|
||||||
LED_A_OFF();
|
LED_A_OFF();
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
LED_C_OFF();
|
LED_C_OFF();
|
||||||
|
@ -1158,57 +1106,54 @@ void ReaderIso15693(uint32_t parameter)
|
||||||
|
|
||||||
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
// Simulate an ISO15693 TAG, perform anti-collision and then print any reader commands
|
||||||
// all demodulation performed in arm rather than host. - greg
|
// all demodulation performed in arm rather than host. - greg
|
||||||
void SimTagIso15693(uint32_t parameter)
|
void SimTagIso15693(uint32_t parameter, uint8_t *uid)
|
||||||
{
|
{
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
LED_C_OFF();
|
LED_C_OFF();
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
uint8_t *answer1 = (((uint8_t *)BigBuf) + 3660); //
|
uint8_t *buf = (((uint8_t *)BigBuf) + 3660); //
|
||||||
|
|
||||||
int answerLen1 = 0;
|
int answerLen1 = 0;
|
||||||
|
int samples = 0;
|
||||||
// Blank arrays
|
int tsamples = 0;
|
||||||
memset(answer1, 0, 100);
|
int wait = 0;
|
||||||
|
int elapsed = 0;
|
||||||
|
|
||||||
|
memset(buf, 0x00, 100);
|
||||||
|
|
||||||
|
// Inventory response
|
||||||
|
BuildInventoryResponse(uid);
|
||||||
|
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||||
// Setup SSC
|
|
||||||
|
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
||||||
|
|
||||||
FpgaSetupSsc();
|
FpgaSetupSsc();
|
||||||
|
|
||||||
// Start from off (no field generated)
|
// Start from off (no field generated)
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
SpinDelay(200);
|
SpinDelay(200);
|
||||||
|
|
||||||
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
|
|
||||||
FpgaSetupSsc();
|
|
||||||
|
|
||||||
// Give the tags time to energize
|
|
||||||
// FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR); // NO GOOD FOR SIM TAG!!!!
|
|
||||||
SpinDelay(200);
|
|
||||||
|
|
||||||
LED_A_OFF();
|
LED_A_OFF();
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
int samples = 0;
|
// Listen to reader
|
||||||
int tsamples = 0;
|
answerLen1 = GetIso15693AnswerFromSniff(buf, 100, &samples, &elapsed) ;
|
||||||
int wait = 0;
|
|
||||||
int elapsed = 0;
|
|
||||||
|
|
||||||
answerLen1 = GetIso15693AnswerFromSniff(answer1, 100, &samples, &elapsed) ;
|
|
||||||
|
|
||||||
if (answerLen1 >=1) // we should do a better check than this
|
if (answerLen1 >=1) // we should do a better check than this
|
||||||
{
|
{
|
||||||
// Build a suitable reponse to the reader INVENTORY cocmmand
|
// Build a suitable reponse to the reader INVENTORY cocmmand
|
||||||
BuildInventoryResponse();
|
// not so obsvious, but in the call to BuildInventoryResponse, the command is copied to the global ToSend buffer used below.
|
||||||
TransmitTo15693Reader(ToSend,ToSendMax, &tsamples, &wait);
|
TransmitTo15693Reader(ToSend, ToSendMax, &tsamples, &wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dbprintf("%d octets read from reader command: %x %x %x %x %x %x %x %x %x", answerLen1,
|
Dbprintf("%d octets read from reader command: %x %x %x %x %x %x %x %x %x", answerLen1,
|
||||||
answer1[0], answer1[1], answer1[2],
|
buf[0], buf[1], buf[2], buf[3],
|
||||||
answer1[3], answer1[4], answer1[5],
|
buf[4], buf[5], buf[6], buf[7], buf[8]);
|
||||||
answer1[6], answer1[7], answer1[8]);
|
|
||||||
|
|
||||||
LED_A_OFF();
|
LED_A_OFF();
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
|
|
|
@ -298,7 +298,26 @@ int CmdHF15Reader(const char *Cmd)
|
||||||
// Simulation is still not working very good
|
// Simulation is still not working very good
|
||||||
int CmdHF15Sim(const char *Cmd)
|
int CmdHF15Sim(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c = {CMD_SIMTAG_ISO_15693, {strtol(Cmd, NULL, 0), 0, 0}};
|
char cmdp = param_getchar(Cmd, 0);
|
||||||
|
uint8_t uid[8] = {0x00};
|
||||||
|
|
||||||
|
//E0 16 24 00 00 00 00 00
|
||||||
|
if (cmdp == 'h' || cmdp == 'H') {
|
||||||
|
PrintAndLog("Usage: hf 15 sim <UID>");
|
||||||
|
PrintAndLog("");
|
||||||
|
PrintAndLog(" sample: hf 15 sim E016240000000000");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_gethex(Cmd, 0, uid, 16)) {
|
||||||
|
PrintAndLog("UID must include 16 HEX symbols");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintAndLog("Starting simulating UID %02X %02X %02X %02X %02X %02X %02X %02X",
|
||||||
|
uid[0],uid[1],uid[2],uid[3],uid[4], uid[5], uid[6], uid[7]);
|
||||||
|
|
||||||
|
UsbCommand c = {CMD_SIMTAG_ISO_15693, {0, 0, 0}};
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,7 @@ int CmdEM410xRead(const char *Cmd)
|
||||||
|
|
||||||
/* get clock */
|
/* get clock */
|
||||||
clock = GetClock(Cmd, high, 0);
|
clock = GetClock(Cmd, high, 0);
|
||||||
|
|
||||||
|
|
||||||
/* parity for our 4 columns */
|
/* parity for our 4 columns */
|
||||||
parity[0] = parity[1] = parity[2] = parity[3] = 0;
|
parity[0] = parity[1] = parity[2] = parity[3] = 0;
|
||||||
header = rows = 0;
|
header = rows = 0;
|
||||||
|
@ -99,7 +98,7 @@ int CmdEM410xRead(const char *Cmd)
|
||||||
|
|
||||||
retest:
|
retest:
|
||||||
/* We go till 5 before the graph ends because we'll get that far below */
|
/* We go till 5 before the graph ends because we'll get that far below */
|
||||||
for (i = 1; i < bit2idx - 5; i++)
|
for (i = 0; i < bit2idx - 5; i++)
|
||||||
{
|
{
|
||||||
/* Step 2: We have our header but need our tag ID */
|
/* Step 2: We have our header but need our tag ID */
|
||||||
if (header == 9 && rows < 10)
|
if (header == 9 && rows < 10)
|
||||||
|
@ -128,7 +127,7 @@ retest:
|
||||||
PrintAndLog("Thought we had a valid tag but failed at word %d (i=%d)", rows + 1, i);
|
PrintAndLog("Thought we had a valid tag but failed at word %d (i=%d)", rows + 1, i);
|
||||||
|
|
||||||
/* Start back rows * 5 + 9 header bits, -1 to not start at same place */
|
/* Start back rows * 5 + 9 header bits, -1 to not start at same place */
|
||||||
i -= 9 + (5 * rows) - 5;
|
i -= 9 + (5 * rows) -2;
|
||||||
|
|
||||||
rows = header = 0;
|
rows = header = 0;
|
||||||
}
|
}
|
||||||
|
@ -214,8 +213,8 @@ int CmdEM410xSim(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("Starting simulating with UID %02X %02X %02X %02X %02X", uid[0],uid[1],uid[2],uid[3],uid[4]);
|
PrintAndLog("Starting simulating UID %02X%02X%02X%02X%02X", uid[0],uid[1],uid[2],uid[3],uid[4]);
|
||||||
|
PrintAndLog("Press pm3-button to about simulation");
|
||||||
|
|
||||||
/* clock is 64 in EM410x tags */
|
/* clock is 64 in EM410x tags */
|
||||||
int clock = 64;
|
int clock = 64;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue