diff --git a/armsrc/hitag2.c b/armsrc/hitag2.c index 8cafdba7a..063ed6c07 100644 --- a/armsrc/hitag2.c +++ b/armsrc/hitag2.c @@ -1199,9 +1199,9 @@ void SniffHitag2(void) { LED_B_ON(); // Capture reader frame if (ra >= HITAG_T_STOP) { -// if (rxlen != 0) { +// if (rxlen != 0) { //DbpString("wierd0?"); -// } +// } // Capture the T0 periods that have passed since last communication or field drop (reset) response = (ra - HITAG_T_LOW); } else if (ra >= HITAG_T_1_MIN) { @@ -1218,9 +1218,9 @@ void SniffHitag2(void) { LED_C_ON(); // Capture tag frame (manchester decoding using only falling edges) if (ra >= HITAG_T_EOF) { -// if (rxlen != 0) { +// if (rxlen != 0) { //DbpString("wierd1?"); -// } +// } // 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 |-_| response = ra - HITAG_T_TAG_HALF_PERIOD; diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 4d292d70c..4fb606141 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -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) { - uint8_t rnd[2]; + uint8_t rnd[2]; 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 }; - memcpy(&c[3], uid, 8); - init_password_15693_slixl(&c[11], password, rnd); - AddCrc15(c, 15); + 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); + init_password_15693_slixl(&c[11], password, rnd); + AddCrc15(c, 15); - 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; + 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; } 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) { - 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 }; - memcpy(&c[3], uid, 8); - c[11] = pass_id; - init_password_15693_slixl(&c[12], password, NULL); - AddCrc15(c, 16); + 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); + c[11] = pass_id; + init_password_15693_slixl(&c[12], password, NULL); + 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]; - 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; + 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; } 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) { - 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 }; - memcpy(&c[3], uid, 8); - init_password_15693_slixl(&c[11], password, rnd); - AddCrc15(c, 15); + 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); + init_password_15693_slixl(&c[11], password, rnd); + AddCrc15(c, 15); - 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; + 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; } */ diff --git a/client/luascripts/hf_legic.lua b/client/luascripts/hf_legic.lua index ca06ae8c5..663f193a3 100644 --- a/client/luascripts/hf_legic.lua +++ b/client/luascripts/hf_legic.lua @@ -713,7 +713,7 @@ function getRandomTempName() local keyLength = 8 local output = "" - for i = 1, keyLength do + for i = 1, keyLength do local rand = math.random(#characterSet) output = output .. string.sub(characterSet, rand, rand) end diff --git a/client/luascripts/lf_ident_json.lua b/client/luascripts/lf_ident_json.lua index 243799115..fb0d82554 100644 --- a/client/luascripts/lf_ident_json.lua +++ b/client/luascripts/lf_ident_json.lua @@ -34,16 +34,16 @@ end --- -- A debug printout-function local function dbg(args) - if not DEBUG then return end + if not DEBUG then return end if type(args) == 'table' then - local i = 1 + local i = 1 while args[i] do dbg(args[i]) - i = i+1 - end - else + i = i+1 + end + else print('###', args) - end + end end --- -- This is only meant to be used when errors occur @@ -58,13 +58,13 @@ local function help() print(copyright) print(author) print(version) - print(desc) + print(desc) print(ac.cyan..'Usage'..ac.reset) print(usage) print(ac.cyan..'Arguments'..ac.reset) print(arguments) print(ac.cyan..'Example usage'..ac.reset) - print(example) + print(example) end --- -- Exit message @@ -79,130 +79,130 @@ end -- -- @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 + 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) + -- Read file + local t = infile:read("*all") + io.close(infile) - local obj, pos, err = json.decode(t, 1, nil) - if err then return oops(string.format("importing json file failed. %s", err)) end + local obj, pos, err = json.decode(t, 1, nil) + if err then return oops(string.format("importing json file failed. %s", err)) end - print(string.format('loaded file %s', input)) - return obj + print(string.format('loaded file %s', input)) + return obj end -- -- 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 - outfile:write(data) - io.close(outfile) - return 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 + outfile:write(data) + io.close(outfile) + return filename end local function encode(blocks) - return json.encode (blocks, { indent = true }) + return json.encode (blocks, { indent = true }) end -- -- map config blocks 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_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 - -- 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, - -- 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 = '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_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_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_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_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 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_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_ST = 'F0088058' --// manchester, RF/32, STT, pwd, 2 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_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 + -- 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) + --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_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_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_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_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_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 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_SECURAKEY_CONFIG_BLOCK = 'F00C8060' --// Securakey - manchester, RF/40, 3 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' - 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_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_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_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_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_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_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 - end + 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_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_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_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_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_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_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_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 + end end -- -- map first block0 with name local function getConfigBlock(block) - block = block:lower() + block = block:lower() local result = nil if block:startswith("f20000") then - return '00088C42', 'Card is a Viking / Starprox' - end - if block:startswith('9522') then - return '00088048', 'Card is an unknown badge' - end - if block:startswith('56495332') then - return '00148068', 'Card is VISA2000' - end - if block:startswith('1d555955') then - return '00107060', 'Card is HID Prox, (Prastel MTAG, sold by ABMatic)' - end - if block:startswith('bb0214ff') or block:startswith('bb0314ff') then - return '00088C6A', 'Card is Noralsy Blue, KCP3000' - end - --#If the block starts with ff8/9/a/b/c - 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('#Covering from tag 1 to tag id 9FFFFFFFFF') - return '00148040', 'Old rectangular Noralsy' - end - if block:startswith('011db') then - return '00107060', 'Card is AWID' - end - if block:startswith('f98c7038') then - return '00150060', 'Card is Guard All/ verex' - end - if block:startswith('ffff0000') then - return '00158040', 'Card is Jablotron' - end - if block:startswith('10d00000') then - return '00088088', 'Card is Presco' - end - if block:startswith('00010101') then - return '00107080', 'Card is Pyramid' - end + return '00088C42', 'Card is a Viking / Starprox' + end + if block:startswith('9522') then + return '00088048', 'Card is an unknown badge' + end + if block:startswith('56495332') then + return '00148068', 'Card is VISA2000' + end + if block:startswith('1d555955') then + return '00107060', 'Card is HID Prox, (Prastel MTAG, sold by ABMatic)' + end + if block:startswith('bb0214ff') or block:startswith('bb0314ff') then + return '00088C6A', 'Card is Noralsy Blue, KCP3000' + end + --#If the block starts with ff8/9/a/b/c + 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('#Covering from tag 1 to tag id 9FFFFFFFFF') + return '00148040', 'Old rectangular Noralsy' + end + if block:startswith('011db') then + return '00107060', 'Card is AWID' + end + if block:startswith('f98c7038') then + return '00150060', 'Card is Guard All/ verex' + end + if block:startswith('ffff0000') then + return '00158040', 'Card is Jablotron' + end + if block:startswith('10d00000') then + return '00088088', 'Card is Presco' + end + if block:startswith('00010101') then + return '00107080', 'Card is Pyramid' + end - return result, 'unknown tag' + return result, 'unknown tag' end -- @@ -216,34 +216,34 @@ function main(args) if #args == 0 then return help() end - local lines - local out = {} - -- Read the parameters - for o, a in getopt.getopt(args, 'hi:') do - if o == "h" then return help() end - if o == "i" then lines = load_json(a) end - end + local lines + local out = {} + -- Read the parameters + for o, a in getopt.getopt(args, 'hi:') do + 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 + --for i = 1, #data do + for _,i in pairs(lines) do - local index = 0 - local one = {} - for ix = 1, #i.data, 8 do - one['blk_'..index] = i.data:sub(ix,ix+7) - index = index + 1 - end + local index = 0 + local one = {} + for ix = 1, #i.data, 8 do + one['blk_'..index] = i.data:sub(ix,ix+7) + index = index + 1 + end - local mconf, msg = getConfigBlock(one["blk_1"]) - one["identification"] = msg - one["config_desc"] = getDefault(one["blk_0"]) + 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) + if msg:find('badge') then + print (msg, i.data) + end + table.insert(out, one) + end + save_json( encode(out) , nil) end main(args) diff --git a/client/luascripts/mfc_hammerlite.lua b/client/luascripts/mfc_hammerlite.lua index 10a528a3d..6ae0da47f 100644 --- a/client/luascripts/mfc_hammerlite.lua +++ b/client/luascripts/mfc_hammerlite.lua @@ -59,20 +59,20 @@ function main(args) for o, a in getopt.getopt(args, 'hw:k:') do if o == 'h' then return help() end if o == 'w' then loopcount = tonumber(a) end - if o == 'k' then key = a end + if o == 'k' then key = a end end starttime = os.time() for i = 1,loopcount,1 do - for a = 1,63,1 - do - if ((a + 1) % 4 ~= 0) and a ~= 0 then -- :) + for a = 1,63,1 + do + if ((a + 1) % 4 ~= 0) and a ~= 0 then -- :) data = randhex(32) - -- core.console('hf mf rdbl --blk '..a..' -k FFFFFFFFFFFF') - core.console('hf mf wrbl --blk '..a..' -k '..key..' -d '..data) - end + -- core.console('hf mf rdbl --blk '..a..' -k FFFFFFFFFFFF') + core.console('hf mf wrbl --blk '..a..' -k '..key..' -d '..data) + end end end diff --git a/client/src/pm3_luawrap.c b/client/src/pm3_luawrap.c index 565fd9d42..0b4cd024b 100644 --- a/client/src/pm3_luawrap.c +++ b/client/src/pm3_luawrap.c @@ -226,7 +226,7 @@ // success code if (SWIG_IsNewObj(res) { ... - delete *ptr; + delete *ptr; } else { ... } @@ -327,32 +327,32 @@ typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - 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 */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + 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 */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - 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 *prev; /* pointer to the previous cast */ + swig_type_info *type; /* pointer to type that is equivalent to this type */ + 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 *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { - 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 */ - 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_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ + 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 */ + 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_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ } swig_module_info; /* @@ -714,18 +714,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #endif /* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 #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 */ top = lua_gettop(L); /* save stack */ #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 - 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 if (ok != 0) { SWIG_DOSTRING_FAIL(lua_tostring(L, -1)); diff --git a/client/src/pm3_pywrap.c b/client/src/pm3_pywrap.c index e8e9b71b3..279b26d21 100644 --- a/client/src/pm3_pywrap.c +++ b/client/src/pm3_pywrap.c @@ -240,7 +240,7 @@ // success code if (SWIG_IsNewObj(res) { ... - delete *ptr; + delete *ptr; } else { ... } @@ -341,32 +341,32 @@ typedef struct swig_type_info *(*swig_dycast_func)(void **); /* Structure to store information on one type */ typedef struct swig_type_info { - const char *name; /* mangled name of this type */ - const char *str; /* human readable name of this type */ - 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 */ - void *clientdata; /* language specific type data */ - int owndata; /* flag if the structure owns the clientdata */ + const char *name; /* mangled name of this type */ + const char *str; /* human readable name of this type */ + 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 */ + void *clientdata; /* language specific type data */ + int owndata; /* flag if the structure owns the clientdata */ } swig_type_info; /* Structure to store a type and conversion function used for casting */ typedef struct swig_cast_info { - swig_type_info *type; /* pointer to type that is equivalent to this type */ - 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 *prev; /* pointer to the previous cast */ + swig_type_info *type; /* pointer to type that is equivalent to this type */ + 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 *prev; /* pointer to the previous cast */ } swig_cast_info; /* Structure used to store module information * Each module generates one structure like this, and the runtime collects * all of these structures and stores them in a circularly linked list.*/ typedef struct swig_module_info { - 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 */ - 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_cast_info **cast_initial; /* Array of initially generated casting structures */ - void *clientdata; /* Language specific module data */ + 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 */ + 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_cast_info **cast_initial; /* Array of initially generated casting structures */ + void *clientdata; /* Language specific module data */ } swig_module_info; /* @@ -728,18 +728,18 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { #endif /* Errors in SWIG */ -#define SWIG_UnknownError -1 -#define SWIG_IOError -2 -#define SWIG_RuntimeError -3 -#define SWIG_IndexError -4 -#define SWIG_TypeError -5 -#define SWIG_DivisionByZero -6 -#define SWIG_OverflowError -7 -#define SWIG_SyntaxError -8 -#define SWIG_ValueError -9 -#define SWIG_SystemError -10 -#define SWIG_AttributeError -11 -#define SWIG_MemoryError -12 +#define SWIG_UnknownError -1 +#define SWIG_IOError -2 +#define SWIG_RuntimeError -3 +#define SWIG_IndexError -4 +#define SWIG_TypeError -5 +#define SWIG_DivisionByZero -6 +#define SWIG_OverflowError -7 +#define SWIG_SyntaxError -8 +#define SWIG_ValueError -9 +#define SWIG_SystemError -10 +#define SWIG_AttributeError -11 +#define SWIG_MemoryError -12 #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) #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_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_SetErrorObj SWIG_Python_SetErrorObj -#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg -#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) -#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) -#define SWIG_fail goto fail +#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg +#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code) +#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) +#define SWIG_fail goto fail /* 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 */ -#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 @@ -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_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) -#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) +#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2) +#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN) #ifdef __cplusplus extern "C" { @@ -1615,12 +1615,12 @@ SwigPyObject_TypeOnce(void) { (unaryfunc)0, /*nb_positive*/ (unaryfunc)0, /*nb_absolute*/ (inquiry)0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ #if PY_VERSION_HEX < 0x03000000 0, /*nb_coerce*/ #endif diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 8d81a0959..c5f49b933 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -176,19 +176,19 @@ static bool DetectWindowsAnsiSupport(void) { #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING #define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #endif - - // disable colors if stdin or stdout are redirected + + // disable colors if stdin or stdout are redirected if ((! session.stdinOnTTY) || (! session.stdoutOnTTY)) - return false; - + return false; + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); DWORD dwMode = 0; GetConsoleMode(hOut, &dwMode); - - //ENABLE_VIRTUAL_TERMINAL_PROCESSING is already set - if((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) - return true; - + + //ENABLE_VIRTUAL_TERMINAL_PROCESSING is already set + if((dwMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING)) + return true; + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; return SetConsoleMode(hOut, dwMode) ? true : false; @@ -385,8 +385,8 @@ check_script: #ifdef HAVE_READLINE script_cmd = readline(prompt_filtered); #if defined(_WIN32) - //Check if color support needs to be enabled again in case the window buffer did change - session.supports_colors = DetectWindowsAnsiSupport(); + //Check if color support needs to be enabled again in case the window buffer did change + session.supports_colors = DetectWindowsAnsiSupport(); #endif if (script_cmd != NULL) { execCommand = true; diff --git a/doc/jooki_notes.md b/doc/jooki_notes.md index 418a2bc38..5217ea3e8 100644 --- a/doc/jooki_notes.md +++ b/doc/jooki_notes.md @@ -84,8 +84,8 @@ Note: Jooki doesn't like more than one NDEF record, so make sure you just have o `Value`|`Figurine Type`| |------|---------------| **01** | Stones | -**02** | Generic Flat | -**03** | System Commands | +**02** | Generic Flat | +**03** | System Commands | **04** | Tests | | `Figurine Type` | `Figurine ID` | `Figurine` | diff --git a/tools/hitag2crack/common/OpenCL-Headers/CL/cl_gl_ext.h b/tools/hitag2crack/common/OpenCL-Headers/CL/cl_gl_ext.h index 916c5189b..9668c72f7 100644 --- a/tools/hitag2crack/common/OpenCL-Headers/CL/cl_gl_ext.h +++ b/tools/hitag2crack/common/OpenCL-Headers/CL/cl_gl_ext.h @@ -37,4 +37,4 @@ clCreateEventFromGLsyncKHR(cl_context context, } #endif -#endif /* __OPENCL_CL_GL_EXT_H */ +#endif /* __OPENCL_CL_GL_EXT_H */ diff --git a/tools/hitag2crack/crack5opencl/ht2crack5opencl.c b/tools/hitag2crack/crack5opencl/ht2crack5opencl.c index 13f667113..6bac850dd 100644 --- a/tools/hitag2crack/crack5opencl/ht2crack5opencl.c +++ b/tools/hitag2crack/crack5opencl/ht2crack5opencl.c @@ -36,7 +36,7 @@ #include "dolphin_macro.h" #if defined(__MINGW64__) -#define timersub(a, b, result) \ +#define timersub(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ @@ -300,7 +300,7 @@ int main(int argc, char **argv) { printf("\n"); } - if (dev_sel[0] == 0xff) printf("Devices selected : ALL\n"); + if (dev_sel[0] == 0xff) printf("Devices selected : ALL\n"); else { printf("Devices selected : %u", dev_sel[0]); for (unsigned int i = 1; i < dev_cnt; i++) printf(", %u", dev_sel[i]); diff --git a/tools/hitag2crack/crack5opencl/opencl.h b/tools/hitag2crack/crack5opencl/opencl.h index 03ae9a990..78cd3d347 100644 --- a/tools/hitag2crack/crack5opencl/opencl.h +++ b/tools/hitag2crack/crack5opencl/opencl.h @@ -104,7 +104,7 @@ typedef struct opencl_ctx { cl_program *programs; // compute program'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 *candidates; // device memory used for the candidates array cl_mem *matches; // device memory used for the matches array