diff --git a/client/luascripts/AWID.lua b/client/luascripts/AWID.lua new file mode 100644 index 000000000..c73a9ba2a --- /dev/null +++ b/client/luascripts/AWID.lua @@ -0,0 +1,41 @@ +local getopt = require('getopt') + +-- Example starting values +local facilityCode = 255 -- Example facility code +local cardNumber = 59615 -- Example starting card number +local sessionStart = os.date("%Y_%m_%d_%H_%M_%S") -- Capture the session start time + +local function showHelp() + print("Usage: script run [-h]") + print("Options:") + print("-h \t This help") +end + +local function main(args) + for o, a in getopt.getopt(args, 'h') do + if o == 'h' then return showHelp() end + end + + print("Session Start: " .. sessionStart) + print("Facility Code,Card Number") + + while true do + print(string.format("Preparing to Write: Facility Code %d, Card Number %d", facilityCode, cardNumber)) + + local command = string.format("lf awid clone --fmt 26 --fc %d --cn %d", facilityCode, cardNumber) + core.console(command) + + print(string.format("%d,%d", facilityCode, cardNumber)) + + print("Press Enter to continue with the next card number or type 'q' and press Enter to quit.") + local user_input = io.read() + + if user_input:lower() == 'q' then + break + else + cardNumber = cardNumber + 1 + end + end +end + +main(args) \ No newline at end of file diff --git a/client/luascripts/H103.lua b/client/luascripts/H103.lua new file mode 100644 index 000000000..d60e596a8 --- /dev/null +++ b/client/luascripts/H103.lua @@ -0,0 +1,57 @@ +local getopt = require('getopt') +local cmds = require('commands') + +local successfulWrites = {} +local facilityCode = 10 -- default value +local cardNumber = 1000 -- default value +local timestamp = os.date('%Y-%m-%d %H:%M:%S', os.time()) + +local function showHelp() + print("Usage: script run [-h]") + print("Options:") + print("-h \t Display this help message") +end + +local function main(args) + for o, a in getopt.getopt(args, 'h') do + if o == 'h' then return showHelp() end + end + + print("Enter starting Facility Code:") + facilityCode = tonumber(io.read()) or facilityCode + + print("Enter starting Card Number:") + cardNumber = tonumber(io.read()) or cardNumber + + while true do + print(string.format("Writing Facility Code: %d, Card Number: %d", facilityCode, cardNumber)) + + local command = string.format("lf hid clone -w H10301 --fc %d --cn %d", facilityCode, cardNumber) + core.console(command) + + table.insert(successfulWrites, string.format("%d,%d", facilityCode, cardNumber)) + + print("Press Enter to write the next card, type 'r' and press Enter to retry, or type 'q' and press Enter to quit.") + local user_input = io.read() + + if user_input:lower() == 'q' then + print("Timestamp: ", timestamp) + print("Successful Writes:") + for _, v in ipairs(successfulWrites) do print(v) end + break + elseif user_input:lower() ~= 'r' then + cardNumber = cardNumber + 1 + end + end +end + +main(args) + +--[[ +Notes: +1. The `lf hid clone` command is used to write HID formatted data to T5577 cards, using the H10301 format. +2. The script prompts the user for the initial facility code and card number at the start of the session. +3. Users can continue to write to the next card, retry the current write, or quit the session by responding to the prompts. +4. Upon quitting, the script prints all successful writes along with a timestamp. +5. Password-related features have been removed in this version of the script as they are not supported by the `lf hid clone` command. +]] diff --git a/client/luascripts/kantech.lua b/client/luascripts/kantech.lua new file mode 100644 index 000000000..301af5731 --- /dev/null +++ b/client/luascripts/kantech.lua @@ -0,0 +1,51 @@ +local getopt = require('getopt') +local cmds = require('commands') + +local successfulWrites = {} +local timestamp = os.date('%Y-%m-%d %H:%M:%S', os.time()) + +local function showHelp() + print("Usage: script run [-h]") + print("Options:") + print("-h \t Display this help message") +end + +local function main(args) + for o, a in getopt.getopt(args, 'h') do + if o == 'h' then return showHelp() end + end + + print("Enter starting Facility Code:") + local facilityCode = tonumber(io.read()) + + print("Enter starting Card Number:") + local cardNumber = tonumber(io.read()) + + while true do + print(string.format("Setting fob to Facility Code: %d, Card Number: %d", facilityCode, cardNumber)) + + -- Writing to block 0 with the specific data for ioProx card format + core.console("lf t55xx write -b 0 -d 00147040") + + -- Command to set facility code and card number on the fob + local command = string.format("lf io clone --vn 2 --fc %d --cn %d", facilityCode, cardNumber) + core.console(command) + + table.insert(successfulWrites, string.format("%d,%d", facilityCode, cardNumber)) + print("Fob created successfully.") + + print("Press Enter to create the next fob, type 'r' and press Enter to retry, or type 'q' and press Enter to quit.") + local user_input = io.read() + + if user_input:lower() == 'q' then + print("Timestamp: ", timestamp) + print("Successful Writes:") + for _, v in ipairs(successfulWrites) do print(v) end + break + elseif user_input:lower() ~= 'r' then + cardNumber = cardNumber + 1 + end + end +end + +main(args)