This commit is contained in:
Philippe Teuwen
2019-04-28 22:54:00 +02:00
parent f1deb865db
commit 69f8d81f4e
12 changed files with 42 additions and 43 deletions

View File

@@ -174,7 +174,7 @@ local function main( args)
local blocks, err = getBlock(0)
if err then
close()
return oops(err)
return oops(err)
end
-- Block 3 contains number of blocks
local b3chars = {string.byte(blocks[4], 1,4)}

View File

@@ -80,7 +80,7 @@ local function help()
print(desc)
print("Example usage")
print(example)
print(usage)
print(usage)
end
---
-- Exit message
@@ -261,7 +261,7 @@ local function test(modulation)
, arg2 = block
}
local response, err = wc:sendMIX(false)
if not response then return oops(err) end
if not response then return oops(err) end
-- Detect
local res, msg = core.t55xx_detect()
@@ -323,7 +323,7 @@ local function main(args)
end
exitMsg('Tests finished')
core.console(
core.console(
format('rem [SUMMARY] Success rate: %d/%d tests passed%s'
, total_pass
, total_tests

View File

@@ -63,7 +63,7 @@ local function getblockdata(response)
if not response then
return nil, 'No response from device'
end
local count, cmd, arg0 = bin.unpack('LL', response)
if arg0 == 1 then
local count, arg1, arg2, data = bin.unpack('LLH511', response, count)
@@ -81,7 +81,7 @@ local function readblock( blocknum, keyA )
return b
end
---
-- decode response and get the blockdata from backdoor magic command
-- decode response and get the blockdata from backdoor magic command
local function readmagicblock( blocknum )
-- Read block N
local CSETBLOCK_SINGLE_OPERATION = 0x1F

View File

@@ -91,7 +91,7 @@ local function getblockdata(response)
if not response then
return nil, 'No response from device'
end
local count, cmd, arg0 = bin.unpack('LL', response)
if arg0 == 1 then
local count, arg1, arg2, data = bin.unpack('LLH511', response, count)
@@ -132,7 +132,7 @@ local function main(args)
local cmdSetDbgOff = "hf mf dbg 0"
core.console( cmdSetDbgOff)
utils.Sleep(0.5)
result, err = lib14a.read(false, true)
if not result then return oops(err) end
@@ -170,7 +170,7 @@ local function main(args)
cmd = Command:newMIX{cmd = cmds.CMD_MIFARE_READBL, arg1 = 0, data = keyA}
block0, err = getblockdata(cmd:sendMIX(false))
if not block0 then return oops(err) end
core.clearCommandBuffer()
-- Read block 1

View File

@@ -242,7 +242,7 @@ local function LoadEmulator(uid, blocks)
blockdata = AddKey(keys, _, blockdata)
end
end
io.write( _..',')
io.flush()
core.clearCommandBuffer()

View File

@@ -15,7 +15,7 @@ xor: the first three block (0,1,2) is not XORED. The rest seems to be xored.
example = [[
-- default
script run ufodump
-- stop at block 10
script run ufodump -b 10
]]
@@ -48,7 +48,7 @@ end
local function oops(err)
print('ERROR:', err)
core.clearCommandBuffer()
return nil, err
return nil, err
end
---
-- Usage help
@@ -59,7 +59,7 @@ local function help()
print(desc)
print('Example usage')
print(example)
print(usage)
print(usage)
end
--
-- writes data to ascii textfile.
@@ -122,7 +122,7 @@ function sendRaw(rawdata, options)
-- of the ASCII-string rawdata
arg2 = string.len(rawdata)/2,
data = rawdata}
return command:sendMIX(options.ignore_response)
end
--

View File

@@ -57,7 +57,7 @@ local function help()
print(desc)
print('Example usage')
print(example)
print(usage)
print(usage)
end
--
--- Set UID on magic command enabled