lf em 410x brute - now works without pressing enter every time to continue one step
This commit is contained in:
@@ -730,40 +730,8 @@ static void ChkBitstream(void) {
|
||||
}
|
||||
}
|
||||
|
||||
//Attempt to simulate any wave in buffer (one bit per output sample)
|
||||
// converts GraphBuffer to bitstream (based on zero crossings) if needed.
|
||||
int CmdLFSim(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf sim",
|
||||
"Simulate low frequency tag from graphbuffer\n"
|
||||
"Use " _YELLOW_("`lf config`") _CYAN_(" to set parameters"),
|
||||
"lf sim\n"
|
||||
"lf sim --gap 240 --> start simulating with 240ms gap"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_u64_0("g", "gap", "<ms>", "start gap in microseconds"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
uint16_t gap = arg_get_u32_def(ctx, 1, 0);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (session.pm3_present == false) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: no proxmark present");
|
||||
return PM3_ENOTTY;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
if (GraphTraceLen < 20) {
|
||||
PrintAndLogEx(ERR, "No data in Graphbuffer");
|
||||
return PM3_ENODATA;
|
||||
}
|
||||
|
||||
// convert to bitstream if necessary
|
||||
ChkBitstream();
|
||||
|
||||
// Uploads GraphBuffer to device, in order to be used for LF SIM.
|
||||
int lfsim_upload_gb(void) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Uploading %zu bytes", GraphTraceLen);
|
||||
|
||||
struct pupload {
|
||||
@@ -802,9 +770,48 @@ int CmdLFSim(const char *Cmd) {
|
||||
PrintAndLogEx(NORMAL, "." NOLF);
|
||||
payload_up.flag = 0;
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
// Disable fast mode before last command
|
||||
conn.block_after_ACK = false;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
//Attempt to simulate any wave in buffer (one bit per output sample)
|
||||
// converts GraphBuffer to bitstream (based on zero crossings) if needed.
|
||||
int CmdLFSim(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf sim",
|
||||
"Simulate low frequency tag from graphbuffer\n"
|
||||
"Use " _YELLOW_("`lf config`") _CYAN_(" to set parameters"),
|
||||
"lf sim\n"
|
||||
"lf sim --gap 240 --> start simulating with 240ms gap"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_u64_0("g", "gap", "<ms>", "start gap in microseconds"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
uint16_t gap = arg_get_u32_def(ctx, 1, 0);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (session.pm3_present == false) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: no proxmark present");
|
||||
return PM3_ENOTTY;
|
||||
}
|
||||
|
||||
// sanity check
|
||||
if (GraphTraceLen < 20) {
|
||||
PrintAndLogEx(ERR, "No data in Graphbuffer");
|
||||
return PM3_ENODATA;
|
||||
}
|
||||
|
||||
// convert to bitstream if necessary
|
||||
ChkBitstream();
|
||||
|
||||
lfsim_upload_gb();
|
||||
|
||||
struct p {
|
||||
uint16_t len;
|
||||
|
||||
@@ -36,6 +36,6 @@ int lf_read(bool verbose, uint32_t samples);
|
||||
int lf_sniff(bool verbose, uint32_t samples);
|
||||
int lf_config(sample_config *config);
|
||||
int lf_getconfig(sample_config *config);
|
||||
|
||||
int lfsim_upload_gb(void);
|
||||
int lfsim_wait_check(uint32_t cmd);
|
||||
#endif
|
||||
|
||||
@@ -536,7 +536,7 @@ static int CmdEM410xBrute(const char *Cmd) {
|
||||
for (uint32_t c = 0; c < uidcnt; ++c) {
|
||||
if (kbd_enter_pressed()) {
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
PrintAndLogEx(INFO, "\nAborted via keyboard!\n");
|
||||
PrintAndLogEx(INFO, "Aborted via keyboard!\n");
|
||||
free(uidblock);
|
||||
return PM3_EOPABORTED;
|
||||
}
|
||||
@@ -549,8 +549,28 @@ static int CmdEM410xBrute(const char *Cmd) {
|
||||
);
|
||||
|
||||
em410x_construct_emul_graph(testuid, clk);
|
||||
CmdLFSim("");
|
||||
msleep(delay);
|
||||
|
||||
lfsim_upload_gb();
|
||||
|
||||
struct p {
|
||||
uint16_t len;
|
||||
uint16_t gap;
|
||||
} PACKED payload;
|
||||
payload.len = GraphTraceLen;
|
||||
payload.gap = 0;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_LF_SIMULATE, &resp, delay)) {
|
||||
if (resp.status == PM3_EOPABORTED) {
|
||||
PrintAndLogEx(INFO, "Button pressed, user aborted");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// msleep(delay);
|
||||
}
|
||||
free(uidblock);
|
||||
return PM3_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user