mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-03 11:36:34 +08:00
Merge pull request #1134 from tcprst/legic_lua_fix
hf_legic Lua - change method for temp file naming
This commit is contained in:
commit
7a6d72fcd4
1 changed files with 20 additions and 1 deletions
|
@ -704,12 +704,31 @@ function writeFile(bytes, filename)
|
|||
return true
|
||||
end
|
||||
|
||||
function getRandomTempName()
|
||||
local upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
local lowerCase = "abcdefghijklmnopqrstuvwxyz"
|
||||
|
||||
local characterSet = upperCase .. lowerCase
|
||||
|
||||
local keyLength = 8
|
||||
local output = ""
|
||||
|
||||
for i = 1, keyLength do
|
||||
local rand = math.random(#characterSet)
|
||||
output = output .. string.sub(characterSet, rand, rand)
|
||||
end
|
||||
|
||||
output = "hf-legic-temp-" .. output
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
---
|
||||
-- read from pm3 into virtual-tag
|
||||
function readFromPM3()
|
||||
local tag, bytes, infile
|
||||
--infile="legic.temp"
|
||||
infile=os.tmpname()
|
||||
infile=getRandomTempName()
|
||||
core.console("hf legic dump -f "..infile)
|
||||
tag=readFile(infile..".bin")
|
||||
os.remove(infile)
|
||||
|
|
Loading…
Reference in a new issue