This commit is contained in:
iceman1001 2019-05-14 11:42:58 -04:00
parent 36ecc4be97
commit 586e2ebabd

View file

@ -580,7 +580,7 @@ function writeToTag(tag)
-- write data to file
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
if (type(filename) ~= "string") then
filename = input(acyellow.."filename to load to pm3-buffer?"..acoff, "legic.temp")
@ -619,7 +619,7 @@ local function readFile(filename)
local bytes = {}
local tag = {}
if file_check(filename) == false then
return oops("input file: "..filename.." not found")
return oops("input file: "..acyellow..filename..acoff.." not found")
end
bytes = getInputBytes(filename)
@ -728,16 +728,16 @@ end
---
-- save mapping to file
local function saveTagMap(map, filename)
if (string.len(filename)>0) then
if (file_check(filename)) then
local answer = confirm("\nthe output-file "..filename.." alredy exists!\nthis will delete the previous content!\ncontinue?")
if #filename > 0 then
if file_check(filename) then
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
end
end
local line
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
for k, v in pairs(map) do
@ -812,8 +812,8 @@ function loadTagMap(filename)
local line, fields
local temp={}
local offset=0
if (file_check(filename)==false) then
return oops("input file: "..filename.." not found")
if not file_check(filename) then
return oops("input file: "..acyellow..filename..acoff.." not found")
else
local fhi,err = io.open(filename)
while true do
@ -1290,7 +1290,7 @@ function dumpCDF(tag)
end
return res
else print("no valid Tag in dumpCDF") end
else print(acred.."no valid Tag in dumpCDF"..acoff) end
end
---
@ -1350,7 +1350,7 @@ function dumpSegment(tag, index)
dp=0
return res
else
return print("Segment not found")
return print(acred.."Segment not found"..acoff)
end
end
@ -2351,11 +2351,11 @@ function modifyMode()
---
-- save values of mainTAG to a file (xored with MCC of mainTAG)
["sf"] = function(x)
if(istable(inTAG)) then
if istable(inTAG) then
outfile = input("enter filename:", "legic.temp")
bytes = tagToBytes(inTAG)
--bytes=xorBytes(bytes, inTAG.MCC)
if (bytes) then
if bytes then
writeFile(bytes, outfile)
end
end
@ -2363,10 +2363,10 @@ function modifyMode()
---
-- save values of mainTAG to a file (xored with 'specific' MCC)
["xf"] = function(x)
if(istable(inTAG)) then
if istable(inTAG) then
outfile = input("enter filename:", "legic.temp")
crc = input("enter new crc: ('00' for a plain dump)", inTAG.MCC)
print("obfuscate witth: "..crc)
print("obfuscate with: "..crc)
bytes=tagToBytes(inTAG)
bytes[5]=crc
if (bytes) then