]> git.zerfleddert.de Git - proxmark3-svn/blame - client/scripts/legic_buffer2card.lua
ADD: `analyse nuid` - generates NUID 4byte from a UID 7byte. Mifare Classic Ev1...
[proxmark3-svn] / client / scripts / legic_buffer2card.lua
CommitLineData
733eb420 1-- this script writes bytes 8 to 256 on the Legic MIM256
2example = "Script writes to Legic Prime Tag from position 0x07 until 0xFF with the value 0x01"
3author = "Mosci"
4desc =
5[[
6This 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
9optional arguments :
10 -h - Help text
11
12Examples :
13 script run legic_buffer2card
14]]
15
16local utils = require('utils')
17local getopt = require('getopt')
18---
19-- This is only meant to be used when errors occur
20function oops(err)
21 print("ERROR: ",err)
22 return nil, err
23 end
24---
25-- Usage help
26function help()
27 print(desc)
28 print("Example usage")
29 print(example)
30end
31--
32-- simple loop-write from 0x07 to 0xff
33function 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
52end
53
54main()
Impressum, Datenschutz