chg: lf simfsk\nlf paradox sim\nlf awid sim\n\lf ioprox sim\nlf pyramid sim - NG

This commit is contained in:
iceman1001 2019-05-23 17:07:12 -04:00
commit c13e2f09a1
7 changed files with 80 additions and 45 deletions

View file

@ -109,8 +109,15 @@ static int sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, uin
uint8_t clk = 50, high = 10, low = 8, invert = 1;
lf_fsksim_t *payload = calloc(1, sizeof(lf_fsksim_t) + bs_len);
payload->fchigh = high;
payload->fclow = low;
payload->separator = invert;
payload->clock = clk;
memcpy(payload->data, bits, bs_len);
clearCommandBuffer();
SendCommandOLD(CMD_FSK_SIM_TAG, (high << 8) + low, (invert << 8) + clk, bs_len, bits, bs_len);
SendCommandNG(CMD_FSK_SIM_TAG, (uint8_t *)payload, sizeof(lf_fsksim_t) + bs_len);
msleep(delay);
return sendPing();
@ -313,8 +320,8 @@ static int CmdAWIDRead(const char *Cmd) {
static int CmdAWIDSim(const char *Cmd) {
uint32_t fc = 0, cn = 0;
uint8_t fmtlen = 0;
uint8_t bits[96];
memset(bits, 0x00, sizeof(bits));
uint8_t bs[96];
memset(bs, 0x00, sizeof(bs));
char cmdp = param_getchar(Cmd, 0);
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') return usage_lf_awid_sim();
@ -329,7 +336,7 @@ static int CmdAWIDSim(const char *Cmd) {
PrintAndLogEx(SUCCESS, "Simulating AWID %u -- FC: %u; CN: %u\n", fmtlen, fc, cn);
PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation or run another command");
if ( getAWIDBits(fmtlen, fc, cn, bits) != PM3_SUCCESS ) {
if ( getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS ) {
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
return PM3_ESOFT;
}
@ -340,10 +347,20 @@ static int CmdAWIDSim(const char *Cmd) {
// arg1 --- fcHigh<<8 + fcLow
// arg2 --- Inversion and clk setting
// 96 --- Bitstream length: 96-bits == 12 bytes
lf_fsksim_t *payload = calloc(1, sizeof(lf_fsksim_t) + sizeof(bs));
payload->fchigh = high;
payload->fclow = low;
payload->separator = invert;
payload->clock = clk;
memcpy(payload->data, bs, sizeof(bs));
clearCommandBuffer();
SendCommandOLD(CMD_FSK_SIM_TAG, (high << 8) + low, (invert << 8) + clk, sizeof(bits), bits, sizeof(bits));
SendCommandNG(CMD_FSK_SIM_TAG, (uint8_t *)payload, sizeof(lf_fsksim_t) + sizeof(bs));
PacketResponseNG resp;
WaitForResponse(CMD_FSK_SIM_TAG, &resp);
PrintAndLogEx(INFO, "Done");
if (resp.status != PM3_EOPABORTED)
return resp.status;
return PM3_SUCCESS;