text
[RRG-proxmark3.git] / client / luascripts / hf_14a_i2crevive.lua
blob59659bb5c3a821eb197a8b289f9498db7a3ab378
1 local getopt = require('getopt')
2 local ansicolors = require('ansicolors')
4 copyright = ''
5 author = 'Equip'
6 version = 'v1.0.1'
7 desc = [[
8 This script tries to recover soft bricked ntag i2c tags through the use of raw commands
9 ]]
10 example = [[
11 1. script run hf_14a_i2crevive
13 usage = [[
14 script run hf_14a_i2crevive
16 arguments = [[
17 -h this help
19 ---
20 local function help()
21 print(copyright)
22 print(author)
23 print(version)
24 print(desc)
25 print(ansicolors.cyan..'Usage'..ansicolors.reset)
26 print(usage)
27 print(ansicolors.cyan..'Arguments'..ansicolors.reset)
28 print(arguments)
29 print(ansicolors.cyan..'Example usage'..ansicolors.reset)
30 print(example)
31 end
33 local function i2cR()
34 return {
35 [0] = 'hf 14a raw -k -a -b 7 40',
36 [1] = 'hf 14a raw -k -a 43',
37 [2] = 'hf 14a raw -c -a A203E1106D00',
38 [3] = 'hf 14a raw -k -a -b 7 40',
39 [4] = 'hf 14a raw -k -a 43',
40 [5] = 'hf 14a raw -c -a A20244000F00',
41 [6] = 'hf 14a raw -k -a -b 7 40',
42 [7] = 'hf 14a raw -k -a 43',
43 [8] = 'hf 14a raw -c -a A2E20000FF00',
44 [9] = 'hf 14a raw -k -a -b 7 40',
45 [10] = 'hf 14a raw -k -a 43',
46 [11] = 'hf 14a raw -c -a A2E3000000E3',
47 [12] = 'hf 14a raw -c -a 5000',
49 end
51 local function sendCmds( cmds )
52 for i = 0, #cmds do
53 if cmds[i] then
54 print ( cmds[i] )
55 core.console( cmds[i] )
56 core.clearCommandBuffer()
57 end
58 end
59 end
61 function main(args)
63 local i
64 local cmds = {}
65 --check for params
66 for o, a in getopt.getopt(args, 'h') do
67 if o == 'h' then return help() end
68 end
70 core.clearCommandBuffer()
71 sendCmds( i2cR() )
72 end
73 main(args)