mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 21:03:23 -07:00
minor cleanups
This commit is contained in:
parent
78711df115
commit
9f669cb26f
8 changed files with 80 additions and 67 deletions
|
@ -946,7 +946,7 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||||
CmdIOdemodFSK(c->arg[0], 0, 0, 1);
|
CmdIOdemodFSK(c->arg[0], 0, 0, 1);
|
||||||
break;
|
break;
|
||||||
case CMD_IO_CLONE_TAG:
|
case CMD_IO_CLONE_TAG:
|
||||||
CopyIOtoT55x7(c->arg[0], c->arg[1], c->d.asBytes[0]);
|
CopyIOtoT55x7(c->arg[0], c->arg[1]);
|
||||||
break;
|
break;
|
||||||
case CMD_EM410X_DEMOD:
|
case CMD_EM410X_DEMOD:
|
||||||
CmdEM410xdemod(c->arg[0], 0, 0, 1);
|
CmdEM410xdemod(c->arg[0], 0, 0, 1);
|
||||||
|
|
|
@ -73,7 +73,7 @@ void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol);
|
||||||
void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol); // Realtime demodulation mode for AWID26
|
void CmdAWIDdemodFSK(int findone, int *high, int *low, int ledcontrol); // Realtime demodulation mode for AWID26
|
||||||
void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol);
|
void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol);
|
||||||
void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol);
|
void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol);
|
||||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an ioProx card to T5557/T5567
|
void CopyIOtoT55x7(uint32_t hi, uint32_t lo); // Clone an ioProx card to T5557/T5567
|
||||||
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
void SimulateTagLowFrequencyBidir(int divisor, int max_bitlen);
|
||||||
void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an HID card to T5557/T5567
|
void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT); // Clone an HID card to T5557/T5567
|
||||||
void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
|
void WriteEM410x(uint32_t card, uint32_t id_hi, uint32_t id_lo);
|
||||||
|
|
|
@ -1113,6 +1113,9 @@ void T55xxWriteBit(int bit) {
|
||||||
// Send T5577 reset command then read stream (see if we can identify the start of the stream)
|
// Send T5577 reset command then read stream (see if we can identify the start of the stream)
|
||||||
void T55xxResetRead(void) {
|
void T55xxResetRead(void) {
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
|
//clear buffer now so it does not interfere with timing later
|
||||||
|
BigBuf_Clear_ext(false);
|
||||||
|
|
||||||
// Set up FPGA, 125kHz
|
// Set up FPGA, 125kHz
|
||||||
LFSetupFPGAForADC(95, true);
|
LFSetupFPGAForADC(95, true);
|
||||||
|
|
||||||
|
@ -1128,7 +1131,7 @@ void T55xxResetRead(void) {
|
||||||
TurnReadLFOn(READ_GAP);
|
TurnReadLFOn(READ_GAP);
|
||||||
|
|
||||||
// Acquisition
|
// Acquisition
|
||||||
doT55x7Acquisition(39999);
|
doT55x7Acquisition(BigBuf_max_traceLen());
|
||||||
|
|
||||||
// Turn the field off
|
// Turn the field off
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); // field off
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); // field off
|
||||||
|
@ -1266,7 +1269,7 @@ void T55xxWakeUp(uint32_t Pwd){
|
||||||
void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
void WriteT55xx(uint32_t *blockdata, uint8_t startblock, uint8_t numblocks) {
|
||||||
// write last block first and config block last (if included)
|
// write last block first and config block last (if included)
|
||||||
for (uint8_t i = numblocks+startblock; i > startblock; i--) {
|
for (uint8_t i = numblocks+startblock; i > startblock; i--) {
|
||||||
Dbprintf("write- Blk: %d, d:%08X",i-1,blockdata[i-1]);
|
//Dbprintf("write- Blk: %d, d:%08X",i-1,blockdata[i-1]);
|
||||||
T55xxWriteBlockExt(blockdata[i-1],i-1,0,0);
|
T55xxWriteBlockExt(blockdata[i-1],i-1,0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1322,7 @@ void CopyHIDtoT55x7(uint32_t hi2, uint32_t hi, uint32_t lo, uint8_t longFMT) {
|
||||||
DbpString("DONE!");
|
DbpString("DONE!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyIOtoT55x7(uint32_t hi, uint32_t lo, uint8_t longFMT) {
|
void CopyIOtoT55x7(uint32_t hi, uint32_t lo) {
|
||||||
uint32_t data[] = {T55x7_BITRATE_RF_64 | T55x7_MODULATION_FSK2a | (2 << T55x7_MAXBLOCK_SHIFT), hi, lo};
|
uint32_t data[] = {T55x7_BITRATE_RF_64 | T55x7_MODULATION_FSK2a | (2 << T55x7_MAXBLOCK_SHIFT), hi, lo};
|
||||||
|
|
||||||
LED_D_ON();
|
LED_D_ON();
|
||||||
|
|
|
@ -255,7 +255,7 @@ uint32_t SnoopLF()
|
||||||
**/
|
**/
|
||||||
void doT55x7Acquisition(size_t sample_size) {
|
void doT55x7Acquisition(size_t sample_size) {
|
||||||
|
|
||||||
#define T55xx_READ_UPPER_THRESHOLD 128+40 // 50
|
#define T55xx_READ_UPPER_THRESHOLD 128+40 // 40 grph
|
||||||
#define T55xx_READ_TOL 5
|
#define T55xx_READ_TOL 5
|
||||||
|
|
||||||
uint8_t *dest = BigBuf_get_addr();
|
uint8_t *dest = BigBuf_get_addr();
|
||||||
|
@ -264,8 +264,6 @@ void doT55x7Acquisition(size_t sample_size) {
|
||||||
if ( bufsize > sample_size )
|
if ( bufsize > sample_size )
|
||||||
bufsize = sample_size;
|
bufsize = sample_size;
|
||||||
|
|
||||||
//memset(dest, 0, bufsize);
|
|
||||||
|
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
bool startFound = false;
|
bool startFound = false;
|
||||||
bool highFound = false;
|
bool highFound = false;
|
||||||
|
@ -282,7 +280,7 @@ void doT55x7Acquisition(size_t sample_size) {
|
||||||
curSample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
curSample = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||||
LED_D_OFF();
|
LED_D_OFF();
|
||||||
|
|
||||||
// find first high sample
|
// skip until the first high sample above threshold
|
||||||
if (!startFound && curSample > T55xx_READ_UPPER_THRESHOLD) {
|
if (!startFound && curSample > T55xx_READ_UPPER_THRESHOLD) {
|
||||||
if (curSample > firstSample)
|
if (curSample > firstSample)
|
||||||
firstSample = curSample;
|
firstSample = curSample;
|
||||||
|
@ -292,15 +290,17 @@ void doT55x7Acquisition(size_t sample_size) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip until samples begin to change
|
// skip until first high samples begin to change
|
||||||
if (startFound || curSample < firstSample-T55xx_READ_TOL){
|
if (startFound || curSample < firstSample-T55xx_READ_TOL){
|
||||||
if (!startFound)
|
// if just found start - recover last sample
|
||||||
|
if (!startFound) {
|
||||||
dest[i++] = firstSample;
|
dest[i++] = firstSample;
|
||||||
startFound = true;
|
startFound = true;
|
||||||
|
}
|
||||||
|
// collect samples
|
||||||
dest[i++] = curSample;
|
dest[i++] = curSample;
|
||||||
if (i >= bufsize-1) break;
|
if (i >= bufsize-1) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//skipCnt++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,13 @@
|
||||||
// Default configuration
|
// Default configuration
|
||||||
t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00};
|
t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00};
|
||||||
|
|
||||||
|
t55xx_conf_block_t Get_t55xx_Config(){
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
void Set_t55xx_Config(t55xx_conf_block_t conf){
|
||||||
|
config = conf;
|
||||||
|
}
|
||||||
|
|
||||||
int usage_t55xx_config(){
|
int usage_t55xx_config(){
|
||||||
PrintAndLog("Usage: lf t55xx config [d <demodulation>] [i 1] [o <offset>]");
|
PrintAndLog("Usage: lf t55xx config [d <demodulation>] [i 1] [o <offset>]");
|
||||||
PrintAndLog("Options:");
|
PrintAndLog("Options:");
|
||||||
|
@ -533,7 +540,7 @@ bool tryDetectModulation(){
|
||||||
bool testModulation(uint8_t mode, uint8_t modread){
|
bool testModulation(uint8_t mode, uint8_t modread){
|
||||||
switch( mode ){
|
switch( mode ){
|
||||||
case DEMOD_FSK:
|
case DEMOD_FSK:
|
||||||
if (modread > 3 && modread < 8) return TRUE;
|
if (modread >= DEMOD_FSK1 && modread <= DEMOD_FSK2a) return TRUE;
|
||||||
break;
|
break;
|
||||||
case DEMOD_ASK:
|
case DEMOD_ASK:
|
||||||
if (modread == DEMOD_ASK) return TRUE;
|
if (modread == DEMOD_ASK) return TRUE;
|
||||||
|
@ -1175,7 +1182,7 @@ int CmdResetRead(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t got[39999];
|
uint8_t got[BIGBUF_SIZE-1];
|
||||||
GetFromBigBuf(got,sizeof(got),0);
|
GetFromBigBuf(got,sizeof(got),0);
|
||||||
WaitForResponse(CMD_ACK,NULL);
|
WaitForResponse(CMD_ACK,NULL);
|
||||||
setGraphBuf(got, sizeof(got));
|
setGraphBuf(got, sizeof(got));
|
||||||
|
@ -1187,12 +1194,12 @@ static command_t CommandTable[] =
|
||||||
{"help", CmdHelp, 1, "This help"},
|
{"help", CmdHelp, 1, "This help"},
|
||||||
{"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"},
|
{"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"},
|
||||||
{"detect", CmdT55xxDetect, 0, "[1] Try detecting the tag modulation from reading the configuration block."},
|
{"detect", CmdT55xxDetect, 0, "[1] Try detecting the tag modulation from reading the configuration block."},
|
||||||
{"read", CmdT55xxReadBlock, 0, "b <block> p [password] [o] [1] -- Read T55xx block data (page 0) [optional password]"},
|
{"read", CmdT55xxReadBlock, 0, "b <block> p [password] [o] [1] -- Read T55xx block data. Optional [p password], [override], [page1]"},
|
||||||
{"resetread",CmdResetRead, 0, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)"},
|
{"resetread",CmdResetRead, 0, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)"},
|
||||||
{"write", CmdT55xxWriteBlock,0, "b <block> d <data> p [password] [1] -- Write T55xx block data (page 0) [optional password]"},
|
{"write", CmdT55xxWriteBlock,0, "b <block> d <data> p [password] [1] -- Write T55xx block data. Optional [p password], [page1]"},
|
||||||
{"trace", CmdT55xxReadTrace, 0, "[1] Show T55xx traceability data (page 1/ blk 0-1)"},
|
{"trace", CmdT55xxReadTrace, 0, "[1] Show T55xx traceability data (page 1/ blk 0-1)"},
|
||||||
{"info", CmdT55xxInfo, 0, "[1] Show T55xx configuration data (page 0/ blk 0)"},
|
{"info", CmdT55xxInfo, 0, "[1] Show T55xx configuration data (page 0/ blk 0)"},
|
||||||
{"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. [optional password]"},
|
{"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. Optional [password], [override]"},
|
||||||
{"special", special, 0, "Show block changes with 64 different offsets"},
|
{"special", special, 0, "Show block changes with 64 different offsets"},
|
||||||
{"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"},
|
{"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
|
|
|
@ -39,6 +39,9 @@ typedef struct {
|
||||||
RF_128 = 0x07,
|
RF_128 = 0x07,
|
||||||
} bitrate;
|
} bitrate;
|
||||||
} t55xx_conf_block_t;
|
} t55xx_conf_block_t;
|
||||||
|
t55xx_conf_block_t Get_t55xx_Config();
|
||||||
|
void Set_t55xx_Config(t55xx_conf_block_t conf);
|
||||||
|
|
||||||
|
|
||||||
int CmdLFT55XX(const char *Cmd);
|
int CmdLFT55XX(const char *Cmd);
|
||||||
int CmdT55xxSetConfig(const char *Cmd);
|
int CmdT55xxSetConfig(const char *Cmd);
|
||||||
|
|
|
@ -27,7 +27,6 @@ uint8_t detectFSKClk(uint8_t *BitStream, size_t size, uint8_t fcHigh, uint8_t f
|
||||||
int DetectNRZClock(uint8_t dest[], size_t size, int clock);
|
int DetectNRZClock(uint8_t dest[], size_t size, int clock);
|
||||||
int DetectPSKClock(uint8_t dest[], size_t size, int clock);
|
int DetectPSKClock(uint8_t dest[], size_t size, int clock);
|
||||||
int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low);
|
int DetectStrongAskClock(uint8_t dest[], size_t size, uint8_t high, uint8_t low);
|
||||||
uint8_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *hi, uint64_t *lo);
|
|
||||||
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
int fskdemod(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow);
|
||||||
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
int getHiLo(uint8_t *BitStream, size_t size, int *high, int *low, uint8_t fuzzHi, uint8_t fuzzLo);
|
||||||
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
uint32_t manchesterEncode2Bytes(uint16_t datain);
|
||||||
|
@ -42,13 +41,14 @@ void psk1TOpsk2(uint8_t *BitStream, size_t size);
|
||||||
size_t removeParity(uint8_t *BitStream, size_t startIdx, uint8_t pLen, uint8_t pType, size_t bLen);
|
size_t removeParity(uint8_t *BitStream, size_t startIdx, uint8_t pLen, uint8_t pType, size_t bLen);
|
||||||
|
|
||||||
//tag specific
|
//tag specific
|
||||||
int FDXBdemodBI(uint8_t *dest, size_t *size);
|
|
||||||
int AWIDdemodFSK(uint8_t *dest, size_t *size);
|
int AWIDdemodFSK(uint8_t *dest, size_t *size);
|
||||||
|
uint8_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx, uint32_t *hi, uint64_t *lo);
|
||||||
|
int FDXBdemodBI(uint8_t *dest, size_t *size);
|
||||||
int gProxII_Demod(uint8_t BitStream[], size_t *size);
|
int gProxII_Demod(uint8_t BitStream[], size_t *size);
|
||||||
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
||||||
int IOdemodFSK(uint8_t *dest, size_t size);
|
int IOdemodFSK(uint8_t *dest, size_t size);
|
||||||
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert);
|
int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert);
|
||||||
int PyramiddemodFSK(uint8_t *dest, size_t *size);
|
|
||||||
int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo);
|
||||||
|
int PyramiddemodFSK(uint8_t *dest, size_t *size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue