mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
lf cmdread: add -k to keep field on
This commit is contained in:
parent
628766391e
commit
c3864a0ce5
5 changed files with 26 additions and 14 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
||||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||||
|
|
||||||
## [unreleased][unreleased]
|
## [unreleased][unreleased]
|
||||||
|
- Added option `-k` to `lf cmdread` to keep field on (@doegox)
|
||||||
- Added `hf mf acl` - decode and print MIFARE access rights (@iceman1001)
|
- Added `hf mf acl` - decode and print MIFARE access rights (@iceman1001)
|
||||||
- Added for readline, <tab> autocomplete work inside pm3 client (@iceman1001)
|
- Added for readline, <tab> autocomplete work inside pm3 client (@iceman1001)
|
||||||
- Fixed `hf iclass dump` - now uses the right key when suppling credit key (@iceman1001)
|
- Fixed `hf iclass dump` - now uses the right key when suppling credit key (@iceman1001)
|
||||||
|
|
|
@ -823,7 +823,8 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
uint16_t period_1;
|
uint16_t period_1;
|
||||||
uint8_t symbol_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
uint8_t symbol_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
||||||
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
||||||
uint32_t samples : 31;
|
uint32_t samples : 30;
|
||||||
|
bool keep : 1;
|
||||||
bool verbose : 1;
|
bool verbose : 1;
|
||||||
} PACKED;
|
} PACKED;
|
||||||
struct p *payload = (struct p *)packet->data.asBytes;
|
struct p *payload = (struct p *)packet->data.asBytes;
|
||||||
|
@ -831,7 +832,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
||||||
memcpy(symbol_extra, payload->symbol_extra, sizeof(symbol_extra));
|
memcpy(symbol_extra, payload->symbol_extra, sizeof(symbol_extra));
|
||||||
memcpy(period_extra, payload->period_extra, sizeof(period_extra));
|
memcpy(period_extra, payload->period_extra, sizeof(period_extra));
|
||||||
ModThenAcquireRawAdcSamples125k(payload->delay, payload->period_0, payload->period_1, symbol_extra, period_extra, packet->data.asBytes + sizeof(struct p), payload->verbose, payload->samples, true);
|
ModThenAcquireRawAdcSamples125k(payload->delay, payload->period_0, payload->period_1, symbol_extra, period_extra, packet->data.asBytes + sizeof(struct p), payload->verbose, payload->keep, payload->samples, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_LF_SNIFF_RAW_ADC: {
|
case CMD_LF_SNIFF_RAW_ADC: {
|
||||||
|
|
|
@ -383,6 +383,8 @@ void loadT55xxConfig(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool prev_keep = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to do a modulation and then get samples.
|
* Function to do a modulation and then get samples.
|
||||||
* @param delay_off
|
* @param delay_off
|
||||||
|
@ -390,24 +392,26 @@ void loadT55xxConfig(void) {
|
||||||
* @param period_1
|
* @param period_1
|
||||||
* @param command (in binary char array)
|
* @param command (in binary char array)
|
||||||
*/
|
*/
|
||||||
void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint16_t period_0, uint16_t period_1, uint8_t *symbol_extra, uint16_t *period_extra, uint8_t *command, bool verbose, uint32_t samples, bool ledcontrol) {
|
void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint16_t period_0, uint16_t period_1, uint8_t *symbol_extra, uint16_t *period_extra, uint8_t *command, bool verbose, bool keep_field_on, uint32_t samples, bool ledcontrol) {
|
||||||
|
|
||||||
|
if (!prev_keep){
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
|
}
|
||||||
// use lf config settings
|
// use lf config settings
|
||||||
sample_config *sc = getSamplingConfig();
|
sample_config *sc = getSamplingConfig();
|
||||||
|
|
||||||
LFSetupFPGAForADC(sc->divisor, true);
|
LFSetupFPGAForADC(sc->divisor, true);
|
||||||
// this causes the field to turn on for uncontrolled amount of time, so we'll turn it off
|
// this causes the field to turn on for uncontrolled amount of time, so we'll turn it off
|
||||||
|
|
||||||
|
if (!prev_keep){
|
||||||
|
|
||||||
// Make sure the tag is reset
|
// Make sure the tag is reset
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
}
|
||||||
|
|
||||||
// start timer
|
// start timer
|
||||||
StartTicks();
|
StartTicks();
|
||||||
|
|
||||||
WaitMS(100);
|
WaitMS(100);
|
||||||
|
|
||||||
// clear read buffer
|
// clear read buffer
|
||||||
BigBuf_Clear_keep_EM();
|
BigBuf_Clear_keep_EM();
|
||||||
|
|
||||||
|
@ -494,8 +498,10 @@ void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint16_t period_0, uint
|
||||||
DoAcquisition_config(verbose, samples, ledcontrol);
|
DoAcquisition_config(verbose, samples, ledcontrol);
|
||||||
|
|
||||||
// Turn off antenna
|
// Turn off antenna
|
||||||
|
if (!keep_field_on) {
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
}
|
||||||
|
prev_keep = keep_field_on;
|
||||||
// tell client we are done
|
// tell client we are done
|
||||||
reply_ng(CMD_LF_MOD_THEN_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_LF_MOD_THEN_ACQ_RAW_ADC, PM3_SUCCESS, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "pm3_cmd.h" // struct
|
#include "pm3_cmd.h" // struct
|
||||||
|
|
||||||
void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint16_t period_0, uint16_t period_1, uint8_t *symbol_extra, uint16_t *period_extra, uint8_t *command, bool verbose, uint32_t samples, bool ledcontrol);
|
void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint16_t period_0, uint16_t period_1, uint8_t *symbol_extra, uint16_t *period_extra, uint8_t *command, bool verbose, bool keep_field_on, uint32_t samples, bool ledcontrol);
|
||||||
void ReadTItag(bool ledcontrol);
|
void ReadTItag(bool ledcontrol);
|
||||||
void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc, bool ledcontrol);
|
void WriteTItag(uint32_t idhi, uint32_t idlo, uint16_t crc, bool ledcontrol);
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,7 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
arg_u64_0("z", "zero", "<us>", "ZERO time period"),
|
arg_u64_0("z", "zero", "<us>", "ZERO time period"),
|
||||||
arg_u64_0("s", "samples", "<dec>", "number of samples to collect"),
|
arg_u64_0("s", "samples", "<dec>", "number of samples to collect"),
|
||||||
arg_lit0("v", "verbose", "verbose output"),
|
arg_lit0("v", "verbose", "verbose output"),
|
||||||
|
arg_lit0("k", "keep", "keep signal field ON after receive"),
|
||||||
arg_lit0("@", NULL, "continuous mode"),
|
arg_lit0("@", NULL, "continuous mode"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
|
@ -249,7 +250,8 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
uint16_t period_0 = arg_get_u32_def(ctx, 5, 0);
|
uint16_t period_0 = arg_get_u32_def(ctx, 5, 0);
|
||||||
uint32_t samples = arg_get_u32_def(ctx, 6, 0);
|
uint32_t samples = arg_get_u32_def(ctx, 6, 0);
|
||||||
bool verbose = arg_get_lit(ctx, 7);
|
bool verbose = arg_get_lit(ctx, 7);
|
||||||
bool cm = arg_get_lit(ctx, 8);
|
bool keep_field_on = arg_get_lit(ctx, 8);
|
||||||
|
bool cm = arg_get_lit(ctx, 9);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if (g_session.pm3_present == false)
|
if (g_session.pm3_present == false)
|
||||||
|
@ -262,7 +264,8 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
uint16_t period_1;
|
uint16_t period_1;
|
||||||
uint8_t symbol_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
uint8_t symbol_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
||||||
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
uint16_t period_extra[LF_CMDREAD_MAX_EXTRA_SYMBOLS];
|
||||||
uint32_t samples : 31;
|
uint32_t samples : 30;
|
||||||
|
bool keep_field_on : 1;
|
||||||
bool verbose : 1;
|
bool verbose : 1;
|
||||||
uint8_t data[PM3_CMD_DATA_SIZE - PAYLOAD_HEADER_SIZE];
|
uint8_t data[PM3_CMD_DATA_SIZE - PAYLOAD_HEADER_SIZE];
|
||||||
} PACKED payload;
|
} PACKED payload;
|
||||||
|
@ -270,6 +273,7 @@ int CmdLFCommandRead(const char *Cmd) {
|
||||||
payload.period_1 = period_1;
|
payload.period_1 = period_1;
|
||||||
payload.period_0 = period_0;
|
payload.period_0 = period_0;
|
||||||
payload.samples = samples;
|
payload.samples = samples;
|
||||||
|
payload.keep_field_on = keep_field_on;
|
||||||
payload.verbose = verbose;
|
payload.verbose = verbose;
|
||||||
memcpy(payload.data, cmd, cmd_len);
|
memcpy(payload.data, cmd, cmd_len);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue