Merge branch 'RfidResearchGroup:master' into spi_flash_v2
[RRG-proxmark3.git] / tools / pm3_tests.sh
blobd5a73fb62e91c9b2c23ba14bc4c2f41010800667
1 #!/usr/bin/env bash
3 PM3PATH="$(dirname "$0")/.."
4 cd "$PM3PATH" || exit 1
6 DICPATH="./client/dictionaries"
7 RESOURCEPATH="./client/resources"
9 SLOWTESTS=false
10 OPENCLTESTS=false
11 TESTALL=true
12 TESTMFKEY=false
13 TESTSTATICNESTED=false
14 TESTNONCE2KEY=false
15 TESTMFNONCEBRUTE=false
16 TESTMFDAESBRUTE=false
17 TESTHITAG2CRACK=false
18 TESTCRYPTORF=false
19 TESTFPGACOMPRESS=false
20 TESTBOOTROM=false
21 TESTARMSRC=false
22 TESTCLIENT=false
23 TESTRECOVERY=false
24 TESTCOMMON=false
26 # https://medium.com/@Drew_Stokes/bash-argument-parsing-54f3b81a6a8f
27 PARAMS=""
28 while (( "$#" )); do
29 case "$1" in
30 -h|--help)
31 echo """
32 Usage: $0 [--long] [--opencl] [--clientbin /path/to/proxmark3] [mfkey|nonce2key|mf_nonce_brute|staticnested|mfd_aes_brute|cryptorf|fpga_compress|bootrom|armsrc|client|recovery|common]
33 --long: Enable slow tests
34 --opencl: Enable tests requiring OpenCL (preferably a Nvidia GPU)
35 --clientbin ...: Specify path to proxmark3 binary to test
36 If no target given, all targets will be tested
37 """
38 exit 0
40 -l|--long)
41 SLOWTESTS=true
42 shift
44 --opencl)
45 OPENCLTESTS=true
46 shift
48 --clientbin)
49 if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then
50 CLIENTBIN=$2
51 shift 2
52 else
53 echo "Error: Argument for $1 is missing" >&2
54 exit 1
57 cryptorf)
58 TESTALL=false
59 TESTCRYPTORF=true
60 shift
62 mfkey)
63 TESTALL=false
64 TESTMFKEY=true
65 shift
67 nonce2key)
68 TESTALL=false
69 TESTNONCE2KEY=true
70 shift
72 mf_nonce_brute)
73 TESTALL=false
74 TESTMFNONCEBRUTE=true
75 shift
77 staticnested)
78 TESTALL=false
79 TESTSTATICNESTED=true
80 shift
82 mfd_aes_brute)
83 TESTALL=false
84 TESTMFDAESBRUTE=true
85 shift
87 fpga_compress)
88 TESTALL=false
89 TESTFPGACOMPRESS=true
90 shift
92 hitag2crack)
93 TESTALL=false
94 TESTHITAG2CRACK=true
95 shift
97 bootrom)
98 TESTALL=false
99 TESTBOOTROM=true
100 shift
102 armsrc)
103 TESTALL=false
104 TESTARMSRC=true
105 shift
107 client)
108 TESTALL=false
109 TESTCLIENT=true
110 shift
112 recovery)
113 TESTALL=false
114 TESTRECOVERY=true
115 shift
117 common)
118 TESTALL=false
119 TESTCOMMON=true
120 shift
122 -*|--*=) # unsupported flags
123 echo "Error: Unsupported flag $1" >&2
124 exit 1
126 *) # preserve positional arguments
127 PARAMS="$PARAMS $1"
128 shift
130 esac
131 done
132 # set positional arguments in their proper place
133 eval set -- "$PARAMS"
135 C_RED='\033[0;31m'
136 C_GREEN='\033[0;32m'
137 C_YELLOW='\033[0;33m'
138 C_BLUE='\033[0;34m'
139 C_NC='\033[0m' # No Color
140 C_OK='\xe2\x9c\x94\xef\xb8\x8f'
141 C_FAIL='\xe2\x9d\x8c'
143 # [opencl] title, file name or file wildcard to check
144 function CheckFileExist() {
145 if [ "$1" == "opencl" ]; then
146 local OPENCLTEST=true
147 shift
148 else
149 local OPENCLTEST=false
152 printf "%-40s" "$1 "
154 if $OPENCLTEST && ! $OPENCLTESTS; then
155 echo -e "[ ${C_YELLOW}SKIPPED${C_NC} ] ( opencl )"
156 return 0
159 if [ -f "$2" ]; then
160 echo -e "[ ${C_GREEN}OK${C_NC} ] ${C_OK}"
161 return 0
164 if ls "$2" 1> /dev/null 2>&1; then
165 echo -e "[ ${C_GREEN}OK${C_NC} ] ${C_OK}"
166 return 0
169 echo -e "[ ${C_RED}FAIL${C_NC} ] ${C_FAIL}"
170 return 1
173 # [slow] [opencl] [retry] [ignore] <title> <command_line> <check_result_regex>
174 # slow: test takes more than ~5s
175 # opencl: test requires OpenCL
176 # retry: test repeated up to 3 times in case of failure
177 # ignore: test failure is not fatal
178 function CheckExecute() {
179 if [ "$1" == "slow" ]; then
180 local SLOWTEST=true
181 shift
182 else
183 local SLOWTEST=false
185 if [ "$1" == "opencl" ]; then
186 local OPENCLTEST=true
187 shift
188 else
189 local OPENCLTEST=false
191 if [ "$1" == "retry" ]; then
192 local RETRY="1 2 3 e"
193 shift
194 else
195 local RETRY="e"
197 if [ "$1" == "ignore" ]; then
198 local IGNOREFAILURE=true
199 shift
200 else
201 local IGNOREFAILURE=false
204 printf "%-40s" "$1 "
205 RESULT=0
207 if $SLOWTEST && ! $SLOWTESTS; then
208 echo -e "[ ${C_YELLOW}SKIPPED${C_NC} ] ( slow )"
209 return $RESULT
211 if $OPENCLTEST && ! $OPENCLTESTS; then
212 echo -e "[ ${C_YELLOW}SKIPPED${C_NC} ] ( opencl )"
213 return $RESULT
216 start=$(date +%s)
217 TIMEINFO=""
218 for I in $RETRY
220 RES=$(eval "$2")
221 end=$(date +%s)
222 delta=$(expr $end - $start)
223 if [ $delta -gt 2 ]; then
224 TIMEINFO=" ($delta s)"
226 if echo "$RES" | grep -E -q "$3"; then
227 echo -e "[ ${C_GREEN}OK${C_NC} ] ${C_OK} $TIMEINFO"
228 return $RESULT
230 if [ ! $I == "e" ]; then echo "retry $I"; fi
231 done
233 RESULT=1
234 if $IGNOREFAILURE; then
235 echo -e "[ ${C_YELLOW}IGNORED${C_NC} ] $TIMEINFO"
236 return 0
239 echo -e "[ ${C_RED}FAIL${C_NC} ] ${C_FAIL} $TIMEINFO"
240 echo -e "Execution trace:\n$RES"
241 return $RESULT
244 echo -e "\n${C_BLUE}Iceman Proxmark3 test tool ${C_NC}\n"
246 echo -n "work directory: "
249 if [ "$TRAVIS_COMMIT" ]; then
250 if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
251 echo "Travis branch: $TRAVIS_BRANCH slug: $TRAVIS_REPO_SLUG commit: $TRAVIS_COMMIT"
252 else
253 echo "Travis pull request: $TRAVIS_PULL_REQUEST branch: $TRAVIS_BRANCH slug: $TRAVIS_PULL_REQUEST_SLUG commit: $TRAVIS_COMMIT"
257 if command -v git >/dev/null && git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
258 echo -n "git branch: "
259 git describe --all
260 echo -n "git sha: "
261 git rev-parse HEAD
262 echo ""
265 while true; do
266 if $TESTALL || $TESTCOMMON; then
267 echo -e "\n${C_BLUE}Testing common:${C_NC}"
268 if ! CheckFileExist "hardnested tables exists" "$RESOURCEPATH/hardnested_tables/bitflip_0_001_states.bin.lz4"; then break; fi
269 if ! CheckFileExist "simmodule fw file exists" "$RESOURCEPATH/sim014.bin"; then break; fi
270 if ! CheckFileExist "iCLASS dictionary exists" "$DICPATH/iclass_default_keys.dic"; then break; fi
271 if ! CheckFileExist "MFC dictionary exists" "$DICPATH/mfc_default_keys.dic"; then break; fi
272 if ! CheckFileExist "MFDES dictionary exists" "$DICPATH/mfdes_default_keys.dic"; then break; fi
273 if ! CheckFileExist "MFP dictionary exists" "$DICPATH/mfp_default_keys.dic"; then break; fi
274 if ! CheckFileExist "MFULC dictionary exists" "$DICPATH/mfulc_default_keys.dic"; then break; fi
275 if ! CheckFileExist "T55XX dictionary exists" "$DICPATH/t55xx_default_pwds.dic"; then break; fi
276 if ! CheckFileExist "HITAG2 dictionary exists" "$DICPATH/ht2_default.dic"; then break; fi
278 echo -e "\n${C_BLUE}Testing tools:${C_NC}"
279 if ! CheckExecute "xorcheck test" "tools/xorcheck.py 04 00 80 64 ba" "final LRC XOR byte value: 5A"; then break; fi
280 if ! CheckExecute "findbits test" "tools/findbits.py 73 0110010101110011" "Match at bit 9: 011001010"; then break; fi
281 if ! CheckExecute "findbits_test test" "tools/findbits_test.py 2>&1" "OK"; then break; fi
282 if ! CheckExecute "pm3_eml_mfd test" "tools/mfc/pm3_eml_mfd_test.py 2>&1" "OK"; then break; fi
283 if ! CheckExecute "recover_pk test" "tools/recover_pk.py selftests 2>&1" "Tests:.*\(.*ok.*"; then break; fi
284 if ! CheckExecute "mkversion create test" "tools/mkversion.sh --short" 'Iceman/'; then break; fi
286 if $TESTALL || $TESTBOOTROM; then
287 echo -e "\n${C_BLUE}Testing bootrom:${C_NC}"
288 if ! CheckFileExist "bootrom exists" "./bootrom/obj/bootrom.elf"; then break; fi
290 if $TESTALL || $TESTARMSRC; then
291 echo -e "\n${C_BLUE}Testing armsrc:${C_NC}"
292 if ! CheckFileExist "arm image exists" "./armsrc/obj/fullimage.elf"; then break; fi
294 if $TESTALL || $TESTRECOVERY; then
295 echo -e "\n${C_BLUE}Testing recovery:${C_NC}"
296 if ! CheckFileExist "recovery image exists" "./recovery/proxmark3_recovery.bin"; then break; fi
299 if $TESTALL || $TESTFPGACOMPRESS; then
300 echo -e "\n${C_BLUE}Testing fpgacompress:${C_NC} ${FPGACPMPRESSBIN:=./tools/fpga_compress/fpga_compress}"
301 if ! CheckFileExist "fpgacompress exists" "$FPGACPMPRESSBIN"; then break; fi
303 if $TESTALL || $TESTMFKEY; then
304 echo -e "\n${C_BLUE}Testing mfkey:${C_NC} ${MFKEY32V2BIN:=./tools/mfc/card_reader/mfkey32v2} ${MFKEY32NESTEDBIN:=./tools/mfc/card_reader/mfkey32nested} ${MFKEY64BIN:=./tools/mfc/card_reader/mfkey64}"
305 if ! CheckFileExist "mfkey32v2 exists" "$MFKEY32V2BIN"; then break; fi
306 if ! CheckFileExist "mfkey32nested exists" "$MFKEY32NESTEDBIN"; then break; fi
307 if ! CheckFileExist "mfkey64 exists" "$MFKEY64BIN"; then break; fi
308 # Need a decent example for mfkey32...
309 if ! CheckExecute "mfkey32v2 test" "$MFKEY32V2BIN 12345678 1AD8DF2B 1D316024 620EF048 30D6CB07 C52077E2 837AC61A" "Found Key: \[a0a1a2a3a4a5\]"; then break; fi
310 if ! CheckExecute "mfkey32nested test" "$MFKEY32NESTEDBIN 5C467F63 4bbf8a12 abb30bd1 46033966 adc18162" "Found Key: \[059e2905bfcc\]"; then break; fi
311 if ! CheckExecute "mfkey64 test" "$MFKEY64BIN 9c599b32 82a4166c a1e458ce 6eea41e0 5cadf439" "Found Key: \[ffffffffffff\]"; then break; fi
312 if ! CheckExecute "mfkey64 long trace test" "$MFKEY64BIN 14579f69 ce844261 f8049ccb 0525c84f 9431cc40 7093df99 9972428ce2e8523f456b99c831e769dced09 8ca6827b ab797fd369e8b93a86776b40dae3ef686efd c3c381ba 49e2c9def4868d1777670e584c27230286f4 fbdcd7c1 4abd964b07d3563aa066ed0a2eac7f6312bf 9f9149ea" "Found Key: \[091e639cb715\]"; then break; fi
314 if $TESTALL || $TESTSTATICNESTED; then
315 echo -e "\n${C_BLUE}Testing staticnested:${C_NC} ${STATICNESTED0NTBIN:=./tools/mfc/card_only/staticnested_0nt} ${STATICNESTED1NTBIN:=./tools/mfc/card_only/staticnested_1nt} ${STATICNESTED2NTBIN:=./tools/mfc/card_only/staticnested_2nt} ${STATICNESTED2X1NTBIN:=./tools/mfc/card_only/staticnested_2x1nt_rf08s} ${STATICNESTED2X11KNTBIN:=./tools/mfc/card_only/staticnested_2x1nt_rf08s_1key}"
316 if ! CheckFileExist "staticnested_0nt exists" "$STATICNESTED0NTBIN"; then break; fi
317 if ! CheckFileExist "staticnested_1nt exists" "$STATICNESTED1NTBIN"; then break; fi
318 if ! CheckFileExist "staticnested_2nt exists" "$STATICNESTED2NTBIN"; then break; fi
319 if ! CheckFileExist "staticnested_2x1nt_rf08s exists" "$STATICNESTED2X1NTBIN"; then break; fi
320 if ! CheckFileExist "staticnested_2x1nt_rf08s_1key exists" "$STATICNESTED2X11KNTBIN"; then break; fi
321 if ! CheckExecute slow "staticnested_0nt test" "$STATICNESTED0NTBIN a13e4902 2e9e49fc 1111 . 7bfc7a5b 1110 a17e4902 50f2abc2 1101; rm keys.dic" "Key ffffffffffff found in 3 arrays"; then break; fi
322 if ! CheckExecute "staticnested_1nt 1/2 test" "$STATICNESTED1NTBIN 5c467f63 0 456ace4e da53428d 1001" "found 19823 keys"; then break; fi
323 if ! CheckExecute "staticnested_1nt 2/2 test" "$STATICNESTED1NTBIN 5c467f63 0 e56f9fa2 7a9616b6 1110" "found 34531 keys"; then break; fi
324 if ! CheckExecute "staticnested_2nt test" "$STATICNESTED2NTBIN 461dce03 7eef3586 7fa28c7e 322bc14d 7f62b3d6" "\[ 2 \].*ffffffffff40.*"; then break; fi
325 if ! CheckExecute "staticnested_2x1nt_rf08s test" "$STATICNESTED2X1NTBIN keys_5c467f63_00_456ace4e.dic keys_5c467f63_00_e56f9fa2.dic; rm keys_5c467f63_00_456ace4e.dic keys_5c467f63_00_e56f9fa2.dic; grep ffffffffff keys_5c467f63_00_456ace4e_filtered.dic" "fffffffffff1"; then break; fi
326 if ! CheckExecute "staticnested_2x1nt_rf08s_1key test" "$STATICNESTED2X11KNTBIN 456ace4e fffffffffff1 keys_5c467f63_00_e56f9fa2_filtered.dic; rm keys_5c467f63_00_456ace4e_filtered.dic keys_5c467f63_00_e56f9fa2_filtered.dic" "MATCH: key2=fffffffffff2"; then break; fi
328 if $TESTALL || $TESTNONCE2KEY; then
329 echo -e "\n${C_BLUE}Testing nonce2key:${C_NC} ${NONCE2KEYBIN:=./tools/mfc/card_only/nonce2key}"
330 if ! CheckFileExist "nonce2key exists" "$NONCE2KEYBIN"; then break; fi
331 if ! CheckExecute "nonce2key test" "$NONCE2KEYBIN e9cadd9c a8bf4a12 a020a8285858b090 050f010607060e07 5693be6c00000000" "key recovered: fc00018778f7"; then break; fi
333 if $TESTALL || $TESTMFNONCEBRUTE; then
334 echo -e "\n${C_BLUE}Testing mf_nonce_brute:${C_NC} ${MFNONCEBRUTEBIN:=./tools/mfc/card_reader/mf_nonce_brute}"
335 if ! CheckFileExist "mf_nonce_brute exists" "$MFNONCEBRUTEBIN"; then break; fi
336 if ! CheckExecute slow "mf_nonce_brute test 1/2" "$MFNONCEBRUTEBIN 9c599b32 5a920d85 1011 98d76b77 d6c6e870 0000 ca7e0b63 0111 3e709c8a" "Key found \[.*ffffffffffff.*\]"; then break; fi
337 if ! CheckExecute slow "mf_nonce_brute test 2/2" "$MFNONCEBRUTEBIN 96519578 d7e3c6ac 0011 cd311951 9da49e49 0010 2bb22e00 0100 a4f7f398" "Key found \[.*3b7e4fd575ad.*\]"; then break; fi
339 if $TESTALL || $TESTMFDAESBRUTE; then
340 echo -e "\n${C_BLUE}Testing mfd_aes_brute:${C_NC} ${MFDASEBRUTEBIN:=./tools/mfd_aes_brute/mfd_aes_brute}"
341 if ! CheckFileExist "mfd_aes_brute exists" "$MFDASEBRUTEBIN"; then break; fi
342 if ! CheckExecute "mfd_aes_brute test 1/2" "$MFDASEBRUTEBIN 1629394800 bb6aea729414a5b1eff7b16328ce37fd 82f5f498dbc29f7570102397a2e5ef2b6dc14a864f665b3c54d11765af81e95c" "key.................... .*261C07A23F2BC8262F69F10A5BDF3764"; then break; fi
343 if ! CheckExecute slow "mfd_aes_brute test 2/2" "$MFDASEBRUTEBIN 1546300800 3fda933e2953ca5e6cfbbf95d1b51ddf 97fe4b5de24188458d102959b888938c988e96fb98469ce7426f50f108eaa583" "key.................... .*E757178E13516A4F3171BC6EA85E165A"; then break; fi
346 if $TESTALL || $TESTCRYPTORF; then
347 echo -e "\n${C_BLUE}Testing CryptoRF sma:${C_NC} ${CRYPTRFBRUTEBIN:=./tools/cryptorf/sma} ${CRYPTRF_MULTI_BRUTEBIN:=./tools/cryptorf/sma_multi}"
348 if ! CheckFileExist "sma exists" "$CRYPTRFBRUTEBIN"; then break; fi
349 if ! CheckFileExist "sma_multi exists" "$CRYPTRF_MULTI_BRUTEBIN"; then break; fi
350 # if ! CheckExecute slow "sma test" "$CRYPTRFBRUTEBIN ffffffffffffffff 1234567812345678 88c9d4466a501a87 dec2ee1b1c9276e9" "key found \[.*4f794a463ff81d81.*\]"; then break; fi
351 if ! CheckExecute slow "sma_multi test" "$CRYPTRF_MULTI_BRUTEBIN ffffffffffffffff 1234567812345678 88c9d4466a501a87 dec2ee1b1c9276e9" "key found \[.*4f794a463ff81d81.*\]"; then break; fi
353 # hitag2crack not yet part of "all"
354 # if $TESTALL || $TESTHITAG2CRACK; then
355 if $TESTHITAG2CRACK; then
356 echo -e "\n${C_BLUE}Testing ht2crack2:${C_NC} ${HT2CRACK2PATH:=./tools/hitag2crack/crack2/}"
357 if ! CheckFileExist "ht2crack2buildtable exists" "$HT2CRACK2PATH/ht2crack2buildtable"; then break; fi
358 if ! CheckFileExist "ht2crack2gentest exists" "$HT2CRACK2PATH/ht2crack2gentest"; then break; fi
359 if ! CheckFileExist "ht2crack2search exists" "$HT2CRACK2PATH/ht2crack2search"; then break; fi
360 if ! CheckFileExist "ht2crack2search_multi exists" "$HT2CRACK2PATH/ht2crack2search_multi"; then break; fi
361 # 1.5Tb tables are supposed to be absent, so it's just a fast check without real cracking
362 if ! CheckExecute "ht2crack2 quick test" "cd $HT2CRACK2PATH; ./ht2crack2gentest 1 && ./runalltests.sh; rm keystream*" "searching on bit"; then break; fi
364 echo -e "\n${C_BLUE}Testing ht2crack3:${C_NC} ${HT2CRACK3PATH:=./tools/hitag2crack/crack3/}"
365 if ! CheckFileExist "ht2crack3 exists" "$HT2CRACK3PATH/ht2crack3"; then break; fi
366 if ! CheckFileExist "ht2crack3test exists" "$HT2CRACK3PATH/ht2crack3test"; then break; fi
367 HT2CRACK3UID=AABBCCDD
368 # Test fast only for HT2CRACK3KEY in begin of keyspace!
369 HT2CRACK3KEY=000102030405
370 HT2CRACK3N=32
371 HT2CRACK3NRAR=hitag2_${HT2CRACK3UID}_nrar_${HT2CRACK3N}emul.txt
372 if ! CheckExecute "ht2crack3 gen testfile" "cd $HT2CRACK3PATH; python3 ../hitag2_gen_nRaR.py $HT2CRACK3KEY $HT2CRACK3UID $HT2CRACK3N > $HT2CRACK3NRAR && echo SUCCESS" "SUCCESS"; then break; fi
373 if ! CheckExecute "ht2crack3test test" "cd $HT2CRACK3PATH; ./ht2crack3test $HT2CRACK3NRAR $HT2CRACK3KEY $HT2CRACK3UID|grep -v SUCCESS||echo SUCCESS" "SUCCESS"; then break; fi
374 if ! CheckExecute "ht2crack3 test" "cd $HT2CRACK3PATH; ./ht2crack3 $HT2CRACK3UID $HT2CRACK3NRAR |grep -E -v '(trying|partial)'" "key = $HT2CRACK3KEY"; then break; fi
375 if ! CheckExecute "ht2crack3 rm testfile" "cd $HT2CRACK3PATH; rm $HT2CRACK3NRAR && echo SUCCESS" "SUCCESS"; then break; fi
377 echo -e "\n${C_BLUE}Testing ht2crack4:${C_NC} ${HT2CRACK4PATH:=./tools/hitag2crack/crack4/}"
378 if ! CheckFileExist "ht2crack4 exists" "$HT2CRACK4PATH/ht2crack4"; then break; fi
379 HT2CRACK4UID=12345678
380 HT2CRACK4KEY=AABBCCDDEEFF
381 HT2CRACK4N=32
382 HT2CRACK4NRAR=hitag2_${HT2CRACK4UID}_nrar_${HT2CRACK4N}emul.txt
383 # The success is probabilistic: a fresh random nRaR file is required for each run
384 # Order of magnitude to crack it: ~15s -> tagged as "slow"
385 if ! CheckExecute slow retry ignore "ht2crack4 test" "cd $HT2CRACK4PATH; \
386 python3 ../hitag2_gen_nRaR.py $HT2CRACK4KEY $HT2CRACK4UID $HT2CRACK4N > $HT2CRACK4NRAR; \
387 ./ht2crack4 -u $HT2CRACK4UID -n $HT2CRACK4NRAR -N 16 -t 500000 2>&1; \
388 rm $HT2CRACK4NRAR" "key = $HT2CRACK4KEY"; then break; fi
390 echo -e "\n${C_BLUE}Testing ht2crack5:${C_NC} ${HT2CRACK5PATH:=./tools/hitag2crack/crack5/}"
391 if ! CheckFileExist "ht2crack5 exists" "$HT2CRACK5PATH/ht2crack5"; then break; fi
392 HT2CRACK5UID=12345678
393 HT2CRACK5KEY=AABBCCDDEEFF
394 # The speed depends on the nRaR so we'll use two pairs known to work fast
395 HT2CRACK5NRAR="71DA20AA 7EFDF3FA 2A4265F9 59653B07"
396 # Order of magnitude to crack it: ~12s on 1 core, ~3s on 4 cores -> tagged as "slow"
397 if ! CheckExecute slow "ht2crack5 test" "cd $HT2CRACK5PATH; ./ht2crack5 $HT2CRACK5UID $HT2CRACK5NRAR" "Key: $HT2CRACK5KEY"; then break; fi
399 echo -e "\n${C_BLUE}Testing ht2crack5opencl:${C_NC} ${HT2CRACK5OPENCLPATH:=./tools/hitag2crack/crack5opencl/}"
400 if ! CheckFileExist opencl "ht2crack5opencl exists" "$HT2CRACK5OPENCLPATH/ht2crack5opencl"; then break; fi
401 HT2CRACK5OPENCLUID=12345678
402 HT2CRACK5OPENCLKEY=AABBCCDDEEFF
403 # The speed depends on the nRaR so we'll use two pairs known to work fast
404 HT2CRACK5OPENCLNRAR="B438220C 944FFD74 942C59E3 3D450B34"
405 # Order of magnitude to crack it: ~15s -> tagged as "slow"
406 if ! CheckExecute slow opencl "ht2crack5opencl test" "cd $HT2CRACK5OPENCLPATH; ./ht2crack5opencl $HT2CRACK5OPENCLUID $HT2CRACK5OPENCLNRAR" "Key found.*$HT2CRACK5OPENCLKEY"; then break; fi
408 if $TESTALL || $TESTCLIENT; then
409 echo -e "\n${C_BLUE}Testing client:${C_NC} ${CLIENTBIN:=./client/proxmark3}"
410 if ! CheckFileExist "proxmark3 exists" "$CLIENTBIN"; then break; fi
411 # Avoid mangling history and logs
412 CLIENTBIN="$CLIENTBIN --incognito"
413 echo -e "\n${C_BLUE}Testing basic help:${C_NC}"
414 if ! CheckExecute "proxmark help" "$CLIENTBIN -h" "wait"; then break; fi
415 if ! CheckExecute "proxmark help text ISO7816" "$CLIENTBIN -t 2>&1" "ISO7816"; then break; fi
416 if ! CheckExecute "proxmark help text hardnested" "$CLIENTBIN -t 2>&1" "hardnested"; then break; fi
417 if ! CheckExecute "proxmark full help dump" "$CLIENTBIN --fulltext 2>&1" "Full help dump done"; then break; fi
418 if ! CheckExecute "proxmark multi cmds 1/2" "$CLIENTBIN -c 'rem foo;rem bar'" "remark: foo"; then break; fi
419 if ! CheckExecute "proxmark multi cmds 2/2" "$CLIENTBIN -c 'rem foo;rem bar'" "remark: bar"; then break; fi
420 if ! CheckExecute "proxmark multi stdin 1/4" "echo 'rem foo;rem bar;quit' |$CLIENTBIN" "remark: foo"; then break; fi
421 if ! CheckExecute "proxmark multi stdin 2/4" "echo 'rem foo;rem bar;quit' |$CLIENTBIN" "remark: bar"; then break; fi
422 if ! CheckExecute "proxmark multi stdin 3/4" "echo -e 'rem foo\nrem bar;quit' |$CLIENTBIN" "remark: foo"; then break; fi
423 if ! CheckExecute "proxmark multi stdin 4/4" "echo -e 'rem foo\nrem bar;quit' |$CLIENTBIN" "remark: bar"; then break; fi
425 echo -e "\n${C_BLUE}Testing scripts:${C_NC}"
426 if ! CheckExecute "script run cmdscript" "$CLIENTBIN -c 'script run example.cmd'" "remark: world"; then break; fi
427 if ! CheckExecute "script run luascript" "$CLIENTBIN -c 'script run data_hex_crc -b 010203040506070809'" "CDMA2000.*7B02"; then break; fi
429 CheckExecute ignore "check Python support" "$CLIENTBIN -c 'hw version'" "Python script.*present"
430 if [ $RESULT -eq 0 ]; then
431 if ! CheckExecute "script run pyscript" "$CLIENTBIN -c 'script run parity.py 10 1234'" "Even parity"; then break; fi
434 echo -e "\n${C_BLUE}Testing data manipulation:${C_NC}"
435 if ! CheckExecute "reveng readline test" "$CLIENTBIN -c 'reveng -h;reveng -D'" "CRC-64/GO-ISO"; then break; fi
436 if ! CheckExecute "reveng -g test" "$CLIENTBIN -c 'reveng -g abda202c'" "CRC-16/ISO-IEC-14443-3-A"; then break; fi
437 if ! CheckExecute "reveng -w test" "$CLIENTBIN -c 'reveng -w 8 -s 01020304e3 010204039d'" "CRC-8/SMBUS"; then break; fi
438 if ! CheckExecute "mfu pwdgen test" "$CLIENTBIN -c 'hf mfu pwdgen --test'" "Selftest ok"; then break; fi
439 if ! CheckExecute "mfu keygen test" "$CLIENTBIN -c 'hf mfu keygen --uid 11223344556677'" "80 B1 C2 71 D8 A0"; then break; fi
440 if ! CheckExecute "jooki encode test" "$CLIENTBIN -c 'hf jooki encode --test'" "04 28 F4 DA F0 4A 81 \( ok \)"; then break; fi
441 if ! CheckExecute "trace load/list 14a" "$CLIENTBIN -c 'trace load -f traces/hf_14a_mfu.trace; trace list -1 -t 14a;'" "READBLOCK\(8\)"; then break; fi
442 if ! CheckExecute "trace load/list x" "$CLIENTBIN -c 'trace load -f traces/hf_14a_mfu.trace; trace list -x1 -t 14a;'" "0.0101840425"; then break; fi
443 if ! CheckExecute "nfc decode test - oob" "$CLIENTBIN -c 'nfc decode -d DA2010016170706C69636174696F6E2F766E642E626C7565746F6F74682E65702E6F6F62301000649201B96DFB0709466C65782032'" "Flex 2"; then break; fi
444 if ! CheckExecute "nfc decode test - device info" "$CLIENTBIN -c 'nfc decode -d d1025744690004536f6e79010752432d533338300220426c61636b204e46432052656164657220636f6e6e656374656420746f2050430310123e4567e89b12d3a45642665544000004124e464320506f72742d3130302076312e3032'" "NFC Port-100 v1.02"; then break; fi
445 if ! CheckExecute "nfc decode test - vcard" "$CLIENTBIN -c 'nfc decode -d d20ca3746578742f782d7643617264424547494e3a56434152440a56455253494f4e3a332e300a4e3a43687269733b4963656d616e3b3b3b0a464e3a476f7468656e627572670a5245563a323032312d30362d32345432303a31353a30385a0a6974656d322e582d4142444154453b747970653d707265663a323032302d30362d32340a4954454d322e582d41424c4142454c3a5f24213c416e6e69766572736172793e21245f0a454e443a56434152440a'" "END:VCARD"; then break; fi
446 if ! CheckExecute "nfc decode test - apple wallet" "$CLIENTBIN -c 'nfc decode -d 031AD10116550077616C6C65743A2F2F61637469766174652F6E6663FE'" "activate/nfc"; then break; fi
447 if ! CheckExecute "nfc decode test - signature" "$CLIENTBIN -c 'nfc decode -d 03FF010194113870696C65742E65653A656B616172743A3266195F26063132303832325904202020205F28033233335F2701316E1B5A13333038363439303039303030323636343030355304EBF2CE704103000000AC536967010200803A2448FCA7D354A654A81BD021150D1A152D1DF4D7A55D2B771F12F094EAB6E5E10F2617A2F8DAD4FD38AFF8EA39B71C19BD42618CDA86EE7E144636C8E0E7CFC4096E19C3680E09C78A0CDBC05DA2D698E551D5D709717655E56FE3676880B897D2C70DF5F06ECE07C71435255144F8EE41AF110E7B180DA0E6C22FB8FDEF61800025687474703A2F2F70696C65742E65652F6372742F33303836343930302D303030312E637274FE'" "30864900-0001.crt"; then break; fi
449 echo -e "\n${C_BLUE}Testing LF:${C_NC}"
450 if ! CheckExecute "lf hitag2 test" "$CLIENTBIN -c 'lf hitag test'" "Tests \( ok"; then break; fi
451 if ! CheckExecute "lf cotag demod test" "$CLIENTBIN -c 'data load -f traces/lf_cotag_220_8331.pm3; data norm; data cthreshold -u 50 -d -20; data envelope; data raw --ar -c 272; lf cotag demod'" \
452 "COTAG Found: FC 220, CN: 8331 Raw: FFB841170363FFFE00001E7F00000000"; then break; fi
453 if ! CheckExecute "lf AWID test" "$CLIENTBIN -c 'data load -f traces/lf_AWID-15-259.pm3;lf search -1'" "AWID ID found"; then break; fi
454 if ! CheckExecute "lf EM410x test" "$CLIENTBIN -c 'data load -f traces/lf_EM4102-1.pm3;lf search -1'" "EM410x ID found"; then break; fi
455 if ! CheckExecute "lf EM4x05 test" "$CLIENTBIN -c 'data load -f traces/lf_EM4x05.pm3;lf search -1'" "FDX-B ID found"; then break; fi
456 if ! CheckExecute "lf EM4x70 calc test" "$CLIENTBIN -c 'lf em 4x70 calc --key F32AA98CF5BE4ADFA6D3480B --rnd 45F54ADA252AAC'" "FRN: 4866BB70 GRN: 9BD180"; then break; fi
457 if ! CheckExecute "lf EM4x70 recover test 1/3" "$CLIENTBIN -c 'lf em 4x70 recover --key 022A028C02BE --rnd 7D5167003571F8 --frn 982DBCC0 --grn 36C0E0'" "022a028c02be000102030405"; then break; fi
458 if ! CheckExecute "lf EM4x70 recover test 2/3" "$CLIENTBIN -c 'lf em 4x70 recover --key 022A028C02BE --rnd 7D5167003571F8 --frn 982DBCC0 --grn 36C0E0'" "022a028c02be366866191b60"; then break; fi
459 if ! CheckExecute "lf EM4x70 recover test 3/3" "$CLIENTBIN -c 'lf em 4x70 recover --key 022A028C02BE --rnd 7D5167003571F8 --frn 982DBCC0 --grn 36C0E0'" "022a028c02bef1e352c2718d"; then break; fi
460 if ! CheckExecute "lf FDX-A FECAVA test" "$CLIENTBIN -c 'data load -f traces/lf_EM4305_fdxa_destron.pm3;lf search -1'" "FDX-A FECAVA Destron ID found"; then break; fi
461 if ! CheckExecute "lf FDX-B test" "$CLIENTBIN -c 'data load -f traces/lf_HomeAgain1600.pm3;lf search -1'" "FDX-B ID found"; then break; fi
462 if ! CheckExecute "lf FDX/BioThermo test" "$CLIENTBIN -c 'data load -f traces/lf_FDXB_Bio-Thermo.pm3; lf fdxb demod'" "95.2 F / 35.1 C"; then break; fi
463 if ! CheckExecute "lf GPROXII test" "$CLIENTBIN -c 'data load -f traces/lf_GProx_36_30_14489.pm3; lf search -1'" "Guardall G-Prox II ID found"; then break; fi
464 if ! CheckExecute "lf HID Prox test" "$CLIENTBIN -c 'data load -f traces/lf_HID-proxCardII-05512-11432784-1.pm3;lf search -1'" "HID Prox ID found"; then break; fi
465 if ! CheckExecute "lf IDTECK test" "$CLIENTBIN -c 'data load -f traces/lf_IDTECK_4944544BAC40E069.pm3; lf search -1'" "Idteck ID found"; then break; fi
466 if ! CheckExecute "lf INDALA test" "$CLIENTBIN -c 'data load -f traces/lf_Indala-504278295.pm3;lf search -1'" "Indala ID found"; then break; fi
467 if ! CheckExecute "lf KERI test" "$CLIENTBIN -c 'data load -f traces/lf_Keri.pm3;lf search -1'" "Pyramid ID found"; then break; fi
468 if ! CheckExecute "lf NEXWATCH test" "$CLIENTBIN -c 'data load -f traces/lf_NEXWATCH_Quadrakey-521512301.pm3;lf search -1 '" "NexWatch ID found"; then break; fi
469 if ! CheckExecute "lf SECURAKEY test" "$CLIENTBIN -c 'data load -f traces/lf_NEXWATCH_Securakey-64169.pm3;lf search -1 '" "Securakey ID found"; then break; fi
470 if ! CheckExecute "lf PAC test" "$CLIENTBIN -c 'data load -f traces/lf_PAC-8E4C058E.pm3;lf search -1'" "PAC/Stanley ID found"; then break; fi
471 if ! CheckExecute "lf PARADOX test" "$CLIENTBIN -c 'data load -f traces/lf_Paradox-96_40426-APJN08.pm3;lf search -1'" "Paradox ID found"; then break; fi
472 if ! CheckExecute "lf VIKING test" "$CLIENTBIN -c 'data load -f traces/lf_Transit999-best.pm3;lf search -1'" "Viking ID found"; then break; fi
473 if ! CheckExecute "lf VISA2000 test" "$CLIENTBIN -c 'data load -f traces/lf_VISA2000.pm3;lf search -1'" "Visa2000 ID found"; then break; fi
475 if ! CheckExecute slow "lf T55 awid 26 test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_awid_26.pm3; lf search -1'" "AWID ID found"; then break; fi
476 if ! CheckExecute slow "lf T55 awid 26 test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_awid_26.pm3; lf awid demod'" \
477 "AWID - len: 26 FC: 224 Card: 1337 - Wiegand: 3c00a73"; then break; fi
478 if ! CheckExecute slow "lf T55 awid 50 test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_awid_50.pm3; lf search -1'" "AWID ID found"; then break; fi
479 if ! CheckExecute slow "lf T55 awid 50 test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_awid_50.pm3; lf awid demod'" \
480 "AWID - len: 50 FC: 2001 Card: 13371337 - Wiegand: 20fa201980f92, Raw: 0128b12eb1811d7117e22111"; then break; fi
481 if ! CheckExecute slow "lf T55 em410x test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_em410x.pm3; lf search -1'" "EM410x ID found"; then break; fi
482 if ! CheckExecute slow "lf T55 em410x test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_em410x.pm3; lf em 410x demod'" \
483 "EM 410x ID 0F0368568B"; then break; fi
484 if ! CheckExecute slow "lf T55 fdxb_animal test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_fdxb_animal.pm3; lf search -1'" "FDX-B ID found"; then break; fi
485 if ! CheckExecute slow "lf T55 fdxb_animal test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_fdxb_animal.pm3; lf fdxb demod'" \
486 "Animal ID......... 999-000000112233"; then break; fi
487 if ! CheckExecute slow "lf T55 fdxb_extended test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_fdxb_extended.pm3; lf search -1'" "FDX-B ID found"; then break; fi
488 if ! CheckExecute slow "lf T55 fdxb_extended test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_fdxb_extended.pm3; lf fdxb demod'" \
489 "temperature... 95.2 F / 35.1 C"; then break; fi
490 if ! CheckExecute slow "lf T55 gallagher test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_gallagher.pm3; lf search -1'" "GALLAGHER ID found"; then break; fi
491 if ! CheckExecute slow "lf T55 gallagher test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_gallagher.pm3; lf gallagher demod'" \
492 "GALLAGHER - Region: 1 Facility: 16640 Card No.: 201 Issue Level: 1"; then break; fi
493 if ! CheckExecute slow "lf T55 gproxii test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_gproxii.pm3; lf search -1'" "Guardall G-Prox II ID found"; then break; fi
494 if ! CheckExecute slow "lf T55 gproxii test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_gproxii.pm3; lf gproxii demod'" \
495 "G-Prox-II - Len: 26 FC: 123 Card: 11223 xor: 102, Raw: f98c7038c63356c7ac26398c"; then break; fi
496 if ! CheckExecute slow "lf T55 hid test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_hid.pm3; lf search -1'" "HID Prox ID found"; then break; fi
497 if ! CheckExecute slow "lf T55 hid test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_hid.pm3; lf hid demod'" \
498 "FC: 118 CN: 1603"; then break; fi
499 if ! CheckExecute slow "lf T55 hid_48 test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_hid_48.pm3; lf search -1'" "HID Prox ID found"; then break; fi
500 if ! CheckExecute slow "lf T55 hid_48 test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_hid_48.pm3; lf hid demod'" \
501 "HID Corporate 1000 48-bit"; then break; fi
502 if ! CheckExecute slow "lf T55 indala_hedem test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala_hedem.pm3; lf search -1'" "Indala ID found"; then break; fi
503 if ! CheckExecute slow "lf T55 indala_hedem test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala_hedem.pm3; lf indala demod'" "Heden-2L...... 888"; then break; fi
504 if ! CheckExecute slow "lf T55 indala test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala.pm3; lf search -1'" "Indala ID found"; then break; fi
505 if ! CheckExecute slow "lf T55 indala test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala.pm3; lf indala demod'" \
506 "Fmt 26 FC: 123 Card: 1337 Parity: 11"; then break; fi
507 if ! CheckExecute slow "lf T55 indala_224 test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala_224.pm3; lf search -1'" "Indala ID found"; then break; fi
508 if ! CheckExecute slow "lf T55 indala_224 test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_indala_224.pm3; lf indala demod'" \
509 "Indala \(len 224\) Raw: 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"; then break; fi
510 if ! CheckExecute slow "lf T55 io test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_io.pm3; lf search -1'" "IO Prox ID found"; then break; fi
511 if ! CheckExecute slow "lf T55 io test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_io.pm3; lf io demod'" \
512 "IO Prox - XSF\(01\)01:01337, Raw: 007840603059cf3f \( ok \)"; then break; fi
513 if ! CheckExecute slow "lf T55 jablotron test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_jablotron.pm3; lf search -1'" "Jablotron ID found"; then break; fi
514 if ! CheckExecute slow "lf T55 jablotron test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_jablotron.pm3; lf jablotron demod'" \
515 "Printed: 1410-00-0011-2233"; then break; fi
516 if ! CheckExecute slow "lf T55 keri test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri.pm3; lf search -1'" "KERI ID found"; then break; fi
517 if ! CheckExecute slow "lf T55 keri test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri.pm3; lf keri demod'" \
518 "KERI - Internal ID: 112233, Raw: E00000008001B669"; then break; fi
519 if ! CheckExecute slow "lf T55 keri_internalid test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri_internalid.pm3; lf search -1'" "KERI ID found"; then break; fi
520 if ! CheckExecute slow "lf T55 keri_internalid test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri_internalid.pm3; lf keri demod'" \
521 "KERI - Internal ID: 12345, Raw: E000000080003039"; then break; fi
522 if ! CheckExecute slow "lf T55 keri_msid test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri_msid.pm3; lf search -1'" "KERI ID found"; then break; fi
523 if ! CheckExecute slow "lf T55 keri_msid test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_keri_msid.pm3; lf keri demod'" \
524 "Descrambled MS - FC: 6 Card: 12345"; then break; fi
525 # if ! CheckExecute slow "lf T55 motorola test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_motorola.pm3; lf search -1'" "Indala ID found"; then break; fi
526 if ! CheckExecute slow "lf T55 motorola test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_motorola.pm3; lf motorola demod'" \
527 "Motorola - fmt: 26 FC: 258 Card: 2, Raw: A0000000A0002021"; then break; fi
528 if ! CheckExecute slow "lf T55 nedap test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nedap.pm3; lf search -1'" "NEDAP ID found"; then break; fi
529 if ! CheckExecute slow "lf T55 nedap test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nedap.pm3; lf nedap demod'" \
530 "NEDAP \(64b\) - ID: 12345 subtype: 1 customer code: 291 / 0x123 Raw: FF82246508209953"; then break; fi
531 if ! CheckExecute slow "lf T55 nexwatch test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch.pm3; lf search -1'" "NexWatch ID found"; then break; fi
532 if ! CheckExecute slow "lf T55 nexwatch test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch.pm3; lf nexwatch demod'" \
533 "Raw : 5600000000213C9F8F150C00"; then break; fi
534 if ! CheckExecute slow "lf T55 nexwatch_nexkey test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch_nexkey.pm3; lf search -1'" "NexWatch ID found"; then break; fi
535 if ! CheckExecute slow "lf T55 nexwatch_nexkey test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch_nexkey.pm3; lf nexwatch demod'" \
536 "88bit id : 521512301 \(0x1f15a56d\)"; then break; fi
537 if ! CheckExecute slow "lf T55 nexwatch_quadrakey test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch_quadrakey.pm3; lf search -1'" "NexWatch ID found"; then break; fi
538 if ! CheckExecute slow "lf T55 nexwatch_quadrakey test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_nexwatch_quadrakey.pm3; lf nexwatch demod'" \
539 "88bit id : 521512301 \(0x1f15a56d\)"; then break; fi
540 if ! CheckExecute slow "lf T55 noralsy test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_noralsy.pm3; lf search -1'" "Noralsy ID found"; then break; fi
541 if ! CheckExecute slow "lf T55 noralsy test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_noralsy.pm3; lf noralsy demod'" \
542 "Noralsy - Card: 112233, Year: 2000, Raw: BB0214FF0110002233070000"; then break; fi
543 if ! CheckExecute slow "lf T55 pac test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_pac.pm3; lf search -1'" "PAC/Stanley ID found"; then break; fi
544 if ! CheckExecute slow "lf T55 pac test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_pac.pm3; lf pac demod'" \
545 "PAC/Stanley - Card: CD4F5552, Raw: FF2049906D8511C593155B56D5B2649F"; then break; fi
546 if ! CheckExecute slow "lf T55 paradox test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_paradox.pm3; lf search -1'" "Paradox ID found"; then break; fi
547 if ! CheckExecute slow "lf T55 paradox test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_paradox.pm3; lf paradox demod'" \
548 "Paradox - ID: 004209dea FC: 96 Card: 40426, Checksum: b2, Raw: 0f55555695596a6a9999a59a"; then break; fi
549 if ! CheckExecute slow "lf T55 presco test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_presco.pm3; lf search -1'" "Presco ID found"; then break; fi
550 if ! CheckExecute slow "lf T55 presco test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_presco.pm3; lf presco demod'" \
551 "Presco Site code: 30 User code: 8665 Full code: 1E8021D9 Raw: 10D0000000000000000000001E8021D9"; then break; fi
552 if ! CheckExecute slow "lf T55 pyramid test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_pyramid.pm3; lf search -1'" "Pyramid ID found"; then break; fi
553 if ! CheckExecute slow "lf T55 pyramid test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_pyramid.pm3; lf pyramid demod'" \
554 "Pyramid - len: 26, FC: 123 Card: 11223 - Wiegand: 2f657ae, Raw: 00010101010101010101016eb35e5da4"; then break; fi
555 if ! CheckExecute slow "lf T55 securakey test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_securakey.pm3; lf search -1'" "Securakey ID found"; then break; fi
556 if ! CheckExecute slow "lf T55 securakey test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_securakey.pm3; lf securakey demod'" \
557 "Securakey - len: 26 FC: 0x35 Card: 64169, Raw: 7FCB400001ADEA5344300000"; then break; fi
558 if ! CheckExecute slow "lf T55 viking test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_viking.pm3; lf search -1'" "Viking ID found"; then break; fi
559 if ! CheckExecute slow "lf T55 viking test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_viking.pm3; lf viking demod'" \
560 "Viking - Card 0001A337, Raw: F200000001A337CF"; then break; fi
561 if ! CheckExecute slow "lf T55 visa2000 test" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_visa2000.pm3; lf search -1'" "Visa2000 ID found"; then break; fi
562 if ! CheckExecute slow "lf T55 visa2000 test2" "$CLIENTBIN -c 'data load -f traces/lf_ATA5577_visa2000.pm3; lf visa2000 demod'" \
563 "Visa2000 - Card 112233, Raw: 564953320001B66900000183"; then break; fi
565 echo -e "\n${C_BLUE}Testing HF:${C_NC}"
566 if ! CheckExecute "hf mf offline text" "$CLIENTBIN -c 'hf mf'" "content from tag dump file"; then break; fi
567 if ! CheckExecute slow retry ignore "hf mf hardnested long test" "$CLIENTBIN -c 'hf mf hardnested -t --tk 000000000000'" "found:"; then break; fi
568 if ! CheckExecute slow "hf iclass loclass long test" "$CLIENTBIN -c 'hf iclass loclass --long'" "verified \( ok \)"; then break; fi
569 if ! CheckExecute slow "emv long test" "$CLIENTBIN -c 'emv test -l'" "Tests \( ok"; then break; fi
570 if ! CheckExecute "hf iclass lookup test" "$CLIENTBIN -c 'hf iclass lookup --csn 9655a400f8ff12e0 --epurse f0ffffffffffffff --macs 0000000089cb984b -f $DICPATH/iclass_default_keys.dic'" \
571 "valid key AE A6 84 A6 DA B2 32 78"; then break; fi
572 if ! CheckExecute "hf iclass loclass test" "$CLIENTBIN -c 'hf iclass loclass --test'" "key diversification \( ok \)"; then break; fi
573 if ! CheckExecute "emv test" "$CLIENTBIN -c 'emv test'" "Tests \( ok"; then break; fi
574 if ! CheckExecute "hf cipurse test" "$CLIENTBIN -c 'hf cipurse test'" "Tests \( ok"; then break; fi
575 if ! CheckExecute "hf mfdes test" "$CLIENTBIN -c 'hf mfdes test'" "Tests \( ok"; then break; fi
576 if ! CheckExecute "hf waveshare load" "$CLIENTBIN -c 'hf waveshare load -m 6 -f tools/lena.bmp -s dither.bmp' && echo '34ff55fe7257876acf30dae00eb0e439 dither.bmp' | md5sum -c" "dither.bmp: OK"; then break; fi
578 echo -e "\n------------------------------------------------------------"
579 echo -e "Tests [ ${C_GREEN}OK${C_NC} ] ${C_OK}\n"
580 exit 0
581 done
582 echo -e "\n------------------------------------------------------------"
583 echo -e "\nTests [ ${C_RED}FAIL${C_NC} ] ${C_FAIL}\n"
584 exit 1