This commit is contained in:
iceman1001 2019-04-29 14:55:39 +02:00
commit c4e4e7dc69

View file

@ -115,8 +115,8 @@ local function main( args)
print( string.rep('--',20) ) print( string.rep('--',20) )
print( string.rep('--',20) ) print( string.rep('--',20) )
dbg('script started') local err, data, data2, k, v, i
local err, data, data2, k, v, i, verbose = 0 local verbose = 0
-- Read the parameters -- Read the parameters
for o, a in getopt.getopt(args, 'hdv') do for o, a in getopt.getopt(args, 'hdv') do
if o == 'h' then return help() end if o == 'h' then return help() end
@ -133,10 +133,10 @@ local function main( args)
core.clearCommandBuffer() core.clearCommandBuffer()
if info.name:match("Ultralight") then if info.name:match("Ultralight") then
dbg('Found a tag') print('[=] Found a tag')
else else
disconnect() disconnect()
return oops('Not a Ultralightbased card. This script reads NDEF formatted UL/NTAGS') return oops('[!] Not a Ultralightbased card. This script reads NDEF formatted UL/NTAGS')
end end
-- Info contained within the tag (block 0 example) -- Info contained within the tag (block 0 example)
@ -157,12 +157,12 @@ local function main( args)
local b3chars = utils.ConvertHexToBytes(blocks[4]); local b3chars = utils.ConvertHexToBytes(blocks[4]);
local t5tarea = b3chars[3] * 8 local t5tarea = b3chars[3] * 8
local t5tarea_blocks = t5tarea / 4; local t5tarea_blocks = t5tarea / 4;
print("Number of blocks:", t5tarea_blocks) print("[=] Number of blocks:", t5tarea_blocks)
-- NDEF compliant? -- NDEF compliant?
if b3chars[1] ~= 0xE1 then if b3chars[1] ~= 0xE1 then
disconnect() disconnect()
return oops('This tag is not NDEF-Compliant') return oops('[!] This tag is not NDEF-Compliant')
end end
local ndefversion = b3chars[2] local ndefversion = b3chars[2]
@ -175,7 +175,7 @@ local function main( args)
the only way to avoid this is to send the read command as many times as block numbers the only way to avoid this is to send the read command as many times as block numbers
removing bytes from 5 to 18 from each answer. removing bytes from 5 to 18 from each answer.
--]] --]]
print('Dumping data...please wait') print('[=] Dumping data...please wait')
for i = 4, t5tarea_blocks - 1, 1 do for i = 4, t5tarea_blocks - 1, 1 do
blocks, err = getBlock(i) blocks, err = getBlock(i)
if err then if err then
@ -187,11 +187,12 @@ local function main( args)
-- Deactivate field -- Deactivate field
disconnect() disconnect()
-- Print results -- Print results
print('Tag info') print('[=] Tag NDEF info')
print('UID ', info.uid) print('[=] ------------------------------------------------')
print('NDEF version', ('%02x'):format(ndefversion)) print('[=] UID ', info.uid)
print('Manufacturer', info.manufacturer) print('[=] NDEF version', ('%02x'):format(ndefversion))
print('Type ', info.name) print('[=] Manufacturer', info.manufacturer)
print('[=] Type ', info.name)
local ndefdata = table.concat(blockData, '', 5) local ndefdata = table.concat(blockData, '', 5)
core.ndefparse(t5tarea, verbose, ndefdata) core.ndefparse(t5tarea, verbose, ndefdata)
@ -203,7 +204,7 @@ local function main( args)
local filename, err = utils.WriteDumpFile(info.uid, blockData) local filename, err = utils.WriteDumpFile(info.uid, blockData)
if err then return oops(err) end if err then return oops(err) end
print(string.format('Dumped data into %s', filename)) print(string.format('[+] Dumped data into %s', filename))
end end
main(args) main(args)