X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/b3a8c87d5cf3ecbc59da2a2cc511689428df7cff..6c81ae5574e2f2b9e0b62f9dafe602d35f23739a:/client/scripts/tnp3clone.lua diff --git a/client/scripts/tnp3clone.lua b/client/scripts/tnp3clone.lua index 011e0a57..8c9397a7 100644 --- a/client/scripts/tnp3clone.lua +++ b/client/scripts/tnp3clone.lua @@ -109,24 +109,28 @@ local function main(args) return oops('failed reading block with chinese magic command. quitting...') end end - local b1 = toytype..'000000000000000000000000' + -- wipe card. + local cmd = (cset..' %s 0004 08 w'):format( b0) + core.console(cmd) + + + local b1 = toytype..'000000000000000000000000' local calc = utils.Crc16(b0..b1) local calcEndian = bor(rsh(calc,8), lsh(band(calc, 0xff), 8)) local cmd = (cset..'1 %s%04x'):format( b1, calcEndian) - core.console( cmd) + core.console(cmd) local pos, key for blockNo = 2, numBlocks-1, 1 do pos = (math.floor( blockNo / 4 ) * 12)+1 key = akeys:sub(pos, pos + 11 ) - if blockNo%4 ~= 3 then - cmd = ('%s %d %s'):format(cset,blockNo,empty) - else + if blockNo%4 == 3 then cmd = ('%s %d %s%s'):format(cset,blockNo,key,AccAndKeyB) - end - core.console(cmd) + core.console(cmd) + end end + core.clearCommandBuffer() end main(args) \ No newline at end of file