]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/scripts/test_t55x7_psk.lua
Update README.md
[proxmark3-svn] / client / scripts / test_t55x7_psk.lua
index 2909ff8352b2bb0f54ada23ff740e99035e138b8..bdd644a7624e4a84536d589874dddf352cdcd03d 100644 (file)
@@ -43,9 +43,6 @@ Arguments:
 local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
 local DEBUG = true -- the debug flag
 
---BLOCK 0 = 00088040 PSK
-local config1 = '0014'
-local config2 = '40'
        
 -- local procedurecmds = {
        -- [1] = '%s%s%s%s',
@@ -57,8 +54,15 @@ local config2 = '40'
        -- [6] = 'data pskindalademod',
 -- }
 
+-- --BLOCK 0 = 00 08 80 40 PSK
+             -- -----------
+                          -- 08------- bitrate
+                                 -- 8----- modulation PSK1
+                                  -- 0---- PSK ClockRate
+                                     -- 40 max 2 blocks
+
 local procedurecmds = {
-       [1] = '%s%s%s%s',
+       [1] = '00%02X%X%X40',
        [2] = 'lf t55xx detect',
        --[3] = '',
        [3] = 'lf t55xx info',
@@ -102,31 +106,37 @@ function ExitMsg(msg)
 end
 
 function test(modulation)
-       local y
-       for y = 0, 8, 4 do
-               for _ = 1, #procedurecmds do
-                       local cmd = procedurecmds[_]
-                       
-                       if #cmd == 0 then  
-                       
-                       elseif _ == 1 then
-
-                               dbg("Writing to T55x7 TAG")
-               
-                               local config = cmd:format( config1, modulation , y, config2)                            
-                               dbg(('lf t55xx write 0 %s'):format(config))
+       local bitrate
+       local clockrate
+       local block = "00"
+       for bitrate = 0x0, 0x1d, 0x4 do
+       
+               for clockrate = 0,8,4 do
+
+                       for _ = 1, #procedurecmds do
+                               local cmd = procedurecmds[_]
+                               
+                               if #cmd == 0 then  
                                
-                               config = tonumber(config,16) 
-                               local writecommand = Command:new{cmd = cmds.CMD_T55XX_WRITE_BLOCK, arg1 = config ,arg2 = 0, arg3 = 0}
-                               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 )
+                               elseif _ == 1 then
+
+                                       dbg("Writing to T55x7 TAG")
+
+                                       local config = cmd:format(bitrate, modulation, clockrate)
+                                       dbg(('lf t55xx write 0 %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
-               core.clearCommandBuffer()       
        end
        print( string.rep('--',20) )
 end
@@ -143,10 +153,9 @@ local function main(args)
 
        core.clearCommandBuffer()
 
-       test(1)
-       test(2)
-       test(3)
-       test(8)
+       test(1)  -- PSK1
+       --test(2) -- PSK2
+       --test(3) -- PSK3
        
        print( string.rep('--',20) )
 end
@@ -160,4 +169,4 @@ main(args)
 
     -- XXXXX0XX = PSK RF/2
     -- XXXXX4XX = PSK RF/4
-    -- XXXXX8XX = PSK RF/8
\ No newline at end of file
+    -- XXXXX8XX = PSK RF/8
Impressum, Datenschutz