chg: need to free some
This commit is contained in:
@@ -107,17 +107,16 @@ static int sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, uin
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
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;
|
||||
payload->fchigh = 10;
|
||||
payload->fclow = 8;
|
||||
payload->separator = 1;
|
||||
payload->clock = 50;
|
||||
memcpy(payload->data, bits, bs_len);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_FSK_SIM_TAG, (uint8_t *)payload, sizeof(lf_fsksim_t) + bs_len);
|
||||
free(payload);
|
||||
|
||||
msleep(delay);
|
||||
return sendPing();
|
||||
@@ -186,7 +185,7 @@ static int CmdAWIDDemod(const char *Cmd) {
|
||||
size_t size = getFromGraphBuf(bits);
|
||||
if (size == 0) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - AWID not enough samples");
|
||||
return PM3_ESOFT;
|
||||
return PM3_ENODATA;
|
||||
}
|
||||
//get binary from fsk wave
|
||||
int waveIdx = 0;
|
||||
@@ -323,8 +322,8 @@ static int CmdAWIDSim(const char *Cmd) {
|
||||
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();
|
||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
if (strlen(Cmd) == 0 || cmdp == 'h') return usage_lf_awid_sim();
|
||||
|
||||
fmtlen = param_get8(Cmd, 0);
|
||||
fc = param_get32ex(Cmd, 1, 0, 10);
|
||||
@@ -340,22 +339,20 @@ static int CmdAWIDSim(const char *Cmd) {
|
||||
PrintAndLogEx(WARNING, "Error with tag bitstream generation.");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
uint8_t clk = 50, high = 10, low = 8, invert = 1;
|
||||
|
||||
// AWID uses: FSK2a fcHigh: 10, fcLow: 8, clk: 50, invert: 1
|
||||
// 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;
|
||||
payload->fchigh = 10;
|
||||
payload->fclow = 8;
|
||||
payload->separator = 1;
|
||||
payload->clock = 50;
|
||||
memcpy(payload->data, bs, sizeof(bs));
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_FSK_SIM_TAG, (uint8_t *)payload, sizeof(lf_fsksim_t) + sizeof(bs));
|
||||
free(payload);
|
||||
|
||||
PacketResponseNG resp;
|
||||
WaitForResponse(CMD_FSK_SIM_TAG, &resp);
|
||||
|
||||
Reference in New Issue
Block a user