]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/scripts/legic_buffer2card.lua
CHG: removed the wiegand converting, since I'm not happy with how its implemented...
[proxmark3-svn] / client / scripts / legic_buffer2card.lua
1 -- this script writes bytes 8 to 256 on the Legic MIM256
2 example = "Script writes to Legic Prime Tag from position 0x07 until 0xFF with the value 0x01"
3 author = "Mosci"
4 desc =
5 [[
6 This is a script which writes value 0x01 to bytes from position 0x07 until 0xFF on a Legic Prime Tag (MIM256 or MIM1024)
7 (created with 'hf legic save my_dump.hex')
8
9 optional arguments :
10 -h - Help text
11
12 Examples :
13 script run legic_buffer2card
14 ]]
15
16 local utils = require('utils')
17 local getopt = require('getopt')
18 ---
19 -- This is only meant to be used when errors occur
20 function oops(err)
21 print("ERROR: ",err)
22 return nil, err
23 end
24 ---
25 -- Usage help
26 function help()
27 print(desc)
28 print("Example usage")
29 print(example)
30 end
31 --
32 -- simple loop-write from 0x07 to 0xff
33 function main()
34
35 -- parse arguments for the script
36 for o, a in getopt.getopt(args, 'h') do
37 if o == "h" then return help() end
38 end
39
40 local cmd = ''
41 local i
42 for i = 7, 255 do
43 cmd = ('hf legic write 0x%02x 0x01'):format(i)
44 print(cmd)
45 core.clearCommandBuffer()
46 core.console(cmd)
47
48 -- got a 'cmd-buffer overflow' on my mac - so just wait a little
49 -- works without that pause on my linux-box
50 utils.Sleep(0.1)
51 end
52 end
53
54 main()
Impressum, Datenschutz