From fb6d2fdee84ea92e5e46e344638cbf4a9f9cb566 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 17:31:57 +0300 Subject: [PATCH 1/6] add test script --- .travis.yml | 2 +- pm3test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pm3test.sh diff --git a/.travis.yml b/.travis.yml index 079ae5a33..d260b9b47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,5 +50,5 @@ script: if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then proxmark3 -h ; elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - ./client/proxmark3 -h ; + ./pm3test.sh; fi \ No newline at end of file diff --git a/pm3test.sh b/pm3test.sh new file mode 100644 index 000000000..3ff3aa5ac --- /dev/null +++ b/pm3test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +PM3PATH=$(dirname "$0") +cd "$PM3PATH" || exit 1 + +C_RED='\033[0;31m' +C_GREEN='\033[0;32m' +C_BLUE='\033[0;34m' +C_NC='\033[0m' # No Color + +function CheckFileExist() { + + if [ -f "$2" ]; then + echo "$1 [OK]" + return 0 + fi + + if ls $2 1> /dev/null 2>&1; then + echo "$1 [OK]" + return 0 + fi + + echo "$1 [Fail]" + return 1 +} + +printf "\n${C_BLUE}RRG Proxmark3 test tool ${C_NC}\n\n" + +while true; do + if ! CheckFileExist "proxmark3 exists" "client/proxmark3"; then break; fi + if ! CheckFileExist "arm image exists" "armsrc/obj/fullimage.elf"; then break; fi + if ! CheckFileExist "bootrom exists" "bootrom/obj/bootrom.elf"; then break; fi + if ! CheckFileExist "hardnested tables exists" "client/hardnested/tables/*.z"; then break; fi + + printf "\n${C_GREEN}Tests [OK]${C_NC}\n\n" + exit 0 +done + +printf "\n${C_RED}Tests [FAIL]${C_NC}\n\n" +exit 1 \ No newline at end of file From d84fd0f7d15cc34c698554bfa79da87d2050b8b6 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 17:36:21 +0300 Subject: [PATCH 2/6] del spaces --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d260b9b47..dd4b42898 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ addons: - wget - RfidResearchGroup/proxmark3/arm-none-eabi-gcc taps: RfidResearchGroup/proxmark3 - + install: if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew info proxmark3; @@ -51,4 +51,4 @@ script: proxmark3 -h ; elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./pm3test.sh; - fi \ No newline at end of file + fi From 6452c395833a322a37ee24b1eb9fbee65b900b8a Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 17:43:34 +0300 Subject: [PATCH 3/6] small fix --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dd4b42898..e272ea9cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,5 +50,6 @@ script: if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then proxmark3 -h ; elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + chmod a+w ./pm3test.sh; ./pm3test.sh; fi From 2510caff4628f0b0e52be9fc234f8925ebd72598 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 18:07:23 +0300 Subject: [PATCH 4/6] add exec tests --- pm3test.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/pm3test.sh b/pm3test.sh index 3ff3aa5ac..d9d103910 100644 --- a/pm3test.sh +++ b/pm3test.sh @@ -24,17 +24,37 @@ function CheckFileExist() { return 1 } +function CheckExecute() { + + if eval "$2 | grep -q $3"; then + echo "$1 [OK]" + return 0 + fi + + echo "$1 [Fail]" + return 1 +} + printf "\n${C_BLUE}RRG Proxmark3 test tool ${C_NC}\n\n" while true; do - if ! CheckFileExist "proxmark3 exists" "client/proxmark3"; then break; fi - if ! CheckFileExist "arm image exists" "armsrc/obj/fullimage.elf"; then break; fi - if ! CheckFileExist "bootrom exists" "bootrom/obj/bootrom.elf"; then break; fi - if ! CheckFileExist "hardnested tables exists" "client/hardnested/tables/*.z"; then break; fi + if ! CheckFileExist "proxmark3 exists" "./client/proxmark3"; then break; fi + if ! CheckFileExist "arm image exists" "./armsrc/obj/fullimage.elf"; then break; fi + if ! CheckFileExist "bootrom exists" "./bootrom/obj/bootrom.elf"; then break; fi + if ! CheckFileExist "hardnested tables exists" "./client/hardnested/tables/*.z"; then break; fi + if ! CheckExecute "proxmark help" "./client/proxmark3 -h" "wait"; then break; fi + if ! CheckExecute "proxmark help text ISO7816" "./client/proxmark3 -t 2>&1" "ISO7816"; then break; fi + if ! CheckExecute "proxmark help text hardnested" "./client/proxmark3 -t 2>&1" "hardnested"; then break; fi + + if ! CheckExecute "hf mf offline text" "./client/proxmark3 -c 'hf mf'" "at_enc"; then break; fi + + if ! CheckExecute "hf mf hardnested test" "./client/proxmark3 -c 'hf mf hardnested t 1 000000000000'" "found:"; then break; fi + #if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test'" "Test?s? ? OK"; then break; fi + printf "\n${C_GREEN}Tests [OK]${C_NC}\n\n" exit 0 done printf "\n${C_RED}Tests [FAIL]${C_NC}\n\n" -exit 1 \ No newline at end of file +exit 1 From 7eb14b015e9601ce285e2b0f72552d9d6ecc96f5 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 18:12:18 +0300 Subject: [PATCH 5/6] travis fix --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e272ea9cc..a533910d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,11 +45,13 @@ install: make all; fi +before_script: + - chmod +x pm3test.sh + script: ## start and run a test script if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then proxmark3 -h ; elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - chmod a+w ./pm3test.sh; ./pm3test.sh; fi From 0cfaaf266fce00989ed242e3d816162c422bcfa7 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Sun, 18 Aug 2019 18:26:08 +0300 Subject: [PATCH 6/6] added `emv test` and some colors --- pm3test.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pm3test.sh b/pm3test.sh index d9d103910..385ba7579 100644 --- a/pm3test.sh +++ b/pm3test.sh @@ -11,27 +11,27 @@ C_NC='\033[0m' # No Color function CheckFileExist() { if [ -f "$2" ]; then - echo "$1 [OK]" + echo -e "$1 ${C_GREEN}[OK]${C_NC}" return 0 fi if ls $2 1> /dev/null 2>&1; then - echo "$1 [OK]" + echo -e "$1 ${C_GREEN}[OK]${C_NC}" return 0 fi - echo "$1 [Fail]" + echo -e "$1 ${C_RED}[Fail]${C_NC}" return 1 } function CheckExecute() { - if eval "$2 | grep -q $3"; then - echo "$1 [OK]" + if eval "$2 | grep -q '$3'"; then + echo -e "$1 ${C_GREEN}[OK]${C_NC}" return 0 fi - echo "$1 [Fail]" + echo -e "$1 ${C_RED}[Fail]${C_NC}" return 1 } @@ -50,7 +50,7 @@ while true; do if ! CheckExecute "hf mf offline text" "./client/proxmark3 -c 'hf mf'" "at_enc"; then break; fi if ! CheckExecute "hf mf hardnested test" "./client/proxmark3 -c 'hf mf hardnested t 1 000000000000'" "found:"; then break; fi - #if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test'" "Test?s? ? OK"; then break; fi + if ! CheckExecute "emv test" "./client/proxmark3 -c 'emv test'" "Test(s) \[ OK"; then break; fi printf "\n${C_GREEN}Tests [OK]${C_NC}\n\n" exit 0