From 2152d563c95319e250841be43065c68f2123ff85 Mon Sep 17 00:00:00 2001 From: Gary Bell Date: Tue, 13 Aug 2024 20:09:05 -0400 Subject: [PATCH] Fixed hid clone script & new t55xx reset script --- CHANGELOG.md | 2 + client/luascripts/lf_hid_bulkclone_v2.lua | 3 +- client/luascripts/lf_t55xx_reset.lua | 89 +++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 client/luascripts/lf_t55xx_reset.lua diff --git a/CHANGELOG.md b/CHANGELOG.md index df99d61b0..5cfba7c3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed missing require of ansicolors in `lf_hid_bulkclone_v2.lua` script (@whiteneon) +- Added `lf_t55xx_reset.lua` - a script to aid in quickly resetting t55xx chips (@whiteneon) - Changed `hf mf chk/fchk`: added option `--no-default` to skip loading the usual ~61 hardcoded keys (@doegox) - Fixed `hf mf wipe` to detect properly write errors (@doegox) - Fixed `hf mf fchk` which was leaving the RF field on when interrupted by keyboard (@doegox) diff --git a/client/luascripts/lf_hid_bulkclone_v2.lua b/client/luascripts/lf_hid_bulkclone_v2.lua index b090d67ec..33d084dd8 100644 --- a/client/luascripts/lf_hid_bulkclone_v2.lua +++ b/client/luascripts/lf_hid_bulkclone_v2.lua @@ -1,9 +1,10 @@ local getopt = require('getopt') +local ansicolors = require('ansicolors') local cmds = require('commands') copyright = '' author = "TheChamop669" -version = 'v1.0.0' +version = 'v1.0.1' desc = [[ Perform bulk enrollment of 26 bit H10301 style RFID Tags For more info, check the comments in the code diff --git a/client/luascripts/lf_t55xx_reset.lua b/client/luascripts/lf_t55xx_reset.lua new file mode 100644 index 000000000..e63b07b66 --- /dev/null +++ b/client/luascripts/lf_t55xx_reset.lua @@ -0,0 +1,89 @@ +local getopt = require('getopt') +local ansicolors = require('ansicolors') +local utils = require('utils') + +copyright = '' +author = 'whiteneon' +version = 'v1.0.0' +desc = [[ +This script attempts to reset the password + - on a T55xx LF chip. + ]] +example = [[ + script run lf_t55xx_reset +]] +usage = [[ +script run lf_t55xx_reset -h +]] +arguments = [[ + -h : this help +]] + +local DEBUG = true +--- +-- A debug printout-function +local function dbg(args) + if not DEBUG then return end + if type(args) == 'table' then + local i = 1 + while args[i] do + dbg(args[i]) + i = i+1 + end + else + print('###', args) + end +end +--- +-- This is only meant to be used when errors occur +local function oops(err) + print('ERROR:', err) + core.clearCommandBuffer() + return nil, err +end +--- +-- Usage help +local function help() + print(copyright) + print(author) + print(version) + print(desc) + print(ansicolors.cyan..'Usage'..ansicolors.reset) + print(usage) + print(ansicolors.cyan..'Arguments'..ansicolors.reset) + print(arguments) + print(ansicolors.cyan..'Example usage'..ansicolors.reset) + print(example) +end +--- +-- The main entry point +function main(args) + local dash = string.rep('--', 20) + + print( dash ) + print( dash ) + print() + + -- Read the parameters + for o, a in getopt.getopt(args, 'h') do + if o == 'h' then return help() end + end + + print('Attempting T55xx chip reset') + print(dash) +-- core.console('lf t55 write -b 0 -d 000880E0 --r0 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r1 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r2 -t') +-- core.console('lf t55 write -b 0 -d 000880E0 --r3 -t') + core.console('lf t55 write -b 0 -d 000880E0 --r0') + core.console('lf t55 write -b 0 -d 000880E0 --r1') + core.console('lf t55 write -b 0 -d 000880E0 --r2') + core.console('lf t55 write -b 0 -d 000880E0 --r3') + core.console('lf t55 wipe') + core.console('lf t55 detect') + print(dash) + print('all done!') + +end + +main(args)