1 local getopt
= require('getopt')
2 local ansicolors
= require('ansicolors')
3 local cmds
= require('commands')
6 author
= "TheChamop669"
9 Perform bulk enrollment of 26 bit H10301 style RFID Tags
10 For more info, check the comments in the code
14 script run lf_hid_bulkclone_v2.lua -f 1 -b 1000
17 script run lf_hid_bulkclone_v2.lua -f facility -b base_id_num
26 -- A debug printout-function
27 local function dbg(args
)
28 if not DEBUG
then return end
29 if type(args
) == 'table' then
40 -- This is only meant to be used when errors occur
41 local function oops(err
)
43 core
.clearCommandBuffer()
53 print(ansicolors
.cyan
..'Usage'..ansicolors
.reset
)
55 print(ansicolors
.cyan
..'Arguments'..ansicolors
.reset
)
57 print(ansicolors
.cyan
..'Example usage'..ansicolors
.reset
)
62 local function exitMsg(msg
)
63 print( string.rep('--',20) )
64 print( string.rep('--',20) )
69 local function main(args
)
71 print( string.rep('--',20) )
72 print( string.rep('--',20) )
75 if #args
== 0 then return help() end
77 for o
, a
in getopt
.getopt(args
, 'f:b:h') do
78 if o
== 'h' then return help() end
81 print('You did not supply a facility code, using 0')
89 print('You did not supply a starting card number, using 1000')
97 local successful_writes
= {}
98 local timestamp
= os
.date('%Y-%m-%d %H:%M:%S', os
.time())
101 print(string.format("Writing Facility Code: %d, Card Number: %d", fc
, cn
))
103 local command
= string.format("lf hid clone -w H10301 --fc %d --cn %d", fc
, cn
)
104 core
.console(command
)
106 table.insert(successful_writes
, string.format("%d,%d", fc
, cn
))
108 print("Press Enter to write the next card, type 'r' and press Enter to retry, or type 'q' and press Enter to quit.")
109 local user_input
= io
.read()
111 if user_input
:lower() == 'q' then
112 print("Timestamp: ", timestamp
)
113 print("Successful Writes:")
114 for _
, v
in ipairs(successful_writes
) do print(v
) end
116 elseif user_input
:lower() ~= 'r' then
126 1. The `lf hid clone` command is used to write HID formatted data to T5577 cards, using the H10301 format.
127 2. The script prompts the user for the initial facility code and card number at the start of the session.
128 3. Users can continue to write to the next card, retry the current write, or quit the session by responding to the prompts.
129 4. Upon quitting, the script prints all successful writes along with a timestamp.
130 5. Password-related features have been removed in this version of the script as they are not supported by the `lf hid clone` command.