mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-27 10:29:18 +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 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 "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 "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"
|
printf "\n${C_GREEN}Tests [OK]${C_NC}\n\n"
|
||||||
exit 0
|
exit 0
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# xorcheck.py - find xor values for 8-bit LRC
|
# xorcheck.py - find xor values for 8-bit LRC
|
||||||
#
|
#
|
||||||
|
@ -24,22 +24,21 @@ import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
if(len(sys.argv) < 3):
|
if(len(sys.argv) < 3):
|
||||||
print
|
print("""
|
||||||
print '\t'+sys.argv[0] + ' - Generate final byte for XOR LRC'
|
\t{0} - Generate final byte for XOR LRC
|
||||||
print
|
|
||||||
print 'Usage: ' + sys.argv[0] + ' <ID Byte1> <ID Byte2> ... <LRC>'
|
Usage: {0} <ID Byte1> <ID Byte2> ... <LRC>
|
||||||
print
|
|
||||||
print '\tSpecifying the bytes of a UID with a known LRC will find the last byte value'
|
\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.'
|
\tneeded to generate that LRC with a rolling XOR. All bytes should be specified in HEX.
|
||||||
print
|
|
||||||
print 'Example:'
|
Example:
|
||||||
print
|
|
||||||
print '\txorcheck.py 04 00 80 64 ba'
|
\t{0} 04 00 80 64 ba
|
||||||
print
|
|
||||||
print 'Should produce the output:'
|
Should produce the output:
|
||||||
print
|
|
||||||
print '\tTarget (BA) requires final LRC XOR byte value: 5A'
|
\tTarget (BA) requires final LRC XOR byte value: 5A\n""".format(sys.argv[0]))
|
||||||
print
|
|
||||||
os._exit(True)
|
os._exit(True)
|
||||||
|
|
||||||
target= int(sys.argv[len(sys.argv) - 1],16)
|
target= int(sys.argv[len(sys.argv) - 1],16)
|
||||||
|
@ -47,6 +46,4 @@ target= int(sys.argv[len(sys.argv) - 1],16)
|
||||||
lrc= 0x00
|
lrc= 0x00
|
||||||
for i in range(len(sys.argv) - 1):
|
for i in range(len(sys.argv) - 1):
|
||||||
lrc ^= int(sys.argv[i + 1],16)
|
lrc ^= int(sys.argv[i + 1],16)
|
||||||
print
|
print('\nTarget (%02X) requires final LRC XOR byte value: %02X\n' % (target,lrc))
|
||||||
print 'Target (%02X) requires final LRC XOR byte value: %02X' % (target,lrc)
|
|
||||||
print
|
|
||||||
|
|
Loading…
Reference in a new issue