This commit is contained in:
iceman1001 2021-05-05 21:04:48 +02:00
parent e5320650c9
commit e4f55556ba
26 changed files with 289 additions and 289 deletions

View file

@ -1257,8 +1257,8 @@ static void PacketReceived(PacketCommandNG *packet) {
uint8_t pwd[4];
} PACKED;
struct p *payload = (struct p *) packet->data.asBytes;
DisablePrivacySlixLIso15693(payload->pwd);
break;
DisablePrivacySlixLIso15693(payload->pwd);
break;
}
#endif
@ -1317,8 +1317,8 @@ static void PacketReceived(PacketCommandNG *packet) {
SimulateIso14443bTag(packet->data.asBytes);
break;
}
case CMD_HF_ISO14443B_COMMAND: {
iso14b_raw_cmd_t *payload = (iso14b_raw_cmd_t*)packet->data.asBytes;
case CMD_HF_ISO14443B_COMMAND: {
iso14b_raw_cmd_t *payload = (iso14b_raw_cmd_t *)packet->data.asBytes;
SendRawCommand14443B_Ex(payload);
break;
}
@ -1704,14 +1704,14 @@ static void PacketReceived(PacketCommandNG *packet) {
break;
}
case CMD_HF_ICLASS_CHKKEYS: {
iClass_Authentication_fast((iclass_chk_t*)packet->data.asBytes);
iClass_Authentication_fast((iclass_chk_t *)packet->data.asBytes);
break;
}
case CMD_HF_ICLASS_DUMP: {
iClass_Dump(packet->data.asBytes);
break;
}
case CMD_HF_ICLASS_RESTORE: {
case CMD_HF_ICLASS_RESTORE: {
iClass_Restore((iclass_restore_req_t *)packet->data.asBytes);
break;
}

View file

@ -1546,7 +1546,7 @@ void iClass_Authentication_fast(iclass_chk_t *p) {
Iso15693InitReader();
bool isOK = false;
uint32_t start_time = 0, eof_time = 0;
if (select_iclass_tag(&hdr, p->use_credit_key, &eof_time) == false)
goto out;

View file

@ -2671,7 +2671,7 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
} // else force RATS
if ((sak & 0x20) == 0) Dbprintf("Forcing RATS according to hf 14a config");
// RATS, Request for answer to select
if (no_rats == false) {
uint8_t rats[] = { ISO14443A_CMD_RATS, 0x80, 0x00, 0x00 }; // FSD=256, FSDI=8, CID=0

View file

@ -26,12 +26,12 @@
#include "ticks.h"
#include "iso14b.h" // defines for ETU conversions
/*
/*
* Current timing issues with ISO14443-b implementation
* Proxmark3
* Carrier Frequency 13.56MHz
* Proxmark3
* Carrier Frequency 13.56MHz
* SSP_CLK runs at 13.56MHz / 4 = 3,39MHz
*
*
*
* PROBLEM 1.
* ----------
@ -62,7 +62,7 @@
#define DELAY_ARM_TO_TAG 16
#define DELAY_TAG_TO_ARM 32
// SSP_CLK runs at 13.56MHz / 4 = 3,39MHz when sniffing.
// SSP_CLK runs at 13.56MHz / 4 = 3,39MHz when sniffing.
// All values should be multiples of 16
#define DELAY_TAG_TO_ARM_SNIFF 32
#define DELAY_READER_TO_ARM_SNIFF 32
@ -86,7 +86,7 @@
*
* FWI_max == 2^14 = 16384
* FWT(max) = (256 x 16 / fc) * 16384 == 4949
*
*
* Which gives a maximum Frame Waiting time of FWT(max) == 4949 ms
* FWT(max) in ETU 4949000 / 9.4395 µS = 524286 ETU
*
@ -106,12 +106,12 @@
// Activation frame waiting time
// 512 ETU?
// 65536/fc == 4833 µS or 4.833ms
// SSP_CLK = 4833 µS * 3.39 = 16384
// SSP_CLK = 4833 µS * 3.39 = 16384
#ifndef FWT_TIMEOUT_14B
# define FWT_TIMEOUT_14B (16384)
#endif
#endif
// ETU 14 * 9.4395 µS = 132 µS == 0.132ms
// ETU 14 * 9.4395 µS = 132 µS == 0.132ms
// TR2, counting from start of PICC EOF 14 ETU.
#define DELAY_ISO14443B_PICC_TO_PCD_READER ETU_TO_SSP(14)
#define DELAY_ISO14443B_PCD_TO_PICC_READER ETU_TO_SSP(15)
@ -126,7 +126,7 @@
* TR0 = FWT(1), FWT(2), FWT(3) .. FWT(14)
*
*
* TR0
* TR0
*/
#ifndef ISO14B_TR0
# define ISO14B_TR0 ETU_TO_SSP(32)
@ -140,7 +140,7 @@
// TR0 max is 151/fsc = 151/848kHz = 302us or 64 samples from FPGA
// 32 ETU * 9.4395 µS == 302 µS
// 32 * 8 = 256 sub carrier cycles,
// 256 / 4 = 64 I/Q pairs.
// 256 / 4 = 64 I/Q pairs.
// since 1 I/Q pair after 4 subcarrier cycles at 848kHz subcarrier
#endif
@ -195,16 +195,16 @@ static uint32_t iso14b_timeout = FWT_TIMEOUT_14B;
* Elementary Time Unit (ETU)
* --------------------------
* ETU is used to denotate 1 bit period i.e. how long one bit transfer takes.
*
*
* - 128 Carrier cycles / 13.56MHz = 8 Subcarrier units / 848kHz = 1/106kHz = 9.4395 µS
* - 16 Carrier cycles = 1 Subcarrier unit = 1.17 µS
*
* Definition
* ----------
* 1 ETU = 128 / ( D x fc )
* 1 ETU = 128 / ( D x fc )
* where
* D = divisor. Which inital is 1
* fc = carrier frequency
* fc = carrier frequency
* gives
* 1 ETU = 128 / fc
* 1 ETU = 128 / 13 560 000 = 9.4395 µS
@ -212,7 +212,7 @@ static uint32_t iso14b_timeout = FWT_TIMEOUT_14B;
*
* (note: It seems we are using the subcarrier as base for our time calculations rather than the field clock)
*
* - 1 ETU = 1/106 KHz
* - 1 ETU = 1/106 KHz
* - 1 ETU = 8 subcarrier units ( 8 / 848kHz )
* - 1 ETU = 1 bit period
*
@ -260,14 +260,14 @@ static uint32_t iso14b_timeout = FWT_TIMEOUT_14B;
* let calc how long it takes the reader to send a message
* SOF 10 ETU + 4 data bytes + 2 crc bytes + EOF 2 ETU
* 10 + (4+2 * 10) + 2 = 72 ETU
* 72 * 9.4395 = 680 µS or 0.68 ms
*
* 72 * 9.4395 = 680 µS or 0.68 ms
*
*
* -> TO VERIFY THIS BELOW <-
* --------------------------
* The mode FPGA_MAJOR_MODE_HF_SIMULATOR | FPGA_HF_SIMULATOR_MODULATE_BPSK which we use to simulate tag
* works like this:
* Simulation per definition is "inversed" effect on the reader antenna.
* works like this:
* Simulation per definition is "inversed" effect on the reader antenna.
* - A 1-bit input to the FPGA becomes 8 pulses at 847.5kHz (1.18µS / pulse) == 9.44us
* - A 0-bit input to the FPGA becomes an unmodulated time of 1.18µS or does it become 8 nonpulses for 9.44us
*
@ -278,13 +278,13 @@ static uint32_t iso14b_timeout = FWT_TIMEOUT_14B;
*
* FPGA doesn't seem to work with ETU. It seems to work with pulse / duration instead.
*
* This means that we are using a bit rate of 106 kbit/s, or fc/128.
* This means that we are using a bit rate of 106 kbit/s, or fc/128.
* Oversample by 4, which ought to make things practical for the ARM
* (fc/32, 423.8 kbits/s, ~52 kbytes/s)
*
* We are sampling the signal at FC/32, we are reporting over SSP to PM3 each
*
* Current I/Q pair sampling
* We are sampling the signal at FC/32, we are reporting over SSP to PM3 each
*
* Current I/Q pair sampling
* -------------------------
* Let us report a correlation every 64 samples. I.e.
* 1 I/Q pair after 4 subcarrier cycles for the 848kHz subcarrier,
@ -303,7 +303,7 @@ static uint32_t iso14b_timeout = FWT_TIMEOUT_14B;
*
* sample: 3sec == 3000ms
*
* 13560000 * 1000 / 128 * 3000 == 13560000000 / 384000 ==
* 13560000 * 1000 / 128 * 3000 == 13560000000 / 384000 ==
* 13560000 / 384 = 35312 FWT
*
* 35312 * 9.4395 ==
@ -428,7 +428,7 @@ static void Uart14bInit(uint8_t *data) {
Uart14bReset();
}
// param timeout accepts ETU
// param timeout accepts ETU
static void iso14b_set_timeout(uint32_t timeout_etu) {
uint32_t ssp = ETU_TO_SSP(timeout_etu);
@ -445,7 +445,7 @@ static void iso14b_set_timeout(uint32_t timeout_etu) {
// keep track of FWT, also updates the timeout
static void iso14b_set_fwt(uint8_t fwt) {
iso14b_fwt = fwt;
iso14b_set_timeout( 32 << fwt );
iso14b_set_timeout(32 << fwt);
}
static void iso14b_set_maxframesize(uint16_t size) {
@ -1370,7 +1370,7 @@ static int Get14443bAnswerFromTag(uint8_t *response, uint16_t max_len, uint32_t
break;
}
if (((GetCountSspClkDelta(dma_start_time) ) > timeout) && Demod.state < DEMOD_PHASE_REF_TRAINING) {
if (((GetCountSspClkDelta(dma_start_time)) > timeout) && Demod.state < DEMOD_PHASE_REF_TRAINING) {
ret = -1;
break;
}
@ -1402,7 +1402,7 @@ static void TransmitFor14443b_AsReader(uint32_t *start_time) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SEND_SHALLOW_MOD);
// TR2 minimum 14 ETUs
if (*start_time < ISO14B_TR0) {
// *start_time = DELAY_ARM_TO_TAG;
@ -1562,15 +1562,15 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void
uint32_t save_iso14b_timeout_spp = iso14b_timeout;
// 2 high bits mandatory set to 0b
// byte1 - WTXM [1..59].
// 2 high bits mandatory set to 0b
// byte1 - WTXM [1..59].
uint8_t wtxm = data_bytes[1] & 0x3F;
// command FWT = FWT * WTXM
uint32_t fwt_temp = iso14b_fwt * wtxm;
// temporarily increase timeout
iso14b_set_timeout( (32 << fwt_temp));
iso14b_set_timeout((32 << fwt_temp));
// Transmit WTX back
data_bytes[1] = wtxm;
@ -2176,7 +2176,7 @@ void SendRawCommand14443B_Ex(iso14b_raw_cmd_t *o) {
// receive buffer
uint8_t buf[PM3_CMD_DATA_SIZE];
memset(buf, 0 , sizeof(buf));
memset(buf, 0, sizeof(buf));
if (DBGLEVEL > DBG_DEBUG) {
Dbprintf("14b raw: param, %04x", o->flags);
}

View file

@ -2108,50 +2108,50 @@ void SetTag15693Uid(uint8_t *uid) {
static void init_password_15693_slixl(uint8_t *buffer, uint8_t *pwd, uint8_t *rnd) {
memcpy(buffer, pwd, 4);
if(rnd) {
buffer[0] ^= rnd[0];
buffer[1] ^= rnd[1];
buffer[2] ^= rnd[0];
buffer[3] ^= rnd[1];
}
if (rnd) {
buffer[0] ^= rnd[0];
buffer[1] ^= rnd[1];
buffer[2] ^= rnd[0];
buffer[3] ^= rnd[1];
}
}
static bool get_rnd_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *rnd) {
// 0x04, == NXP from manufacture id list.
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH, ISO15693_GET_RANDOM_NUMBER, 0x04, 0x00, 0x00 };
AddCrc15(c, 3);
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH, ISO15693_GET_RANDOM_NUMBER, 0x04, 0x00, 0x00 };
AddCrc15(c, 3);
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH];
int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 5) {
return false;
}
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH];
int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 5) {
return false;
}
if(rnd) {
memcpy(rnd, &recvbuf[1], 2);
}
return true;
if (rnd) {
memcpy(rnd, &recvbuf[1], 2);
}
return true;
}
static uint32_t set_pass_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t pass_id, uint8_t *password) {
uint8_t rnd[2];
if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT;
}
uint8_t rnd[2];
if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT;
}
// 0x04, == NXP from manufacture id list.
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH, ISO15693_SET_PASSWORD, 0x04, pass_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
init_password_15693_slixl(&c[4], password, rnd);
AddCrc15(c, 8);
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH, ISO15693_SET_PASSWORD, 0x04, pass_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
init_password_15693_slixl(&c[4], password, rnd);
AddCrc15(c, 8);
start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH];
int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 3) {
return PM3_EWRONGANSWER;
}
start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH];
int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 3) {
return PM3_EWRONGANSWER;
}
return PM3_SUCCESS;
return PM3_SUCCESS;
}
/*
@ -2220,11 +2220,11 @@ static uint32_t destroy_15693_slixl(uint32_t start_time, uint32_t *eof_time, uin
*/
void DisablePrivacySlixLIso15693(uint8_t *password) {
LED_D_ON();
Iso15693InitReader();
StartCountSspClk();
uint32_t start_time = 0, eof_time = 0;
// 4 == pass id.
LED_D_ON();
Iso15693InitReader();
StartCountSspClk();
uint32_t start_time = 0, eof_time = 0;
// 4 == pass id.
int res = set_pass_15693_slixl(start_time, &eof_time, 0x10, password);
reply_ng(CMD_HF_ISO15693_SLIX_L_DISABLE_PRIVACY, res, NULL, 0);
switch_off();

View file

@ -878,7 +878,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
if (blockNo == 4) {
p_em += blockNo * 16;
// TLV in NDEF, flip length between
// TLV in NDEF, flip length between
// 4 | 03 21 D1 02 1C 53 70 91 01 09 54 02 65 6E 4C 69
// 0xFF means long length
// 0xFE mean max short length

View file

@ -35,7 +35,7 @@ local function calypso_parse(result)
if len > 0 then
local d = string.sub(result.Data, 0, len);
return d, nil
end
end
end
return nil, "calypso_parse failed"
end

View file

@ -10,7 +10,7 @@ version = 'v1.0.0'
desc = [[
This script loads a json format file, with the field "data" and a hexbyte array of data. Ie t55x7 dump,
it tries to identify which system based on block1, and detect block0 settings.
The script returns a file with the new identification added, in json format. The output is save in 'dumpdata.json'
The script returns a file with the new identification added, in json format. The output is save in 'dumpdata.json'
]]
example = [[
script run lf_ident_json -i lf_t55xx.json
@ -20,18 +20,18 @@ script run lf_en4100_bulk.lua [-h] [-c] [-p password] [-s <start cn>] [-v]
]]
arguments = [[
-h : this help
-i : infile ( .json format )
-i : infile ( .json format )
]]
-- Some globals
local DEBUG = false
string.startswith = function(self, str)
string.startswith = function(self, str)
return self:find('^' .. str) ~= nil
end
---
---
-- A debug printout-function
local function dbg(args)
if not DEBUG then return end
@ -43,16 +43,16 @@ local function dbg(args)
end
else
print('###', args)
end
end
---
end
end
---
-- This is only meant to be used when errors occur
local function oops(err)
print('ERROR:', err)
core.clearCommandBuffer()
return nil, errr
end
---
---
-- Usage help
local function help()
print(copyright)
@ -75,14 +75,14 @@ local function exitMsg(msg)
print()
end
--- loads a json formatted text file with
--- loads a json formatted text file with
--
-- @param input the file containing the json-dump (defaults to dumpdata.json)
local function load_json(input)
input = input or 'dumpdata.json'
local infile = io.open(input, "rb")
if not infile then return oops(string.format("Could not read file %s", tostring(input))) end
-- Read file
local t = infile:read("*all")
io.close(infile)
@ -94,17 +94,17 @@ local function load_json(input)
return obj
end
--
-- Save
-- Save
local function save_json(data, filename)
filename = filename or 'dumpdata.json'
local outfile = io.open(filename, "w")
if not outfile then return oops(string.format("Could not write to file %s", tostring(filename))) end
if not outfile then return oops(string.format("Could not write to file %s", tostring(filename))) end
outfile:write(data)
io.close(outfile)
return filename
return filename
end
local function encode(blocks)
local function encode(blocks)
return json.encode (blocks, { indent = true })
end
--
@ -151,7 +151,7 @@ local function getDefault(block0)
elseif block0 == T55X7_IOPROX_CONFIG_BLOCK then return 'T55X7_IOPROX_CONFIG_BLOCK :: HID FSK2a, RF/64, 2 data blocks'
elseif block0 == T55X7_PRESCO_CONFIG_BLOCK then return 'T55X7_PRESCO_CONFIG_BLOCK :: manchester, RF/32, STT, 5 data blocks'
elseif block0 == T5555_DEFAULT_CONFIG_BLOCK then return 'T5555_DEFAULT_CONFIG_BLOCK :: ask, manchester, RF/64, 2 data blocks?'
elseif block0 == T55X7_STARPROX then return 'T55X7_STARPROX :: manchester, inverse, RF/32, 2 data blocks'
elseif block0 == T55X7_STARPROX then return 'T55X7_STARPROX :: manchester, inverse, RF/32, 2 data blocks'
elseif block0 == T55X7_VISA2K_CONFIG_BLOCK then return 'T55X7_VISA2K_CONFIG_BLOCK :: manchester, RF/64, STT, 3 data blocks'
elseif block0 == T55X7_SECURAKEY_CONFIG_BLOCK then return 'T55X7_SECURAKEY_CONFIG_BLOCK :: manchester, RF/40, 3 data blocks'
else return 'unknown configblock'..' '..block0
@ -197,15 +197,15 @@ local function getConfigBlock(block)
end
if block:startswith('10d00000') then
return '00088088', 'Card is Presco'
end
end
if block:startswith('00010101') then
return '00107080', 'Card is Pyramid'
end
return result, 'unknown tag'
end
--
--
-- The main entry point
function main(args)
@ -213,7 +213,7 @@ function main(args)
print( string.rep('--',20) )
print()
if #args == 0 then return help() end
if #args == 0 then return help() end
local lines
@ -223,13 +223,13 @@ function main(args)
if o == "h" then return help() end
if o == "i" then lines = load_json(a) end
end
--for i = 1, #data do
for _,i in pairs(lines) do
local index = 0
local one = {}
for ix = 1, #i.data, 8 do
for ix = 1, #i.data, 8 do
one['blk_'..index] = i.data:sub(ix,ix+7)
index = index + 1
end
@ -237,13 +237,13 @@ function main(args)
local mconf, msg = getConfigBlock(one["blk_1"])
one["identification"] = msg
one["config_desc"] = getDefault(one["blk_0"])
if msg:find('badge') then
print (msg, i.data)
end
table.insert(out, one)
end
save_json( encode(out) , nil)
end
save_json( encode(out) , nil)
end
main(args)
main(args)

View file

@ -1079,7 +1079,7 @@ static int CmdAnalyseFoo(const char *Cmd) {
return PM3_SUCCESS;
}
static int CmdAnalyseUnits(const char* Cmd) {
static int CmdAnalyseUnits(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "analyse units",
@ -1104,8 +1104,8 @@ static int CmdAnalyseUnits(const char* Cmd) {
PrintAndLogEx(INFO, "US to ETU conversions");
PrintAndLogEx(INFO, " 9 US = %u ETU (expect 1) " _GREEN_("ok"), US_TO_ETU(9));
PrintAndLogEx(INFO, " 10 US = %u ETU (expect 1) " _GREEN_("ok"), US_TO_ETU(10));
PrintAndLogEx(INFO, " 94 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(94));
PrintAndLogEx(INFO, " 95 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(95));
PrintAndLogEx(INFO, " 94 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(94));
PrintAndLogEx(INFO, " 95 US = %u ETU (expect 10) " _GREEN_("ok"), US_TO_ETU(95));
PrintAndLogEx(INFO, " 302 US = %u ETU (expect 32) " _GREEN_("ok"), US_TO_ETU(302));
PrintAndLogEx(NORMAL, "");
@ -1116,8 +1116,8 @@ static int CmdAnalyseUnits(const char* Cmd) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "US to SSP CLK 3.39MHz conversions");
PrintAndLogEx(INFO, " 9 US = %u SSP (expect 32) ", US_TO_SSP(9));
PrintAndLogEx(INFO, " 10 US = %u SSP (expect 32 or 48) ", US_TO_SSP(10));
PrintAndLogEx(INFO, " 9 US = %u SSP (expect 32) ", US_TO_SSP(9));
PrintAndLogEx(INFO, " 10 US = %u SSP (expect 32 or 48) ", US_TO_SSP(10));
PrintAndLogEx(INFO, " 94 US = %u SSP (expect 320) ", US_TO_SSP(94));
PrintAndLogEx(INFO, " 95 US = %u SSP (expect 320 or 336) ", US_TO_SSP(95));
PrintAndLogEx(INFO, " 302 US = %u SSP (expect 1024) ", US_TO_SSP(302));
@ -1133,9 +1133,9 @@ static int CmdAnalyseUnits(const char* Cmd) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "ETU to SSP CLK 3.39MHz conversions");
PrintAndLogEx(INFO, " 1 ETU = %u SSP (expect 32) " _GREEN_("ok"), ETU_TO_SSP(1));
PrintAndLogEx(INFO, " 10 ETU = %u SSP (expect 320) " _GREEN_("ok"), ETU_TO_SSP(10));
PrintAndLogEx(INFO, " 32 ETU = %u SSP (expect 1024) " _GREEN_("ok"), ETU_TO_SSP(32));
PrintAndLogEx(INFO, " 1 ETU = %u SSP (expect 32) " _GREEN_("ok"), ETU_TO_SSP(1));
PrintAndLogEx(INFO, " 10 ETU = %u SSP (expect 320) " _GREEN_("ok"), ETU_TO_SSP(10));
PrintAndLogEx(INFO, " 32 ETU = %u SSP (expect 1024) " _GREEN_("ok"), ETU_TO_SSP(32));
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "SSP CLK 3.39MHz to ETU conversions");
@ -1145,10 +1145,10 @@ static int CmdAnalyseUnits(const char* Cmd) {
} else if (etu) {
PrintAndLogEx(INFO, " %d ETU = %u us ", ETU_TO_US(etu));
PrintAndLogEx(INFO, " %d ETU = %u SSP ", ETU_TO_SSP(etu));
PrintAndLogEx(INFO, " %d ETU = %u SSP ", ETU_TO_SSP(etu));
} else if (us) {
PrintAndLogEx(INFO, " %d us = %u ETU ", US_TO_ETU(us));
PrintAndLogEx(INFO, " %d us = %u SSP ", US_TO_SSP(us));
PrintAndLogEx(INFO, " %d us = %u SSP ", US_TO_SSP(us));
}
return PM3_SUCCESS;

View file

@ -2883,7 +2883,7 @@ static int CmdDataModulationSearch(const char *Cmd) {
return try_detect_modulation();
}
static int CmdAsn1Decoder(const char* Cmd) {
static int CmdAsn1Decoder(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "data asn1",

View file

@ -98,7 +98,7 @@ static int rdv4_sign_write(uint8_t *signature, uint8_t slen) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_FLASHMEM_WRITE, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_FLASHMEM_WRITE, (uint8_t *)&payload, sizeof(payload));
if (WaitForResponseTimeout(CMD_FLASHMEM_WRITE, &resp, 2000) == false) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -107,7 +107,7 @@ static int rdv4_sign_write(uint8_t *signature, uint8_t slen) {
if (resp.status != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Writing signature ( "_RED_("fail") ")");
return PM3_EFAILED;
}
}
}
PrintAndLogEx(SUCCESS, "Writing signature at offset %u ( "_GREEN_("ok") " )", FLASH_MEM_SIGNATURE_OFFSET);
return PM3_SUCCESS;
@ -271,7 +271,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
uint32_t bytes_sent = 0;
uint32_t bytes_remaining = datalen;
// fast push mode
conn.block_after_ACK = true;
@ -285,7 +285,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
.len = bytes_in_packet,
};
memcpy(payload.data, data + bytes_sent, bytes_in_packet);
SendCommandNG(CMD_FLASHMEM_WRITE, (uint8_t*)&payload, sizeof(payload));
SendCommandNG(CMD_FLASHMEM_WRITE, (uint8_t *)&payload, sizeof(payload));
bytes_remaining -= bytes_in_packet;
bytes_sent += bytes_in_packet;

View file

@ -48,7 +48,7 @@ static int switch_off_field_14b(void) {
.rawlen = 0,
};
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
return PM3_SUCCESS;
}
@ -191,11 +191,11 @@ static bool wait_cmd_14b(bool verbose, bool is_select, uint32_t timeout) {
PrintAndLogEx(SUCCESS, "received " _YELLOW_("%u") " bytes", len);
PrintAndLogEx(SUCCESS, "%s[%02X %02X] %s",
sprint_hex(data, len - 2),
data[len - 2],
data[len - 1],
(crc) ? _GREEN_("ok") : _RED_("fail")
);
sprint_hex(data, len - 2),
data[len - 2],
data[len - 1],
(crc) ? _GREEN_("ok") : _RED_("fail")
);
} else if (len == 0) {
PrintAndLogEx(INFO, "no response from tag");
} else {
@ -354,7 +354,7 @@ static int CmdHF14BCmdRaw(const char *Cmd) {
datalen = (datalen > PM3_CMD_DATA_SIZE) ? PM3_CMD_DATA_SIZE : datalen;
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t*)calloc(1, sizeof(iso14b_raw_cmd_t) + datalen);
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + datalen);
if (packet == NULL) {
PrintAndLogEx(FAILED, "failed to allocate memory");
return PM3_EMALLOC;
@ -365,7 +365,7 @@ static int CmdHF14BCmdRaw(const char *Cmd) {
memcpy(packet->raw, data, datalen);
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
free(packet);
if (read_reply == false) {
@ -415,7 +415,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
PacketResponseNG resp;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
@ -428,7 +428,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
// test 14b standard
packet.flags = (ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT);
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
if (resp.oldarg[0] == 0) {
@ -762,7 +762,7 @@ static bool HF14B_Std_Info(bool verbose, bool do_aid_search) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -807,7 +807,7 @@ static bool HF14B_Std_Info(bool verbose, bool do_aid_search) {
// SRx get and print full info (needs more info...)
static bool HF14B_ST_Info(bool verbose, bool do_aid_search) {
iso14b_raw_cmd_t packet = {
iso14b_raw_cmd_t packet = {
.flags = (ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT),
.timeout = 0,
.rawlen = 0,
@ -815,7 +815,7 @@ static bool HF14B_ST_Info(bool verbose, bool do_aid_search) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -861,7 +861,7 @@ static int CmdHF14Binfo(const char *Cmd) {
static bool HF14B_st_reader(bool verbose) {
iso14b_raw_cmd_t packet = {
iso14b_raw_cmd_t packet = {
.flags = (ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_DISCONNECT),
.timeout = 0,
.rawlen = 0,
@ -870,7 +870,7 @@ static bool HF14B_st_reader(bool verbose) {
// SRx get and print general info about SRx chip from UID
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -912,7 +912,7 @@ static bool HF14B_std_reader(bool verbose) {
// 14b get and print UID only (general info)
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -959,7 +959,7 @@ static bool HF14B_ask_ct_reader(bool verbose) {
// 14b get and print UID only (general info)
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) PrintAndLogEx(WARNING, "timeout while waiting for reply");
return false;
@ -991,7 +991,7 @@ static bool HF14B_ask_ct_reader(bool verbose) {
// test for other 14b type tags (mimic another reader - don't have tags to identify)
static bool HF14B_other_reader(bool verbose) {
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t*)calloc(1, sizeof(iso14b_raw_cmd_t) + 4);
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + 4);
if (packet == NULL) {
PrintAndLogEx(FAILED, "failed to allocate memory");
return PM3_EMALLOC;
@ -1005,7 +1005,7 @@ static bool HF14B_other_reader(bool verbose) {
clearCommandBuffer();
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -1035,7 +1035,7 @@ static bool HF14B_other_reader(bool verbose) {
packet->rawlen = 1;
packet->raw[0] = ISO14443B_AUTHENTICATE;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -1064,7 +1064,7 @@ static bool HF14B_other_reader(bool verbose) {
packet->raw[0] = ISO14443B_RESET;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
free(packet);
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
@ -1320,7 +1320,7 @@ static int CmdHF14BDump(const char *Cmd) {
// detect blocksize from card :)
PrintAndLogEx(INFO, "reading tag memory from UID " _GREEN_("%s"), sprint_hex_inrow(SwapEndian64(card.uid, card.uidlen, 8), card.uidlen));
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t*)calloc(1, sizeof(iso14b_raw_cmd_t) + 2);
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + 2);
if (packet == NULL) {
PrintAndLogEx(FAILED, "failed to allocate memory");
return PM3_EMALLOC;
@ -1330,15 +1330,15 @@ static int CmdHF14BDump(const char *Cmd) {
packet->rawlen = 0;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t));
PacketResponseNG resp;
// select
int status = 0;
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
status = resp.oldarg[0];
if (status < 0) {
PrintAndLogEx(FAILED, "failed to select arg0[%" PRId64 "]" , resp.oldarg[0]);
PrintAndLogEx(FAILED, "failed to select arg0[%" PRId64 "]", resp.oldarg[0]);
free(packet);
return switch_off_field_14b();
}
@ -1359,7 +1359,7 @@ static int CmdHF14BDump(const char *Cmd) {
packet->raw[1] = blocknum & 0xFF;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + 2);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + 2);
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
status = resp.oldarg[0];
@ -1567,19 +1567,19 @@ static int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card) {
};
// Anticollision + SELECT STD card
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
PrintAndLogEx(INFO, "Trying 14B Select SRx");
// Anticollision + SELECT SR card
packet.flags = (ISO14B_CONNECT | ISO14B_SELECT_SR);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
PrintAndLogEx(INFO, "Trying 14B Select CTS");
// Anticollision + SELECT ASK C-Ticket card
packet.flags = (ISO14B_CONNECT | ISO14B_SELECT_CTS);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
PrintAndLogEx(ERR, "connection timeout");
switch_off_field_14b();
@ -1615,8 +1615,8 @@ static int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card) {
}
static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
bool activateField, uint8_t *dataout, int maxdataoutlen,
int *dataoutlen, bool *chainingout, int user_timeout) {
bool activateField, uint8_t *dataout, int maxdataoutlen,
int *dataoutlen, bool *chainingout, int user_timeout) {
*chainingout = false;
@ -1627,7 +1627,7 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
return selres;
}
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t*)calloc(1, sizeof(iso14b_raw_cmd_t) + datainlen);
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + datainlen);
if (packet == NULL) {
PrintAndLogEx(FAILED, "APDU: failed to allocate memory");
return PM3_EMALLOC;
@ -1653,12 +1653,12 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
// "Command APDU" length should be 5+255+1, but javacard's APDU buffer might be smaller - 133 bytes
// https://stackoverflow.com/questions/32994936/safe-max-java-card-apdu-data-command-and-respond-size
// here length PM3_CMD_DATA_SIZE=512
if (datain) {
if (datain) {
packet->rawlen = datainlen;
memcpy(packet->raw, datain, datainlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t) + packet->rawlen);
} else {
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t));
}
free(packet);
PacketResponseNG resp;
@ -1666,7 +1666,7 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
PrintAndLogEx(ERR, "APDU: reply timeout");
return PM3_ETIMEOUT;
}
int rlen = resp.oldarg[0];
int dlen = rlen - 2;
if (dlen < 0) {
@ -1709,8 +1709,8 @@ static int handle_14b_apdu(bool chainingin, uint8_t *datain, int datainlen,
}
int exchange_14b_apdu(uint8_t *datain, int datainlen, bool activate_field,
bool leave_signal_on, uint8_t *dataout, int maxdataoutlen,
int *dataoutlen, int user_timeout) {
bool leave_signal_on, uint8_t *dataout, int maxdataoutlen,
int *dataoutlen, int user_timeout) {
*dataoutlen = 0;
bool chaining = false;
@ -1814,7 +1814,7 @@ static int CmdHF14BAPDU(const char *Cmd) {
arg_lit0("t", "tlv", "executes TLV decoder if it possible"),
arg_lit0(NULL, "decode", "decode apdu request if it possible"),
arg_str0("m", "make", "<hex>", "make apdu with head from this field and data from data field.\n"
" must be 4 bytes: <CLA INS P1 P2>"),
" must be 4 bytes: <CLA INS P1 P2>"),
arg_lit0("e", "extended", "make extended length apdu if `m` parameter included"),
arg_int0("l", "le", "<int>", "Le apdu parameter if `m` parameter included"),
arg_strx1("d", "data", "<hex>", "<APDU | data> if `m` parameter included"),

View file

@ -2161,9 +2161,9 @@ static int CmdHF15SlixDisable(const char *Cmd) {
CLIGetHexWithReturn(ctx, 1, payload.pwd, &pwdlen);
CLIParserFree(ctx);
PrintAndLogEx(INFO, "Trying to disabling privacy mode using password " _GREEN_("%s")
, sprint_hex_inrow(payload.pwd, sizeof(payload.pwd))
);
PrintAndLogEx(INFO, "Trying to disabling privacy mode using password " _GREEN_("%s")
, sprint_hex_inrow(payload.pwd, sizeof(payload.pwd))
);
PacketResponseNG resp;
clearCommandBuffer();
@ -2174,21 +2174,21 @@ static int CmdHF15SlixDisable(const char *Cmd) {
return PM3_ESOFT;
}
switch(resp.status) {
case PM3_ETIMEOUT: {
PrintAndLogEx(WARNING, "no tag found");
switch (resp.status) {
case PM3_ETIMEOUT: {
PrintAndLogEx(WARNING, "no tag found");
break;
}
case PM3_EWRONGANSWER: {
PrintAndLogEx(WARNING, "password was not accepted");
case PM3_EWRONGANSWER: {
PrintAndLogEx(WARNING, "password was not accepted");
break;
}
case PM3_SUCCESS: {
PrintAndLogEx(SUCCESS, "privacy mode is now disabled ( " _GREEN_("ok") " ) ");
break;
}
}
return resp.status;
}
return resp.status;
}
static command_t CommandTable[] = {

View file

@ -42,7 +42,7 @@ static int switch_off_field_cryptorf(void) {
.rawlen = 0,
};
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
return PM3_SUCCESS;
}
@ -105,7 +105,7 @@ static bool get_14b_UID(iso14b_card_select_t *card) {
.rawlen = 0,
};
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT)) {
if (resp.oldarg[0] == 0) {
@ -130,7 +130,7 @@ static int infoHFCryptoRF(bool verbose) {
};
// 14b get and print UID only (general info)
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
if (verbose) {
@ -190,14 +190,14 @@ static int CmdHFCryptoRFInfo(const char *Cmd) {
int readHFCryptoRF(bool loop, bool verbose) {
int res = PM3_ESOFT;
do {
do {
iso14b_raw_cmd_t packet = {
.flags = (ISO14B_CONNECT | ISO14B_SELECT_STD | ISO14B_DISCONNECT),
.timeout = 0,
.rawlen = 0,
};
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
@ -300,7 +300,7 @@ static int CmdHFCryptoRFDump(const char *Cmd) {
PrintAndLogEx(INFO, "Reading memory from tag UID " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
// select tag
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t*)calloc(1, sizeof(iso14b_raw_cmd_t) + 2);
iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + 2);
if (packet == NULL) {
PrintAndLogEx(FAILED, "failed to allocate memory");
return PM3_EMALLOC;
@ -310,7 +310,7 @@ static int CmdHFCryptoRFDump(const char *Cmd) {
packet->rawlen = 0;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)packet, sizeof(iso14b_raw_cmd_t));
PacketResponseNG resp;
// select
@ -339,7 +339,7 @@ static int CmdHFCryptoRFDump(const char *Cmd) {
packet->raw[1] = blocknum & 0xFF;
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t) + 2);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t) + 2);
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000)) {
status = resp.oldarg[0];

View file

@ -689,7 +689,7 @@ static int emrtd_read_file(uint8_t *dataout, int *dataoutlen, uint8_t *kenc, uin
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "." NOLF);
lnbreak = 32;
}
}
}
PrintAndLogEx(NORMAL, "");
@ -1035,7 +1035,7 @@ static bool emrtd_connect(bool *use_14b) {
.rawlen = 0,
};
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t*)&packet, sizeof(iso14b_raw_cmd_t));
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, 2000) == false) {
PrintAndLogEx(INFO, "timeout, no eMRTD spotted with 14b, exiting");
return false;

View file

@ -137,11 +137,11 @@ static void iclass_upload_emul(uint8_t *d, uint16_t n, uint16_t *bytes_sent) {
clearCommandBuffer();
struct p *payload = calloc(4 + bytes_in_packet, sizeof(uint8_t));
payload->offset = *bytes_sent;
payload->offset = *bytes_sent;
payload->len = bytes_in_packet;
memcpy(payload->data, d + *bytes_sent, bytes_in_packet);
SendCommandNG(CMD_HF_ICLASS_EML_MEMSET, (uint8_t*)payload, 4 + bytes_in_packet);
SendCommandNG(CMD_HF_ICLASS_EML_MEMSET, (uint8_t *)payload, 4 + bytes_in_packet);
free(payload);
bytes_remaining -= bytes_in_packet;
@ -3046,7 +3046,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) {
// - a list of keys.
// - a list of precalculated macs that corresponds to the key list
// We send a chunk of macs to the device each time
// main keychunk loop
for (chunk_offset = 0; chunk_offset < keycount; chunk_offset += max_chunk_size) {
@ -3068,7 +3068,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) {
}
uint32_t tmp_plen = sizeof(iclass_chk_t) + (4 * curr_chunk_cnt);
iclass_chk_t *packet = calloc(tmp_plen, sizeof(uint8_t) );
iclass_chk_t *packet = calloc(tmp_plen, sizeof(uint8_t));
if (packet == NULL) {
PrintAndLogEx(WARNING, "failed to allocate memory");
break;
@ -3079,7 +3079,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) {
memcpy(packet->items, (pre + chunk_offset), (4 * curr_chunk_cnt));
clearCommandBuffer();
SendCommandNG(CMD_HF_ICLASS_CHKKEYS, (uint8_t*)packet, tmp_plen);
SendCommandNG(CMD_HF_ICLASS_CHKKEYS, (uint8_t *)packet, tmp_plen);
free(packet);
bool looped = false;
@ -3098,15 +3098,15 @@ static int CmdHFiClassCheckKeys(const char *Cmd) {
if (looped)
PrintAndLogEx(NORMAL, "");
if (resp.status == PM3_SUCCESS) {
found_offset = resp.data.asBytes[0];
found_key = true;
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(SUCCESS,
"Found valid key " _GREEN_("%s")
, sprint_hex(keyBlock + (chunk_offset + found_offset) * 8, 8)
);
"Found valid key " _GREEN_("%s")
, sprint_hex(keyBlock + (chunk_offset + found_offset) * 8, 8)
);
break;
} else {
PrintAndLogEx(INPLACE, "Chunk [%03d/%d]", chunk_offset, keycount);
@ -3324,7 +3324,7 @@ static void *bf_generate_mac(void *thread_arg) {
void GenerateMacFrom(uint8_t *CSN, uint8_t *CCNR, bool use_raw, bool use_elite, uint8_t *keys, uint32_t keycnt, iclass_premac_t *list) {
pthread_mutex_init(&generator_mutex, NULL);
iclass_tc = num_CPUs();
pthread_t threads[iclass_tc];
iclass_thread_arg_t args[iclass_tc];

View file

@ -902,7 +902,7 @@ static int CmdLegicRestore(const char *Cmd) {
}
if (shall_obsfuscate) {
if (legic_xor(data, card.cardsize) == false){
if (legic_xor(data, card.cardsize) == false) {
PrintAndLogEx(FAILED, "Obsfuscate failed, exiting...");
PrintAndLogEx(HINT, "Try running command without `--ob` parameter");
free(data);

View file

@ -908,7 +908,7 @@ void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
case MFDES_INIT_KEY_SETTINGS:
snprintf(exp, size, "INIT KEY SETTINGS");
break;
case MFDES_FINALIZE_KEY_SETTINGS:
case MFDES_FINALIZE_KEY_SETTINGS:
snprintf(exp, size, "FINALIZE KEY SETTINGS");
break;
case MFDES_GET_DELEGATE_INFO:

View file

@ -5794,7 +5794,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
"hf mf wipe --> reads card uid to generate file name\n"
"hf mf wipe --gen2 --> force write to S0, B0 manufacture block\n"
"hf mf wipe -f mykey.bin --> use mykey.bin\n"
);
);
void *argtable[] = {
arg_param_begin,
arg_str0("f", "file", "<fn>", "key filename"),
@ -5831,7 +5831,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
uint8_t keyB[MIFARE_4K_MAXSECTOR * 6];
uint8_t num_sectors = 0;
uint8_t mf[MFBLOCK_SIZE];
uint8_t mf[MFBLOCK_SIZE];
switch (keyslen) {
case (MIFARE_MINI_MAXSECTOR * 2 * 6): {
PrintAndLogEx(INFO, "Loaded keys matching MIFARE Classic Mini 320b");
@ -5864,7 +5864,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
}
}
if (gen2)
if (gen2)
PrintAndLogEx(INFO, "Forcing overwrite of sector 0 / block 0 ");
else
PrintAndLogEx(INFO, "Skipping sector 0 / block 0");

View file

@ -1160,12 +1160,12 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
As such, we should be able to convert the Des to TDes then run the code as TDes
*/
if (new_algo == MFDES_ALGO_DES) {
memcpy(&new_key[8],new_key,8);
memcpy(&new_key[8], new_key, 8);
new_algo = MFDES_ALGO_3DES;
}
if (old_algo == MFDES_ALGO_DES) {
memcpy(&old_key[8],old_key,8);
memcpy(&old_key[8], old_key, 8);
old_algo = MFDES_ALGO_3DES;
}
@ -1208,13 +1208,13 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
uint8_t new_key_length = 16;
switch (new_algo) {
/*
// We have converted the DES to 3DES above,so this will never hit
case MFDES_ALGO_DES:
memcpy(data + cmdcnt + 1, new_key, new_key_length);
memcpy(data + cmdcnt + 1 + new_key_length, new_key, new_key_length);
break;
*/
/*
// We have converted the DES to 3DES above,so this will never hit
case MFDES_ALGO_DES:
memcpy(data + cmdcnt + 1, new_key, new_key_length);
memcpy(data + cmdcnt + 1 + new_key_length, new_key, new_key_length);
break;
*/
case MFDES_ALGO_3DES:
case MFDES_ALGO_AES:
new_key_length = 16;
@ -1259,8 +1259,8 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
// 19 bytes
//uint8_t csPkt[30] = {0x00};
csPkt[0] = 0xC4;
memcpy (&csPkt[1],data,18);
memcpy(&csPkt[1], data, 18);
desfire_crc32(csPkt, 19, data + 1 + cmdcnt);
} else {
desfire_crc32_append(data + 1, cmdcnt);
@ -1288,13 +1288,13 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
apdu.Lc = (uint8_t)cmdcnt + 1;
// apdu.data = p;
// the above data pointed to from p did not have the key no. at the start, so copy preprocessed data after the key no.
memcpy (&data[1], p, cmdcnt);
memcpy(&data[1], p, cmdcnt);
apdu.data = data;
uint32_t recv_len = 0;
uint16_t sw = 0;
// If we call send_desfire with 2nd option (turn field on), it will turn off then on
// leading to loosing the authentication on the aid, so lets not turn on here.
// int res = send_desfire_cmd(&apdu, true, NULL, &recv_len, &sw, 0, true);
@ -1319,7 +1319,7 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
As such !p is true and the code reports "Error on changing key"; so comment back to user until its fixed.
*/
if (new_algo == MFDES_ALGO_AES) {
PrintAndLogEx(WARNING,"AES password may have been changed, please check new password with the auth command.");
PrintAndLogEx(WARNING, "AES password may have been changed, please check new password with the auth command.");
}
return PM3_ESOFT;
@ -3612,10 +3612,10 @@ static int CmdHF14ADesInfo(const char *Cmd) {
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02};
static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 };
if (str_startswith((const char*)card.ats + 1, STANDALONE_DESFIRE)) {
if (str_startswith((const char *)card.ats + 1, STANDALONE_DESFIRE)) {
PrintAndLogEx(INFO, "Standalone DESFire");
}
if (str_startswith((const char*)card.ats + 1, JCOP_DESFIRE)) {
if (str_startswith((const char *)card.ats + 1, JCOP_DESFIRE)) {
PrintAndLogEx(INFO, "JCOP DESFire");
}
}

View file

@ -145,16 +145,16 @@ static int CmdIdteckClone(const char *Cmd) {
blocks[0] = EM4305_IDTECK_CONFIG_BLOCK;
snprintf(cardtype, sizeof(cardtype), "EM4305/4469");
}
for (uint8_t i = 1; i < ARRAYLEN(blocks); i++) {
blocks[i] = bytes_to_num(raw + ((i - 1) * 4), sizeof(uint32_t));
}
// config for Indala 64 format (RF/32;PSK1 with RF/2;Maxblock=2)
PrintAndLogEx(INFO, "Preparing to clone Idteck to " _YELLOW_("%s") " raw " _GREEN_("%s")
, cardtype
, sprint_hex_inrow(raw, raw_len)
);
, cardtype
, sprint_hex_inrow(raw, raw_len)
);
print_blocks(blocks, ARRAYLEN(blocks));
int res;
@ -174,7 +174,7 @@ static int CmdIdteckSim(const char *Cmd) {
"Enables simulation of Idteck card.\n"
"Simulation runs until the button is pressed or another USB command is issued.",
"lf idteck sim --raw 4944544B351FBE4B"
);
);
void *argtable[] = {
arg_param_begin,

View file

@ -329,7 +329,7 @@ void dumpCommandsRecursive(const command_t cmds[], int markdown, bool full_help)
PrintAndLogEx(NORMAL, "|`%s%-*s`|%-*s|`%s`", parent, w_cmd - (int)strlen(parent) - 2, cmds[i].Name, w_off, cmd_offline, cmds[i].Help);
else if (full_help) {
PrintAndLogEx(NORMAL, "---------------------------------------------------------------------------------------");
PrintAndLogEx(NORMAL, _RED_("%s%-*s\n") "available offline: %s", parent, w_cmd - (int)strlen(parent), cmds[i].Name, cmds[i].IsAvailable()?_GREEN_("yes"):_RED_("no"));
PrintAndLogEx(NORMAL, _RED_("%s%-*s\n") "available offline: %s", parent, w_cmd - (int)strlen(parent), cmds[i].Name, cmds[i].IsAvailable() ? _GREEN_("yes") : _RED_("no"));
cmds[i].Parse("--help");
} else {
PrintAndLogEx(NORMAL, "%s%-*s|%-*s|%s", parent, w_cmd - (int)strlen(parent), cmds[i].Name, w_off, cmd_offline, cmds[i].Help);

View file

@ -257,12 +257,12 @@ static int CmdScriptRun(const char *Cmd) {
sscanf(Cmd, "%127s%n %255[^\n\r]%n", filename, &fnlen, arguments, &arg_len);
// hack
// since we don't want to use "-f" for script filename,
// since we don't want to use "-f" for script filename,
// and be able to send in parameters into script meanwhile
// being able to "-h" here too.
// being able to "-h" here too.
if ((strlen(filename) == 0) ||
(strcmp(filename, "-h") == 0) ||
(strcmp(filename, "--help") == 0)) {
(strcmp(filename, "-h") == 0) ||
(strcmp(filename, "--help") == 0)) {
ctx->argtable = argtable;
ctx->argtableLen = arg_getsize(argtable);
CLIParserPrintHelp(ctx);

View file

@ -407,41 +407,41 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
// tag row
if (use_us) {
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | Tag |%-72s | %s| %s",
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " %10u | %10u | Tag |%-72s | %s| %s",
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
} else {
// reader row
if (use_us) {
PrintAndLogEx(NORMAL,
_YELLOW_(" %10.1f") " | " _YELLOW_("%10.1f") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
PrintAndLogEx(NORMAL,
_YELLOW_(" %10.1f") " | " _YELLOW_("%10.1f") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL,
_YELLOW_(" %10u") " | " _YELLOW_("%10u") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
_YELLOW_(" %10u") " | " _YELLOW_("%10u") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
}
@ -449,16 +449,16 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
} else {
if (hdr->isResponse) {
PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s",
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " | | |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
}
}
@ -629,15 +629,15 @@ int CmdTraceListAlias(const char *Cmd, const char *alias, const char *protocol)
CLIParserContext *ctx;
char desc[500] = {0};
snprintf(desc, sizeof(desc) - 1,
"Alias of `trace list -t %s` with selected protocol data to annotate trace buffer\n"
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n"
"It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
protocol);
"Alias of `trace list -t %s` with selected protocol data to annotate trace buffer\n"
"You can load a trace from file (see `trace load -h`) or it be downloaded from device by default\n"
"It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol",
protocol);
char example[200] = {0};
snprintf(example, sizeof(example) - 1,
"%s list -f -> show frame delay times\n"
"%s list -1 -> use trace buffer ",
alias, alias);
"%s list -f -> show frame delay times\n"
"%s list -1 -> use trace buffer ",
alias, alias);
char fullalias[100] = {0};
snprintf(fullalias, sizeof(fullalias) - 1, "%s list", alias);
CLIParserInit(&ctx, fullalias, desc, example);

View file

@ -318,21 +318,21 @@ bool asn1_tag_dump(const struct tlv *tlv, int level, bool *candump) {
const struct asn1_tag *tag = asn1_get_tag(tlv);
/*
if ((tlv->tag & 0x20) == 0x20 ) {
} else if ((tlv->tag & 0x80) == 0x80 ) {
} else {
}
*/
/*
if ((tlv->tag & 0x20) == 0x20 ) {
} else if ((tlv->tag & 0x80) == 0x80 ) {
} else {
}
*/
PrintAndLogEx(INFO,
"%*s-- %2x [%02zx] '"_YELLOW_("%s") "'" NOLF
, (level * 4)
, " "
, tlv->tag
, tlv->len
, tag->name
);
"%*s-- %2x [%02zx] '"_YELLOW_("%s") "'" NOLF
, (level * 4)
, " "
, tlv->tag
, tlv->len
, tag->name
);
switch (tag->type) {
case ASN1_TAG_GENERIC:

View file

@ -75,7 +75,7 @@ static bool Unpack_ind26(wiegand_message_t *packed, wiegand_card_t *card) {
card->FacilityCode = get_linear_field(packed, 1, 12);
card->CardNumber = get_linear_field(packed, 13, 12);
card->ParityValid =
(get_bit_by_position(packed, 0) == evenparity32(get_linear_field(packed, 1, 12))) &&
(get_bit_by_position(packed, 25) == oddparity32(get_linear_field(packed, 13, 12)));
@ -146,8 +146,8 @@ static bool Pack_indasc27(wiegand_card_t *card, wiegand_message_t *packed, bool
if (card->OEM > 0) return false; // Not used in this format
packed->Length = 27;
set_nonlinear_field(packed, card->FacilityCode, 11, (uint8_t[]) {9,4,6,5,0,7,19,8,10,16,24,12,22});
set_nonlinear_field(packed, card->CardNumber, 14, (uint8_t[]) {26,1,3,15,14,17,20,13,25,2,18,21,11,23});
set_nonlinear_field(packed, card->FacilityCode, 11, (uint8_t[]) {9, 4, 6, 5, 0, 7, 19, 8, 10, 16, 24, 12, 22});
set_nonlinear_field(packed, card->CardNumber, 14, (uint8_t[]) {26, 1, 3, 15, 14, 17, 20, 13, 25, 2, 18, 21, 11, 23});
if (preamble)
return add_HID_header(packed);
return true;
@ -158,8 +158,8 @@ static bool Unpack_indasc27(wiegand_message_t *packed, wiegand_card_t *card) {
if (packed->Length != 27) return false; // Wrong length? Stop here.
card->FacilityCode = get_nonlinear_field(packed, 11, (uint8_t[]) {9,4,6,5,0,7,19,8,10,16,24,12,22});
card->CardNumber = get_nonlinear_field(packed, 14, (uint8_t[]) {26,1,3,15,14,17,20,13,25,2,18,21,11,23});
card->FacilityCode = get_nonlinear_field(packed, 11, (uint8_t[]) {9, 4, 6, 5, 0, 7, 19, 8, 10, 16, 24, 12, 22});
card->CardNumber = get_nonlinear_field(packed, 14, (uint8_t[]) {26, 1, 3, 15, 14, 17, 20, 13, 25, 2, 18, 21, 11, 23});
return true;
}
@ -537,7 +537,7 @@ static bool Unpack_N10002(wiegand_message_t *packed, wiegand_card_t *card) {
card->ParityValid =
(get_bit_by_position(packed, 0) == evenparity32(get_linear_field(packed, 1, 16))) &&
(get_bit_by_position(packed, 33) == oddparity32(get_linear_field(packed, 17, 16)));
return true;
}
@ -1199,7 +1199,7 @@ static bool Unpack_pw39(wiegand_message_t *packed, wiegand_card_t *card) {
card->FacilityCode = get_linear_field(packed, 1, 17);
card->CardNumber = get_linear_field(packed, 18, 20);
card->ParityValid =
(get_bit_by_position(packed, 0) == evenparity32(get_linear_field(packed, 1, 18))) &&
(get_bit_by_position(packed, 38) == oddparity32(get_linear_field(packed, 19, 19)));
@ -1290,19 +1290,19 @@ static void hid_print_card(wiegand_card_t *card, const cardformat_t format) {
static const cardformat_t FormatTable[] = {
{"H10301", Pack_H10301, Unpack_H10301, "HID H10301 26-bit", {1, 1, 0, 0, 1}}, // imported from old pack/unpack
{"ind26", Pack_ind26, Unpack_ind26, "Indala 26-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"ind27", Pack_ind27, Unpack_ind27, "Indala 27-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"indasc27", Pack_indasc27, Unpack_indasc27, "Indala ASC 27-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"ind26", Pack_ind26, Unpack_ind26, "Indala 26-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"ind27", Pack_ind27, Unpack_ind27, "Indala 27-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"indasc27", Pack_indasc27, Unpack_indasc27, "Indala ASC 27-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"Tecom27", Pack_Tecom27, Unpack_Tecom27, "Tecom 27-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"2804W", Pack_2804W, Unpack_2804W, "2804 Wiegand 28-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"ind29", Pack_ind29, Unpack_ind29, "Indala 29-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"ind29", Pack_ind29, Unpack_ind29, "Indala 29-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"ATSW30", Pack_ATSW30, Unpack_ATSW30, "ATS Wiegand 30-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"ADT31", Pack_ADT31, Unpack_ADT31, "HID ADT 31-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"HCP32", Pack_hcp32, Unpack_hcp32, "HID Check Point 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"HPP32", Pack_hpp32, Unpack_hpp32, "HID Hewlett-Packard 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"HCP32", Pack_hcp32, Unpack_hcp32, "HID Check Point 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"HPP32", Pack_hpp32, Unpack_hpp32, "HID Hewlett-Packard 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"Kastle", Pack_Kastle, Unpack_Kastle, "Kastle 32-bit", {1, 1, 1, 0, 1}}, // from @xilni; PR #23 on RfidResearchGroup/proxmark3
{"Kantech", Pack_Kantech, Unpack_Kantech, "Indala/Kantech KFS 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"WIE32", Pack_wie32, Unpack_wie32, "Wiegand 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"WIE32", Pack_wie32, Unpack_wie32, "Wiegand 32-bit", {1, 1, 0, 0, 0}}, // from cardinfo.barkweb.com.au
{"D10202", Pack_D10202, Unpack_D10202, "HID D10202 33-bit", {1, 1, 0, 0, 1}}, // from cardinfo.barkweb.com.au
{"H10306", Pack_H10306, Unpack_H10306, "HID H10306 34-bit", {1, 1, 0, 0, 1}}, // imported from old pack/unpack
{"N10002", Pack_N10002, Unpack_N10002, "Honeywell/Northern N10002 34-bit", {1, 1, 0, 0, 1}}, // from proxclone.com