chg: luascripts now uses t55xx write NG frame format

This commit is contained in:
iceman1001 2019-05-13 16:51:26 +02:00
commit 6a6902e57d
5 changed files with 41 additions and 40 deletions

View file

@ -39,7 +39,8 @@ Arguments:
-h this help -h this help
]] ]]
local DEBUG = false -- the debug flag local DEBUG = true -- the debug flag
local TIMEOUT = 1500
local total_tests = 0 local total_tests = 0
local total_pass = 0 local total_pass = 0
@ -237,7 +238,9 @@ local function test(modulation)
local process_block0_cmds = {} local process_block0_cmds = {}
local y local y
local block = '00' local password = '00000000'
local block = '00' -- configuration block 0
local flags = '00' -- page 0, no pwd, no testmode
local s = ('Start test of %s'):format(modulation) local s = ('Start test of %s'):format(modulation)
print(s) print(s)
@ -254,13 +257,11 @@ local function test(modulation)
-- Write Config block -- Write Config block
dbg(('lf t55xx write b 0 d %s'):format(p_config_cmd)) dbg(('lf t55xx write b 0 d %s'):format(p_config_cmd))
local config = tonumber(p_config_cmd, 16)
local wc = Command:newMIX{ local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(p_config_cmd, 32), password, block, flags)
cmd = cmds.CMD_T55XX_WRITE_BLOCK
, arg1 = config local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data}
, arg2 = block local response, err = wc:sendNG(false, TIMEOUT)
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end if not response then return oops(err) end
-- Detect -- Detect
@ -309,7 +310,7 @@ local function main(args)
-- Adjust this table to set which configurations should be tested -- Adjust this table to set which configurations should be tested
-- local test_modes = { 'PSK1', 'PSK2', 'PSK3', 'FSK1', 'FSK2', 'FSK1A', 'FSK2A', 'ASK', 'BI' } -- local test_modes = { 'PSK1', 'PSK2', 'PSK3', 'FSK1', 'FSK2', 'FSK1A', 'FSK2A', 'ASK', 'BI' }
local test_modes = { 'ASK', 'PSK1' } local test_modes = { 'ASK' }
for _ = 1, #test_modes do for _ = 1, #test_modes do
res = WipeCard() res = WipeCard()

View file

@ -48,6 +48,7 @@ Arguments:
]] ]]
local DEBUG = true -- the debug flag local DEBUG = true -- the debug flag
local TIMEOUT = 1500
--BLOCK 0 = 00008040 ASK / MAN --BLOCK 0 = 00008040 ASK / MAN
local config1 = '00' local config1 = '00'
@ -101,7 +102,9 @@ end
local function test() local function test()
local y local y
local password = '00000000'
local block = '00' local block = '00'
local flags = '00'
for y = 0x0, 0x1d, 0x4 do for y = 0x0, 0x1d, 0x4 do
for _ = 1, #procedurecmds do for _ = 1, #procedurecmds do
local pcmd = procedurecmds[_] local pcmd = procedurecmds[_]
@ -111,14 +114,11 @@ local function test()
elseif _ == 1 then elseif _ == 1 then
local config = pcmd:format(config1, y, config2) local config = pcmd:format(config1, y, config2)
dbg(('lf t55xx write b 0 d %s'):format(config)) dbg(('lf t55xx write b 0 d %s'):format(config))
config = tonumber(config, 16) local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags)
local wc = Command:newMIX{
cmd = cmds.CMD_T55XX_WRITE_BLOCK local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data}
, arg1 = config local response, err = wc:sendNG(false, TIMEOUT)
, arg2 = block
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end if not response then return oops(err) end
else else

View file

@ -42,6 +42,7 @@ Arguments:
]] ]]
local DEBUG = true -- the debug flag local DEBUG = true -- the debug flag
local TIMEOUT = 1500
--BLOCK 0 = 00010040 BIPHASE --BLOCK 0 = 00010040 BIPHASE
local config1 = '00' local config1 = '00'
@ -95,7 +96,9 @@ end
local function test() local function test()
local y local y
local password = '00000000'
local block = '00' local block = '00'
local flags = '00'
for y = 1, 0x1D, 4 do for y = 1, 0x1D, 4 do
for _ = 1, #procedurecmds do for _ = 1, #procedurecmds do
local pcmd = procedurecmds[_] local pcmd = procedurecmds[_]
@ -107,13 +110,11 @@ local function test()
local config = pcmd:format(config1, y, config2) local config = pcmd:format(config1, y, config2)
dbg(('lf t55xx write b 0 d %s'):format(config)) dbg(('lf t55xx write b 0 d %s'):format(config))
config = tonumber(config, 16) local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags)
local wc = Command:newMIX{
cmd = cmds.CMD_T55XX_WRITE_BLOCK local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data}
, arg1 = config local response, err = wc:sendNG(false, TIMEOUT)
, arg2 = block
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end if not response then return oops(err) end
else else
dbg(pcmd) dbg(pcmd)

View file

@ -44,6 +44,7 @@ Arguments:
]] ]]
local DEBUG = true -- the debug flag local DEBUG = true -- the debug flag
local TIMEOUT = 1500
--BLOCK 0 = 00008040 FSK --BLOCK 0 = 00008040 FSK
local config1 = '00' local config1 = '00'
@ -97,7 +98,9 @@ end
local function test(modulation) local function test(modulation)
local y local y
local password = '00000000'
local block = '00' local block = '00'
local flags = '00'
for y = 0x0, 0x1d, 0x4 do for y = 0x0, 0x1d, 0x4 do
for _ = 1, #procedurecmds do for _ = 1, #procedurecmds do
local pcmd = procedurecmds[_] local pcmd = procedurecmds[_]
@ -108,14 +111,10 @@ local function test(modulation)
local config = pcmd:format(config1, y, modulation, config2) local config = pcmd:format(config1, y, modulation, config2)
dbg(('lf t55xx write b 0 d %s'):format(config)) dbg(('lf t55xx write b 0 d %s'):format(config))
local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags)
config = tonumber(config,16) local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data}
local wc = Command:newMIX{ local response, err = wc:sendNG(false, TIMEOUT)
cmd = cmds.CMD_T55XX_WRITE_BLOCK
, arg1 = config
, arg2 = block
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end if not response then return oops(err) end
else else
dbg(pcmd) dbg(pcmd)

View file

@ -40,6 +40,7 @@ Arguments:
]] ]]
local DEBUG = true -- the debug flag local DEBUG = true -- the debug flag
local TIMEOUT = 1500
-- --BLOCK 0 = 00 08 80 40 PSK -- --BLOCK 0 = 00 08 80 40 PSK
-- ----------- -- -----------
@ -97,7 +98,9 @@ end
local function test(modulation) local function test(modulation)
local bitrate local bitrate
local clockrate local clockrate
local password = '00000000'
local block = '00' local block = '00'
local flags = '00'
for bitrate = 0x0, 0x1d, 0x4 do for bitrate = 0x0, 0x1d, 0x4 do
for clockrate = 0,8,4 do for clockrate = 0,8,4 do
@ -114,13 +117,10 @@ local function test(modulation)
local config = cmd:format(bitrate, modulation, clockrate) local config = cmd:format(bitrate, modulation, clockrate)
dbg(('lf t55xx write b 0 d %s'):format(config)) dbg(('lf t55xx write b 0 d %s'):format(config))
config = tonumber(config, 16) local data = ('%s%s%s%s'):format(utils.SwapEndiannessStr(config, 32), password, block, flags)
local wc = Command:newMIX{
cmd = cmds.CMD_T55XX_WRITE_BLOCK local wc = Command:newNG{cmd = cmds.CMD_T55XX_WRITE_BLOCK, data = data}
, arg1 = config local response, err = wc:sendNG(false, TIMEOUT)
, arg2 = block
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end if not response then return oops(err) end
else else
dbg(cmd) dbg(cmd)