mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
test_t55x7 logs & stats
This commit is contained in:
parent
fa0a2914f6
commit
841f20c5e5
1 changed files with 99 additions and 78 deletions
|
@ -40,7 +40,9 @@ Arguments:
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
|
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
|
||||||
local DEBUG = true -- the debug flag
|
local DEBUG = false -- the debug flag
|
||||||
|
local total_tests = 0
|
||||||
|
local total_pass = 0
|
||||||
|
|
||||||
local data_blocks_cmds = {
|
local data_blocks_cmds = {
|
||||||
[1] = '00000000',
|
[1] = '00000000',
|
||||||
|
@ -95,73 +97,6 @@ local function GetConfigs( modulation )
|
||||||
|
|
||||||
local t = {}
|
local t = {}
|
||||||
|
|
||||||
t['ASK'] = {
|
|
||||||
[1] = '00008040',
|
|
||||||
[2] = '00048040',
|
|
||||||
[3] = '00088040',
|
|
||||||
[4] = '000c8040',
|
|
||||||
[5] = '00108040',
|
|
||||||
[6] = '00148040',
|
|
||||||
[7] = '00188040',
|
|
||||||
[8] = '001c8040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['BI'] = {
|
|
||||||
[1] = '00010040',
|
|
||||||
[2] = '00050040',
|
|
||||||
[3] = '00090040',
|
|
||||||
[4] = '000d0040',
|
|
||||||
[5] = '00110040',
|
|
||||||
[6] = '00150040',
|
|
||||||
[7] = '00190040',
|
|
||||||
[8] = '001d0040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['FSK2A'] = {
|
|
||||||
[1] = '00007040',
|
|
||||||
[2] = '00047040',
|
|
||||||
[3] = '00087040',
|
|
||||||
[4] = '000c7040',
|
|
||||||
[5] = '00107040',
|
|
||||||
[6] = '00147040',
|
|
||||||
[7] = '00187040',
|
|
||||||
[8] = '001c7040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['FSK1A'] = {
|
|
||||||
[1] = '00006040',
|
|
||||||
[2] = '00046040',
|
|
||||||
[3] = '00086040',
|
|
||||||
[4] = '000c6040',
|
|
||||||
[5] = '00106040',
|
|
||||||
[6] = '00146040',
|
|
||||||
[7] = '00186040',
|
|
||||||
[8] = '001c6040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['FSK2'] = {
|
|
||||||
[1] = '00005040',
|
|
||||||
[2] = '00045040',
|
|
||||||
[3] = '00085040',
|
|
||||||
[4] = '000c5040',
|
|
||||||
[5] = '00105040',
|
|
||||||
[6] = '00145040',
|
|
||||||
[7] = '00185040',
|
|
||||||
[8] = '001c5040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['FSK1'] = {
|
|
||||||
[1] = '00004040',
|
|
||||||
[2] = '00004040',
|
|
||||||
[3] = '00044040',
|
|
||||||
[4] = '00084040',
|
|
||||||
[5] = '000c4040',
|
|
||||||
[6] = '00104040',
|
|
||||||
[7] = '00144040',
|
|
||||||
[8] = '00184040',
|
|
||||||
[9] = '001c4040',
|
|
||||||
}
|
|
||||||
|
|
||||||
t['PSK1'] = {
|
t['PSK1'] = {
|
||||||
[1] = '00001040',
|
[1] = '00001040',
|
||||||
[2] = '00041040',
|
[2] = '00041040',
|
||||||
|
@ -193,7 +128,75 @@ local function GetConfigs( modulation )
|
||||||
[6] = '00143040',
|
[6] = '00143040',
|
||||||
[7] = '00183040',
|
[7] = '00183040',
|
||||||
[8] = '001c3040',
|
[8] = '001c3040',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t['FSK1'] = {
|
||||||
|
[1] = '00004040',
|
||||||
|
[2] = '00004040',
|
||||||
|
[3] = '00044040',
|
||||||
|
[4] = '00084040',
|
||||||
|
[5] = '000c4040',
|
||||||
|
[6] = '00104040',
|
||||||
|
[7] = '00144040',
|
||||||
|
[8] = '00184040',
|
||||||
|
[9] = '001c4040',
|
||||||
|
}
|
||||||
|
|
||||||
|
t['FSK2'] = {
|
||||||
|
[1] = '00005040',
|
||||||
|
[2] = '00045040',
|
||||||
|
[3] = '00085040',
|
||||||
|
[4] = '000c5040',
|
||||||
|
[5] = '00105040',
|
||||||
|
[6] = '00145040',
|
||||||
|
[7] = '00185040',
|
||||||
|
[8] = '001c5040',
|
||||||
|
}
|
||||||
|
|
||||||
|
t['FSK1A'] = {
|
||||||
|
[1] = '00006040',
|
||||||
|
[2] = '00046040',
|
||||||
|
[3] = '00086040',
|
||||||
|
[4] = '000c6040',
|
||||||
|
[5] = '00106040',
|
||||||
|
[6] = '00146040',
|
||||||
|
[7] = '00186040',
|
||||||
|
[8] = '001c6040',
|
||||||
|
}
|
||||||
|
|
||||||
|
t['FSK2A'] = {
|
||||||
|
[1] = '00007040',
|
||||||
|
[2] = '00047040',
|
||||||
|
[3] = '00087040',
|
||||||
|
[4] = '000c7040',
|
||||||
|
[5] = '00107040',
|
||||||
|
[6] = '00147040',
|
||||||
|
[7] = '00187040',
|
||||||
|
[8] = '001c7040',
|
||||||
|
}
|
||||||
|
|
||||||
|
t['ASK'] = {
|
||||||
|
[1] = '00008040',
|
||||||
|
[2] = '00048040',
|
||||||
|
[3] = '00088040',
|
||||||
|
[4] = '000c8040',
|
||||||
|
[5] = '00108040',
|
||||||
|
[6] = '00148040',
|
||||||
|
[7] = '00188040',
|
||||||
|
[8] = '001c8040',
|
||||||
|
}
|
||||||
|
|
||||||
|
t['BI'] = {
|
||||||
|
[1] = '00010040',
|
||||||
|
[2] = '00050040',
|
||||||
|
[3] = '00090040',
|
||||||
|
[4] = '000d0040',
|
||||||
|
[5] = '00110040',
|
||||||
|
[6] = '00150040',
|
||||||
|
[7] = '00190040',
|
||||||
|
[8] = '001d0040',
|
||||||
|
}
|
||||||
|
|
||||||
return t[modulation:upper()]
|
return t[modulation:upper()]
|
||||||
end
|
end
|
||||||
---
|
---
|
||||||
|
@ -203,17 +206,17 @@ local function WipeCard()
|
||||||
print('Wiping card')
|
print('Wiping card')
|
||||||
core.console('lf t55xx wipe')
|
core.console('lf t55xx wipe')
|
||||||
|
|
||||||
print('Detecting card');
|
print('Detecting card')
|
||||||
local res, msg = core.t55xx_detect()
|
local res, msg = core.t55xx_detect()
|
||||||
if not res then
|
if not res then
|
||||||
oops("can't detect modulation. Test failed.");
|
oops("Can't detect modulation. Test failed.")
|
||||||
core.console("rem Failed to detect");
|
core.console("rem [ERR:DETECT:WIPED] Failed to detect after wipe")
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
local wipe_data_cmd = "lf t55xx write b %s d %s"
|
local wipe_data_cmd = "lf t55xx write b %s d %s"
|
||||||
for _ = 1, #data_blocks_cmds do
|
for _ = 1, #data_blocks_cmds do
|
||||||
local val = data_blocks_cmds[_]
|
local val = data_blocks_cmds[_]
|
||||||
local c = string.format(wipe_data_cmd, _, val);
|
local c = string.format(wipe_data_cmd, _, val)
|
||||||
core.console(c)
|
core.console(c)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -239,7 +242,6 @@ local function test(modulation)
|
||||||
|
|
||||||
local s = ('Start test of %s'):format(modulation)
|
local s = ('Start test of %s'):format(modulation)
|
||||||
print(s)
|
print(s)
|
||||||
core.console('rem '..s)
|
|
||||||
|
|
||||||
process_block0_cmds = GetConfigs(modulation)
|
process_block0_cmds = GetConfigs(modulation)
|
||||||
|
|
||||||
|
@ -248,6 +250,7 @@ local function test(modulation)
|
||||||
for _ = 1, #process_block0_cmds do
|
for _ = 1, #process_block0_cmds do
|
||||||
|
|
||||||
local p_config_cmd = process_block0_cmds[_]
|
local p_config_cmd = process_block0_cmds[_]
|
||||||
|
local errors = 0
|
||||||
core.clearCommandBuffer()
|
core.clearCommandBuffer()
|
||||||
|
|
||||||
-- Write Config block
|
-- Write Config block
|
||||||
|
@ -262,19 +265,30 @@ local function test(modulation)
|
||||||
local res, msg = core.t55xx_detect()
|
local res, msg = core.t55xx_detect()
|
||||||
if not res then
|
if not res then
|
||||||
print("can't detect modulation, skip to next config")
|
print("can't detect modulation, skip to next config")
|
||||||
|
core.console(format("rem [ERR:DETECT:%s] Failed to detect modulation", p_config_cmd))
|
||||||
|
core.console(format('rem [SUMMARY:%s] FAIL detection', p_config_cmd))
|
||||||
|
total_tests = total_tests + #data_blocks_cmds
|
||||||
else
|
else
|
||||||
-- Loop block1-2
|
-- Loop block1-2
|
||||||
for _ = 1, #data_blocks_cmds do
|
for _ = 1, #data_blocks_cmds do
|
||||||
|
total_tests = total_tests + 1
|
||||||
local val = data_blocks_cmds[_]
|
local val = data_blocks_cmds[_]
|
||||||
local blockdata, msg = CheckReadBlock(_)
|
local blockdata, msg = CheckReadBlock(_)
|
||||||
if blockdata:lower() ~= val:lower() then
|
if blockdata:lower() ~= val:lower() then
|
||||||
print( ('Test %s == %s Failed'):format(val, blockdata))
|
print( ('Test %s == %s Failed'):format(val, blockdata))
|
||||||
core.console( format('rem -- block %d value %s failed', _, val))
|
core.console( format('rem [ERR:READ:%s:%d] block %d: read %s instead of %s', p_config_cmd, _, _, blockdata, val))
|
||||||
|
errors = errors+1
|
||||||
else
|
else
|
||||||
print( ('Test %s == %s OK'):format(val, blockdata))
|
print( ('Test %s == %s OK'):format(val, blockdata))
|
||||||
|
total_pass = total_pass + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
if errors >0 then
|
||||||
|
core.console( format('rem [SUMMARY:%s] FAIL %d test%s', p_config_cmd, errors, errors > 1 and "s" or ""))
|
||||||
|
else
|
||||||
|
core.console( format('rem [SUMMARY:%s] PASS all tests', p_config_cmd))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -292,15 +306,22 @@ local function main(args)
|
||||||
local res
|
local res
|
||||||
|
|
||||||
-- 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 = { 'ASK', 'PSK1' }
|
local test_modes = { 'ASK', 'PSK1' }
|
||||||
|
|
||||||
for _ = 1, #test_modes do
|
for _ = 1, #test_modes do
|
||||||
res = WipeCard()
|
res = WipeCard()
|
||||||
print (test_modes[_])
|
if res then
|
||||||
if res then test(test_modes[_]) end
|
print (test_modes[_])
|
||||||
|
test(test_modes[_])
|
||||||
|
else
|
||||||
|
exitMsg('Abort!')
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
exitMsg('Tests finished')
|
exitMsg('Tests finished')
|
||||||
|
core.console( format('rem [SUMMARY] Success rate: %d/%d tests passed%s', total_pass, total_tests, total_pass < total_tests and ", help me improving that number!" or " \\o/"))
|
||||||
|
|
||||||
end
|
end
|
||||||
main(args)
|
main(args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue