From d3d701f53886052fc3683b7dbf2518bafb981706 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 27 May 2024 15:08:49 +0200 Subject: [PATCH] the generation of NrAr is used in the regression tests. I readded the old way and if you call the hitag2_gen_nRaR.py with five params, you get the nice commands instead --- CHANGELOG.md | 1 + tools/hitag2crack/hitag2_gen_nRaR.py | 10 ++++++++++ tools/pm3_tests.sh | 1 + 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff3639ea6..1b1aa773a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed the pm3 regressiontests for Hitag2Crack (@iceman1001) - Changed `mem spiffs tree` - adapted to bigbuff and show if empty (@iceman1001) - Changed `lf hitag info` - now tries to identify different key fob emulators (@iceman1001) - Added `lf hitag reader` - act as a Hitag2 reader (@iceman1001) diff --git a/tools/hitag2crack/hitag2_gen_nRaR.py b/tools/hitag2crack/hitag2_gen_nRaR.py index 68256b61e..7ddc95d10 100755 --- a/tools/hitag2crack/hitag2_gen_nRaR.py +++ b/tools/hitag2crack/hitag2_gen_nRaR.py @@ -109,11 +109,21 @@ def hitag2(state, length=48): if __name__ == "__main__": import sys + if len(sys.argv) == 4: key = int(sys.argv[1], 16) uid = int(sys.argv[2], 16) n = int(sys.argv[3]) for i in range(n): + nonce = random.randrange(2**32) + state = hitag2_init(key, uid, nonce) + print('%08X %08X' % (nonce, hitag2(state, 32) ^ 0xffffffff)) + + elif len(sys.argv) == 5: + key = int(sys.argv[1], 16) + uid = int(sys.argv[2], 16) + n = int(sys.argv[3]) + for i in range(n): nonceA = random.randrange(2**32) stateA = hitag2_init(key, uid, nonceA) csA = hitag2(stateA, 32) ^ 0xffffffff diff --git a/tools/pm3_tests.sh b/tools/pm3_tests.sh index 5c7ee8d75..a35512df4 100755 --- a/tools/pm3_tests.sh +++ b/tools/pm3_tests.sh @@ -256,6 +256,7 @@ while true; do if ! CheckFileExist "MFP dictionary exists" "$DICPATH/mfp_default_keys.dic"; then break; fi if ! CheckFileExist "MFULC dictionary exists" "$DICPATH/mfulc_default_keys.dic"; then break; fi if ! CheckFileExist "T55XX dictionary exists" "$DICPATH/t55xx_default_pwds.dic"; then break; fi + if ! CheckFileExist "HITAG2 dictionary exists" "$DICPATH/ht2_default.dic"; then break; fi echo -e "\n${C_BLUE}Testing tools:${C_NC}" if ! CheckExecute "xorcheck test" "tools/xorcheck.py 04 00 80 64 ba" "final LRC XOR byte value: 5A"; then break; fi -- 2.11.4.GIT