style
This commit is contained in:
@@ -11,17 +11,17 @@ This is a script to allow raw 1444a commands to be sent and received.
|
||||
example = [[
|
||||
# 1. Connect and don't disconnect
|
||||
script run 14araw -p
|
||||
|
||||
|
||||
# 2. Send mf auth, read response (nonce)
|
||||
script run 14araw -o -x 6000F57b -p
|
||||
|
||||
|
||||
# 3. disconnect
|
||||
script run 14araw -o
|
||||
|
||||
# All three steps in one go:
|
||||
script run 14araw -x 6000F57b
|
||||
]]
|
||||
usage = [[
|
||||
usage = [[
|
||||
script run 14araw -x 6000F57b
|
||||
|
||||
Arguments:
|
||||
@@ -124,7 +124,7 @@ function main(args)
|
||||
-- The actual raw payload, if any
|
||||
if payload then
|
||||
res, err = sendRaw(payload,{ignore_response = ignore_response, topaz_mode = topaz_mode, append_crc = append_crc})
|
||||
if err then
|
||||
if err then
|
||||
lib14a.disconnect()
|
||||
return oops(err)
|
||||
end
|
||||
|
||||
@@ -118,10 +118,10 @@ local bxor = bit32.bxor
|
||||
|
||||
-- we need always 2 digits
|
||||
local function prepend_zero(s)
|
||||
if (string.len(s) == 1) then
|
||||
if (string.len(s) == 1) then
|
||||
return '0' .. s
|
||||
else
|
||||
if (string.len(s) == 0) then
|
||||
if (string.len(s) == 0) then
|
||||
return '00'
|
||||
else
|
||||
return s
|
||||
@@ -360,7 +360,7 @@ function displaySegments(bytes)
|
||||
pld = pld..bytes[(start+4+1+Seg[5]+Seg[6]+i)-1]..' '
|
||||
end
|
||||
print(pld)
|
||||
if (KGH) then
|
||||
if (KGH) then
|
||||
print("'Kaba Group Header' detected")
|
||||
end
|
||||
start = start+Seg[4]
|
||||
|
||||
@@ -57,7 +57,7 @@ local function help()
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
print(usage)
|
||||
print(usage)
|
||||
end
|
||||
--
|
||||
-- Exit message
|
||||
|
||||
@@ -64,7 +64,7 @@ local function help()
|
||||
print(desc)
|
||||
print("Example usage")
|
||||
print(example)
|
||||
print(usage)
|
||||
print(usage)
|
||||
end
|
||||
--
|
||||
-- Exit message
|
||||
|
||||
@@ -118,7 +118,7 @@ local function calypso_send_cmd_raw(data, ignoreresponse )
|
||||
arg1 = flags,
|
||||
arg2 = #data/2, -- LEN of data, half the length of the ASCII-string hex string
|
||||
data = data} -- data bytes (commands etc)
|
||||
|
||||
|
||||
result, err = command:sendMIX(ignoreresponse)
|
||||
if result then
|
||||
local r = calypso_parse(result)
|
||||
@@ -212,7 +212,7 @@ function main(args)
|
||||
end
|
||||
|
||||
lib14b.connect()
|
||||
|
||||
|
||||
-- Select 14b tag.
|
||||
card, err = lib14b.waitFor14443b()
|
||||
if not card then return oops(err) end
|
||||
|
||||
@@ -16,13 +16,13 @@ The dump is decrypted. If a raw dump is wanted, use the -r parameter
|
||||
]]
|
||||
example = [[
|
||||
script run didump
|
||||
|
||||
|
||||
-- selftest
|
||||
script run didump -t
|
||||
|
||||
|
||||
-- Generate raw dump, into json.
|
||||
script run didump -r
|
||||
|
||||
|
||||
-- load file
|
||||
script run didump -i dumpdata.json
|
||||
]]
|
||||
@@ -37,7 +37,7 @@ Arguments:
|
||||
e encrypt data
|
||||
v validate data
|
||||
i dumpdata.json load json dump file
|
||||
end
|
||||
end
|
||||
]]
|
||||
|
||||
-- Some shortcuts
|
||||
@@ -589,7 +589,7 @@ function main(args)
|
||||
|
||||
-- GET TAG UID
|
||||
tag, err = lib14a.read(false, true)
|
||||
if err then
|
||||
if err then
|
||||
lib14a.disconnect()
|
||||
return oops(err)
|
||||
end
|
||||
|
||||
@@ -58,7 +58,7 @@ local function help()
|
||||
print(desc)
|
||||
print('Example usage')
|
||||
print(example)
|
||||
print(usage)
|
||||
print(usage)
|
||||
end
|
||||
---
|
||||
-- Exit message
|
||||
|
||||
@@ -311,14 +311,14 @@ function main(args)
|
||||
-- Initialize the card using the already-present read14a library
|
||||
-- Perform RATS and PPS (Protocol and Parameter Selection) check to finish the ISO 14443-4 protocol.
|
||||
info,err = lib14a.read(true, false)
|
||||
if not info then
|
||||
if not info then
|
||||
lib14a.disconnect()
|
||||
return oops(err)
|
||||
end
|
||||
|
||||
--
|
||||
response = sendRaw("D01100", true, true)
|
||||
if not response then
|
||||
if not response then
|
||||
lib14a.disconnect()
|
||||
return oops("No response from PPS check")
|
||||
end
|
||||
|
||||
@@ -121,7 +121,7 @@ function main(args)
|
||||
|
||||
-- First of all, connect
|
||||
info, err = lib14a.read(true, true)
|
||||
if err then
|
||||
if err then
|
||||
lib14a.disconnect()
|
||||
return oops(err)
|
||||
end
|
||||
@@ -137,7 +137,7 @@ function main(args)
|
||||
for block = 00, endblock do
|
||||
local cmd = string.format('10%02x00', block)
|
||||
res, err = sendRaw(cmd , {ignore_response = ignore_response})
|
||||
if err then
|
||||
if err then
|
||||
lib14a.disconnect()
|
||||
return oops(err)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user