mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
chf: lf asksim - uses NG
This commit is contained in:
parent
98b75e43a5
commit
e727fe5818
14 changed files with 162 additions and 62 deletions
|
@ -712,16 +712,29 @@ int CmdLFaskSim(const char *Cmd) {
|
|||
if (encoding == 0) clk /= 2; //askraw needs to double the clock speed
|
||||
|
||||
size_t size = DemodBufferLen;
|
||||
if (size > PM3_CMD_DATA_SIZE) {
|
||||
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, PM3_CMD_DATA_SIZE);
|
||||
size = PM3_CMD_DATA_SIZE;
|
||||
if (size > (PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t))) {
|
||||
PrintAndLogEx(NORMAL, "DemodBuffer too long for current implementation - length: %d - max: %d", size, PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t));
|
||||
size = PM3_CMD_DATA_SIZE - sizeof(lf_asksim_t);
|
||||
}
|
||||
|
||||
PrintAndLogEx(NORMAL, "preparing to sim ask data: %d bits", size);
|
||||
|
||||
lf_asksim_t *payload = calloc(1, sizeof(lf_asksim_t) + size);
|
||||
payload->encoding = encoding;
|
||||
payload->invert = invert;
|
||||
payload->separator = separator;
|
||||
payload->clock = clk;
|
||||
memcpy(payload->data, DemodBuffer, size);
|
||||
|
||||
PrintAndLogEx(INFO, "Simulating");
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandOLD(CMD_ASK_SIM_TAG, clk << 8 | encoding, invert << 8 | separator, size, DemodBuffer, size);
|
||||
SendCommandNG(CMD_ASK_SIM_TAG, (uint8_t *)payload, sizeof(lf_asksim_t) + size);
|
||||
free(payload);
|
||||
|
||||
PacketResponseNG resp;
|
||||
WaitForResponse(CMD_ASK_SIM_TAG, &resp);
|
||||
|
||||
PrintAndLogEx(INFO, "Done");
|
||||
if (resp.status != PM3_EOPABORTED)
|
||||
return resp.status;
|
||||
return PM3_SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue