mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
hitag signal refactoring
This commit is contained in:
parent
d956e8c2a3
commit
89bae75c55
7 changed files with 523 additions and 340 deletions
|
@ -23,7 +23,7 @@ APP_CFLAGS = $(PLATFORM_DEFS) \
|
|||
-DON_DEVICE \
|
||||
-fno-strict-aliasing -ffunction-sections -fdata-sections
|
||||
|
||||
SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c
|
||||
SRC_LF = lfops.c lfsampling.c pcf7931.c lfdemod.c lfadc.c
|
||||
SRC_ISO15693 = iso15693.c iso15693tools.c
|
||||
SRC_ISO14443a = iso14443a.c mifareutil.c mifarecmd.c epa.c mifaresim.c
|
||||
#UNUSED: mifaresniff.c desfire_crypto.c
|
||||
|
|
821
armsrc/hitag2.c
821
armsrc/hitag2.c
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@
|
|||
#include "common.h"
|
||||
#include "hitag.h"
|
||||
|
||||
void SniffHitag(void);
|
||||
void SniffHitag(uint32_t type);
|
||||
void SimulateHitagTag(bool tag_mem_supplied, uint8_t *data);
|
||||
void ReaderHitag(hitag_function htf, hitag_data *htd);
|
||||
void WriterHitag(hitag_function htf, hitag_data *htd, int page);
|
||||
|
|
|
@ -168,7 +168,9 @@ void lf_init(bool reader) {
|
|||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
||||
|
||||
// Prepare data trace
|
||||
if (logging) initSampleBuffer(NULL);
|
||||
uint32_t bufsize = 20000;
|
||||
|
||||
if (logging) initSampleBuffer(&bufsize);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -106,17 +106,23 @@ sampling_t samples = {0, 0, 0, 0};
|
|||
|
||||
void initSampleBuffer(uint32_t *sample_size) {
|
||||
|
||||
BigBuf_free();
|
||||
BigBuf_Clear_ext(false);
|
||||
|
||||
if (sample_size == NULL || *sample_size == 0) {
|
||||
*sample_size = BigBuf_max_traceLen();
|
||||
|
||||
data.buffer = BigBuf_get_addr();
|
||||
|
||||
memset(data.buffer, 0, *sample_size);
|
||||
} else {
|
||||
*sample_size = MIN(*sample_size, BigBuf_max_traceLen());
|
||||
|
||||
data.buffer = BigBuf_malloc(*sample_size);
|
||||
|
||||
memset(data.buffer, 0, *sample_size);
|
||||
}
|
||||
|
||||
// use a bitstream to handle the output
|
||||
data.buffer = BigBuf_get_addr();
|
||||
|
||||
memset(data.buffer, 0, *sample_size);
|
||||
|
||||
//
|
||||
samples.dec_counter = 0;
|
||||
samples.sum = 0;
|
||||
|
|
|
@ -485,8 +485,9 @@ static int CmdLFHitagInfo(const char *Cmd) {
|
|||
if (getHitagUid(&uid) == false)
|
||||
return 1;
|
||||
|
||||
PrintAndLogEx(SUCCESS, "UID: %08X", uid);
|
||||
PrintAndLogEx(SUCCESS, "UID: " _YELLOW_("%08X"), uid);
|
||||
|
||||
return PM3_SUCCESS;
|
||||
// how to detemine Hitag types?
|
||||
// read block3, get configuration byte.
|
||||
PrintAndLogEx(FAILED, _RED_("TODO: This is a hardcoded example!"));
|
||||
|
@ -497,7 +498,7 @@ static int CmdLFHitagInfo(const char *Cmd) {
|
|||
//printHitagConfiguration( 0x02 );
|
||||
//printHitagConfiguration( 0x00 );
|
||||
//printHitagConfiguration( 0x04 );
|
||||
return 0;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// TODO: iceman
|
||||
|
@ -564,7 +565,7 @@ static int CmdLFHitagReader(const char *Cmd) {
|
|||
|
||||
uint32_t id = bytes_to_num(resp.data.asBytes, 4);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: %08x", id);
|
||||
PrintAndLogEx(SUCCESS, "Valid Hitag2 tag found - UID: " _YELLOW_("%08x"), id);
|
||||
if (htf != RHT2F_UID_ONLY) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Dumping tag memory...");
|
||||
|
|
|
@ -21,6 +21,8 @@ typedef enum {
|
|||
RHTSF_KEY = 02,
|
||||
WHTSF_CHALLENGE = 03,
|
||||
WHTSF_KEY = 04,
|
||||
RHT1F_PLAIN = 11,
|
||||
RHT1F_AUTHENTICATE = 12,
|
||||
RHT2F_PASSWORD = 21,
|
||||
RHT2F_AUTHENTICATE = 22,
|
||||
RHT2F_CRYPTO = 23,
|
||||
|
@ -44,8 +46,17 @@ typedef struct {
|
|||
uint8_t data[4];
|
||||
} PACKED rht2d_crypto;
|
||||
|
||||
typedef struct {
|
||||
bool key_no;
|
||||
uint8_t logdata_0[4];
|
||||
uint8_t logdata_1[4];
|
||||
uint8_t nonce[4];
|
||||
uint8_t key[4];
|
||||
} PACKED rht1d_authenticate;
|
||||
|
||||
typedef union {
|
||||
rht2d_password pwd;
|
||||
rht1d_authenticate ht1auth;
|
||||
rht2d_authenticate auth;
|
||||
rht2d_crypto crypto;
|
||||
} hitag_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue