mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-26 10:04:24 +08:00
xorcheck script converted in python3 + test
This commit is contained in:
parent
5527cb2428
commit
aa6fc60a22
2 changed files with 18 additions and 20 deletions
|
@ -116,6 +116,7 @@ while true; do
|
|||
if ! CheckExecute "mfkey64 test" "tools/mfkey/mfkey64 9c599b32 82a4166c a1e458ce 6eea41e0 5cadf439" "Found Key: \[ffffffffffff\]"; then break; fi
|
||||
if ! CheckExecute "mfkey64 long trace test" "tools/mfkey/./mfkey64 14579f69 ce844261 f8049ccb 0525c84f 9431cc40 7093df99 9972428ce2e8523f456b99c831e769dced09 8ca6827b ab797fd369e8b93a86776b40dae3ef686efd c3c381ba 49e2c9def4868d1777670e584c27230286f4 fbdcd7c1 4abd964b07d3563aa066ed0a2eac7f6312bf 9f9149ea" "Found Key: \[091e639cb715\]"; then break; fi
|
||||
if ! CheckExecute "nonce2key test" "tools/nonce2key/nonce2key e9cadd9c a8bf4a12 a020a8285858b090 050f010607060e07 5693be6c00000000" "key recovered: fc00018778f7"; then break; fi
|
||||
if ! CheckExecute "xorcheck test" "tools/xorcheck.py 04 00 80 64 ba" "final LRC XOR byte value: 5A"; then break; fi
|
||||
printf "\n${C_GREEN}Tests [OK]${C_NC}\n\n"
|
||||
exit 0
|
||||
done
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# xorcheck.py - find xor values for 8-bit LRC
|
||||
#
|
||||
|
@ -24,22 +24,21 @@ import sys
|
|||
import os
|
||||
|
||||
if(len(sys.argv) < 3):
|
||||
print
|
||||
print '\t'+sys.argv[0] + ' - Generate final byte for XOR LRC'
|
||||
print
|
||||
print 'Usage: ' + sys.argv[0] + ' <ID Byte1> <ID Byte2> ... <LRC>'
|
||||
print
|
||||
print '\tSpecifying the bytes of a UID with a known LRC will find the last byte value'
|
||||
print '\tneeded to generate that LRC with a rolling XOR. All bytes should be specified in HEX.'
|
||||
print
|
||||
print 'Example:'
|
||||
print
|
||||
print '\txorcheck.py 04 00 80 64 ba'
|
||||
print
|
||||
print 'Should produce the output:'
|
||||
print
|
||||
print '\tTarget (BA) requires final LRC XOR byte value: 5A'
|
||||
print
|
||||
print("""
|
||||
\t{0} - Generate final byte for XOR LRC
|
||||
|
||||
Usage: {0} <ID Byte1> <ID Byte2> ... <LRC>
|
||||
|
||||
\tSpecifying the bytes of a UID with a known LRC will find the last byte value
|
||||
\tneeded to generate that LRC with a rolling XOR. All bytes should be specified in HEX.
|
||||
|
||||
Example:
|
||||
|
||||
\t{0} 04 00 80 64 ba
|
||||
|
||||
Should produce the output:
|
||||
|
||||
\tTarget (BA) requires final LRC XOR byte value: 5A\n""".format(sys.argv[0]))
|
||||
os._exit(True)
|
||||
|
||||
target= int(sys.argv[len(sys.argv) - 1],16)
|
||||
|
@ -47,6 +46,4 @@ target= int(sys.argv[len(sys.argv) - 1],16)
|
|||
lrc= 0x00
|
||||
for i in range(len(sys.argv) - 1):
|
||||
lrc ^= int(sys.argv[i + 1],16)
|
||||
print
|
||||
print 'Target (%02X) requires final LRC XOR byte value: %02X' % (target,lrc)
|
||||
print
|
||||
print('\nTarget (%02X) requires final LRC XOR byte value: %02X\n' % (target,lrc))
|
||||
|
|
Loading…
Reference in a new issue