mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
lua: fix mix of spaces & tabs
This commit is contained in:
parent
716c17bac8
commit
05ff45e550
41 changed files with 5185 additions and 5185 deletions
|
@ -7,112 +7,112 @@ copyright = 'Copyright (c) 2018 IceSQL AB. All rights reserved.'
|
|||
author = 'Christian Herrmann'
|
||||
version = 'v1.0.4'
|
||||
desc = [[
|
||||
This script tries to set UID on a IS15693 SLIX magic card
|
||||
This script tries to set UID on a IS15693 SLIX magic card
|
||||
Remember the UID ->MUST<- start with 0xE0
|
||||
]]
|
||||
example = [[
|
||||
|
||||
-- ISO15693 slix magic tag
|
||||
-- ISO15693 slix magic tag
|
||||
|
||||
script run iso15_magic -u E004013344556677
|
||||
|
||||
script run iso15_magic -u E004013344556677 -a
|
||||
script run iso15_magic -u E004013344556677
|
||||
|
||||
script run iso15_magic -u E004013344556677 -a
|
||||
]]
|
||||
usage = [[
|
||||
script run iso15_magic -h -u <uid>
|
||||
|
||||
Arguments:
|
||||
-h : this help
|
||||
-u <UID> : UID (16 hexsymbols)
|
||||
-a : use offical pm3 repo ISO15 commands instead of iceman fork.
|
||||
-h : this help
|
||||
-u <UID> : UID (16 hexsymbols)
|
||||
-a : use offical pm3 repo ISO15 commands instead of iceman fork.
|
||||
]]
|
||||
|
||||
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
|
||||
---
|
||||
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)
|
||||
return nil, err
|
||||
print("ERROR: ",err)
|
||||
return nil, err
|
||||
end
|
||||
---
|
||||
---
|
||||
-- Usage help
|
||||
local function help()
|
||||
print(copyright)
|
||||
print(author)
|
||||
print(version)
|
||||
print(desc)
|
||||
print('Example usage')
|
||||
print(example)
|
||||
print(copyright)
|
||||
print(author)
|
||||
print(version)
|
||||
print(desc)
|
||||
print('Example usage')
|
||||
print(example)
|
||||
end
|
||||
--
|
||||
--- Set UID on magic command enabled on a ICEMAN based REPO
|
||||
local function magicUID_iceman(b0, b1)
|
||||
print('Using backdoor Magic tag function')
|
||||
core.console("hf 15 raw -2 -c 02213E00000000")
|
||||
core.console("hf 15 raw -2 -c 02213F69960000")
|
||||
core.console("hf 15 raw -2 -c 022138"..b1)
|
||||
core.console("hf 15 raw -2 -c 022139"..b0)
|
||||
print('Using backdoor Magic tag function')
|
||||
core.console("hf 15 raw -2 -c 02213E00000000")
|
||||
core.console("hf 15 raw -2 -c 02213F69960000")
|
||||
core.console("hf 15 raw -2 -c 022138"..b1)
|
||||
core.console("hf 15 raw -2 -c 022139"..b0)
|
||||
end
|
||||
--
|
||||
--- Set UID on magic command enabled, OFFICAL REPO
|
||||
local function magicUID_offical(b0, b1)
|
||||
print('Using backdoor Magic tag function OFFICAL REPO')
|
||||
core.console("hf 15 cmd raw -c 02213E00000000")
|
||||
core.console("hf 15 cmd raw -c 02213F69960000")
|
||||
core.console("hf 15 cmd raw -c 022138"..b1)
|
||||
core.console("hf 15 cmd raw -c 022139"..b0)
|
||||
print('Using backdoor Magic tag function OFFICAL REPO')
|
||||
core.console("hf 15 cmd raw -c 02213E00000000")
|
||||
core.console("hf 15 cmd raw -c 02213F69960000")
|
||||
core.console("hf 15 cmd raw -c 022138"..b1)
|
||||
core.console("hf 15 cmd raw -c 022139"..b0)
|
||||
end
|
||||
---
|
||||
---
|
||||
-- The main entry point
|
||||
function main(args)
|
||||
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print()
|
||||
print( string.rep('--',20) )
|
||||
print( string.rep('--',20) )
|
||||
print()
|
||||
|
||||
local uid = 'E004013344556677'
|
||||
local use_iceman = true
|
||||
|
||||
-- Read the parameters
|
||||
for o, a in getopt.getopt(args, 'hu:a') do
|
||||
if o == "h" then return help() end
|
||||
if o == "u" then uid = a end
|
||||
if o == "a" then use_iceman = false end
|
||||
end
|
||||
|
||||
-- uid string checks
|
||||
if uid == nil then return oops('empty uid string') end
|
||||
if #uid == 0 then return oops('empty uid string') end
|
||||
if #uid ~= 16 then return oops('uid wrong length. Should be 8 hex bytes') end
|
||||
local uid = 'E004013344556677'
|
||||
local use_iceman = true
|
||||
|
||||
local bytes = utils.ConvertHexToBytes(uid)
|
||||
|
||||
local block0 = string.format('%02X%02X%02X%02X', bytes[4], bytes[3], bytes[2], bytes[1])
|
||||
local block1 = string.format('%02X%02X%02X%02X', bytes[8], bytes[7], bytes[6], bytes[5])
|
||||
|
||||
print('new UID | '..uid)
|
||||
|
||||
core.clearCommandBuffer()
|
||||
|
||||
if use_iceman then
|
||||
magicUID_iceman(block0, block1)
|
||||
else
|
||||
magicUID_offical(block0, block1)
|
||||
end
|
||||
-- Read the parameters
|
||||
for o, a in getopt.getopt(args, 'hu:a') do
|
||||
if o == "h" then return help() end
|
||||
if o == "u" then uid = a end
|
||||
if o == "a" then use_iceman = false end
|
||||
end
|
||||
|
||||
-- uid string checks
|
||||
if uid == nil then return oops('empty uid string') end
|
||||
if #uid == 0 then return oops('empty uid string') end
|
||||
if #uid ~= 16 then return oops('uid wrong length. Should be 8 hex bytes') end
|
||||
|
||||
local bytes = utils.ConvertHexToBytes(uid)
|
||||
|
||||
local block0 = string.format('%02X%02X%02X%02X', bytes[4], bytes[3], bytes[2], bytes[1])
|
||||
local block1 = string.format('%02X%02X%02X%02X', bytes[8], bytes[7], bytes[6], bytes[5])
|
||||
|
||||
print('new UID | '..uid)
|
||||
|
||||
core.clearCommandBuffer()
|
||||
|
||||
if use_iceman then
|
||||
magicUID_iceman(block0, block1)
|
||||
else
|
||||
magicUID_offical(block0, block1)
|
||||
end
|
||||
end
|
||||
|
||||
main(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue