Make progress on CLI

This commit is contained in:
David Houdek 2023-10-16 12:49:30 +02:00
parent c837aab523
commit e60fd41d2b

View File

@ -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
############################################################################