mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-20 03:48:33 +08:00
textual
This commit is contained in:
parent
36ecc4be97
commit
586e2ebabd
1 changed files with 36 additions and 36 deletions
|
@ -580,7 +580,7 @@ function writeToTag(tag)
|
||||||
|
|
||||||
-- write data to file
|
-- write data to file
|
||||||
if (taglen > 0) then
|
if (taglen > 0) then
|
||||||
WriteBytes = utils.input(acyellow.."enter number of bytes to write?"..acoff, taglen)
|
WriteBytes = input(acyellow.."enter number of bytes to write?"..acoff, taglen)
|
||||||
-- load file into pm3-buffer
|
-- load file into pm3-buffer
|
||||||
if (type(filename) ~= "string") then
|
if (type(filename) ~= "string") then
|
||||||
filename = input(acyellow.."filename to load to pm3-buffer?"..acoff, "legic.temp")
|
filename = input(acyellow.."filename to load to pm3-buffer?"..acoff, "legic.temp")
|
||||||
|
@ -619,7 +619,7 @@ local function readFile(filename)
|
||||||
local bytes = {}
|
local bytes = {}
|
||||||
local tag = {}
|
local tag = {}
|
||||||
if file_check(filename) == false then
|
if file_check(filename) == false then
|
||||||
return oops("input file: "..filename.." not found")
|
return oops("input file: "..acyellow..filename..acoff.." not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
bytes = getInputBytes(filename)
|
bytes = getInputBytes(filename)
|
||||||
|
@ -728,16 +728,16 @@ end
|
||||||
---
|
---
|
||||||
-- save mapping to file
|
-- save mapping to file
|
||||||
local function saveTagMap(map, filename)
|
local function saveTagMap(map, filename)
|
||||||
if (string.len(filename)>0) then
|
if #filename > 0 then
|
||||||
if (file_check(filename)) then
|
if file_check(filename) then
|
||||||
local answer = confirm("\nthe output-file "..filename.." alredy exists!\nthis will delete the previous content!\ncontinue?")
|
local answer = confirm("\nthe output-file "..acyellow..filename..acoff.." alredy exists!\nthis will delete the previous content!\ncontinue?")
|
||||||
if not answer then return print("user abort") end
|
if not answer then return print("user abort") end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local line
|
local line
|
||||||
local fho,err = io.open(filename, "w")
|
local fho,err = io.open(filename, "w")
|
||||||
if err then oops("OOps ... faild to open output-file ".. filename) end
|
if err then oops("OOps ... faild to open output-file "..acyellow..filename..acoff) end
|
||||||
|
|
||||||
-- write line to new file
|
-- write line to new file
|
||||||
for k, v in pairs(map) do
|
for k, v in pairs(map) do
|
||||||
|
@ -812,8 +812,8 @@ function loadTagMap(filename)
|
||||||
local line, fields
|
local line, fields
|
||||||
local temp={}
|
local temp={}
|
||||||
local offset=0
|
local offset=0
|
||||||
if (file_check(filename)==false) then
|
if not file_check(filename) then
|
||||||
return oops("input file: "..filename.." not found")
|
return oops("input file: "..acyellow..filename..acoff.." not found")
|
||||||
else
|
else
|
||||||
local fhi,err = io.open(filename)
|
local fhi,err = io.open(filename)
|
||||||
while true do
|
while true do
|
||||||
|
@ -821,11 +821,11 @@ function loadTagMap(filename)
|
||||||
if line == nil then
|
if line == nil then
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
fields=split(line)
|
fields = split(line)
|
||||||
end
|
end
|
||||||
if (#fields==2) then
|
if (#fields == 2) then
|
||||||
if (fields[1]=='offset') then
|
if (fields[1] == 'offset') then
|
||||||
offset=tonumber(fields[2],10)
|
offset = tonumber(fields[2],10)
|
||||||
end
|
end
|
||||||
-- map-name
|
-- map-name
|
||||||
map[fields[1]]=fields[2]
|
map[fields[1]]=fields[2]
|
||||||
|
@ -1102,10 +1102,10 @@ end
|
||||||
---
|
---
|
||||||
-- check if byte is highlighted or not
|
-- check if byte is highlighted or not
|
||||||
function check4Highlight(addr, tagMap)
|
function check4Highlight(addr, tagMap)
|
||||||
local res=false
|
local res = false
|
||||||
for _, v in pairs(tagMap.mappings) do
|
for _, v in pairs(tagMap.mappings) do
|
||||||
if (addr >= v['start'] and addr <= v['end'] ) then
|
if (addr >= v['start'] and addr <= v['end'] ) then
|
||||||
res= v['highlight']
|
res = v['highlight']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return res
|
return res
|
||||||
|
@ -1116,7 +1116,7 @@ end
|
||||||
function addMapping(tag, tagMap, x)
|
function addMapping(tag, tagMap, x)
|
||||||
if (type(x) ~= "number") then x = #tagMap.mappings + 1 end
|
if (type(x) ~= "number") then x = #tagMap.mappings + 1 end
|
||||||
local bytes = tagToBytes(tag)
|
local bytes = tagToBytes(tag)
|
||||||
local myMapping={}
|
local myMapping = {}
|
||||||
myMapping['name'] = input(accyan.."enter Maping-Name:"..acoff, string.format("mapping %d", #tagMap.mappings+1))
|
myMapping['name'] = input(accyan.."enter Maping-Name:"..acoff, string.format("mapping %d", #tagMap.mappings+1))
|
||||||
myMapping['start'] = tonumber(input(accyan.."enter start-addr:"..acoff, '1'), 10)
|
myMapping['start'] = tonumber(input(accyan.."enter start-addr:"..acoff, '1'), 10)
|
||||||
myMapping['end'] = tonumber(input(accyan.."enter end-addr:"..acoff, #bytes), 10)
|
myMapping['end'] = tonumber(input(accyan.."enter end-addr:"..acoff, #bytes), 10)
|
||||||
|
@ -1193,11 +1193,11 @@ end
|
||||||
-- map all token data
|
-- map all token data
|
||||||
function mapTokenData(tagMap, mname, mstart, mend, mhigh)
|
function mapTokenData(tagMap, mname, mstart, mend, mhigh)
|
||||||
--if ( not mhigh ) then mhigh=false end
|
--if ( not mhigh ) then mhigh=false end
|
||||||
local myMapping={}
|
local myMapping = {}
|
||||||
myMapping['name'] =mname
|
myMapping['name'] = mname
|
||||||
myMapping['start']=mstart
|
myMapping['start'] = mstart
|
||||||
myMapping['end'] =mend
|
myMapping['end'] = mend
|
||||||
myMapping['highlight']=mhigh
|
myMapping['highlight'] = mhigh
|
||||||
table.insert(tagMap.mappings, myMapping)
|
table.insert(tagMap.mappings, myMapping)
|
||||||
return tagMap
|
return tagMap
|
||||||
end
|
end
|
||||||
|
@ -1290,7 +1290,7 @@ function dumpCDF(tag)
|
||||||
end
|
end
|
||||||
|
|
||||||
return res
|
return res
|
||||||
else print("no valid Tag in dumpCDF") end
|
else print(acred.."no valid Tag in dumpCDF"..acoff) end
|
||||||
end
|
end
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1350,7 +1350,7 @@ function dumpSegment(tag, index)
|
||||||
dp=0
|
dp=0
|
||||||
return res
|
return res
|
||||||
else
|
else
|
||||||
return print("Segment not found")
|
return print(acred.."Segment not found"..acoff)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2351,11 +2351,11 @@ function modifyMode()
|
||||||
---
|
---
|
||||||
-- save values of mainTAG to a file (xored with MCC of mainTAG)
|
-- save values of mainTAG to a file (xored with MCC of mainTAG)
|
||||||
["sf"] = function(x)
|
["sf"] = function(x)
|
||||||
if(istable(inTAG)) then
|
if istable(inTAG) then
|
||||||
outfile=input("enter filename:", "legic.temp")
|
outfile = input("enter filename:", "legic.temp")
|
||||||
bytes=tagToBytes(inTAG)
|
bytes = tagToBytes(inTAG)
|
||||||
--bytes=xorBytes(bytes, inTAG.MCC)
|
--bytes=xorBytes(bytes, inTAG.MCC)
|
||||||
if (bytes) then
|
if bytes then
|
||||||
writeFile(bytes, outfile)
|
writeFile(bytes, outfile)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2363,10 +2363,10 @@ function modifyMode()
|
||||||
---
|
---
|
||||||
-- save values of mainTAG to a file (xored with 'specific' MCC)
|
-- save values of mainTAG to a file (xored with 'specific' MCC)
|
||||||
["xf"] = function(x)
|
["xf"] = function(x)
|
||||||
if(istable(inTAG)) then
|
if istable(inTAG) then
|
||||||
outfile=input("enter filename:", "legic.temp")
|
outfile = input("enter filename:", "legic.temp")
|
||||||
crc=input("enter new crc: ('00' for a plain dump)", inTAG.MCC)
|
crc = input("enter new crc: ('00' for a plain dump)", inTAG.MCC)
|
||||||
print("obfuscate witth: "..crc)
|
print("obfuscate with: "..crc)
|
||||||
bytes=tagToBytes(inTAG)
|
bytes=tagToBytes(inTAG)
|
||||||
bytes[5]=crc
|
bytes[5]=crc
|
||||||
if (bytes) then
|
if (bytes) then
|
||||||
|
@ -2436,7 +2436,7 @@ function modifyMode()
|
||||||
---
|
---
|
||||||
-- load a tagMap
|
-- load a tagMap
|
||||||
["lm"] = function(x)
|
["lm"] = function(x)
|
||||||
tagMap=loadTagMap(input(accyan.."enter filename:"..acoff, "Legic.map"))
|
tagMap = loadTagMap(input(accyan.."enter filename:"..acoff, "Legic.map"))
|
||||||
end,
|
end,
|
||||||
---
|
---
|
||||||
-- dump single segment
|
-- dump single segment
|
||||||
|
|
Loading…
Add table
Reference in a new issue