mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
lua: fix mix of spaces & tabs
This commit is contained in:
parent
716c17bac8
commit
05ff45e550
41 changed files with 5185 additions and 5185 deletions
|
@ -4,8 +4,8 @@ local bin = require('bin')
|
|||
local utils = require('utils')
|
||||
|
||||
example =[[
|
||||
1. script run test_t55x7_psk
|
||||
2. script run test_t55x7_psk -o
|
||||
1. script run test_t55x7_psk
|
||||
2. script run test_t55x7_psk -o
|
||||
]]
|
||||
author = "Iceman"
|
||||
usage = "script run test_t55x7_psk"
|
||||
|
@ -18,21 +18,21 @@ The outlined procedure is as following:
|
|||
"lf t55xx info"
|
||||
|
||||
Loop OUTER:
|
||||
change the configuretion block 0 with:
|
||||
change the configuretion block 0 with:
|
||||
-xxxx8xxx = PSK RF/2 with Manchester modulation
|
||||
-xxxx1xxx = PSK RF/2 with PSK1 modulation (phase change when input changes)
|
||||
-xxxx2xxx = PSK RF/2 with PSk2 modulation (phase change on bitclk if input high)
|
||||
-xxxx3xxx = PSK RF/2 with PSk3 modulation (phase change on rising edge of input)
|
||||
Loop INNER
|
||||
for each outer configuration, also do
|
||||
XXXXX0XX = PSK RF/2
|
||||
XXXXX4XX = PSK RF/4
|
||||
XXXXX8XX = PSK RF/8
|
||||
Loop INNER
|
||||
for each outer configuration, also do
|
||||
XXXXX0XX = PSK RF/2
|
||||
XXXXX4XX = PSK RF/4
|
||||
XXXXX8XX = PSK RF/8
|
||||
|
||||
In all 12 individual test for the PSK demod
|
||||
|
||||
Arguments:
|
||||
-h : this help
|
||||
-h : this help
|
||||
]]
|
||||
|
||||
local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
|
||||
|
@ -40,111 +40,111 @@ local DEBUG = true -- the debug flag
|
|||
|
||||
-- --BLOCK 0 = 00 08 80 40 PSK
|
||||
-- -----------
|
||||
-- 08------- bitrate
|
||||
-- 8----- modulation PSK1
|
||||
-- 0---- PSK ClockRate
|
||||
-- 40 max 2 blocks
|
||||
-- 08------- bitrate
|
||||
-- 8----- modulation PSK1
|
||||
-- 0---- PSK ClockRate
|
||||
-- 40 max 2 blocks
|
||||
|
||||
local procedurecmds = {
|
||||
[1] = '00%02X%X%X40',
|
||||
[2] = 'lf t55xx detect',
|
||||
[3] = 'lf t55xx info',
|
||||
[1] = '00%02X%X%X40',
|
||||
[2] = 'lf t55xx detect',
|
||||
[3] = 'lf t55xx info',
|
||||
}
|
||||
---
|
||||
---
|
||||
-- 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
|
||||
while args[i] do
|
||||
dbg(args[i])
|
||||
i = i+1
|
||||
end
|
||||
else
|
||||
print("###", args)
|
||||
end
|
||||
end
|
||||
---
|
||||
local i = 1
|
||||
while args[i] do
|
||||
dbg(args[i])
|
||||
i = i+1
|
||||
end
|
||||
else
|
||||
print("###", args)
|
||||
end
|
||||
end
|
||||
---
|
||||
-- This is only meant to be used when errors occur
|
||||
local function oops(err)
|
||||
print("ERROR: ",err)
|
||||
print("ERROR: ",err)
|
||||
end
|
||||
---
|
||||
---
|
||||
-- Usage help
|
||||
local function help()
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
end
|
||||
--
|
||||
-- Exit message
|
||||
local function ExitMsg(msg)
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print(msg)
|
||||
print()
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print(msg)
|
||||
print()
|
||||
end
|
||||
|
||||
local function test(modulation)
|
||||
local bitrate
|
||||
local clockrate
|
||||
local block = "00"
|
||||
for bitrate = 0x0, 0x1d, 0x4 do
|
||||
|
||||
for clockrate = 0,8,4 do
|
||||
local bitrate
|
||||
local clockrate
|
||||
local block = "00"
|
||||
for bitrate = 0x0, 0x1d, 0x4 do
|
||||
|
||||
for _ = 1, #procedurecmds do
|
||||
local cmd = procedurecmds[_]
|
||||
|
||||
if #cmd == 0 then
|
||||
|
||||
elseif _ == 1 then
|
||||
for clockrate = 0,8,4 do
|
||||
|
||||
dbg("Writing to T55x7 TAG")
|
||||
for _ = 1, #procedurecmds do
|
||||
local cmd = procedurecmds[_]
|
||||
|
||||
local config = cmd:format(bitrate, modulation, clockrate)
|
||||
dbg(('lf t55xx write b 0 d %s'):format(config))
|
||||
|
||||
config = tonumber(config,16)
|
||||
local writecmd = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK,arg1 = config, arg2 = block, arg3 = "00", data = "00"}
|
||||
local err = core.SendCommand(writecmd:getBytes())
|
||||
if err then return oops(err) end
|
||||
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
|
||||
else
|
||||
dbg(cmd)
|
||||
core.console( cmd )
|
||||
end
|
||||
end
|
||||
core.clearCommandBuffer()
|
||||
end
|
||||
end
|
||||
print( string.rep('--',20) )
|
||||
if #cmd == 0 then
|
||||
|
||||
elseif _ == 1 then
|
||||
|
||||
dbg("Writing to T55x7 TAG")
|
||||
|
||||
local config = cmd:format(bitrate, modulation, clockrate)
|
||||
dbg(('lf t55xx write b 0 d %s'):format(config))
|
||||
|
||||
config = tonumber(config,16)
|
||||
local writecmd = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK,arg1 = config, arg2 = block, arg3 = "00", data = "00"}
|
||||
local err = core.SendCommand(writecmd:getBytes())
|
||||
if err then return oops(err) end
|
||||
local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
|
||||
else
|
||||
dbg(cmd)
|
||||
core.console( cmd )
|
||||
end
|
||||
end
|
||||
core.clearCommandBuffer()
|
||||
end
|
||||
end
|
||||
print( string.rep('--',20) )
|
||||
end
|
||||
|
||||
local function main(args)
|
||||
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
|
||||
-- Arguments for the script
|
||||
for o, arg in getopt.getopt(args, 'h') do
|
||||
if o == "h" then return help() end
|
||||
end
|
||||
-- Arguments for the script
|
||||
for o, arg in getopt.getopt(args, 'h') do
|
||||
if o == "h" then return help() end
|
||||
end
|
||||
|
||||
core.clearCommandBuffer()
|
||||
core.clearCommandBuffer()
|
||||
|
||||
test(1) -- PSK1
|
||||
--test(2) -- PSK2
|
||||
--test(3) -- PSK3
|
||||
|
||||
print( string.rep('--',20) )
|
||||
test(1) -- PSK1
|
||||
--test(2) -- PSK2
|
||||
--test(3) -- PSK3
|
||||
|
||||
print( string.rep('--',20) )
|
||||
end
|
||||
main(args)
|
||||
|
||||
-- Where it iterates over
|
||||
-- Where it iterates over
|
||||
-- xxxx8xxx = PSK RF/2 with Manchester modulation
|
||||
-- xxxx1xxx = PSK RF/2 with PSK1 modulation (phase change when input changes)
|
||||
-- xxxx2xxx = PSK RF/2 with PSk2 modulation (phase change on bitclk if input high)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue