mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-05 04:25:20 +08:00
ADD: @icsom changes and additions to lua scripts for LEGIC
This commit is contained in:
parent
e3f9c50d81
commit
790e8eae09
2 changed files with 1973 additions and 1078 deletions
client
63
client/lualibs/ansicolors.lua
Normal file
63
client/lualibs/ansicolors.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
local pairs = pairs
|
||||
local tostring = tostring
|
||||
local setmetatable = setmetatable
|
||||
local schar = string.char
|
||||
|
||||
module 'ansicolors'
|
||||
|
||||
local colormt = {}
|
||||
|
||||
function colormt:__tostring()
|
||||
return self.value
|
||||
end
|
||||
|
||||
function colormt:__concat(other)
|
||||
return tostring(self) .. tostring(other)
|
||||
end
|
||||
|
||||
function colormt:__call(s)
|
||||
return self .. s .. _M.reset
|
||||
end
|
||||
|
||||
colormt.__metatable = {}
|
||||
|
||||
local function makecolor(value)
|
||||
return setmetatable({ value = schar(27) .. '[' .. tostring(value) .. 'm' }, colormt)
|
||||
end
|
||||
|
||||
local colors = {
|
||||
-- attributes
|
||||
reset = 0,
|
||||
clear = 0,
|
||||
bright = 1,
|
||||
dim = 2,
|
||||
underscore = 4,
|
||||
blink = 5,
|
||||
reverse = 7,
|
||||
hidden = 8,
|
||||
|
||||
-- foreground
|
||||
black = 30,
|
||||
red = 31,
|
||||
green = 32,
|
||||
yellow = 33,
|
||||
blue = 34,
|
||||
magenta = 35,
|
||||
cyan = 36,
|
||||
white = 37,
|
||||
|
||||
-- background
|
||||
onblack = 40,
|
||||
onred = 41,
|
||||
ongreen = 42,
|
||||
onyellow = 43,
|
||||
onblue = 44,
|
||||
onmagenta = 45,
|
||||
oncyan = 46,
|
||||
onwhite = 47,
|
||||
}
|
||||
|
||||
for c, v in pairs(colors) do
|
||||
_M[c] = makecolor(v)
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue