mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Merge branch 'master' of https://github.com/Proxmark/proxmark3
Conflicts: armsrc/epa.c
This commit is contained in:
commit
31b3689f0b
9 changed files with 78 additions and 35 deletions
|
@ -259,10 +259,6 @@ void EPA_PACE_Collect_Nonce(UsbCommand *c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// increase the timeout (at least some cards really do need this!)
|
|
||||||
iso14a_set_timeout(0x0002FFFF);
|
|
||||||
Dbprintf("epa: Epic!");
|
|
||||||
|
|
||||||
// read the CardAccess file
|
// read the CardAccess file
|
||||||
// this array will hold the CardAccess file
|
// this array will hold the CardAccess file
|
||||||
uint8_t card_access[256] = {0};
|
uint8_t card_access[256] = {0};
|
||||||
|
@ -436,8 +432,6 @@ int EPA_Setup()
|
||||||
|
|
||||||
iso14a_set_timeout(10500);
|
iso14a_set_timeout(10500);
|
||||||
|
|
||||||
iso14a_set_timeout(10500);
|
|
||||||
|
|
||||||
// select the card
|
// select the card
|
||||||
return_code = iso14443a_select_card(uid, &card_select_info, NULL);
|
return_code = iso14443a_select_card(uid, &card_select_info, NULL);
|
||||||
if (return_code != 1) {
|
if (return_code != 1) {
|
||||||
|
|
|
@ -141,16 +141,40 @@ const uint8_t OddByteParity[256] = {
|
||||||
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void iso14a_set_trigger(bool enable) {
|
void iso14a_set_trigger(bool enable) {
|
||||||
trigger = enable;
|
trigger = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void iso14a_set_timeout(uint32_t timeout) {
|
void iso14a_set_timeout(uint32_t timeout) {
|
||||||
iso14a_timeout = timeout;
|
iso14a_timeout = timeout;
|
||||||
|
if(MF_DBGLEVEL >= 3) Dbprintf("ISO14443A Timeout set to %ld (%dms)", iso14a_timeout, iso14a_timeout / 106);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void iso14a_set_ATS_timeout(uint8_t *ats) {
|
||||||
|
|
||||||
|
uint8_t tb1;
|
||||||
|
uint8_t fwi;
|
||||||
|
uint32_t fwt;
|
||||||
|
|
||||||
|
if (ats[0] > 1) { // there is a format byte T0
|
||||||
|
if ((ats[1] & 0x20) == 0x20) { // there is an interface byte TB(1)
|
||||||
|
if ((ats[1] & 0x10) == 0x10) { // there is an interface byte TA(1) preceding TB(1)
|
||||||
|
tb1 = ats[3];
|
||||||
|
} else {
|
||||||
|
tb1 = ats[2];
|
||||||
|
}
|
||||||
|
fwi = (tb1 & 0xf0) >> 4; // frame waiting indicator (FWI)
|
||||||
|
fwt = 256 * 16 * (1 << fwi); // frame waiting time (FWT) in 1/fc
|
||||||
|
|
||||||
|
iso14a_set_timeout(fwt/(8*16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Generate the parity value for a byte sequence
|
// Generate the parity value for a byte sequence
|
||||||
//
|
//
|
||||||
|
@ -1600,7 +1624,7 @@ static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receive
|
||||||
if(ManchesterDecoding(b, offset, 0)) {
|
if(ManchesterDecoding(b, offset, 0)) {
|
||||||
NextTransferTime = MAX(NextTransferTime, Demod.endTime - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER)/16 + FRAME_DELAY_TIME_PICC_TO_PCD);
|
NextTransferTime = MAX(NextTransferTime, Demod.endTime - (DELAY_AIR2ARM_AS_READER + DELAY_ARM2AIR_AS_READER)/16 + FRAME_DELAY_TIME_PICC_TO_PCD);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (c++ > iso14a_timeout) {
|
} else if (c++ > iso14a_timeout && Demod.state == DEMOD_UNSYNCD) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1798,6 +1822,10 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
|
||||||
|
|
||||||
// reset the PCB block number
|
// reset the PCB block number
|
||||||
iso14_pcb_blocknum = 0;
|
iso14_pcb_blocknum = 0;
|
||||||
|
|
||||||
|
// set default timeout based on ATS
|
||||||
|
iso14a_set_ATS_timeout(resp);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,5 @@ extern void iso14443a_setup(uint8_t fpga_minor_mode);
|
||||||
extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data);
|
extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data);
|
||||||
extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr);
|
extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr);
|
||||||
extern void iso14a_set_trigger(bool enable);
|
extern void iso14a_set_trigger(bool enable);
|
||||||
extern void iso14a_set_timeout(uint32_t timeout);
|
|
||||||
|
|
||||||
#endif /* __ISO14443A_H */
|
#endif /* __ISO14443A_H */
|
||||||
|
|
|
@ -12,9 +12,9 @@ CXX=g++
|
||||||
VPATH = ../common
|
VPATH = ../common
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
|
|
||||||
LDLIBS = -L/opt/local/lib -L/usr/local/lib ../liblua/liblua.a -lreadline -lpthread -lm
|
LDLIBS = -L/mingw/lib -L/opt/local/lib -L/usr/local/lib ../liblua/liblua.a -lm -lreadline -lpthread -lgdi32
|
||||||
LDFLAGS = $(COMMON_FLAGS)
|
LDFLAGS = $(COMMON_FLAGS)
|
||||||
CFLAGS = -std=c99 -I. -I../include -I../common -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4
|
CFLAGS = -std=c99 -I. -I../include -I../common -I/mingw/include -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4
|
||||||
LUAPLATFORM = generic
|
LUAPLATFORM = generic
|
||||||
ifneq (,$(findstring MINGW,$(platform)))
|
ifneq (,$(findstring MINGW,$(platform)))
|
||||||
CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
|
CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
|
||||||
|
@ -146,6 +146,17 @@ clean:
|
||||||
tarbin: $(BINS)
|
tarbin: $(BINS)
|
||||||
$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%)
|
$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%)
|
||||||
|
|
||||||
|
# must be run as root
|
||||||
|
install_kext: Info.plist
|
||||||
|
mkdir -p /System/Library/Extensions/Proxmark3.kext/Contents
|
||||||
|
cp Info.plist /System/Library/Extensions/Proxmark3.kext/Contents
|
||||||
|
chown -R root:wheel /System/Library/Extensions/Proxmark3.kext
|
||||||
|
chmod 755 /System/Library/Extensions/Proxmark3.kext /System/Library/Extensions/Proxmark3.kext/Contents
|
||||||
|
chmod 644 /System/Library/Extensions/Proxmark3.kext/Contents/Info.plist
|
||||||
|
rm -rf /System/Library/Caches/com.apple.kext.caches
|
||||||
|
touch /System/Library/Extensions
|
||||||
|
@echo "*** You may need to reboot for the kext to take effect."
|
||||||
|
|
||||||
lua_build:
|
lua_build:
|
||||||
@echo Compiling liblua, using platform $(LUAPLATFORM)
|
@echo Compiling liblua, using platform $(LUAPLATFORM)
|
||||||
cd ../liblua && make $(LUAPLATFORM)
|
cd ../liblua && make $(LUAPLATFORM)
|
||||||
|
|
|
@ -129,11 +129,6 @@ int CmdHF14AList(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void iso14a_set_timeout(uint32_t timeout) {
|
|
||||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_SET_TIMEOUT, 0, timeout}};
|
|
||||||
SendCommand(&c);
|
|
||||||
}
|
|
||||||
|
|
||||||
int CmdHF14AReader(const char *Cmd)
|
int CmdHF14AReader(const char *Cmd)
|
||||||
{
|
{
|
||||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||||
|
@ -346,7 +341,7 @@ int CmdHF14AReader(const char *Cmd)
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
WaitForResponse(CMD_ACK,&resp);
|
WaitForResponse(CMD_ACK,&resp);
|
||||||
uint8_t isOK = resp.arg[0] & 0xff;
|
uint8_t isOK = resp.arg[0] & 0xff;
|
||||||
PrintAndLog(" Answers to chinese magic backdoor commands: %s", (isOK ? "YES" : "NO") );
|
PrintAndLog("Answers to chinese magic backdoor commands: %s", (isOK ? "YES" : "NO") );
|
||||||
|
|
||||||
// disconnect
|
// disconnect
|
||||||
c.cmd = CMD_READER_ISO_14443a;
|
c.cmd = CMD_READER_ISO_14443a;
|
||||||
|
@ -510,12 +505,13 @@ int CmdHF14ACmdRaw(const char *cmd) {
|
||||||
uint8_t active=0;
|
uint8_t active=0;
|
||||||
uint8_t active_select=0;
|
uint8_t active_select=0;
|
||||||
uint16_t numbits=0;
|
uint16_t numbits=0;
|
||||||
uint16_t timeout=0;
|
uint32_t timeout=0;
|
||||||
uint8_t bTimeout=0;
|
uint8_t bTimeout=0;
|
||||||
char buf[5]="";
|
char buf[5]="";
|
||||||
int i=0;
|
int i=0;
|
||||||
uint8_t data[USB_CMD_DATA_SIZE];
|
uint8_t data[USB_CMD_DATA_SIZE];
|
||||||
unsigned int datalen=0, temp;
|
uint16_t datalen=0;
|
||||||
|
uint32_t temp;
|
||||||
|
|
||||||
if (strlen(cmd)<2) {
|
if (strlen(cmd)<2) {
|
||||||
PrintAndLog("Usage: hf 14a raw [-r] [-c] [-p] [-f] [-b] [-t] <number of bits> <0A 0B 0C ... hex>");
|
PrintAndLog("Usage: hf 14a raw [-r] [-c] [-p] [-f] [-b] [-t] <number of bits> <0A 0B 0C ... hex>");
|
||||||
|
@ -525,7 +521,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
|
||||||
PrintAndLog(" -a active signal field ON without select");
|
PrintAndLog(" -a active signal field ON without select");
|
||||||
PrintAndLog(" -s active signal field ON with select");
|
PrintAndLog(" -s active signal field ON with select");
|
||||||
PrintAndLog(" -b number of bits to send. Useful for send partial byte");
|
PrintAndLog(" -b number of bits to send. Useful for send partial byte");
|
||||||
PrintAndLog(" -t timeout");
|
PrintAndLog(" -t timeout in ms");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +557,7 @@ int CmdHF14ACmdRaw(const char *cmd) {
|
||||||
case 't':
|
case 't':
|
||||||
bTimeout=1;
|
bTimeout=1;
|
||||||
sscanf(cmd+i+2,"%d",&temp);
|
sscanf(cmd+i+2,"%d",&temp);
|
||||||
timeout = temp & 0xFFFF;
|
timeout = temp;
|
||||||
i+=3;
|
i+=3;
|
||||||
while(cmd[i]!=' ' && cmd[i]!='\0') { i++; }
|
while(cmd[i]!=' ' && cmd[i]!='\0') { i++; }
|
||||||
i+=2;
|
i+=2;
|
||||||
|
@ -610,13 +606,13 @@ int CmdHF14ACmdRaw(const char *cmd) {
|
||||||
c.arg[0] |= ISO14A_NO_SELECT;
|
c.arg[0] |= ISO14A_NO_SELECT;
|
||||||
}
|
}
|
||||||
if(bTimeout){
|
if(bTimeout){
|
||||||
#define MAX_TIMEOUT 624*105 // max timeout is 624 ms
|
#define MAX_TIMEOUT 40542464 // (2^32-1) * (8*16) / 13560000Hz * 1000ms/s =
|
||||||
c.arg[0] |= ISO14A_SET_TIMEOUT;
|
c.arg[0] |= ISO14A_SET_TIMEOUT;
|
||||||
c.arg[2] = timeout * 105; // each bit is about 9.4 us
|
if(timeout > MAX_TIMEOUT) {
|
||||||
if(c.arg[2]>MAX_TIMEOUT) {
|
timeout = MAX_TIMEOUT;
|
||||||
c.arg[2] = MAX_TIMEOUT;
|
PrintAndLog("Set timeout to 40542 seconds (11.26 hours). The max we can wait for response");
|
||||||
PrintAndLog("Set timeout to 624 ms. The max we can wait for response");
|
|
||||||
}
|
}
|
||||||
|
c.arg[2] = 13560000 / 1000 / (8*16) * timeout; // timeout in ETUs (time to transfer 1 bit, approx. 9.4 us)
|
||||||
}
|
}
|
||||||
if(power)
|
if(power)
|
||||||
c.arg[0] |= ISO14A_NO_DISCONNECT;
|
c.arg[0] |= ISO14A_NO_DISCONNECT;
|
||||||
|
|
|
@ -756,12 +756,18 @@ int CmdLFfind(const char *Cmd)
|
||||||
static command_t CommandTable[] =
|
static command_t CommandTable[] =
|
||||||
{
|
{
|
||||||
{"help", CmdHelp, 1, "This help"},
|
{"help", CmdHelp, 1, "This help"},
|
||||||
{"cmdread", CmdLFCommandRead, 0, "<off period> <'0' period> <'1' period> <command> ['h'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'h' for 134)"},
|
|
||||||
{"em4x", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
|
{"em4x", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
|
||||||
{"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"},
|
|
||||||
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
|
|
||||||
{"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
|
{"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
|
||||||
{"io", CmdLFIO, 1, "{ ioProx tags... }"},
|
{"hitag", CmdLFHitag, 1, "{ HITAG RFIDs... }"},
|
||||||
|
{"io", CmdLFIO, 1, "{ IOPROX RFIDs... }"},
|
||||||
|
{"pcf7931", CmdLFPCF7931, 1, "{ PCF7931 RFIDs... }"},
|
||||||
|
{"ti", CmdLFTI, 1, "{ TI RFIDs... }"},
|
||||||
|
{"t55xx", CmdLFT55XX, 1, "{ T55X7 RFIDs... }"},
|
||||||
|
|
||||||
|
{"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"},
|
||||||
|
|
||||||
|
{"cmdread", CmdLFCommandRead, 0, "<off period> <'0' period> <'1' period> <command> ['h'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'h' for 134)"},
|
||||||
|
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
|
||||||
{"indalademod", CmdIndalaDemod, 1, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
|
{"indalademod", CmdIndalaDemod, 1, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
|
||||||
{"indalaclone", CmdIndalaClone, 0, "<UID> ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"},
|
{"indalaclone", CmdIndalaClone, 0, "<UID> ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"},
|
||||||
{"read", CmdLFRead, 0, "Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"},
|
{"read", CmdLFRead, 0, "Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"},
|
||||||
|
@ -770,11 +776,7 @@ static command_t CommandTable[] =
|
||||||
{"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"},
|
{"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"},
|
||||||
{"simman", CmdLFSimManchester, 0, "<Clock> <Bitstream> [GAP] Simulate arbitrary Manchester LF tag"},
|
{"simman", CmdLFSimManchester, 0, "<Clock> <Bitstream> [GAP] Simulate arbitrary Manchester LF tag"},
|
||||||
{"snoop", CmdLFSnoop, 0, "['l'|'h'|<divisor>] [trigger threshold]-- Snoop LF (l:125khz, h:134khz)"},
|
{"snoop", CmdLFSnoop, 0, "['l'|'h'|<divisor>] [trigger threshold]-- Snoop LF (l:125khz, h:134khz)"},
|
||||||
{"ti", CmdLFTI, 1, "{ TI RFIDs... }"},
|
|
||||||
{"hitag", CmdLFHitag, 1, "{ Hitag tags and transponders... }"},
|
|
||||||
{"vchdemod", CmdVchDemod, 1, "['clone'] -- Demodulate samples for VeriChip"},
|
{"vchdemod", CmdVchDemod, 1, "['clone'] -- Demodulate samples for VeriChip"},
|
||||||
{"t55xx", CmdLFT55XX, 1, "{ T55xx RFIDs... }"},
|
|
||||||
{"pcf7931", CmdLFPCF7931, 1, "{PCF7931 RFIDs...}"},
|
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,19 @@ int usage_t55xx_dump(){
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
FSK1 / FSK1a
|
||||||
|
size = fskdemod(dest, size, 32, 0, 8, 10); // fsk1 RF/32
|
||||||
|
size = fskdemod(dest, size, 32, 1, 8, 10); // fsk1a RF/32
|
||||||
|
|
||||||
|
FSK2 / FSK2a
|
||||||
|
size = fskdemod(dest, size, 32, 0, 10, 8); // fsk2 RF/32
|
||||||
|
size = fskdemod(dest, size, 32, 1, 10, 8); // fsk2a RF/32
|
||||||
|
size = fskdemod(dest, size, 50, 1, 10, 8); // fsk2a RF/50
|
||||||
|
size = fskdemod(dest, size, 64, 1, 10, 8); // FSK2a RF/64
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
int CmdReadBlk(const char *Cmd)
|
int CmdReadBlk(const char *Cmd)
|
||||||
{
|
{
|
||||||
int invert = 0;
|
int invert = 0;
|
||||||
|
|
BIN
fpga/fpga_hf.bit
BIN
fpga/fpga_hf.bit
Binary file not shown.
|
@ -570,7 +570,7 @@ assign pwr_oe3 = 1'b0;
|
||||||
// TAGSIM_MOD: short circuit antenna with different resistances (modulated by sub_carrier modulated by mod_sig_coil)
|
// TAGSIM_MOD: short circuit antenna with different resistances (modulated by sub_carrier modulated by mod_sig_coil)
|
||||||
// for pwr_oe4 = 1 (tristate): antenna load = 10k || 33 = 32,9 Ohms
|
// for pwr_oe4 = 1 (tristate): antenna load = 10k || 33 = 32,9 Ohms
|
||||||
// for pwr_oe4 = 0 (active): antenna load = 10k || 33 || 33 = 16,5 Ohms
|
// for pwr_oe4 = 0 (active): antenna load = 10k || 33 || 33 = 16,5 Ohms
|
||||||
assign pwr_oe4 = ~(mod_sig_coil & sub_carrier & (mod_type == `TAGSIM_MOD));
|
assign pwr_oe4 = mod_sig_coil & sub_carrier & (mod_type == `TAGSIM_MOD);
|
||||||
|
|
||||||
// This is all LF, so doesn't matter.
|
// This is all LF, so doesn't matter.
|
||||||
assign pwr_oe2 = 1'b0;
|
assign pwr_oe2 = 1'b0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue