make miscchecks
This commit is contained in:
1 parent
af6ff40748
commit
1f27be076b
12 files changed
+274
-274
No files matched your search
@@ -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
|
||||
|
||||
+128
-128
@@ -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)
|
||||
@@ -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
|
||||
|
||||
|
||||
+31
-31
@@ -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));
|
||||
|
||||
+43
-43
@@ -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
|
||||
|
||||
+11
-11
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user