mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-21 20:52:45 +08:00
FIX: test_t55x7_psk.lua now correctly handles bitrate/modulation/clockrate combinations for PSK1.
Uncomment lines in main to test PSK2, PSK3.
This commit is contained in:
parent
ca65d3af86
commit
1c6490cddc
2 changed files with 38 additions and 30 deletions
|
@ -217,6 +217,6 @@ function Command:getBytes()
|
||||||
local data = self.data
|
local data = self.data
|
||||||
local cmd = self.cmd
|
local cmd = self.cmd
|
||||||
local arg1, arg2, arg3 = self.arg1, self.arg2, self.arg3
|
local arg1, arg2, arg3 = self.arg1, self.arg2, self.arg3
|
||||||
return bin.pack("LLLLH",cmd, arg1, arg2, arg3,data);
|
return bin.pack("LLLLH",cmd, arg1, arg2, arg3, data);
|
||||||
end
|
end
|
||||||
return _commands
|
return _commands
|
||||||
|
|
|
@ -43,9 +43,6 @@ 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 = true -- the debug flag
|
||||||
|
|
||||||
--BLOCK 0 = 00088040 PSK
|
|
||||||
local config1 = '0014'
|
|
||||||
local config2 = '40'
|
|
||||||
|
|
||||||
-- local procedurecmds = {
|
-- local procedurecmds = {
|
||||||
-- [1] = '%s%s%s%s',
|
-- [1] = '%s%s%s%s',
|
||||||
|
@ -57,8 +54,15 @@ local config2 = '40'
|
||||||
-- [6] = 'data pskindalademod',
|
-- [6] = 'data pskindalademod',
|
||||||
-- }
|
-- }
|
||||||
|
|
||||||
|
-- --BLOCK 0 = 00 08 80 40 PSK
|
||||||
|
-- -----------
|
||||||
|
-- 08------- bitrate
|
||||||
|
-- 8----- modulation PSK1
|
||||||
|
-- 0---- PSK ClockRate
|
||||||
|
-- 40 max 2 blocks
|
||||||
|
|
||||||
local procedurecmds = {
|
local procedurecmds = {
|
||||||
[1] = '%s%s%s%s',
|
[1] = '00%02X%X%X40',
|
||||||
[2] = 'lf t55xx detect',
|
[2] = 'lf t55xx detect',
|
||||||
--[3] = '',
|
--[3] = '',
|
||||||
[3] = 'lf t55xx info',
|
[3] = 'lf t55xx info',
|
||||||
|
@ -102,31 +106,36 @@ function ExitMsg(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test(modulation)
|
function test(modulation)
|
||||||
local y
|
local bitrate
|
||||||
for y = 0, 8, 4 do
|
local clockrate
|
||||||
for _ = 1, #procedurecmds do
|
for bitrate = 0x0, 0x1d, 0x4 do
|
||||||
local cmd = procedurecmds[_]
|
|
||||||
|
|
||||||
if #cmd == 0 then
|
for clockrate = 0,8,4 do
|
||||||
|
|
||||||
elseif _ == 1 then
|
for _ = 1, #procedurecmds do
|
||||||
|
local cmd = procedurecmds[_]
|
||||||
|
|
||||||
dbg("Writing to T55x7 TAG")
|
if #cmd == 0 then
|
||||||
|
|
||||||
local config = cmd:format( config1, modulation , y, config2)
|
elseif _ == 1 then
|
||||||
dbg(('lf t55xx write 0 %s'):format(config))
|
|
||||||
|
|
||||||
config = tonumber(config,16)
|
dbg("Writing to T55x7 TAG")
|
||||||
local writecommand = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK, arg1 = config ,arg2 = 0, arg3 = 0}
|
|
||||||
local err = core.SendCommand(writecommand:getBytes())
|
local config = cmd:format(bitrate, modulation, clockrate)
|
||||||
if err then return oops(err) end
|
dbg(('lf t55xx write 0 %s'):format(config))
|
||||||
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
|
|
||||||
else
|
config = tonumber(config,16)
|
||||||
dbg(cmd)
|
local writecommand = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK, arg1 = config ,arg2 = 0, arg3 = 0}
|
||||||
core.console( cmd )
|
local err = core.SendCommand(writecommand:getBytes())
|
||||||
|
if err then return oops(err) end
|
||||||
|
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
|
||||||
|
else
|
||||||
|
dbg(cmd)
|
||||||
|
core.console( cmd )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
core.clearCommandBuffer()
|
||||||
end
|
end
|
||||||
core.clearCommandBuffer()
|
|
||||||
end
|
end
|
||||||
print( string.rep('--',20) )
|
print( string.rep('--',20) )
|
||||||
end
|
end
|
||||||
|
@ -143,10 +152,9 @@ local function main(args)
|
||||||
|
|
||||||
core.clearCommandBuffer()
|
core.clearCommandBuffer()
|
||||||
|
|
||||||
test(1)
|
test(1) -- PSK1
|
||||||
test(2)
|
--test(2) -- PSK2
|
||||||
test(3)
|
--test(3) -- PSK3
|
||||||
test(8)
|
|
||||||
|
|
||||||
print( string.rep('--',20) )
|
print( string.rep('--',20) )
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue