From e60fd41d2b7861ed3e0f8964274c52b537ba4dd8 Mon Sep 17 00:00:00 2001 From: David Houdek Date: Mon, 16 Oct 2023 12:49:30 +0200 Subject: [PATCH] Make progress on CLI --- iottadd.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/iottadd.sh b/iottadd.sh index 372b376..4a21bf6 100755 --- a/iottadd.sh +++ b/iottadd.sh @@ -1,7 +1,7 @@ #!/bin/bash -GREEN="\033[1;32m" -RED="\033[1;31m" +GREEN="\033[0;32m" +RED="\033[0;31m" PURPLE="\033[0;35m" BLUE="\033[1;34m" RESET="\033[0m" @@ -13,6 +13,16 @@ usage() { -r for usage on server (remote)${RESET}" } +getConf() { + echo -e "${GREEN}Is that ok? ${BLUE}[${GREEN}Y${BLUE}/${RED}n${BLUE}]${PURPLE}" + read -p " " confirmation + echo -en "${RESET}" + + if [[ $confirmation == "n" ]]; then + exit 255 + fi +} + if [ -z "$3" ]; then echo -e "${RED}Not enough arguments!\n${RESET}" @@ -29,13 +39,8 @@ if [[ $1 == "-l" ]]; then elif [[ $1 == "-r" ]]; then # Used on server - echo -en "${GREEN}Running with: ID=${BLUE}${2}${GREEN} and PASS=${BLUE}${3}\nIs that ok? [${GREEN}Y${BLUE}/${RED}n${BLUE}]${PURPLE}" - read -p " " confirmation - echo -en "${RESET}" - - if [[ $confirmation == "n" ]]; then - exit 255 - fi + echo -e "${GREEN}Running with: ID=${BLUE}${2}${GREEN} and PASS=${BLUE}${3}" + getConf if [ ! -w ./rawkey-generator.py ]; then echo -e "${RED}You don't have rawkey-generator.py in the same folder or don't have execute permitions${CLEAR}" @@ -44,7 +49,9 @@ elif [[ $1 == "-r" ]]; then RAWKEY="0x00"$(python ./rawkey-generator.py "${3}" "Sincoolka IoTT") - echo -e "${GREEN}Generated raw key: ${BLUE}${RAWKEY}${CLEAR}" + echo -e "${GREEN}Generated raw key (pmk): ${BLUE}${RAWKEY}${CLEAR}" + getConf + ############################################################################