]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Attempt to use raw writing capabilities via scripting engine. Not functional yet
authormartin.holst@gmail.com <martin.holst@gmail.com@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Thu, 4 Jul 2013 12:56:00 +0000 (12:56 +0000)
committermartin.holst@gmail.com <martin.holst@gmail.com@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Thu, 4 Jul 2013 12:56:00 +0000 (12:56 +0000)
client/commands.lua
client/scripts/writeraw.lua [new file with mode: 0644]

index e09adb36cd8af0c39b9e280104a7953f39576a89..bf2a8a1fb4e0995b01257513be9669cb732ac5b9 100644 (file)
@@ -162,6 +162,10 @@ Command = {
                
                return o
        end,
+       parse = function (packet)
+               local count,cmd,arg1,arg2,arg3,data = bin.unpack('LLLLH512',packet)
+               return Command:new{cmd = cmd, arg1 = arg1, arg2 = arg2, arg3 = arg3, data = data}
+       end,
 }
 function Command:__tostring()
        local output = ("%s\r\nargs : (%s, %s, %s)\r\ndata:\r\n%s\r\n"):format(
@@ -181,6 +185,4 @@ function Command:getBytes()
        
        return bin.pack("LLLLH",cmd, arg1, arg2, arg3,data);
 end
-
-
 return _commands
\ No newline at end of file
diff --git a/client/scripts/writeraw.lua b/client/scripts/writeraw.lua
new file mode 100644 (file)
index 0000000..2525086
--- /dev/null
@@ -0,0 +1,46 @@
+local cmds = require('commands')
+local desc =
+[[
+
+This script is a work in progress, not yet functional. It is an attempt to use the raw-writing 
+capabilities already present within the devices
+
+]]
+
+print(desc)
+
+-- Some raw data
+local rawdata = "6000F57b" --mf_auth
+local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds
+
+function show(usbpacket)
+       if usbpacket then
+               local response = Command.parse(usbpacket)
+               print(response)
+       end
+end
+
+-- Want to do both connect and send raw, so we should AND the two commands
+-- ISO14A_COMMAND.ISO14A_RAW and ISO14A_CONNECT. However, we don't have a 
+-- bitlib yet, so we'll do it manually, 1 & 8 == 9
+-- ISO14A_NO_DISCONNECT = 2
+
+print(string.len(rawdata))
+local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a, 
+                                                                       arg1 = 9, 
+                                                                       arg2 = string.len(rawdata), 
+                                                                       data = rawdata}
+core.clearCommandBuffer()
+print("Sending")
+print(command)
+local err = core.SendCommand(command:getBytes())
+if err then
+       print(err)
+       return nil, err
+end
+local cardselect = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
+print("Card select:")
+show(cardselect)
+local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT)
+print("Raw response:")
+show(response)
Impressum, Datenschutz