mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
yes
This commit is contained in:
commit
0efbf2b9ad
6 changed files with 124 additions and 16 deletions
|
@ -357,7 +357,8 @@ This project uses the changelog in accordance with [keepchangelog](http://keepac
|
|||
- Fix T55xx config getting displayed when using password when no password needed on read. (@mwalker33)
|
||||
- Fix `em 4x05_dump` to print all blocks read (@mwalker33)
|
||||
- Added save to .eml and .bin for `em 4x05_dump` (@mwalker33)
|
||||
|
||||
- Added `s` <samples to skip> to `lf config` / `lf sniff` to skip samples when sniffing based on same option in Proxmark/proxmark3 by @marshmellow42. (@mwalker33)
|
||||
|
||||
### Fixed
|
||||
- Changed driver file proxmark3.inf to support both old and new Product/Vendor IDs (@pwpiwi)
|
||||
- Changed start sequence in Qt mode (fix: short commands hangs main Qt thread) (@merlokk)
|
||||
|
|
|
@ -24,7 +24,7 @@ Default LF config is set to:
|
|||
divisor = 95 (125kHz)
|
||||
trigger_threshold = 0
|
||||
*/
|
||||
sample_config config = { 1, 8, 1, 95, 0 } ;
|
||||
sample_config config = { 1, 8, 1, 95, 0, 0 } ;
|
||||
|
||||
void printConfig() {
|
||||
DbpString(_BLUE_("LF Sampling config"));
|
||||
|
@ -33,6 +33,7 @@ void printConfig() {
|
|||
Dbprintf(" [d] decimation..........%d", config.decimation);
|
||||
Dbprintf(" [a] averaging...........%s", (config.averaging) ? "Yes" : "No");
|
||||
Dbprintf(" [t] trigger threshold...%d", config.trigger_threshold);
|
||||
Dbprintf(" [s] samples to skip.....%d ", config.samples_to_skip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,9 @@ void setSamplingConfig(sample_config *sc) {
|
|||
if (sc->divisor != 0) config.divisor = sc->divisor;
|
||||
if (sc->bits_per_sample != 0) config.bits_per_sample = sc->bits_per_sample;
|
||||
if (sc->trigger_threshold != -1) config.trigger_threshold = sc->trigger_threshold;
|
||||
// if (sc->samples_to_skip == 0xffffffff) // if needed to not update if not supplied
|
||||
|
||||
config.samples_to_skip = sc->samples_to_skip;
|
||||
config.decimation = (sc->decimation != 0) ? sc->decimation : 1;
|
||||
config.averaging = sc->averaging;
|
||||
if (config.bits_per_sample > 8) config.bits_per_sample = 8;
|
||||
|
@ -124,7 +127,7 @@ void LFSetupFPGAForADC(int divisor, bool lf_field) {
|
|||
* @param silent - is true, now outputs are made. If false, dbprints the status
|
||||
* @return the number of bits occupied by the samples.
|
||||
*/
|
||||
uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averaging, int trigger_threshold, bool silent, int bufsize, uint32_t cancel_after) {
|
||||
uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averaging, int trigger_threshold, bool silent, int bufsize, uint32_t cancel_after, uint32_t samples_to_skip) {
|
||||
|
||||
uint8_t *dest = BigBuf_get_addr();
|
||||
bufsize = (bufsize > 0 && bufsize < BigBuf_max_traceLen()) ? bufsize : BigBuf_max_traceLen();
|
||||
|
@ -176,6 +179,12 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
}
|
||||
|
||||
trigger_threshold = 0;
|
||||
|
||||
if (samples_to_skip > 0) {
|
||||
samples_to_skip--;
|
||||
continue;
|
||||
}
|
||||
|
||||
sample_total_numbers++;
|
||||
|
||||
if (averaging)
|
||||
|
@ -196,6 +205,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
|
||||
// store the sample
|
||||
sample_total_saved ++;
|
||||
|
||||
if (bits_per_sample == 8) {
|
||||
dest[sample_total_saved - 1] = sample;
|
||||
|
||||
|
@ -238,7 +248,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint32_t bits_per_sample, bool averag
|
|||
* @return number of bits sampled
|
||||
*/
|
||||
uint32_t DoAcquisition_default(int trigger_threshold, bool silent) {
|
||||
return DoAcquisition(1, 8, 0, trigger_threshold, silent, 0, 0);
|
||||
return DoAcquisition(1, 8, 0, trigger_threshold, silent, 0, 0, 0);
|
||||
}
|
||||
uint32_t DoAcquisition_config(bool silent, int sample_size) {
|
||||
return DoAcquisition(config.decimation
|
||||
|
@ -247,11 +257,12 @@ uint32_t DoAcquisition_config(bool silent, int sample_size) {
|
|||
, config.trigger_threshold
|
||||
, silent
|
||||
, sample_size
|
||||
, 0);
|
||||
, 0
|
||||
, config.samples_to_skip);
|
||||
}
|
||||
|
||||
uint32_t DoPartialAcquisition(int trigger_threshold, bool silent, int sample_size, uint32_t cancel_after) {
|
||||
return DoAcquisition(1, 8, 0, trigger_threshold, silent, sample_size, cancel_after);
|
||||
return DoAcquisition(1, 8, 0, trigger_threshold, silent, sample_size, cancel_after, 0);
|
||||
}
|
||||
|
||||
uint32_t ReadLF(bool activeField, bool silent, int sample_size) {
|
||||
|
|
|
@ -2243,7 +2243,7 @@ static command_t CommandTable[] = {
|
|||
{"tune", CmdTuneSamples, IfPm3Present, "Get hw tune samples for graph window"},
|
||||
{"undec", CmdUndec, AlwaysAvailable, "Un-decimate samples by 2"},
|
||||
{"zerocrossings", CmdZerocrossings, AlwaysAvailable, "Count time between zero-crossings"},
|
||||
{"iir", CmdDataIIR, IfPm3Present, "apply IIR buttersworth filter on plotdata"},
|
||||
{"iir", CmdDataIIR, AlwaysAvailable, "apply IIR buttersworth filter on plotdata"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -105,14 +105,15 @@ static int usage_lf_sniff(void) {
|
|||
static int usage_lf_config(void) {
|
||||
PrintAndLogEx(NORMAL, "Usage: lf config [h] [H|<divisor>] [b <bps>] [d <decim>] [a 0|1]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h This help");
|
||||
PrintAndLogEx(NORMAL, " L Low frequency (125 kHz)");
|
||||
PrintAndLogEx(NORMAL, " H High frequency (134 kHz)");
|
||||
PrintAndLogEx(NORMAL, " q <divisor> Manually set divisor. 88-> 134 kHz, 95-> 125 kHz");
|
||||
PrintAndLogEx(NORMAL, " b <bps> Sets resolution of bits per sample. Default (max): 8");
|
||||
PrintAndLogEx(NORMAL, " d <decim> Sets decimation. A value of N saves only 1 in N samples. Default: 1");
|
||||
PrintAndLogEx(NORMAL, " a [0|1] Averaging - if set, will average the stored sample value when decimating. Default: 1");
|
||||
PrintAndLogEx(NORMAL, " t <threshold> Sets trigger threshold. 0 means no threshold (range: 0-128)");
|
||||
PrintAndLogEx(NORMAL, " h This help");
|
||||
PrintAndLogEx(NORMAL, " L Low frequency (125 kHz)");
|
||||
PrintAndLogEx(NORMAL, " H High frequency (134 kHz)");
|
||||
PrintAndLogEx(NORMAL, " q <divisor> Manually set divisor. 88-> 134 kHz, 95-> 125 kHz");
|
||||
PrintAndLogEx(NORMAL, " b <bps> Sets resolution of bits per sample. Default (max): 8");
|
||||
PrintAndLogEx(NORMAL, " d <decim> Sets decimation. A value of N saves only 1 in N samples. Default: 1");
|
||||
PrintAndLogEx(NORMAL, " a [0|1] Averaging - if set, will average the stored sample value when decimating. Default: 1");
|
||||
PrintAndLogEx(NORMAL, " t <threshold> Sets trigger threshold. 0 means no threshold (range: 0-128)");
|
||||
PrintAndLogEx(NORMAL, " s <samplestoskip> Sets a number of samples to skip before capture. Default: 0");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " lf config b 8 L");
|
||||
PrintAndLogEx(NORMAL, " Samples at 125 kHz, 8bps.");
|
||||
|
@ -399,6 +400,8 @@ int CmdLFSetConfig(const char *Cmd) {
|
|||
bool errors = false;
|
||||
int trigger_threshold = -1;//Means no change
|
||||
uint8_t unsigned_trigg = 0;
|
||||
uint32_t samples_to_skip = 0; // will return offset to 0 if not supplied. Could set to 0xffffffff if needed to not update
|
||||
|
||||
|
||||
uint8_t cmdp = 0;
|
||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||
|
@ -437,6 +440,10 @@ int CmdLFSetConfig(const char *Cmd) {
|
|||
averaging = param_getchar(Cmd, cmdp + 1) == '1';
|
||||
cmdp += 2;
|
||||
break;
|
||||
case 's':
|
||||
samples_to_skip = param_get32ex(Cmd, cmdp + 1, 0, 10);
|
||||
cmdp+=2;
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
||||
errors = 1;
|
||||
|
@ -450,7 +457,7 @@ int CmdLFSetConfig(const char *Cmd) {
|
|||
//Bps is limited to 8
|
||||
if (bps >> 4) bps = 8;
|
||||
|
||||
sample_config config = { decimation, bps, averaging, divisor, trigger_threshold };
|
||||
sample_config config = { decimation, bps, averaging, divisor, trigger_threshold, samples_to_skip };
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_SAMPLING_SET_CONFIG, (uint8_t *)&config, sizeof(sample_config));
|
||||
|
|
|
@ -167,6 +167,20 @@ static int usage_lf_em4x05_dump(void) {
|
|||
PrintAndLogEx(NORMAL, " lf em 4x50_dump f card1 11223344");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_lf_em4x05_wipe(void) {
|
||||
PrintAndLogEx(NORMAL, "Wipe EM4x05/EM4x69. Tag must be on antenna. ");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Usage: lf em 4x05_wipe [h] <pwd>");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h - this help");
|
||||
PrintAndLogEx(NORMAL, " c - chip type : 0 em4205");
|
||||
PrintAndLogEx(NORMAL, " 1 em4305 (default)");
|
||||
PrintAndLogEx(NORMAL, " pwd - password (hex) (optional)");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, " lf em 4x05_wipe");
|
||||
PrintAndLogEx(NORMAL, " lf em 4x05_wipe 11223344");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_lf_em4x05_read(void) {
|
||||
PrintAndLogEx(NORMAL, "Read EM4x05/EM4x69. Tag must be on antenna. ");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
@ -1425,6 +1439,79 @@ static int CmdEM4x05Write(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "Write could " _RED_("not") "be verified");
|
||||
return status;
|
||||
}
|
||||
static int CmdEM4x05Wipe(const char *Cmd) {
|
||||
uint8_t addr = 0;
|
||||
uint32_t pwd = 0;
|
||||
uint8_t cmdp = 0;
|
||||
uint8_t chipType = 1; // em4305
|
||||
uint32_t chipInfo = 0x00040072; // Chip info/User Block normal 4305 Chip Type
|
||||
uint32_t chipUID = 0x614739AE; // UID normally readonly, but just in case
|
||||
uint32_t blockData = 0x00000000; // UserBlock/Password (set to 0x00000000 for a wiped card1
|
||||
uint32_t config = 0x0001805F; // Default config (no password)
|
||||
int success = PM3_SUCCESS;
|
||||
char cmdStr [100];
|
||||
char optchk[10];
|
||||
|
||||
while (param_getchar(Cmd, cmdp) != 0x00) {
|
||||
// check if cmd is a 1 byte option
|
||||
param_getstr(Cmd, cmdp,optchk,sizeof(optchk));
|
||||
if (strlen (optchk) == 1) {// Have a single character so option not part of password
|
||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||
case 'c': // chip type
|
||||
if (param_getchar(Cmd, cmdp) != 0x00)
|
||||
chipType = param_get8ex (Cmd,cmdp+1,0,10);
|
||||
cmdp+=2;
|
||||
break;
|
||||
case 'h': // return usage_lf_em4x05_wipe();
|
||||
default : // Unknown or 'h' send help
|
||||
return usage_lf_em4x05_wipe();
|
||||
break;
|
||||
};
|
||||
} else { // Not a single character so assume password
|
||||
pwd = param_get32ex(Cmd, cmdp, 1, 16);
|
||||
cmdp++;
|
||||
}
|
||||
}
|
||||
|
||||
switch (chipType) {
|
||||
case 0 : // em4205
|
||||
chipInfo = 0x00040070;
|
||||
config = 0x0001805F;
|
||||
break;
|
||||
case 1 : // em4305
|
||||
chipInfo = 0x00040072;
|
||||
config = 0x0001805F;
|
||||
break;
|
||||
default : // Type 0/Default : EM4305
|
||||
chipInfo = 0x00040072;
|
||||
config = 0x0001805F;
|
||||
}
|
||||
|
||||
// block 0 : User Data or Chip Info
|
||||
sprintf (cmdStr,"%d %08X %08X",0,chipInfo,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
// block 1 : UID - this should be read only for EM4205 and EM4305 not sure about others
|
||||
sprintf (cmdStr,"%d %08X %08X",1,chipUID,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
// block 2 : password
|
||||
sprintf (cmdStr,"%d %08X %08X",2,blockData,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
pwd = blockData; // Password should now have changed, so use new password
|
||||
// block 3 : user data
|
||||
sprintf (cmdStr,"%d %08X %08X",3,blockData,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
// block 4 : config
|
||||
sprintf (cmdStr,"%d %08X %08X",4,config,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
|
||||
// Remainder of user/data blocks
|
||||
for (addr = 5; addr < 14; addr++) {// Clear user data blocks
|
||||
sprintf (cmdStr,"%d %08X %08X",addr,blockData,pwd);
|
||||
CmdEM4x05Write (cmdStr);
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
static void printEM4x05config(uint32_t wordData) {
|
||||
uint16_t datarate = (((wordData & 0x3F) + 1) * 2);
|
||||
|
@ -1660,6 +1747,7 @@ static command_t CommandTable[] = {
|
|||
|
||||
{"4x05_demod", CmdEM4x05Demod, AlwaysAvailable, "demodulate a EM4x05/EM4x69 tag from the GraphBuffer"},
|
||||
{"4x05_dump", CmdEM4x05Dump, IfPm3Lf, "dump EM4x05/EM4x69 tag"},
|
||||
{"4x05_wipe", CmdEM4x05Wipe, IfPm3Lf, "wipe EM4x05/EM4x69 tag"},
|
||||
{"4x05_info", CmdEM4x05Info, IfPm3Lf, "tag information EM4x05/EM4x69"},
|
||||
{"4x05_read", CmdEM4x05Read, IfPm3Lf, "read word data from EM4x05/EM4x69"},
|
||||
{"4x05_write", CmdEM4x05Write, IfPm3Lf, "write word data to EM4x05/EM4x69"},
|
||||
|
|
|
@ -118,6 +118,7 @@ typedef struct {
|
|||
bool averaging;
|
||||
int divisor;
|
||||
int trigger_threshold;
|
||||
uint32_t samples_to_skip;
|
||||
} PACKED sample_config;
|
||||
/*
|
||||
typedef struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue