mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-21 06:35:04 +08:00
Remove unneeded function and place code in main
This commit is contained in:
parent
f77bb94a86
commit
d36f3d876b
1 changed files with 5 additions and 23 deletions
|
@ -45,26 +45,6 @@ local function show(data)
|
||||||
debug("Hexdata" , hexdata)
|
debug("Hexdata" , hexdata)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--- Fire up a connection with a tag, return uid
|
|
||||||
-- @return UID if successfull
|
|
||||||
-- @return nil, errormessage if unsuccessfull
|
|
||||||
local function open()
|
|
||||||
-- debug("Opening connection")
|
|
||||||
-- core.clearCommandBuffer()
|
|
||||||
-- local x = string.format("hf 14a raw -r -p -s")
|
|
||||||
-- debug(x)
|
|
||||||
-- core.console(x)
|
|
||||||
-- debug("done")
|
|
||||||
-- data, err = waitCmd(true)
|
|
||||||
-- if err then return oops(err) end
|
|
||||||
-- show(data)
|
|
||||||
-- local formatString = ("H%d"):format(string.len(data))
|
|
||||||
-- local _,uid = bin.unpack(formatString, data)
|
|
||||||
tag, err = lib14a.read(false, true)
|
|
||||||
if not tag then return oops(err) end
|
|
||||||
core.clearCommandBuffer()
|
|
||||||
return tag
|
|
||||||
end
|
|
||||||
--- Shut down tag communication
|
--- Shut down tag communication
|
||||||
-- return no return values
|
-- return no return values
|
||||||
local function close()
|
local function close()
|
||||||
|
@ -165,9 +145,11 @@ local function main( args)
|
||||||
if o == "d" then DEBUG = true end
|
if o == "d" then DEBUG = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
local uid = open()
|
local tag, err = lib14a.read(false, true)
|
||||||
if (uid==nil) then oops("No card present") return end
|
if not tag then return oops(err) end
|
||||||
print(("UID: %s"):format(uid.uid))
|
core.clearCommandBuffer()
|
||||||
|
if (tag==nil) then oops("No card present") return end
|
||||||
|
print(("UID: %s"):format(tag.uid))
|
||||||
|
|
||||||
-- First, get block 1 byte 1
|
-- First, get block 1 byte 1
|
||||||
local block, err = getBlock(0)
|
local block, err = getBlock(0)
|
||||||
|
|
Loading…
Reference in a new issue