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
|
@ -5,73 +5,73 @@ example = "script calculates many different checksums (CRC) over the provided he
|
|||
author = "Iceman"
|
||||
desc =
|
||||
[[
|
||||
This script calculates many checksums (CRC) over the provided hex input.
|
||||
This script calculates many checksums (CRC) over the provided hex input.
|
||||
|
||||
Arguments:
|
||||
-b data in hex
|
||||
-w bitwidth of the CRC family of algorithm. <optional> defaults to all known CRC presets.
|
||||
Examples :
|
||||
script run e -b 010203040506070809
|
||||
script run e -b 010203040506070809 -w 16
|
||||
-b data in hex
|
||||
-w bitwidth of the CRC family of algorithm. <optional> defaults to all known CRC presets.
|
||||
Examples :
|
||||
script run e -b 010203040506070809
|
||||
script run e -b 010203040506070809 -w 16
|
||||
]]
|
||||
|
||||
---
|
||||
---
|
||||
-- A debug printout-function
|
||||
function dbg(args)
|
||||
if DEBUG then
|
||||
print("###", args)
|
||||
end
|
||||
end
|
||||
---
|
||||
if DEBUG then
|
||||
print("###", args)
|
||||
end
|
||||
end
|
||||
---
|
||||
-- This is only meant to be used when errors occur
|
||||
function oops(err)
|
||||
print("[!] ERROR: ",err)
|
||||
return nil,err
|
||||
print("[!] ERROR: ",err)
|
||||
return nil,err
|
||||
end
|
||||
---
|
||||
---
|
||||
-- Usage help
|
||||
function help()
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
end
|
||||
---
|
||||
---
|
||||
-- The main entry point
|
||||
function main(args)
|
||||
|
||||
local data
|
||||
local width = 0
|
||||
local data
|
||||
local width = 0
|
||||
|
||||
-- Read the parameters
|
||||
for o, a in getopt.getopt(args, 'hb:w:') do
|
||||
if o == "h" then return help() end
|
||||
if o == "b" then data = a end
|
||||
if o == "w" then width = a end
|
||||
end
|
||||
-- Read the parameters
|
||||
for o, a in getopt.getopt(args, 'hb:w:') do
|
||||
if o == "h" then return help() end
|
||||
if o == "b" then data = a end
|
||||
if o == "w" then width = a end
|
||||
end
|
||||
|
||||
data = data or '01020304'
|
||||
width = width or 0
|
||||
|
||||
print( string.rep('-',60) )
|
||||
print('Bit width of CRC | '..width)
|
||||
print('Bytes | '..data)
|
||||
print('')
|
||||
print( ('%-20s| %-16s| %s'):format('Model','CRC', 'CRC reverse','bigEnd', 'bigEnd','little','little'))
|
||||
print( string.rep('-',60) )
|
||||
local lists, err = core.reveng_models(width)
|
||||
if lists == nil then return oops(err) end
|
||||
|
||||
for _,i in pairs(lists) do
|
||||
if string.len(i) > 1 then
|
||||
local a1 = core.reveng_runmodel(i, data, false, '0')
|
||||
local a2 = core.reveng_runmodel(i, data, true, '0')
|
||||
local a3 = core.reveng_runmodel(i, data, false, 'b')
|
||||
local a4 = core.reveng_runmodel(i, data, false, 'B')
|
||||
local a5 = core.reveng_runmodel(i, data, false, 'l')
|
||||
local a6 = core.reveng_runmodel(i, data, false, 'L')
|
||||
print( ('%-20s| %-16s| %-16s| %-16s| %-16s| %-16s| %-16s'):format(i, a1:upper(), a2:upper(),a3:upper(),a4:upper(),a5:upper(),a6:upper() ) )
|
||||
end
|
||||
end
|
||||
data = data or '01020304'
|
||||
width = width or 0
|
||||
|
||||
print( string.rep('-',60) )
|
||||
print('Bit width of CRC | '..width)
|
||||
print('Bytes | '..data)
|
||||
print('')
|
||||
print( ('%-20s| %-16s| %s'):format('Model','CRC', 'CRC reverse','bigEnd', 'bigEnd','little','little'))
|
||||
print( string.rep('-',60) )
|
||||
local lists, err = core.reveng_models(width)
|
||||
if lists == nil then return oops(err) end
|
||||
|
||||
for _,i in pairs(lists) do
|
||||
if string.len(i) > 1 then
|
||||
local a1 = core.reveng_runmodel(i, data, false, '0')
|
||||
local a2 = core.reveng_runmodel(i, data, true, '0')
|
||||
local a3 = core.reveng_runmodel(i, data, false, 'b')
|
||||
local a4 = core.reveng_runmodel(i, data, false, 'B')
|
||||
local a5 = core.reveng_runmodel(i, data, false, 'l')
|
||||
local a6 = core.reveng_runmodel(i, data, false, 'L')
|
||||
print( ('%-20s| %-16s| %-16s| %-16s| %-16s| %-16s| %-16s'):format(i, a1:upper(), a2:upper(),a3:upper(),a4:upper(),a5:upper(),a6:upper() ) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
main(args)
|
Loading…
Add table
Add a link
Reference in a new issue