make miscchecks

This commit is contained in:
Philippe Teuwen 2021-06-04 21:56:47 +02:00
commit 1f27be076b
12 changed files with 274 additions and 274 deletions

View file

@ -1199,9 +1199,9 @@ void SniffHitag2(void) {
LED_B_ON(); LED_B_ON();
// Capture reader frame // Capture reader frame
if (ra >= HITAG_T_STOP) { if (ra >= HITAG_T_STOP) {
// if (rxlen != 0) { // if (rxlen != 0) {
//DbpString("wierd0?"); //DbpString("wierd0?");
// } // }
// Capture the T0 periods that have passed since last communication or field drop (reset) // Capture the T0 periods that have passed since last communication or field drop (reset)
response = (ra - HITAG_T_LOW); response = (ra - HITAG_T_LOW);
} else if (ra >= HITAG_T_1_MIN) { } else if (ra >= HITAG_T_1_MIN) {
@ -1218,9 +1218,9 @@ void SniffHitag2(void) {
LED_C_ON(); LED_C_ON();
// Capture tag frame (manchester decoding using only falling edges) // Capture tag frame (manchester decoding using only falling edges)
if (ra >= HITAG_T_EOF) { if (ra >= HITAG_T_EOF) {
// if (rxlen != 0) { // if (rxlen != 0) {
//DbpString("wierd1?"); //DbpString("wierd1?");
// } // }
// Capture the T0 periods that have passed since last communication or field drop (reset) // Capture the T0 periods that have passed since last communication or field drop (reset)
// We always recieve a 'one' first, which has the falling edge after a half period |-_| // We always recieve a 'one' first, which has the falling edge after a half period |-_|
response = ra - HITAG_T_TAG_HALF_PERIOD; response = ra - HITAG_T_TAG_HALF_PERIOD;

View file

@ -2162,66 +2162,66 @@ static uint32_t set_pass_15693_slixl(uint32_t start_time, uint32_t *eof_time, ui
/* /*
static uint32_t enable_privacy_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { static uint32_t enable_privacy_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) { if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_ENABLE_PRIVACY, pass_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_ENABLE_PRIVACY, pass_id, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
memcpy(&c[3], uid, 8); memcpy(&c[3], uid, 8);
init_password_15693_slixl(&c[11], password, rnd); init_password_15693_slixl(&c[11], password, rnd);
AddCrc15(c, 15); AddCrc15(c, 15);
start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER; start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH]; 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); int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 3) { if (recvlen != 3) {
return PM3_EWRONGANSWER; return PM3_EWRONGANSWER;
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t write_password_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) { static uint32_t write_password_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t pass_id, uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) { if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_WRITE_PASSWORD, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_WRITE_PASSWORD, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
memcpy(&c[3], uid, 8); memcpy(&c[3], uid, 8);
c[11] = pass_id; c[11] = pass_id;
init_password_15693_slixl(&c[12], password, NULL); init_password_15693_slixl(&c[12], password, NULL);
AddCrc15(c, 16); AddCrc15(c, 16);
start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER; start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH]; 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); int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 3) { if (recvlen != 3) {
return PM3_EWRONGANSWER; return PM3_EWRONGANSWER;
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static uint32_t destroy_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t *password) { static uint32_t destroy_15693_slixl(uint32_t start_time, uint32_t *eof_time, uint8_t *uid, uint8_t *password) {
uint8_t rnd[2]; uint8_t rnd[2];
if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) { if (get_rnd_15693_slixl(start_time, eof_time, rnd) == false) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_DESTROY, ISO15693_ENABLE_PRIVACY, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t c[] = {ISO15_REQ_DATARATE_HIGH | ISO15_REQ_ADDRESS, ISO15693_DESTROY, ISO15693_ENABLE_PRIVACY, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
memcpy(&c[3], uid, 8); memcpy(&c[3], uid, 8);
init_password_15693_slixl(&c[11], password, rnd); init_password_15693_slixl(&c[11], password, rnd);
AddCrc15(c, 15); AddCrc15(c, 15);
start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER; start_time = *eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH]; 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); int recvlen = SendDataTag(c, sizeof(c), false, true, recvbuf, sizeof(recvbuf), start_time, ISO15693_READER_TIMEOUT_WRITE, eof_time);
if (recvlen != 3) { if (recvlen != 3) {
return PM3_EWRONGANSWER; return PM3_EWRONGANSWER;
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }
*/ */

View file

@ -713,7 +713,7 @@ function getRandomTempName()
local keyLength = 8 local keyLength = 8
local output = "" local output = ""
for i = 1, keyLength do for i = 1, keyLength do
local rand = math.random(#characterSet) local rand = math.random(#characterSet)
output = output .. string.sub(characterSet, rand, rand) output = output .. string.sub(characterSet, rand, rand)
end end

View file

@ -34,16 +34,16 @@ end
--- ---
-- A debug printout-function -- A debug printout-function
local function dbg(args) local function dbg(args)
if not DEBUG then return end if not DEBUG then return end
if type(args) == 'table' then if type(args) == 'table' then
local i = 1 local i = 1
while args[i] do while args[i] do
dbg(args[i]) dbg(args[i])
i = i+1 i = i+1
end end
else else
print('###', args) print('###', args)
end end
end end
--- ---
-- This is only meant to be used when errors occur -- This is only meant to be used when errors occur
@ -58,13 +58,13 @@ local function help()
print(copyright) print(copyright)
print(author) print(author)
print(version) print(version)
print(desc) print(desc)
print(ac.cyan..'Usage'..ac.reset) print(ac.cyan..'Usage'..ac.reset)
print(usage) print(usage)
print(ac.cyan..'Arguments'..ac.reset) print(ac.cyan..'Arguments'..ac.reset)
print(arguments) print(arguments)
print(ac.cyan..'Example usage'..ac.reset) print(ac.cyan..'Example usage'..ac.reset)
print(example) print(example)
end end
--- ---
-- Exit message -- Exit message
@ -79,130 +79,130 @@ end
-- --
-- @param input the file containing the json-dump (defaults to dumpdata.json) -- @param input the file containing the json-dump (defaults to dumpdata.json)
local function load_json(input) local function load_json(input)
input = input or 'dumpdata.json' input = input or 'dumpdata.json'
local infile = io.open(input, "rb") local infile = io.open(input, "rb")
if not infile then return oops(string.format("Could not read file %s", tostring(input))) end if not infile then return oops(string.format("Could not read file %s", tostring(input))) end
-- Read file -- Read file
local t = infile:read("*all") local t = infile:read("*all")
io.close(infile) io.close(infile)
local obj, pos, err = json.decode(t, 1, nil) local obj, pos, err = json.decode(t, 1, nil)
if err then return oops(string.format("importing json file failed. %s", err)) end if err then return oops(string.format("importing json file failed. %s", err)) end
print(string.format('loaded file %s', input)) print(string.format('loaded file %s', input))
return obj return obj
end end
-- --
-- Save -- Save
local function save_json(data, filename) local function save_json(data, filename)
filename = filename or 'dumpdata.json' filename = filename or 'dumpdata.json'
local outfile = io.open(filename, "w") 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) outfile:write(data)
io.close(outfile) io.close(outfile)
return filename return filename
end end
local function encode(blocks) local function encode(blocks)
return json.encode (blocks, { indent = true }) return json.encode (blocks, { indent = true })
end end
-- --
-- map config blocks -- map config blocks
local function getDefault(block0) local function getDefault(block0)
block0 = block0:upper() block0 = block0:upper()
local T55X7_DEFAULT_CONFIG_BLOCK = '000880E8' --// compat mode, RF/32, manchester, STT, 7 data blocks local T55X7_DEFAULT_CONFIG_BLOCK = '000880E8' --// compat mode, RF/32, manchester, STT, 7 data blocks
local T55X7_RAW_CONFIG_BLOCK = '000880E0' --// compat mode, RF/32, manchester, 7 data blocks local T55X7_RAW_CONFIG_BLOCK = '000880E0' --// compat mode, RF/32, manchester, 7 data blocks
local T55X7_EM_UNIQUE_CONFIG_BLOCK = '00148040' --// emulate em4x02/unique - compat mode, manchester, RF/64, 2 data blocks local T55X7_EM_UNIQUE_CONFIG_BLOCK = '00148040' --// emulate em4x02/unique - compat mode, manchester, RF/64, 2 data blocks
-- FDXB requires data inversion and BiPhase 57 is simply BipHase 50 inverted, so we can either do it using the modulation scheme or the inversion flag -- FDXB requires data inversion and BiPhase 57 is simply BipHase 50 inverted, so we can either do it using the modulation scheme or the inversion flag
-- we've done both below to prove that it works either way, and the modulation value for BiPhase 50 in the Atmel data sheet of binary "10001" (17) is a typo, -- we've done both below to prove that it works either way, and the modulation value for BiPhase 50 in the Atmel data sheet of binary "10001" (17) is a typo,
-- and it should actually be "10000" (16) -- and it should actually be "10000" (16)
--local T55X7_FDXB_CONFIG_BLOCK 903F8080 // emulate fdx-b - xtended mode, biPhase ('57), RF/32, 4 data blocks --local T55X7_FDXB_CONFIG_BLOCK 903F8080 // emulate fdx-b - xtended mode, biPhase ('57), RF/32, 4 data blocks
local T55X7_FDXB_CONFIG_BLOCK = '903F0082' --// emulate fdx-b - xtended mode, biPhase ('50), invert data, RF/32, 4 data blocks local T55X7_FDXB_CONFIG_BLOCK = '903F0082' --// emulate fdx-b - xtended mode, biPhase ('50), invert data, RF/32, 4 data blocks
local T55X7_HID_26_CONFIG_BLOCK = '00107060' --// hid 26 bit - compat mode, FSK2a, RF/50, 3 data blocks local T55X7_HID_26_CONFIG_BLOCK = '00107060' --// hid 26 bit - compat mode, FSK2a, RF/50, 3 data blocks
local T55X7_PYRAMID_CONFIG_BLOCK = '00107080' --// Pyramid 26 bit - compat mode, FSK2a, RF/50, 4 data blocks local T55X7_PYRAMID_CONFIG_BLOCK = '00107080' --// Pyramid 26 bit - compat mode, FSK2a, RF/50, 4 data blocks
local T55X7_INDALA_64_CONFIG_BLOCK = '00081040' --// emulate indala 64 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 2 data block local T55X7_INDALA_64_CONFIG_BLOCK = '00081040' --// emulate indala 64 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 2 data block
local T55X7_INDALA_224_CONFIG_BLOCK = '000810E0' --// emulate indala 224 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 7 data block local T55X7_INDALA_224_CONFIG_BLOCK = '000810E0' --// emulate indala 224 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 7 data block
local T55X7_GUARDPROXII_CONFIG_BLOCK = '00150060' --// Direct modulation, Biphase, RF/64, 3 data blocks local T55X7_GUARDPROXII_CONFIG_BLOCK = '00150060' --// Direct modulation, Biphase, RF/64, 3 data blocks
local T55X7_VIKING_CONFIG_BLOCK = '00088040' --// compat mode, manchester, RF/32, 2 data blocks local T55X7_VIKING_CONFIG_BLOCK = '00088040' --// compat mode, manchester, RF/32, 2 data blocks
local T55X7_NORALYS_CONFIG_BLOCK = '00088C6A' --// NORALYS (KCP3000) -- compat mode, manchester, inverse, RF/32, STT, 3 data blocks local T55X7_NORALYS_CONFIG_BLOCK = '00088C6A' --// NORALYS (KCP3000) -- compat mode, manchester, inverse, RF/32, STT, 3 data blocks
local T55X7_IOPROX_CONFIG_BLOCK = '00147040' --// HID FSK2a, RF/64, 2 data blocks local T55X7_IOPROX_CONFIG_BLOCK = '00147040' --// HID FSK2a, RF/64, 2 data blocks
local T55X7_PRESCO_CONFIG_BLOCK = '00088088' --// manchester, RF/32, STT, 5 data blocks local T55X7_PRESCO_CONFIG_BLOCK = '00088088' --// manchester, RF/32, STT, 5 data blocks
local T5555_DEFAULT_CONFIG_BLOCK = '6001F004' --// ask, manchester, RF/64, 2 data blocks? local T5555_DEFAULT_CONFIG_BLOCK = '6001F004' --// ask, manchester, RF/64, 2 data blocks?
local T55X7_STARPROX = '00088C42' --// manchester, inverse, RF/32, 2 data blocks local T55X7_STARPROX = '00088C42' --// manchester, inverse, RF/32, 2 data blocks
local T55X7_VISA2K_CONFIG_BLOCK = '00148068' --// VISA2000 - manchester, RF/64, STT, 3 data blocks local T55X7_VISA2K_CONFIG_BLOCK = '00148068' --// VISA2000 - manchester, RF/64, STT, 3 data blocks
local T55X7_SECURAKEY_CONFIG_BLOCK = 'F00C8060' --// Securakey - manchester, RF/40, 3 data blocks local T55X7_SECURAKEY_CONFIG_BLOCK = 'F00C8060' --// Securakey - manchester, RF/40, 3 data blocks
local T55X7_ST = 'F0088058' --// manchester, RF/32, STT, pwd, 2 data blocks local T55X7_ST = 'F0088058' --// manchester, RF/32, STT, pwd, 2 data blocks
if block0 == T55X7_DEFAULT_CONFIG_BLOCK then return 'T55X7_DEFAULT_CONFIG_BLOCK :: compat mode, manchester, RF/32, STT, 7 data blocks' if block0 == T55X7_DEFAULT_CONFIG_BLOCK then return 'T55X7_DEFAULT_CONFIG_BLOCK :: compat mode, manchester, RF/32, STT, 7 data blocks'
elseif block0 == T55X7_RAW_CONFIG_BLOCK then return 'T55X7_RAW_CONFIG_BLOCK :: compat mode, manchester, RF/32, 7 data blocks' elseif block0 == T55X7_RAW_CONFIG_BLOCK then return 'T55X7_RAW_CONFIG_BLOCK :: compat mode, manchester, RF/32, 7 data blocks'
elseif block0 == T55X7_EM_UNIQUE_CONFIG_BLOCK then return 'T55X7_EM_UNIQUE_CONFIG_BLOCK :: emulate em4x02/unique - compat mode, manchester, RF/64, 2 data blocks' elseif block0 == T55X7_EM_UNIQUE_CONFIG_BLOCK then return 'T55X7_EM_UNIQUE_CONFIG_BLOCK :: emulate em4x02/unique - compat mode, manchester, RF/64, 2 data blocks'
elseif block0 == T55X7_FDXB_CONFIG_BLOCK then return 'T55X7_FDXB_CONFIG_BLOCK :: emulate fdx-b - xtended mode, BiPhase (50, invert data, RF/32, 4 data blocks' elseif block0 == T55X7_FDXB_CONFIG_BLOCK then return 'T55X7_FDXB_CONFIG_BLOCK :: emulate fdx-b - xtended mode, BiPhase (50, invert data, RF/32, 4 data blocks'
elseif block0 == T55X7_PYRAMID_CONFIG_BLOCK then return 'T55X7_PYRAMID_CONFIG_BLOCK :: Pyramid 26 bit - compat mode, FSK2a, RF/50, 4 data blocks' elseif block0 == T55X7_PYRAMID_CONFIG_BLOCK then return 'T55X7_PYRAMID_CONFIG_BLOCK :: Pyramid 26 bit - compat mode, FSK2a, RF/50, 4 data blocks'
elseif block0 == T55X7_HID_26_CONFIG_BLOCK then return 'T55X7_HID_26_CONFIG_BLOCK :: hid 26 bit - compat mode, FSK2a, RF/50, 3 data blocks' elseif block0 == T55X7_HID_26_CONFIG_BLOCK then return 'T55X7_HID_26_CONFIG_BLOCK :: hid 26 bit - compat mode, FSK2a, RF/50, 3 data blocks'
elseif block0 == T55X7_INDALA_64_CONFIG_BLOCK then return 'T55X7_INDALA_64_CONFIG_BLOCK :: emulate indala 64 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 2 data blocks' elseif block0 == T55X7_INDALA_64_CONFIG_BLOCK then return 'T55X7_INDALA_64_CONFIG_BLOCK :: emulate indala 64 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 2 data blocks'
elseif block0 == T55X7_INDALA_224_CONFIG_BLOCK then return 'T55X7_INDALA_224_CONFIG_BLOCK :: emulate indala 224 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 7 data blocks' elseif block0 == T55X7_INDALA_224_CONFIG_BLOCK then return 'T55X7_INDALA_224_CONFIG_BLOCK :: emulate indala 224 bit - compat mode, PSK1, psk carrier FC * 2, RF/32, 7 data blocks'
elseif block0 == T55X7_GUARDPROXII_CONFIG_BLOCK then return 'T55X7_GUARDPROXII_CONFIG_BLOCK :: biphase, direct modulation, RF/64, 3 data blocks' elseif block0 == T55X7_GUARDPROXII_CONFIG_BLOCK then return 'T55X7_GUARDPROXII_CONFIG_BLOCK :: biphase, direct modulation, RF/64, 3 data blocks'
elseif block0 == T55X7_VIKING_CONFIG_BLOCK then return 'T55X7_VIKING_CONFIG_BLOCK :: compat mode, manchester, RF/32, 2 data blocks' elseif block0 == T55X7_VIKING_CONFIG_BLOCK then return 'T55X7_VIKING_CONFIG_BLOCK :: compat mode, manchester, RF/32, 2 data blocks'
elseif block0 == T55X7_NORALYS_CONFIG_BLOCK then return 'T55X7_NORALYS_CONFIG_BLOCK :: NORALYS (KCP3000) -- compat mode, manchester, inverse, RF/32, STT, 3 data blocks' elseif block0 == T55X7_NORALYS_CONFIG_BLOCK then return 'T55X7_NORALYS_CONFIG_BLOCK :: NORALYS (KCP3000) -- compat mode, manchester, inverse, RF/32, STT, 3 data blocks'
elseif block0 == T55X7_IOPROX_CONFIG_BLOCK then return 'T55X7_IOPROX_CONFIG_BLOCK :: HID FSK2a, RF/64, 2 data blocks' 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 == 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 == 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_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' elseif block0 == T55X7_SECURAKEY_CONFIG_BLOCK then return 'T55X7_SECURAKEY_CONFIG_BLOCK :: manchester, RF/40, 3 data blocks'
else return 'unknown configblock'..' '..block0 else return 'unknown configblock'..' '..block0
end end
end end
-- --
-- map first block0 with name -- map first block0 with name
local function getConfigBlock(block) local function getConfigBlock(block)
block = block:lower() block = block:lower()
local result = nil local result = nil
if block:startswith("f20000") then if block:startswith("f20000") then
return '00088C42', 'Card is a Viking / Starprox' return '00088C42', 'Card is a Viking / Starprox'
end end
if block:startswith('9522') then if block:startswith('9522') then
return '00088048', 'Card is an unknown badge' return '00088048', 'Card is an unknown badge'
end end
if block:startswith('56495332') then if block:startswith('56495332') then
return '00148068', 'Card is VISA2000' return '00148068', 'Card is VISA2000'
end end
if block:startswith('1d555955') then if block:startswith('1d555955') then
return '00107060', 'Card is HID Prox, (Prastel MTAG, sold by ABMatic)' return '00107060', 'Card is HID Prox, (Prastel MTAG, sold by ABMatic)'
end end
if block:startswith('bb0214ff') or block:startswith('bb0314ff') then if block:startswith('bb0214ff') or block:startswith('bb0314ff') then
return '00088C6A', 'Card is Noralsy Blue, KCP3000' return '00088C6A', 'Card is Noralsy Blue, KCP3000'
end end
--#If the block starts with ff8/9/a/b/c --#If the block starts with ff8/9/a/b/c
if block:find('^(ff[8-9a-c])') then if block:find('^(ff[8-9a-c])') then
dbg('#This is a regular EM 410 tag, using a FF pattern (from FF8 to FFF)') dbg('#This is a regular EM 410 tag, using a FF pattern (from FF8 to FFF)')
dbg('#Covering from tag 1 to tag id 9FFFFFFFFF') dbg('#Covering from tag 1 to tag id 9FFFFFFFFF')
return '00148040', 'Old rectangular Noralsy' return '00148040', 'Old rectangular Noralsy'
end end
if block:startswith('011db') then if block:startswith('011db') then
return '00107060', 'Card is AWID' return '00107060', 'Card is AWID'
end end
if block:startswith('f98c7038') then if block:startswith('f98c7038') then
return '00150060', 'Card is Guard All/ verex' return '00150060', 'Card is Guard All/ verex'
end end
if block:startswith('ffff0000') then if block:startswith('ffff0000') then
return '00158040', 'Card is Jablotron' return '00158040', 'Card is Jablotron'
end end
if block:startswith('10d00000') then if block:startswith('10d00000') then
return '00088088', 'Card is Presco' return '00088088', 'Card is Presco'
end end
if block:startswith('00010101') then if block:startswith('00010101') then
return '00107080', 'Card is Pyramid' return '00107080', 'Card is Pyramid'
end end
return result, 'unknown tag' return result, 'unknown tag'
end end
-- --
@ -216,34 +216,34 @@ function main(args)
if #args == 0 then return help() end if #args == 0 then return help() end
local lines local lines
local out = {} local out = {}
-- Read the parameters -- Read the parameters
for o, a in getopt.getopt(args, 'hi:') do for o, a in getopt.getopt(args, 'hi:') do
if o == "h" then return help() end if o == "h" then return help() end
if o == "i" then lines = load_json(a) end if o == "i" then lines = load_json(a) end
end end
--for i = 1, #data do --for i = 1, #data do
for _,i in pairs(lines) do for _,i in pairs(lines) do
local index = 0 local index = 0
local one = {} 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) one['blk_'..index] = i.data:sub(ix,ix+7)
index = index + 1 index = index + 1
end end
local mconf, msg = getConfigBlock(one["blk_1"]) local mconf, msg = getConfigBlock(one["blk_1"])
one["identification"] = msg one["identification"] = msg
one["config_desc"] = getDefault(one["blk_0"]) one["config_desc"] = getDefault(one["blk_0"])
if msg:find('badge') then if msg:find('badge') then
print (msg, i.data) print (msg, i.data)
end end
table.insert(out, one) table.insert(out, one)
end end
save_json( encode(out) , nil) save_json( encode(out) , nil)
end end
main(args) main(args)

View file

@ -59,20 +59,20 @@ function main(args)
for o, a in getopt.getopt(args, 'hw:k:') do for o, a in getopt.getopt(args, 'hw:k:') do
if o == 'h' then return help() end if o == 'h' then return help() end
if o == 'w' then loopcount = tonumber(a) end if o == 'w' then loopcount = tonumber(a) end
if o == 'k' then key = a end if o == 'k' then key = a end
end end
starttime = os.time() starttime = os.time()
for i = 1,loopcount,1 for i = 1,loopcount,1
do do
for a = 1,63,1 for a = 1,63,1
do do
if ((a + 1) % 4 ~= 0) and a ~= 0 then -- :) if ((a + 1) % 4 ~= 0) and a ~= 0 then -- :)
data = randhex(32) data = randhex(32)
-- core.console('hf mf rdbl --blk '..a..' -k FFFFFFFFFFFF') -- core.console('hf mf rdbl --blk '..a..' -k FFFFFFFFFFFF')
core.console('hf mf wrbl --blk '..a..' -k '..key..' -d '..data) core.console('hf mf wrbl --blk '..a..' -k '..key..' -d '..data)
end end
end end
end end

View file

@ -226,7 +226,7 @@
// success code // success code
if (SWIG_IsNewObj(res) { if (SWIG_IsNewObj(res) {
... ...
delete *ptr; delete *ptr;
} else { } else {
... ...
} }
@ -327,32 +327,32 @@ typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store information on one type */ /* Structure to store information on one type */
typedef struct swig_type_info { typedef struct swig_type_info {
const char *name; /* mangled name of this type */ const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */ const char *str; /* human readable name of this type */
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */ void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */ int owndata; /* flag if the structure owns the clientdata */
} swig_type_info; } swig_type_info;
/* Structure to store a type and conversion function used for casting */ /* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info { typedef struct swig_cast_info {
swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_type_info *type; /* pointer to type that is equivalent to this type */
swig_converter_func converter; /* function to cast the void pointers */ swig_converter_func converter; /* function to cast the void pointers */
struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *next; /* pointer to next cast in linked list */
struct swig_cast_info *prev; /* pointer to the previous cast */ struct swig_cast_info *prev; /* pointer to the previous cast */
} swig_cast_info; } swig_cast_info;
/* Structure used to store module information /* Structure used to store module information
* Each module generates one structure like this, and the runtime collects * Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/ * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info { typedef struct swig_module_info {
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
size_t size; /* Number of types in this module */ size_t size; /* Number of types in this module */
struct swig_module_info *next; /* Pointer to next element in circularly linked list */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
swig_type_info **type_initial; /* Array of initially generated type structures */ swig_type_info **type_initial; /* Array of initially generated type structures */
swig_cast_info **cast_initial; /* Array of initially generated casting structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
void *clientdata; /* Language specific module data */ void *clientdata; /* Language specific module data */
} swig_module_info; } swig_module_info;
/* /*
@ -714,18 +714,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
#endif #endif
/* Errors in SWIG */ /* Errors in SWIG */
#define SWIG_UnknownError -1 #define SWIG_UnknownError -1
#define SWIG_IOError -2 #define SWIG_IOError -2
#define SWIG_RuntimeError -3 #define SWIG_RuntimeError -3
#define SWIG_IndexError -4 #define SWIG_IndexError -4
#define SWIG_TypeError -5 #define SWIG_TypeError -5
#define SWIG_DivisionByZero -6 #define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7 #define SWIG_OverflowError -7
#define SWIG_SyntaxError -8 #define SWIG_SyntaxError -8
#define SWIG_ValueError -9 #define SWIG_ValueError -9
#define SWIG_SystemError -10 #define SWIG_SystemError -10
#define SWIG_AttributeError -11 #define SWIG_AttributeError -11
#define SWIG_MemoryError -12 #define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13 #define SWIG_NullReferenceError -13
@ -2568,9 +2568,9 @@ SWIG_Lua_dostring(lua_State *L, const char *str) {
if (str == 0 || str[0] == 0) return 0; /* nothing to do */ if (str == 0 || str[0] == 0) return 0; /* nothing to do */
top = lua_gettop(L); /* save stack */ top = lua_gettop(L); /* save stack */
#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) #if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
ok = luaL_dostring(L, str); /* looks like this is lua 5.1.X or later, good */ ok = luaL_dostring(L, str); /* looks like this is lua 5.1.X or later, good */
#else #else
ok = lua_dostring(L, str); /* might be lua 5.0.x, using lua_dostring */ ok = lua_dostring(L, str); /* might be lua 5.0.x, using lua_dostring */
#endif #endif
if (ok != 0) { if (ok != 0) {
SWIG_DOSTRING_FAIL(lua_tostring(L, -1)); SWIG_DOSTRING_FAIL(lua_tostring(L, -1));

View file

@ -240,7 +240,7 @@
// success code // success code
if (SWIG_IsNewObj(res) { if (SWIG_IsNewObj(res) {
... ...
delete *ptr; delete *ptr;
} else { } else {
... ...
} }
@ -341,32 +341,32 @@ typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store information on one type */ /* Structure to store information on one type */
typedef struct swig_type_info { typedef struct swig_type_info {
const char *name; /* mangled name of this type */ const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */ const char *str; /* human readable name of this type */
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */ void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */ int owndata; /* flag if the structure owns the clientdata */
} swig_type_info; } swig_type_info;
/* Structure to store a type and conversion function used for casting */ /* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info { typedef struct swig_cast_info {
swig_type_info *type; /* pointer to type that is equivalent to this type */ swig_type_info *type; /* pointer to type that is equivalent to this type */
swig_converter_func converter; /* function to cast the void pointers */ swig_converter_func converter; /* function to cast the void pointers */
struct swig_cast_info *next; /* pointer to next cast in linked list */ struct swig_cast_info *next; /* pointer to next cast in linked list */
struct swig_cast_info *prev; /* pointer to the previous cast */ struct swig_cast_info *prev; /* pointer to the previous cast */
} swig_cast_info; } swig_cast_info;
/* Structure used to store module information /* Structure used to store module information
* Each module generates one structure like this, and the runtime collects * Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/ * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info { typedef struct swig_module_info {
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
size_t size; /* Number of types in this module */ size_t size; /* Number of types in this module */
struct swig_module_info *next; /* Pointer to next element in circularly linked list */ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
swig_type_info **type_initial; /* Array of initially generated type structures */ swig_type_info **type_initial; /* Array of initially generated type structures */
swig_cast_info **cast_initial; /* Array of initially generated casting structures */ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
void *clientdata; /* Language specific module data */ void *clientdata; /* Language specific module data */
} swig_module_info; } swig_module_info;
/* /*
@ -728,18 +728,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
#endif #endif
/* Errors in SWIG */ /* Errors in SWIG */
#define SWIG_UnknownError -1 #define SWIG_UnknownError -1
#define SWIG_IOError -2 #define SWIG_IOError -2
#define SWIG_RuntimeError -3 #define SWIG_RuntimeError -3
#define SWIG_IndexError -4 #define SWIG_IndexError -4
#define SWIG_TypeError -5 #define SWIG_TypeError -5
#define SWIG_DivisionByZero -6 #define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7 #define SWIG_OverflowError -7
#define SWIG_SyntaxError -8 #define SWIG_SyntaxError -8
#define SWIG_ValueError -9 #define SWIG_ValueError -9
#define SWIG_SystemError -10 #define SWIG_SystemError -10
#define SWIG_AttributeError -11 #define SWIG_AttributeError -11
#define SWIG_MemoryError -12 #define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13 #define SWIG_NullReferenceError -13
@ -1058,7 +1058,7 @@ typedef struct swig_const_info {
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#endif #endif
#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags) #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty) #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src) #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
@ -1088,10 +1088,10 @@ typedef struct swig_const_info {
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj) #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
#define SWIG_SetErrorObj SWIG_Python_SetErrorObj #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
#define SWIG_fail goto fail #define SWIG_fail goto fail
/* Runtime API implementation */ /* Runtime API implementation */
@ -1213,7 +1213,7 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
} }
/* A functor is a function object with one single object argument */ /* A functor is a function object with one single object argument */
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL); #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
/* /*
Helper for static pointer initialization for both C and C++ code, for example Helper for static pointer initialization for both C and C++ code, for example
@ -1235,8 +1235,8 @@ SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssi
#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1) #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -1615,12 +1615,12 @@ SwigPyObject_TypeOnce(void) {
(unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_positive*/
(unaryfunc)0, /*nb_absolute*/ (unaryfunc)0, /*nb_absolute*/
(inquiry)0, /*nb_nonzero*/ (inquiry)0, /*nb_nonzero*/
0, /*nb_invert*/ 0, /*nb_invert*/
0, /*nb_lshift*/ 0, /*nb_lshift*/
0, /*nb_rshift*/ 0, /*nb_rshift*/
0, /*nb_and*/ 0, /*nb_and*/
0, /*nb_xor*/ 0, /*nb_xor*/
0, /*nb_or*/ 0, /*nb_or*/
#if PY_VERSION_HEX < 0x03000000 #if PY_VERSION_HEX < 0x03000000
0, /*nb_coerce*/ 0, /*nb_coerce*/
#endif #endif

View file

@ -176,19 +176,19 @@ static bool DetectWindowsAnsiSupport(void) {
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif #endif
// disable colors if stdin or stdout are redirected // disable colors if stdin or stdout are redirected
if ((! session.stdinOnTTY) || (! session.stdoutOnTTY)) if ((! session.stdinOnTTY) || (! session.stdoutOnTTY))
return false; return false;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwMode = 0; DWORD dwMode = 0;
GetConsoleMode(hOut, &dwMode); GetConsoleMode(hOut, &dwMode);
//ENABLE_VIRTUAL_TERMINAL_PROCESSING is already set //ENABLE_VIRTUAL_TERMINAL_PROCESSING is already set
if((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) if((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING))
return true; return true;
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
return SetConsoleMode(hOut, dwMode) ? true : false; return SetConsoleMode(hOut, dwMode) ? true : false;
@ -385,8 +385,8 @@ check_script:
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
script_cmd = readline(prompt_filtered); script_cmd = readline(prompt_filtered);
#if defined(_WIN32) #if defined(_WIN32)
//Check if color support needs to be enabled again in case the window buffer did change //Check if color support needs to be enabled again in case the window buffer did change
session.supports_colors = DetectWindowsAnsiSupport(); session.supports_colors = DetectWindowsAnsiSupport();
#endif #endif
if (script_cmd != NULL) { if (script_cmd != NULL) {
execCommand = true; execCommand = true;

View file

@ -84,8 +84,8 @@ Note: Jooki doesn't like more than one NDEF record, so make sure you just have o
`Value`|`Figurine Type`| `Value`|`Figurine Type`|
|------|---------------| |------|---------------|
**01** | Stones | **01** | Stones |
**02** | Generic Flat | **02** | Generic Flat |
**03** | System Commands | **03** | System Commands |
**04** | Tests | **04** | Tests |
| `Figurine Type` | `Figurine ID` | `Figurine` | | `Figurine Type` | `Figurine ID` | `Figurine` |

View file

@ -37,4 +37,4 @@ clCreateEventFromGLsyncKHR(cl_context context,
} }
#endif #endif
#endif /* __OPENCL_CL_GL_EXT_H */ #endif /* __OPENCL_CL_GL_EXT_H */

View file

@ -36,7 +36,7 @@
#include "dolphin_macro.h" #include "dolphin_macro.h"
#if defined(__MINGW64__) #if defined(__MINGW64__)
#define timersub(a, b, result) \ #define timersub(a, b, result) \
do { \ do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
@ -300,7 +300,7 @@ int main(int argc, char **argv) {
printf("\n"); printf("\n");
} }
if (dev_sel[0] == 0xff) printf("Devices selected : ALL\n"); if (dev_sel[0] == 0xff) printf("Devices selected : ALL\n");
else { else {
printf("Devices selected : %u", dev_sel[0]); printf("Devices selected : %u", dev_sel[0]);
for (unsigned int i = 1; i < dev_cnt; i++) printf(", %u", dev_sel[i]); for (unsigned int i = 1; i < dev_cnt; i++) printf(", %u", dev_sel[i]);

View file

@ -104,7 +104,7 @@ typedef struct opencl_ctx {
cl_program *programs; // compute program's cl_program *programs; // compute program's
cl_kernel *kernels; // compute kernel's cl_kernel *kernels; // compute kernel's
// cl_mem cand_base; // device memory used for the candidate base // cl_mem cand_base; // device memory used for the candidate base
cl_mem *keystreams; // device memory used for the keystream array cl_mem *keystreams; // device memory used for the keystream array
cl_mem *candidates; // device memory used for the candidates array cl_mem *candidates; // device memory used for the candidates array
cl_mem *matches; // device memory used for the matches array cl_mem *matches; // device memory used for the matches array