#!/usr/bin/env bash ################################################################################################################# SOF ##################################################################################################################### echo -e '\x1b[38;2;6;45;86m'" .:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::. " echo -e '\x1b[38;2;6;45;86m'" /mMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNd- " echo -e '\x1b[38;2;6;45;86m'"-MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN." echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmNMMMMMMMMMMMmMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMh:NMMMMMMMMMMoyMMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMm -NMMMMMMMMMs.NMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMy -hmmmmmNNm- sMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmdyo+:. ......... .NMMMymMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMmy+-.. -hNm-+MMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMms:. ... /MMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMh/. /MMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMmMMMMMMMMMMMmhN:. /MMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMM+sNMMMMMMMMMN-h: .-+syyys/- -NMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMs +NMMMMMMMhm--d. :. -sdNMMMMMNNmy. :ydMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMM+ :yhyyyhhso. os yhshNMMMMMMMh+:-:. :s- .NMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMmho. . .yo.h:sMMMMMMMMMMNd+. -NNs- yMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMNh/. :++.-MMMMMMMMMMMMMm+. :ymds. -NMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMmo- .MMMMMMMMMMMMMMMdo. ..-. yMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMmo. .NMMMMMMMMMMMMMMMMNy/.. .mMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMNs. hMMMMMMMMMMMMMMMMMMMNho-. :NMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMm: ./syyyo- -hmNMMMMMMMMMMMMMMMMMMMMmho:.. /NMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMd. .smMMMNNNms. . .+MMMMMMMMMMMMMMMMMMMMMMMMNdy/ ..yMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMd. /mMMMMMy/:--. so. .mMMMMMMMMMMMMMMMMMMMMMMMNdo--:+sdNMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMN- /NMMMMMMMMdo. oMm+. /MMMMMMMMMMMMMMMMdNMMMMMMNNNMMmMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMo -NMMMMMMMMMMdso-. /hmm+ sMMMMMMMMMMMMMMMs-mMMMMMMMMMM:dMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMN. sMMMMMMMMMMMo .os/..... .dMMMMMMMMMMMMMMs -NMMMMMMMMM-:MMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMd mMMMMMMMMMMM/ .:os+-. .dMMMMMMMMMMMNm. -soosyhdms .mMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMs mMMMMMMMMMMM: .hNhs/.. .dMMMMNmhs+:-. +MMMNoMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMy hMMMMMMMMMMM: oMMMMMNdyo/. .mNh+-. +mNy.mMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMd +MMMMMMMMMMM/ :MMMMMMMMNs...:ohh/. . mMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMN. .mMMMMMMMMMMo .NMMMMMMNhhdNMMh: mMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMM+ /MMMMMMMMMMh yMMMMMMMMMMMN+ .NMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMm. +MMMMMMMMMN. .NMMMMMMMMMN- :sdmNNNdy+. dMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMo +MMMMMMMMM+ +MMMMMMMMM/ -dMMMMMMNmmNN/ .sdMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMN: :mMMMMMMMm. oMMMMMMMh .mMMMMMMMms- .. /o. .mMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMm. .yMMMMMMMo oMMMMMM/ sMMMMMMMMMMMh: :NNo. sMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMm. -hMMMMMN: /NMMMM. dMMMMMMMMMMMMMh- :hmNy. .NMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMm- -yNMMMm. .yMMM. dMMMMMMMMMMMMMMNh:. .... yMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMN+ .+hNMd. :hM: dMMMMMMMMMMMMMMMMNmo- .NMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMh- ./ss. .:: sMMMMMMMMMMMMMMMMMMMNms/. /MMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMNo. . :MMMMMMMMMMMMMMMMMMMMMMMNdo:.. oMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMmo. .mMMMMMMMMMMMMMMMMMMMMMMMMMMNmh: .dMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMNy:. +MMMMMMMMMMMMMMMMMMMMMMMMMMNh+::/+sdNMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMNdo- .dMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"/MMMMMMMMMMMMMMMMMMMMNd+-. -NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-" echo -e '\x1b[38;2;6;45;86m'"-NMMMMMMMMMMMMMMMMMMMMMMNdo:. /NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd." echo -e '\x1b[38;2;6;45;86m'" -ymNNNNNNNNNNNNNNNNNNNNNNNNdo-. +NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNmy." echo -e '\x1b[38;2;6;45;86m'" ............................ .-................................" echo -e '\x1b[38;2;6;45;86m'" ...... ......... .............. ........... maple ......" ##################################################################################################################### ##################################################################################################################### i=`cat maple|grep -n MARKER|cut -f1 -d":"`;i=$(echo $i|xargs|cut -f2 -d" ");ii=`wc -l maple|cut -f1 -d" "`; iii=$((ii-i));tail -n $iii $0>mpl;MD5=$(md5sum mpl|cut -f1 -d ' ');rm mpl;DM5="dc9efe05627b4cb8f0516cc9449a8a39" [ "$MD5" = "$DM5" ] || exit; # MARKER ############################################################################################################ ##################################################################################################################### CMD=$1; CMDARG=$2; ##################################################################################################################### ##################################################################################################################### CMD_SERVICES_MODE=0; HYDRA_BOT=0 HYDRA_TYPE=9 INIT=0; BOTMODE=-1 MEMORY="" TOKEN="" ##################################################################################################################### ##################################################################################################################### DISCORD__SERVICING=-1 TELEGRAM_SERVICING=-1 MATRIX___SERVICING=-1 OPENAI___SERVICING=-1 HYDRA____SERVICING=-1 CRYPTO___SERVICING=-1 YOUTUBE__SERVICING=-1 TWITTER__SERVICING=-1 SASL_____SERVICING=-1 NICKSERV_SERVICING=-1 ##################################################################################################################### ##################################################################################################################### sa1="\x1b[38;2;6;90;23m" sa2="\x1b[38;2;11;121;25m" sa3="\x1b[38;2;72;71;111m" sa4="\x1b[38;2;248;175;25m" sa5="\x1b[38;2;227;238;12m" sb1="\x1b[38;2;39;36;37m" sb2="\x1b[38;2;34;56;59m" sb3="\x1b[38;2;29;130;150m" sb4="\x1b[38;2;14;138;147m" sb5="\x1b[38;2;252;231;174m" sc1="\x1b[38;2;6;45;86m" sc2="\x1b[38;2;13;119;130m" sc3="\x1b[38;2;96;191;164m" sc4="\x1b[38;2;73;216;193m" sc5="\x1b[38;2;195;235;193m" ##################################################################################################################### ##################################################################################################################### function rgb () { ############################################################################################################# ############################################################################################################# if [ $1 -eq 0 ]; then echo -e "\033[0m" elif [ $1 -eq 1 ]; then echo -e "$sa1"$2 elif [ $1 -eq 2 ]; then echo -e "$sa2"$2 elif [ $1 -eq 3 ]; then echo -e "$sa3"$2 elif [ $1 -eq 4 ]; then echo -e "$sa4"$2 elif [ $1 -eq 5 ]; then echo -e "$sa5"$2 elif [ $1 -eq 6 ]; then echo -e "$sb1"$2 elif [ $1 -eq 7 ]; then echo -e "$sb2"$2 elif [ $1 -eq 8 ]; then echo -e "$sb3"$2 elif [ $1 -eq 9 ]; then echo -e "$sb4"$2 elif [ $1 -eq 10 ]; then echo -e "$sb5"$2 elif [ $1 -eq 11 ]; then echo -e "$sc1"$2 elif [ $1 -eq 12 ]; then echo -e "$sc2"$2 elif [ $1 -eq 13 ]; then echo -e "$sc3"$2 elif [ $1 -eq 14 ]; then echo -e "$sc4"$2 elif [ $1 -eq 15 ]; then echo -e "$sc5"$2 fi ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### function rgbrando () { ############################################################################################################# ############################################################################################################# R=$((RANDOM%256)) G=$((RANDOM%256)) B=$((RANDOM%256)) echo -e "\e[38;2;"$R";"$G";"$B"m" ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### function analyze () { ############################################################################################################# ############################################################################################################# R="$(rgbrando)" G="$(rgbrando)" B="$(rgbrando)" W="$(rgbrando)" CYCLE=$((CYCLE+1)) echo -e "######################################################### SOF" echo -e $W" stage: $CYCLE - ( CONTENT BELOW )" echo -e $B"filename: $1" echo -e $B"filesize: `cat $1|wc -c`" echo -e $G" md5sum: `md5sum $1|cut -c-32`" echo -e $G"fileinfo: `file $1`" echo -e $R"`cat $1|hexdump -C`"|head -n 4 echo -e $R"`cat $1|hexdump -C`"|tail -n 4 echo -e $B"filename: $1" echo -e $W"stage $CYCLE: ( CONTENT ABOVE )" echo -e "EOF #########################################################" ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### function pin_ops () { ############################################################################################################# ############################################################################################################# #################### # encrypts the pin # #################### function encrypt_pin () { echo -e "\n"$(rgb 13 '+')" "$(rgb 9 'encrypting pin')" "$(rgb 0) [ -e storage/user/config/maple.pin ] || (echo "storage/user/config/maple.pin not even here") [ -e storage/user/config/maple.pin ] && (gpg -a --symmetric --cipher-algo AES256 storage/user/config/maple.pin); } ############################################################################################################# ############################################################################################################# ############################## # generates a new sshkey ide # ############################## function generate_pin () { echo -e "${sc3}+${sb4} generating pin ${1}\n" PASSPHRASE=$(gpg --gen-random 2 48 | base64); echo -e "$PASSPHRASE" > storage/user/config/maple.pin; } ############################################################################################################# ############################################################################################################# ######################################################################## # reverts sshkey identify passphrase from a php encrypted file storage # ######################################################################## function decrypt_pin () { echo -e $(rgb 13 '+')" "$(rgb 9 'decrypting pin')" "$(rgb 0) PASSPHRASE=$(gpg -d -q storage/user/config/maple.pin.asc); } ############################################################################################################# # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # ############################################################################################################# export GPG_TTY=$(tty) [ -e storage/user/config ] || (mkdir -p storage/user/config) [ -e storage/user/status ] || (mkdir storage/user/status) echo "offline" > storage/user/status/status_id ############################################################################################################# ############################################################################################################# ############################################################################## # check if an encrypted file exists that stores our ssh identity passphrase, # # if not- create a new identity passphrase and then encrypt it into a file. # ############################################################################## if [ -e storage/user/config/maple.pin.asc ]; then echo -e "\n${sc3}+${sc4} storage/user/config/maple.pin.asc ${sc5}found" if [ -e storage/user/config/maple.pin ]; then echo -e "${sc3}+${sc4} storage/user/config/maple.pin ${sc5}found" else echo -e "${sc3}+${sc4} storage/user/config/maple.pin ${sc5}not found" fi; #[ -e storage/user/config/maple.pin ] else echo -e "\n${sc3}+${sc4} storage/user/config/maple.pin.asc ${sc5}not found" echo -e $(rgb 13 '+')" "$(rgb 9 'creating new storage/user/config/maple.pin')" "$(rgb 0) (generate_pin "storage/user/config/maple.pin"); fi; #[ -e storage/user/config/maple.pin.asc ]; ############################################################################################################# ############################################################################################################# ################################################### # check if ssh agent is running, if not, start it # ################################################### ssh-add > /dev/null 2>&1; [ $? -eq 2 ] && eval $(ssh-agent -s) > /dev/null 2>&1; ############################################################################################################# ############################################################################################################# ############################################################ # ssh running, create and/or add our identity to the agent # ############################################################ ssh-add > /dev/null 2>&1; ######################### if [ $? -eq 1 ]; then #################### IDENTITY="maplenet"; #################### ################################# # check if identify files exist # ################################# if [ -e "storage/user/config/"$IDENTITY".pub" ]; then echo -e "${sc3}+${sc4} storage/user/config/"$IDENTITY".pub ${sc5}found" if [ -e "storage/user/config/"$IDENTITY ]; then export FLAG_IDENTITY=1; echo -e "${sc3}+${sc4} storage/user/config/"$IDENTITY" ${sc5}found" echo -e "${sc3}+${sc4} storage/user/config/"$IDENTITY" ${sc5}not found" fi; #[ -e storage/user/config/maplenet ] else export FLAG_IDENTITY=0; echo -e "${sc3}+${sc4} storage/user/config/"$IDENTITY" ${sc5}not found" echo -e "${sc3}+${sb4} creating new storage/user/config/${IDENTITY}" fi; #[ -e storage/user/config/maplenet.pub ] ############################## # generate new identify file # ############################## if [ $FLAG_IDENTITY -eq 0 ]; then (generate_pin "storage/user/config/$IDENTITY"); [ ! -z $PASSPHRASE ] && (echo -e "\n${sc4}PASSPHRASE: ${sc5}$PASSPHRASE\n"); ssh-keygen -t rsa -m pem -b 4096 -f storage/user/config/"$IDENTITY" -N "$PASSPHRASE" else (decrypt_pin); fi; #[ $FLAG_IDENTIFY -eq 0 ] ######################################################################## # add identify file to the ssh-agent including the identity passphrase # ######################################################################## echo "$PASSPHRASE" | openssl rsa -in storage/user/config/"$IDENTITY" -passin stdin | ssh-add - [ -e storage/user/config/maple.pin.asc ] || (encrypt_pin); [ -e storage/user/config/maple.pin.asc ] && echo -e $(rgb 13 '+')" "$(rgb 9 'pin encrypted')" "$(rgb 0) [ -e storage/user/config/maple.pin ] && (rm storage/user/config/maple.pin) fi; #[ $? -eq 1 ] ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kset() { ############################################################################################################# ############################################################################################################# if [[ -z $1 ]] || [[ -z $2 ]]; then echo "${sc4}error: no variable or value to kset()"; exit; fi echo "$1 = $2" >> $CONFIG ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kwrite() { ############################################################################################################# ############################################################################################################# if [[ -z $1 ]]; then echo "${sc4}error: ${sc5}no value to kwrite()"; exit; fi echo "$1" >> $CONFIG ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kblank() { ############################################################################################################# ############################################################################################################# echo "" >> $CONFIG ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kmodesetup() { ############################################################################################################# ############################################################################################################# HYDRA=$1; MODE=$2; FAILED=0; echo -e "${sc1}[${sc2} entered kmodesetup${sc3}: ${sc4}$HYDRA ${sc1}]"; ############################################################################################################# ############################################################################################################# if [ ! -e env ]; then echo -e "${sc1}[ ${sc2}setting up $HYDRA ${sc1}]\n"; which python3 > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "${sc4}python3 not installed, install like pacman -Sy python3, apt install python3, brew install python3"; FAILED=1; fi python3 -m pip > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "${sc4}python3 pip module not installed, attempting to auto-install"; wget https://bootstrap.pypa.io/get-pip.py; python3 get-pip.py; fi python3 -m pip > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "${sc4}python3 pip module still not installed, manually install python3 pip module before proceeding"; FAILED=1; fi which virtualenv > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "${sc4}python3 virtualenv module not installed, attempting to auto-install"; python3 -m pip install virtualenv; fi which virtualenv > /dev/null 2>&1 if [ $? -eq 1 ]; then echo "${sc4}python3 virtualenv module still not installed, manually install python3 virtualenv module before proceeding"; FAILED=1; fi if [ $FAILED -eq 1 ]; then echo "${sc4}pre-requisites not met, aborting installation"; exit 1; fi which python3.9 > /dev/null 2>&1 if [ $? -eq 0 ]; then virtualenv -p python3.9 env > /dev/null 2>&1; else virtualenv -p python3 env > /dev/null 2>&1; fi source env/bin/activate > /dev/null 2>&1 if [ $? -eq 1 ]; then which python3.9 > /dev/null 2>&1 if [ $? -eq 1 ]; then python3.9 -m venv env > /dev/null 2>&1; else python3 -m venv env > /dev/null 2>&1; fi source env/bin/activate > /dev/null 2>&1 if [ $? -eq 1 ]; then echo -e "\n${sc4}[ error: ${sc5}trouble setting up a python virtual environment - aborting ${sc4}]" exit 1 fi fi pip install --upgrade pip [ "$MODE" = "0" ] && (pip install -r storage/bot/requirements/requirements_services.txt --no-cache-dir ) [ "$MODE" = "1" ] && (pip install -r storage/bot/requirements/requirements_core.txt --no-cache-dir ) [ "$MODE" = "2" ] && (pip install -r storage/bot/requirements/requirements_services.txt --no-cache-dir ) [ "$MODE" = "3" ] && (pip install -r storage/bot/requirements/requirements_devops.txt --no-cache-dir ) echo -e "\n${sc4}[ ${sc5}$HYDRA setup complete ${sc4}]" deactivate fi; #[ ! -e env ] ############################################################################################################# ############################################################################################################# echo -e "${sc4}[ ${sc5}setting up $HYDRA activation ${sc4}]" ############################################################################################################# ############################################################################################################# if [ "$MODE" = "1" ] || [ "$MODE" = "2" ] || [ "$MODE" = "3" ]; then ##################################################################################################### ##################################################################################################### echo -e "${sc4}[ ${sc5}fetching $HYDRA credentials ${sc4}]" ##################################################################################################### ##################################################################################################### cmd_hydra_undak ##################################################################################################### ##################################################################################################### if [ ! $? -eq 13 ]; then HYDRA_BOT=1 cp data_dack/hydra.key storage/user/config/ cp data_dack/maplenet.pub storage/user/config/ cp data_dack/maple.pin.asc storage/user/config/ [ -e storage/user/credentials ] || mkdir -p storage/user/credentials cp data_dack/activate__hydra* storage/user/credentials/ rm -Rf {data_dack,data_aes} else echo -e "${sc4}TOKEN WAS OMITTED, UNDAK OF CREDENTIALS NOT POSSIBLE ${sc3}- ${sc5}APPEND CREDENTIALS TO ENV/BIN/ACTIVATE ${sc3}- ${sc4}SEE BOTTOM OF README.MD FOR HELP WITH ENVIRONMENTAL VARIABLE EXPORTS" fi ##################################################################################################### ##################################################################################################### # if [ "$MODE" = "1" ]; then # [ -e storage/user/credentials/activate__hydra_core__standalone ] && cat storage/user/credentials/activate__hydra_core__standalone > activation # elif [ "$MODE" = "2" ]; then # [ -e storage/user/credentials/activate__hydra_dupe__services ] && cat storage/user/credentials/activate__hydra_dupe__services > activation # elif [ "$MODE" = "3" ]; then # [ -e storage/user/credentials/activate__hydra_dupe__devops ] && cat storage/user/credentials/activate__hydra_dupe__devops > activation # fi ##################################################################################################### ##################################################################################################### fi ############################################################################################################# ############################################################################################################# [ "$MODE" = "0" ] && (cp storage/bot/variants/dupe/bot_maple__services.py ./bot_maple.py) [ "$MODE" = "1" ] && (cp storage/bot/variants/core/bot_maple.ini bot_maple.ini) [ "$MODE" = "2" ] && (cp storage/bot/variants/dupe/bot_maple__services.py bot_maple.py) [ "$MODE" = "3" ] && (cp storage/bot/variants/dupe/bot_maple__devops.py bot_maple.py) ############################################################################################################# ############################################################################################################# echo -e "${sc4}[ ${sc5}leaving setup and running $HYDRA ${sc5}]" ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kmode () { ############################################################################################################# ############################################################################################################# MODE=$1 echo -e "\n${sc1}[ ${sc2}entered kmode - $MODE ${sc1}]" ############################################################################################################# ############################################################################################################# if [ $MODE -eq 0 ]; then HYDRA="default"; HYDRA_TYPE=0 elif [ $MODE -eq 1 ]; then HYDRA="hydra_core__standalone"; HYDRA_TYPE=1 elif [ $MODE -eq 2 ]; then HYDRA="hydra_dupe__services"; HYDRA_TYPE=2 elif [ $MODE -eq 3 ]; then HYDRA="hydra_dupe__devops"; HYDRA_TYPE=3 fi; #[ "$MODE" = "0" ] ############################################################################################################# ############################################################################################################# [ -e storage/bot/status ] || (mkdir storage/bot/status) echo "$HYDRA" > storage/bot/status/status_id kmodesetup "$HYDRA" "$MODE" ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### kprompt() { ############################################################################################################# ############################################################################################################# if [[ -z $1 ]] || [[ -z $2 ]] || [[ -z $3 ]] || [[ -z $4 ]] || [[ -z $5 ]] || [[ -z $6 ]]; then echo "error: no variable, prompt, help, enforcement, type or memory passed to kprompt()"; exit; fi ############################################################################################################# ############################################################################################################# local INIVAR=$1; local PROMPT=$2; local DIALOG=$3; local ENFORCE=$4; local TYPE=$5; local MEMORIZE=$6; unset REPLY; ############################################################################################################# ############################################################################################################# while [[ -z "${REPLY}" ]] || [[ $ENFORCE -eq 1 ]]; do if [ $TYPE -eq 1 ]; then echo -e "$DIALOG"; echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[1/2]: " elif [ $TYPE -eq 2 ]; then echo -e "$DIALOG"; echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[1/2/3]: " elif [ $TYPE -eq 3 ]; then echo -e "$DIALOG"; echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n ": " else echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[y/n]: " fi; read; if [[ $ENFORCE -eq 1 ]] && [[ $TYPE -eq 0 ]]; then while ! [[ -z $ENFORCE ]]; do if ([ ${REPLY} == "y" ] || [ ${REPLY} == "Y" ]); then return 0 elif ([ ${REPLY} == "n" ] || [ ${REPLY} == "N" ]); then return 9 else echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[y/n]: " read; fi; done; elif [[ $ENFORCE -eq 1 ]] && [[ $TYPE -eq 1 ]]; then while ! [[ -z $ENFORCE ]]; do if ([ "${REPLY}" = "1" ]); then return 1 elif ([ "${REPLY}" = "2" ]); then return 2 else echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[1/2]: " read; fi; done; elif [[ $ENFORCE -eq 1 ]] && [[ $TYPE -eq 2 ]]; then while ! [[ -z $ENFORCE ]]; do if ([ "${REPLY}" = "1" ]); then return 1 elif ([ "${REPLY}" = "2" ]); then return 2 elif ([ "${REPLY}" = "3" ]); then return 3 else echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[1/2/3]: " read; fi; done; elif [[ $ENFORCE -eq 1 ]] && [[ $TYPE -eq 3 ]]; then while ! [[ -z $ENFORCE ]]; do if ([ ! "${REPLY}" = "" ]); then REPLY="$REPLY" return 0 else echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n ": " read; fi done; elif [[ $TYPE -eq 1 ]]; then while true; do [[ ${REPLY} =~ ^-?[0-9]+$ ]] if ! [ $? -eq 0 ]; then echo -en "$PROMPT"; [ $ENFORCE -eq 0 ] && echo -n ": " || echo -n "[y/n]: " read; else return ${REPLY} fi done; fi; done; ############################################################################################################# ############################################################################################################# if [ $MEMORIZE -eq 1 ]; then echo -e $(rgb 13 '+')" "$(rgb 9 'MEMORIZE'11)" "$(rgb 0) MEMORY=${REPLY} fi; [ $TYPE -eq 1 ] && return ${REPLY} || kset "$INIVAR" "${REPLY}" return 0; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_hydra_dak () { ############################################################################################################# ############################################################################################################# [ -e data_dack ] && ( rm -Rf data_dack ) ############################################################################################################# ############################################################################################################# mkdir data_dack cp storage/user/config/hydra.key data_dack cp storage/user/config/maplenet.pub data_dack cp storage/user/config/maple.pin.asc data_dack [ -e storage/user/credentials ] || (mkdir storage/user/credentials) cp storage/user/credentials/activate__hydra_core__standalone data_dack cp storage/user/credentials/activate__hydra_dupe__services data_dack cp storage/user/credentials/activate__hydra_dupe__devops data_dack ############################################################################################################# ############################################################################################################# DAK=data_dack ############################################################################################################# # STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 STAGE 1 ############################################################################################################# FDIR=$(basename "$DAK"); FNAME="data_dak"; CYCLE=0; ############################################################################################################# ############################################################################################################# echo -e "${sc4}[ ${sc5}dacking archive ${sc4}]" ############################################################################################################# ############################################################################################################# tar cvfz $FNAME.tgz $FDIR analyze $FNAME.tgz ############################################################################################################# ############################################################################################################# # STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 STAGE 2 ############################################################################################################# ############################################################################################################# cat $FNAME.tgz|base64 > $FNAME.tgz.b64 analyze $FNAME.tgz.b64 ############################################################################################################# ############################################################################################################# # STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 STAGE 3 ############################################################################################################# ############################################################################################################# dd bs=128 count=3 if=/dev/random of=random > /dev/null 2>&1 cat random|base64 > b64 dd bs=77 count=2 if=b64 of=trash > /dev/null 2>&1 cat $FNAME.tgz.b64 >> trash mv trash $FNAME.tgz.b64.d analyze $FNAME.tgz.b64.d rm random && rm *b64 && rm $FNAME.tgz ############################################################################################################# ############################################################################################################# # STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 STAGE 4 ############################################################################################################# ############################################################################################################# FPASS=$(sha256sum $FNAME.tgz.b64.d|cut -c1-64) zip $FNAME.zip $FNAME.tgz.b64.d -r9 -P $FPASS analyze $FNAME.zip rm -Rf $FDIR && rm $FNAME.tgz.b64.d ############################################################################################################# ############################################################################################################# # STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 STAGE 5 ############################################################################################################# ############################################################################################################# PASSWORD=$(gpg --gen-random 2 1024|base64) echo $PASSWORD|tr -d ' ' > dr1p_aes1 openssl enc -aes-256-cbc -pbkdf2 -iter 20000 -in "$FNAME.zip" -out "$FNAME.aes" -pass file:"dr1p_aes1" analyze $FNAME.aes ############################################################################################################# ############################################################################################################# # STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 STAGE 6 ############################################################################################################# ############################################################################################################# base64 < "$FNAME.aes" > "$FNAME.dak" && rm "$FNAME.aes" && rm "$FNAME.zip" analyze $FNAME.dak ############################################################################################################# ############################################################################################################# echo -e "${sc4}[ ${sc5}crypto password ${sc4}]\n${sc3}$PASSWORD\n${sc4}[ ${sc5}archive password ${sc4}]\n${sc5}$FPASS\n${sc5}[ ${sc4}archive filename ${sc5}]\n${sc3}$FNAME.zip\n${sc4}[ ${sc5}archive contents ${sc4}]" > $FNAME.passwords echo -e "${sc4}[ ${sc5}crypto password ${sc4}]\n${sc3}$PASSWORD\n${sc4}[ ${sc5}archive password ${sc4}]\n${sc3}$FPASS\n"$C"${sc4}[ ${sc5}archive filename ${sc4}]\n${sc3}$FNAME.zip\n${sc4}[ ${sc5}archive contents ${sc4}]" echo $PASSWORD|tr -d ' ' > dr1p_aes2 echo $FPASS > dr1p_zip cat $FNAME.passwords > data_dack_dak cat $FNAME.dak >> data_dack_dak ############################################################################################################# ############################################################################################################# # STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 STAGE 7 ############################################################################################################# ############################################################################################################# export GPG_TTY=$(tty) PASSPHRASE=$(gpg -d -q storage/user/config/maple.pin.asc); gpg -a --symmetric --cipher-algo AES256 data_dack_dak ############################################################################################################# ############################################################################################################# # STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 STAGE 8 ############################################################################################################# ############################################################################################################# openssl enc -aes-256-cbc -pbkdf2 -iter 20000 -in "data_dack_dak.asc" -out "data_dack_aes" -k $PASSPHRASE base64 < "data_dack_aes" > "dak_tcp" && rm {dr1p_,data_}* analyze dak_tcp echo -e $B".[d]. xmit dakd .[d]." cat storage/user/config/maple.pin.asc > dak_tcp.tmp cat dak_tcp >> dak_tcp.tmp analyze dak_tcp.tmp mv dak_tcp.tmp dak_tcp [ -e storage/user/logs ] || (mkdir storage/user/logs) TCPAC=$(cat dak_tcp|nc tcp.ac 9999|jq -r '.txt,.del'|xargs) > /dev/null 2>&1; if [ ! -z "$TCPAC" ]; then echo $TCPAC>storage/user/logs/tcpac.log TXT=$(echo $TCPAC|cut -f 1 -d ' '); DEL=$(echo $TCPAC|cut -f 2 -d ' '); echo -e "\n${sc2}*** ${sc4}WRITE DOWN THIS TOKEN ${sc2}***" [ -e storage/user/logs ] || (mkdir storage/user/logs) basename "$TXT">storage/user/logs/token.log TOKEN=$(cat storage/user/logs/token.log) echo -e "${sc4}TOKEN: ${sc5}$TOKEN" echo -e "${sc2}*** ${sc4}WRITE DOWN THIS TOKEN ${sc2}***" else echo -e "${sc4}TCP.AC SERVICE OUTAGE ${sc3}// ${sc5}YOU WILL HAVE TO MOVE CREDENTIALS MANUALLY" fi ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_hydra_undak () { ############################################################################################################# ############################################################################################################# if [ -z "$TOKEN" ]; then echo -ne "\n${sc4}if you have an online token credential pak input it now, otherwise just hit enter: ${sc5}" read TOKEN fi ############################################################################################################# ############################################################################################################# if [ -z $TOKEN ]; then echo -e "${sc4}TOKEN OMITTED ${sc3}- ${sc5}BYPASSING CREDENTIAL AUTOMATION ${sc3}- ${sc5}YOU WILL HAVE TO SETUP CREDENTIALS MANUALLY" return 13; fi ############################################################################################################# ############################################################################################################# curl -L "https://tcp.ac/t/$TOKEN" --output dak_tcp mkdir -p storage/user/config cp storage/user/scripts/unkey.py . python3 unkey.py ############################################################################################################# ############################################################################################################# # STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 STAGE 9 ############################################################################################################# ############################################################################################################# echo -e "${sc4}[${sc5} reached cmd_hydra_undak ${sc4}]" export GPG_TTY=$(tty) PASSPHRASE=$(gpg -d -q storage/user/config/maple.pin.asc); base64 -d < dak_tcp > data_dack_aes analyze data_dack_aes openssl enc -d -aes-256-cbc -pbkdf2 -iter 20000 -in "data_dack_aes" -out "data_dack_dak.asc" -k $PASSPHRASE analyze data_dack_dak.asc ############################################################################################################# ############################################################################################################# # STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A STAGE A ############################################################################################################# ############################################################################################################# export GPG_TTY=$(tty) PASSPHRASE=$(gpg -o data_tcp -d -q data_dack_dak.asc) analyze data_dack_dak.asc cp storage/user/scripts/undak.py . && python3 undak.py ############################################################################################################# ############################################################################################################# # STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B STAGE B ############################################################################################################# ############################################################################################################# base64 -d < data_tcp_deconcatenated > data_aes openssl enc -d -aes-256-cbc -pbkdf2 -iter 20000 -in "data_aes" -out "data_dak" -pass file:"dr1p_aes2" FNAME="data_dak" FPASS=$(cat dr1p_zip) unzip -P $FPASS $FNAME && FNAMELESS=$(echo "$FNAME" | cut -f 1 -d '.') ############################################################################################################# ############################################################################################################# # STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C STAGE C ############################################################################################################# ############################################################################################################# if [ $? -ne 0 ]; then echo "${sc4}not ok: ${sc5}$?"; echo "${sc4}error: ${sc5}problem undacking"; exit 666; fi dd skip=77 bs=2 if=$FNAMELESS.tgz.b64.d of=$FNAMELESS.tgz.b64 #> /dev/null 2>&1 if [ $? -ne 0 ]; then echo "${sc4}not ok: ${sc5}$?"; echo "${sc4}error: ${sc5}problem undacking"; exit 666; fi cat $FNAMELESS.tgz.b64|base64 -d > $FNAMELESS.tgz if [ $? -ne 0 ]; then echo "${sc4}not ok: ${sc5}$?"; echo "${sc4}error: ${sc5}problem undacking"; exit 666; fi tar zxvf $FNAMELESS.tgz if [ $? -ne 0 ]; then echo -e "${sc4}not ok:${sc5} $?"; echo "${sc4}error: ${sc5}problem undacking"; exit 666; fi echo -e "\n${sc4}.[d]. undacked .[d].\n" rm *.tgz.b64.d && rm *.tgz.b64 && rm $FNAMELESS.tgz; rm data_dack_aes; rm data_dack_dak.asc; rm data_dak; rm data_tcp; rm data_tcp_deconcatenated; rm dr1p_*; rm dak_*; rm undak.py; rm unkey.py; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_hydra () { ############################################################################################################# ############################################################################################################# export GPG_TTY=$(tty) if [ ! -e storage/user/config/hydra.key ]; then echo -e "\n${sc1}[ ${sc2}generating hydra keyset ${sc1}]" HYDRAKEY=$(gpg --gen-random 2 4096 | base64); [ -e storage/user/config ] || (mkdir storage/user/config) echo -e "$HYDRAKEY" > storage/user/config/hydra.key fi; if [ ! -e storage/user/config/maplenet.pub ]; then pin_ops; fi; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_default () { ############################################################################################################# ############################################################################################################# (kmode 0); ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_services () { ############################################################################################################# ############################################################################################################# echo -e "\n${sc1}[ ${sc2}setting up services ${sc2}]" [ -e storage/user/credentials ] || (mkdir -p storage/user/credentials) if [ $2 -eq 1 ]; then if [ -e storage/user/credentials/activate__hydra_core__standalone ]; then echo -e "\n${sc3}+ ${sc1}storage/user/credentials/activate__hydra_core__standalone ${sc2}exists" cat storage/user/credentials/activate__hydra_core__standalone >> activate TOKEN=TOKEN fi elif [ $2 -eq 2 ]; then if [ -e storage/user/credentials/activate__hydra_dupe__services ]; then echo -e "\n${sc3}+ ${sc1}storage/user/credentials/activate__hydra_dupe__services ${sc2}exists" cat storage/user/credentials/activate__hydra_dupe__services >> activate TOKEN=TOKEN fi elif [ $2 -eq 3 ]; then if [ -e storage/user/credentials/activate__hydra_dupe__devops ]; then echo -e "\n${sc3}+ ${sc1}storage/user/credentials/activate__hydra_dupe__devops ${sc2}exists" cat storage/user/credentials/activate__hydra_dupe__devops >> activate TOKEN=TOKEN fi fi ############################################################################################################# ############################################################################################################# SOURCED_ACTIVATE=0 ############################################################################################################# ############################################################################################################# if [ -e activate ]; then kprompt "MODE" "\n${sc4}use local activate file found in local directory?${sc5} " "local activate file" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then SOURCED_ACTIVATE=1 echo -e "\n${sc1}[ ${sc2}using local activate file ${sc2}]" cat activate|grep "export"|grep "=" >> env/bin/activate cat activate|grep "export"|grep "="|grep YOUTUBE > /dev/null 2>&1; [ $? -eq 0 ] && YOUTUBE__SERVICING=1 || YOUTUBE__SERVICING=0 cat activate|grep "export"|grep "="|grep TWITTER > /dev/null 2>&1; [ $? -eq 0 ] && TWITTER__SERVICING=1 || TWITTER__SERVICING=0 cat activate|grep "export"|grep "="|grep OPENAI > /dev/null 2>&1; [ $? -eq 0 ] && OPENAI___SERVICING=1 || OPENAI___SERVICING=0 cat activate|grep "export"|grep "="|grep MATRIX > /dev/null 2>&1; [ $? -eq 0 ] && MATRIX___SERVICING=1 || MATRIX___SERVICING=0 cat activate|grep "export"|grep "="|grep DISCORD > /dev/null 2>&1; [ $? -eq 0 ] && DISCORD__SERVICING=1 || DISCORD__SERVICING=0 cat activate|grep "export"|grep "="|grep TELEGRAM > /dev/null 2>&1; [ $? -eq 0 ] && TELEGRAM_SERVICING=1 || TELEGRAM_SERVICING=0 cat activate|grep "export"|grep "="|grep CRYPTO > /dev/null 2>&1; [ $? -eq 0 ] && CRYPTO___SERVICING=1 || CRYPTO___SERVICING=0 cat activate|grep "export"|grep "="|grep SASL > /dev/null 2>&1; [ $? -eq 0 ] && SASL_____SERVICING=1 || SASL_____SERVICING=0 cat activate|grep "export"|grep "="|grep NICKSERV > /dev/null 2>&1; [ $? -eq 0 ] && NICKSERV_SERVICING=1 || NICKSERV_SERVICING=0 if [ $MATRIX___SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use matrix services?${sc5} " "matrix" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then MATRIX___SERVICING=0 fi fi if [ $DISCORD__SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use discord services?${sc5} " "discord" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then DISCORD__SERVICING=0 fi fi if [ $TELEGRAM_SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use telegram services?${sc5} " "telegram" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then TELEGRAM_SERVICING=0 fi fi if [ $YOUTUBE__SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use youtube services?${sc5} " "youtube" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then YOUTUBE__SERVICING=0 fi fi if [ $TWITTER__SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use twitter services?${sc5} " "twitter" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then TWITTER__SERVICING=0 fi fi if [ $CRYPTO___SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use cryptocompare services?${sc5} " "cryptocompare" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then CRYPTO___SERVICING=0 fi fi if [ $OPENAI___SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use openai services?${sc5} " "openai" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then OPENAI___SERVICING=0 fi fi cat activate|grep "export"|grep "="|grep HYDRA > /dev/null 2>&1 if [ $? -eq 0 ]; then SASL_____SERVICING=1 NICKSERV_SERVICING=0 else if [ $SASL_____SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use sasl services?${sc5} " "sasl" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then SASL_____SERVICING=1 NICKSERV_SERVICING=0 else if [ $NICKSERV_SERVICING -eq 1 ]; then kprompt "MODE" "\n${sc4}will this bot use nickserv services?${sc5} " "nickserv" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then NICKSERV_SERVICING=1 SASL_____SERVICING=0 else NICKSERV_SERVICING=0 SASL_____SERVICING=0 fi fi fi fi fi kprompt "MODE" "\n${sc4}remove local activate file found in local directory?${sc5} " "local activate file" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then echo -e "\n${sc3}+ ${sc1}removing local activate file" rm activate else echo -e "\n${sc3}+ ${sc1}keeping local activate file" fi return fi fi ############################################################################################################# ############################################################################################################# if [ $CMD_SERVICES_MODE -eq 1 ]; then ##################################################################################################### ##################################################################################################### echo -e "\n${sc1}[ ${sc2}HYDRA MODE ${sc1}]" HYDRA____SERVICING=1 SASL_____SERVICING=1 NICKSERV_SERVICING=0 ##################################################################################################### ##################################################################################################### if [ $HYDRA_BOT -eq 0 ]; then echo -e "export HYDRA_DESIGNATION=core" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export HYDRA_DESIGNATION=dupe" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export HYDRA_DESIGNATION=dupe" >> storage/user/credentials/activate__hydra_dupe__devops echo -e 'export HYDRA_PURPOSE="core - keep uptime and designate tasks"' >> storage/user/credentials/activate__hydra_core__standalone echo -e 'export HYDRA_PURPOSE="services - runs the ai"' >> storage/user/credentials/activate__hydra_dupe__services fi ##################################################################################################### ##################################################################################################### if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "${sc4}hydra irc homechannel${sc1}" "\n${sc1}[${sc2} hydra irc homechannel ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} #b0ts3x" 1 3 0; RESULT=$? echo -e "export HYDRA_HOME=$REPLY" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export HYDRA_HOME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export HYDRA_HOME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__devops fi ##################################################################################################### ##################################################################################################### if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "${sc4}sasl username${sc1}" "\n${sc1}[ ${sc2}sasl username ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} username" 1 3 0; RESULT=$? echo -e "export BOT_SASL_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export BOT_SASL_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export BOT_SASL_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__devops echo -e "export BOT_SASL_USERNAME=$REPLY" >> activation echo -e "export NICKSERV_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export NICKSERV_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export NICKSERV_USERNAME=$REPLY" >> storage/user/credentials/activate__hydra_dupe__devops echo -e "export NICKSERV_USERNAME=$REPLY" >> activation fi ##################################################################################################### ##################################################################################################### if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "${sc4}sasl password${sc1}" "\n${sc1}[ ${sc2}sasl password ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} password" 1 3 0; RESULT=$? echo -e "export BOT_SASL_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export BOT_SASL_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export BOT_SASL_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_dupe__devops echo -e "export BOT_SASL_PASSWORD=$REPLY" >> activation echo -e "export NICKSERV_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_core__standalone echo -e "export NICKSERV_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_dupe__services echo -e "export NICKSERV_PASSWORD=$REPLY" >> storage/user/credentials/activate__hydra_dupe__devops echo -e "export NICKSERV_PASSWORD=$REPLY" >> activation fi ##################################################################################################### ##################################################################################################### else ##################################################################################################### ##################################################################################################### echo -e "\n${sc1}[ ${sc2}NON-HYDRA MODE ${sc1}]" HYDRA____SERVICING=0 ##################################################################################################### ##################################################################################################### [ -e activation ] && rm activation ##################################################################################################### ##################################################################################################### kprompt "MODE" "\n${sc4}will this bot use sasl services?${sc5} " "sasl" 1 0 0; RESULT=$? ##################################################################################################### ##################################################################################################### if [ $RESULT -eq 0 ]; then kprompt "MODE" "${sc4}sasl username${sc1}" "\n${sc1}[ ${sc2}sasl username ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} username" 1 3 0; RESULT=$? echo -e "export BOT_SASL_USERNAME=$REPLY" >> activation kprompt "MODE" "${sc4}sasl password${sc1}" "${sc1}[ ${sc2}sasl password ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} password" 1 3 0; RESULT=$? echo -e "export BOT_SASL_PASSWORD=$REPLY" >> activation SASL_____SERVICING=1 NICKSERV_SERVICING=0 else ############################################################################################# ############################################################################################# SASL_____SERVICING=0 ############################################################################################# ############################################################################################# kprompt "MODE" "\n${sc4}will this bot use nickserv services?${sc5} " "nickserv" 1 0 0; RESULT=$? ############################################################################################# ############################################################################################# if [ $RESULT -eq 0 ]; then kprompt "MODE" "${sc4}nickserv username${sc1}" "\n${sc1}[ ${sc2}nickserv username ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} username" 1 3 0; RESULT=$? echo -e "export NICKSERV_USERNAME=$REPLY" >> activation kprompt "MODE" "${sc4}nickserv password${sc1}" "${sc1}[ ${sc2}nickserv password ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} password" 1 3 0; RESULT=$? echo -e "export NICKSERV_PASSWORD=$REPLY" >> activation NICKSERV_SERVICING=1 else ##################################################################################### ##################################################################################### NICKSERV_SERVICING=0 ##################################################################################### ##################################################################################### fi fi fi ############################################################################################################# ############################################################################################################# if [ ! $1 -eq 1 ]; then ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use matrix services?${sc5} " "matrix" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "matrix homeserver${sc1}" "\n${sc1}[${sc2} matrix homeserver ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} https://matrix.org" 1 3 0; RESULT=$? echo -e "export MATRIX_HOMESERVER=$REPLY" >> activation kprompt "MODE" "matrix username${sc1}" "${sc1}[${sc2} matrix username ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} whatever username you setup" 1 3 0; RESULT=$? echo -e "export MATRIX___USERNAME=$REPLY" >> activation kprompt "MODE" "matrix password${sc1}" "${sc1}[${sc2} matrix password ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} whatever password you setup for this username" 1 3 0; RESULT=$? echo -e "export MATRIX___PASSWORD=$REPLY" >> activation fi MATRIX___SERVICING=1 else MATRIX___SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use discord services?${sc5} " "discord" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "discord_token${sc1}" "\n${sc1}[${sc2} discord token ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} OTAzOTU4NjQyNTIzNTI5MjM2.GXqwzj.Rnv8RudPRnv5jAeVu4dPnIl6TpSER7Eez5RZze" 1 3 0; RESULT=$? echo -e "export DISCORD__TOKEN=$REPLY" >> activation kprompt "MODE" "channel_id${sc1}" "${sc1}]${sc2} channel_id ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} 1009465637633929222" 1 3 0; RESULT=$? echo -e "export DISCORD__SCHAN=$REPLY" >> activation fi DISCORD__SERVICING=1 else DISCORD__SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use telegram services?${sc5} " "discord" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "telegram_token${sc1}" "\n${sc1}[${sc2} telegram token ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} 5405833579:AAHvEUc1hms29JBoJDhoGBUE8Ept8dBrZr5" 1 3 0; RESULT=$? echo -e "export TELEGRAM_TOKEN=$REPLY" >> activation fi TELEGRAM_SERVICING=1 else TELEGRAM_SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use youtube services?${sc5} " "youtube" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "developer_key${sc1}" "\n${sc1}[${sc2} youtube api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} AIzaSyDmlgOry16XSTIVmm9au06YJDOmNrAZeRz" 1 3 0; RESULT=$? echo -e "export YOUTUBE_DEVELOPER_KEY=$REPLY" >> activation fi YOUTUBE__SERVICING=1 else YOUTUBE__SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use twitter services?${sc5} " "twitter" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "consumer_key${sc1}" "\n${sc1}[${sc2} twitter api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} RMIn8DlEGhhJJBCRovD7RezZR" 1 3 0; RESULT=$? echo -e "export TWITTER_CONSUMER_KEY=$REPLY" >> activation kprompt "MODE" "consumer_secret${sc1}" "${sc1}[${sc2} twitter api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} Uc5X87M7kIah0mPucdQVFJZrPWvtIvmZPR9x2L4QPLpZdd3ZzD" 1 3 0; RESULT=$? echo -e "export TWITTER_CONSUMER_SECRET=$REPLY" >> activation kprompt "MODE" "access_token_key${sc1}" "${sc1}[${sc2} twitter api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} 1032240340353188844-yqnMN7ulbgsc4yWUYM0yxAbDdDeeeZ" 1 3 0; RESULT=$? echo -e "export TWITTER_ACCESS_TOKEN_KEY=$REPLY" >> activation kprompt "MODE" "access_token_secret${sc1}" "${sc1}[${sc2} twitter api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} UhlWXud7RTHRdSxdVQWgEBfC9GHmG5tcYos5lq3Zee77E" 1 3 0; RESULT=$? echo -e "export TWITTER_ACCESS_TOKEN_SECRET=$REPLY" >> activation fi TWITTER__SERVICING=1 else TWITTER__SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use cryptocompare services?${sc5} " "cryptocompare" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "\ncryptocompare_key${sc1}" "${sc1}[${sc2} cryptocompare key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} 8wXfZYl4cN4iSmKsRVOhXDCVxF9wZ8c7Qy4o4bKgTVpcplq9Q8oId0mY" 1 3 0; RESULT=$? echo -e "export CRYPTOCOMPARE_KEY=$REPLY" >> activation fi CRYPTO___SERVICING=1 else CRYPTO___SERVICING=0 fi ############################################################################################################# ############################################################################################################# kprompt "MODE" "\n${sc4}will this bot use openai services?${sc5} " "openai" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then if [ $HYDRA_BOT -eq 0 ]; then kprompt "MODE" "openai_key${sc1}" "\n${sc1}[${sc2} openai api key ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} XDtj5CZLexa6Pfh8qLf9RdshVqStK6yuonIsNGhO1wJVf7Z7BxR" 1 3 0; RESULT=$? echo -e "export OPENAI_KEY=$REPLY" >> activation fi OPENAI___SERVICING=1 else OPENAI___SERVICING=0 fi fi ############################################################################################################# ############################################################################################################# if [ -e env/bin ]; then [ -e activation ] && cat activation >> env/bin/activate fi ############################################################################################################# ############################################################################################################# if [ $HYDRA_BOT -eq 0 ]; then [ -e activation ] && cat activation|grep -v SASL|grep -v NICKSERV >> storage/user/credentials/activate__hydra_core__standalone [ -e activation ] && cat activation|grep -v SASL|grep -v NICKSERV >> storage/user/credentials/activate__hydra_dupe__services [ -e activation ] && cat activation|grep -v SASL|grep -v NICKSERV >> storage/user/credentials/activate__hydra_dupe__devops fi ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_setup () { ############################################################################################################# ############################################################################################################# if [ $INIT -eq 0 ]; then ##################################################################################################### ##################################################################################################### M0="${sc2}CHOOSE ${sc3}" M1="${sc4}1${sc1})${sc5} HYDRA\n" M2="${sc4}2${sc1})${sc5} NON${sc1}-${sc5}HYDRA" ##################################################################################################### ##################################################################################################### kprompt "MODE" "\n${M0}" "\n${M1}${M2}" 1 1 0; RESULT=$? ##################################################################################################### ##################################################################################################### if [ $RESULT -eq 1 ]; then CMD_SERVICES_MODE=1 BOTMODE=0 cmd_setup_bot ##################################################################################################### ##################################################################################################### elif [ $RESULT -eq 2 ]; then (kmode 0); CMD_SERVICES_MODE=0 cmd_services 0 0 if [ ! -e plugins ]; then mkdir plugins cat storage/bot/variants/default/bot_maple__default__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/ cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/default/bot_maple__default__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py BOTMODE=1 cmd_setup_botmode fi; fi; fi; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_setup_botmode () { ############################################################################################################# ############################################################################################################# if [ $DISCORD__SERVICING -eq 0 ]; then cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi else cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/net_discord_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/net_discord_plugin.tmp;mv plugins/net_discord_plugin.tmp plugins/net_discord_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi fi ############################################################################################################# ############################################################################################################# if [ $TELEGRAM_SERVICING -eq 0 ]; then cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py [ -e plugins/net_telegram_plugin.py ] && cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi else cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py cat plugins/net_telegram_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > plugins/net_telegram_plugin.tmp;mv plugins/net_telegram_plugin.tmp plugins/net_telegram_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi fi ############################################################################################################# ############################################################################################################# if [ $MATRIX___SERVICING -eq 0 ]; then cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py [ -e plugins/net_matrix_plugin.py ] && cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi else cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/cmd_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/cmd_irc_plugin.tmp;mv plugins/cmd_irc_plugin.tmp plugins/cmd_irc_plugin.py cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py cat plugins/net_matrix_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > plugins/net_matrix_plugin.tmp;mv plugins/net_matrix_plugin.tmp plugins/net_matrix_plugin.py if [ $BOTMODE -eq 1 ]; then cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=True"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py fi fi ############################################################################################################# ############################################################################################################# if [ $TWITTER__SERVICING -eq 0 ]; then cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py [ -e plugins/twitter_plugin.py ] && cat plugins/twitter_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py else cat plugins/url_grabber_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py cat plugins/twitter_plugin.py|sed s/"???TWITTER???"/"SERVICES_TWITTER=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py fi ############################################################################################################# ############################################################################################################# if [ $CMD_SERVICES_MODE -eq 1 ]; then if [ $HYDRA____SERVICING -eq 0 ]; then [ -e plugins/net_hydra_plugin.py ] && cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=False"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py else cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=True"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py fi fi ############################################################################################################# ############################################################################################################# if [ $OPENAI___SERVICING -eq 0 ]; then [ -e plugins/openai_plugin.py ] && cat plugins/openai_plugin.py|sed s/"???OPENAI???"/"SERVICES_OPENAI=False"/g > plugins/openai_plugin.tmp;mv plugins/openai_plugin.tmp plugins/openai_plugin.py else cat plugins/openai_plugin.py|sed s/"???OPENAI???"/"SERVICES_OPENAI=True"/g > plugins/openai_plugin.tmp;mv plugins/openai_plugin.tmp plugins/openai_plugin.py fi ############################################################################################################# ############################################################################################################# if [ $CRYPTO___SERVICING -eq 0 ]; then [ -e plugins/crypto_plugin.py ] && cat plugins/crypto_plugin.py|sed s/"???CRYPTOCOMPARE???"/"SERVICES_CRYPTOCOMPARE=False"/g > plugins/crypto_plugin.tmp;mv plugins/crypto_plugin.tmp plugins/crypto_plugin.py else cat plugins/crypto_plugin.py|sed s/"???CRYPTOCOMPARE???"/"SERVICES_CRYPTOCOMPARE=True"/g > plugins/crypto_plugin.tmp;mv plugins/crypto_plugin.tmp plugins/crypto_plugin.py fi ############################################################################################################# ############################################################################################################# if [ $NICKSERV_SERVICING -eq 0 ]; then [ -e plugins/auth_nickserv_plugin.py ] && cat plugins/auth_nickserv_plugin.py|sed s/"???AUTHNICKSERV???"/"SERVICES_AUTHNICKSERV=False"/g > plugins/auth_nickserv_plugin.tmp;mv plugins/auth_nickserv_plugin.tmp plugins/auth_nickserv_plugin.py else [ -e plugins/auth_nickserv_plugin.py ] && cat plugins/auth_nickserv_plugin.py|sed s/"???AUTHNICKSERV???"/"SERVICES_AUTHNICKSERV=True"/g > plugins/auth_nickserv_plugin.tmp;mv plugins/auth_nickserv_plugin.tmp plugins/auth_nickserv_plugin.py fi ############################################################################################################# ############################################################################################################# if [ $SASL_____SERVICING -eq 0 ]; then [ -e plugins/auth_sasl_plugin.py ] && cat plugins/auth_sasl_plugin.py|sed s/"???AUTHSASL???"/"SERVICES_AUTHSASL=False"/g > plugins/auth_sasl_plugin.tmp;mv plugins/auth_sasl_plugin.tmp plugins/auth_sasl_plugin.py else cat plugins/auth_sasl_plugin.py|sed s/"???AUTHSASL???"/"SERVICES_AUTHSASL=True"/g > plugins/auth_sasl_plugin.tmp;mv plugins/auth_sasl_plugin.tmp plugins/auth_sasl_plugin.py fi ############################################################################################################# ############################################################################################################# if [ $YOUTUBE__SERVICING -eq 0 ]; then cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py [ -e plugins/youtube_plugin.py ] && cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=False"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py else cat plugins/url_grabber_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/url_grabber_plugin.tmp;mv plugins/url_grabber_plugin.tmp plugins/url_grabber_plugin.py cat plugins/twitter_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/twitter_plugin.tmp;mv plugins/twitter_plugin.tmp plugins/twitter_plugin.py cat plugins/boombox_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/boombox_plugin.tmp;mv plugins/boombox_plugin.tmp plugins/boombox_plugin.py cat plugins/youtube_plugin.py|sed s/"???YOUTUBE???"/"SERVICES_YOUTUBE=True"/g > plugins/youtube_plugin.tmp;mv plugins/youtube_plugin.tmp plugins/youtube_plugin.py fi ############################################################################################################# ############################################################################################################# if [ ! -e databases ]; then cp -Rf storage/bot/databases databases fi; } ##################################################################################################################### ##################################################################################################################### cmd_setup_bot () { ############################################################################################################# ############################################################################################################# if [ $INIT = 0 ]; then ##################################################################################################### ##################################################################################################### M0="${sc2}CHOOSE ${sc3}" M1="${sc4}1${sc1})${sc5} DUPE ${sc1}- ${sc5}SERVICES\n" M2="${sc4}2${sc1})${sc5} CORE ${sc1}- ${sc5}STRIPPED\n" M3="${sc4}3${sc1})${sc5} DUPE ${sc1}- ${sc5}DEVOPS" ##################################################################################################### ##################################################################################################### kprompt "MODE" "\n${M0}" "\n${M1}${M2}${M3}" 1 2 0; RESULT=$? ##################################################################################################### ##################################################################################################### if [ $RESULT -eq 1 ]; then (kmode 2); [ -e storage/user/config/hydra.key ] || cmd_hydra; if [ ! -e plugins ]; then cmd_services 0 2 mkdir plugins cat storage/bot/variants/dupe/bot_maple__services__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/ BOTMODE=1 cmd_setup_botmode cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__services__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat storage/user/credentials/activate__hydra_dupe__services >> env/bin/activate if [ -z $TOKEN ]; then kprompt "MODE" "${sc4}""\nneed an online token credential pak?${sc5} " "credential pak" 1 0 0; RESULT=$? if [ $RESULT -eq 0 ]; then cmd_hydra_dak; fi; fi fi; ##################################################################################################### ##################################################################################################### elif [ $RESULT -eq 2 ]; then (kmode 1); [ -e storage/user/config/hydra.key ] || cmd_hydra; if [ ! -e plugins ]; then cmd_services 1 1 mkdir plugins cat storage/bot/variants/core/bot_maple__core__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/ cat bot_maple.ini|sed '/includes/r storage/bot/variants/core/bot_maple__core__initial_plugins.txt' > bot_maple.tmp;mv bot_maple.tmp bot_maple.ini cat storage/user/credentials/activate__hydra_core__standalone >> env/bin/activate if [ $HYDRA____SERVICING -eq 0 ]; then cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=False"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py else cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=True"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py cat plugins/auth_sasl_plugin.py|sed s/"???AUTHSASL???"/"SERVICES_AUTHSASL=True"/g > plugins/auth_sasl_plugin.tmp;mv plugins/auth_sasl_plugin.tmp plugins/auth_sasl_plugin.py fi fi; if [ ! -e databases ]; then cp -Rf storage/bot/databases databases fi; ##################################################################################################### ##################################################################################################### elif [ $RESULT -eq 3 ]; then (kmode 3); [ -e storage/user/config/hydra.key ] || cmd_hydra; cmd_services 1 3 cat storage/user/credentials/activate__hydra_dupe__devops >> env/bin/activate kprompt "MODE" "${sc4}devops purpose${sc5}" "\n${sc1}[${sc2} devops purpose ${sc1}]${sc3} - ${sc5}example${sc4}:${sc3} doing development" 1 3 0; RESULT=$? PURPOSE="devops - $REPLY" echo -e "export HYDRA_PURPOSE='$PURPOSE'" >> env/bin/activate if [ ! -e plugins ]; then mkdir plugins cat storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt|grep -v "#"|grep -v irc3|sed s/plugins.//|xargs -I{} cp storage/bot/plugins/{}.py plugins/ cat plugins/net_irc_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat plugins/net_irc_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat plugins/net_irc_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py cat plugins/tool_dims_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_dims_plugin.tmp;mv plugins/tool_dims_plugin.tmp plugins/tool_dims_plugin.py cat plugins/tool_bus_plugin.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/tool_bus_plugin.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat plugins/tool_bus_plugin.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > plugins/tool_bus_plugin.tmp;mv plugins/tool_bus_plugin.tmp plugins/tool_bus_plugin.py cat bot_maple.py|sed s/"???TELEGRAM???"/"SERVICES_TELEGRAM=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py cat bot_maple.py|sed s/"???MATRIX???"/"SERVICES_MATRIX=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py cat bot_maple.py|sed s/"???DISCORD???"/"SERVICES_DISCORD=False"/g > bot_maple.tmp;mv bot_maple.tmp bot_maple.py cat plugins/net_irc_plugin.py|sed '/includes/r storage/bot/variants/dupe/bot_maple__devops__initial_plugins.txt' > plugins/net_irc_plugin.tmp;mv plugins/net_irc_plugin.tmp plugins/net_irc_plugin.py if [ $HYDRA____SERVICING -eq 0 ]; then cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=False"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py else cat plugins/net_hydra_plugin.py|sed s/"???HYDRA???"/"SERVICES_HYDRA=True"/g > plugins/net_hydra_plugin.tmp;mv plugins/net_hydra_plugin.tmp plugins/net_hydra_plugin.py cat plugins/auth_sasl_plugin.py|sed s/"???AUTHSASL???"/"SERVICES_AUTHSASL=True"/g > plugins/auth_sasl_plugin.tmp;mv plugins/auth_sasl_plugin.tmp plugins/auth_sasl_plugin.py fi fi; if [ ! -e databases ]; then cp -Rf storage/bot/databases databases fi; fi; fi; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_start () { ############################################################################################################# ############################################################################################################# echo -e "${sc1}[ ${sc2}running `cat storage/bot/status/status_id` ${sc1}]" ############################################################################################################# ############################################################################################################# source env/bin/activate ############################################################################################################# ############################################################################################################# [ -e storage/bot/status ] || (mkdir storage/bot/status) MODE=$(cat storage/bot/status/status_id) ############################################################################################################# ############################################################################################################# if [ "$MODE" = "hydra_core__standalone" ]; then bash -c 'echo $$>r3kt.pid; exec irc3 plugins/bot_maple.ini & disown' dip=`cat r3kt.pid` dip=$((dip+1)) echo $dip>r3kt.pid else bash -c 'echo $$>r3kt.pid; exec python3 plugins/bot_maple.py & disown' dip=`cat r3kt.pid` dip=$((dip+1)) echo $dip>r3kt.pid fi; ############################################################################################################# ############################################################################################################# sid=$(cat storage/bot/status/status_id) pid=$(cat *.pid) echo -e "${sc1}[ ${sc2}${sid} bot added to background as a job - pid: ${pid} ${sc1}]" ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_stop () { ############################################################################################################# ############################################################################################################# echo -e "${sc1}[ ${sc2}stopping `cat r3kt.pid` ${sc1}]" pid=`cat r3kt.pid` && kill -9 $pid > /dev/null 2>&1 [ $? -eq 1 ] && kill -9 $(ps aux|grep bot_maple|grep -v grep|xargs|cut -f 2 -d ' ') > /dev/null 2>&1; rm r3kt.pid; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_cleanup () { ############################################################################################################# ############################################################################################################# echo -e "${sc1}[ ${sc2}executed command - cleanup ${sc1}]" ############################################################################################################# ############################################################################################################# [ -e bot_maple.py ] && (rm bot_maple.py) [ -e models ] && (rm -Rf models) [ -e personalities ] && (rm -Rf personalities) [ -e env ] && (rm -Rf env) [ -e plugins ] && (rm -Rf plugins) [ -e databases ] && (rm -Rf databases) rm -Rf storage/user/config/* rm -Rf {data_,dr1p_}* [ -e undak.py ] && (rm undak.py) [ -e unkey.py ] && (rm unkey.py) [ -e fifo ] && (rm -Rf fifo) [ -e dak_tcp ] && (rm dak_tcp) [ -e bot_maple.ini ] && (rm bot_maple.ini) [ -e storage/bot/status/status_id ] && (rm storage/bot/status/status_id) [ -e storage/user/credentials/activate__hydra_core__standalone ] && (rm storage/user/credentials/activate__hydra_core__standalone) [ -e storage/user/credentials/activate__hydra_dupe__services ] && (rm storage/user/credentials/activate__hydra_dupe__services) [ -e storage/user/credentials/activate__hydra_dupe__devops ] && (rm storage/user/credentials/activate__hydra_dupe__devops) [ -e storage/bot/status ] && (rm -Rf storage/bot/status) [ -e storage/user/status ] && (rm -Rf storage/user/status) [ -e storage/user/config ] && (rm -Rf storage/user/config) [ -e storage/user/credentials ] && (rm -Rf storage/user/credentials) [ -e storage/user/logs/tcpac.log ] && (curl `cat storage/user/logs/tcpac.log|cut -f 2 -d ' '`) [ -e storage/user/logs ] && (rm -Rf storage/user/logs) [ -e r3kt.pid ] && (PID=`cat r3kt.pid`;rm r3kt.pid;kill -9 $PID > /dev/null 2>&1) ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### cmd_autosync () { ######################################################################################################### SOF ############################################################################################################# # 1) if this is ran without a parameter services are stopped, # local files are updated via github and then services restarted # 2) if this is ran with a parameter ex: net_hydra_plugin.py, # the plugin version from storage/bot/plugins is pushed to github # 2) and then remote instances are updated locally from what we pushed from devops.. # this speeds up development/testing time. ############################################################################################################# ############################################################################################################# COREKEY=maplenet; COREUSER=dr1p; COREHOST=saipro; COREBASE="~/maple"; DUPEKEY=maplenet; DUPEUSER=dr1p; DUPEHOST=saiosx; DUPEBASE="~/maple"; ############################################################################################################# ############################################################################################################# [ -z "$CMDARG" ] || ( FILENAME=$(basename `echo "$CMDARG"`); find . -iname $FILENAME|grep "storage"|xargs -I{} git add {}; git commit -m 'script: autosync'; git pull; git push; ) ############################################################################################################# ############################################################################################################# STOP="[ -e r3kt.pid ] && (./maple);" CMD="git pull; diff -q plugins/ storage/bot/plugins/|grep differ|cut -f 4 -d ' '|grep -v discord|grep -v irc|xargs -I{} cp {} plugins/;" START="./maple & disown" ssh -i ~/.ssh/$COREKEY $COREUSER@$COREHOST "cd $COREBASE; $STOP $CMD $START" ssh -i ~/.ssh/$DUPEKEY $DUPEUSER@$DUPEHOST "cd $DUPEBASE; $STOP $CMD $START" ############################################################################################################# ######################################################################################################### EOF } ##################################################################################################################### ##################################################################################################################### error () { ############################################################################################################# ############################################################################################################# echo -e $(rgb 13 '+')" "$(rgb 9 'error'11) $1" "$(rgb 0) ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### help () { ############################################################################################################# ############################################################################################################# COMMANDS=(setup start stop cleanup autosync); ############################################################################################################# ############################################################################################################# [ $1 -eq 1 ] && echo -e $(rgb 13 '+')" "$(rgb 9 'commands'11) ${COMMANDS[*]}" "$(rgb 0) ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### prereq () { ############################################################################################################# ############################################################################################################# echo -e "\n$(rgb 12 '[') $(rgb 13 'PREREQUISITES CHECK') $(rgb 12 ']') $(rgb 0)\n"; ############################################################################################################# ############################################################################################################# if [ -e preset ]; then if [ -e preset/credentials ]; then [ -e storage/user/credentials ] || (mkdir -p storage/user/credentials) cp preset/credentials/* storage/user/credentials/ fi fi ############################################################################################################# ############################################################################################################# PREREQUISITES_PROGS=(jq nc) FOUND_PROGS=() ############################################################################################################# ############################################################################################################# for p in ${PREREQUISITES_PROGS[@]}; do which $p >> /dev/null 2>&1 if [ $? -eq 0 ]; then echo -e $(rgb 12 '+')" "$(rgb 9 'located '$p'')" "$(rgb 0) else FOUND_PROGS+=("$p") fi done ############################################################################################################# ############################################################################################################# for p in ${FOUND_PROGS[@]}; do MESSAGE="installation required" [ "jq" == $p ] && echo -e "$(rgb 15 '-') $(rgb 14 'missing $p') $(rgb 13 '-') $(rgb 12 '$MESSAGE')" [ "nc" == $p ] && echo -e "$(rgb 15 '-') $(rgb 14 'missing $p') $(rgb 13 '-') $(rgb 12 '$MESSAGE')" done ############################################################################################################# ############################################################################################################# [ 0 -ne "${#FOUND_PROGS[@]}" ] && echo -e "\n$(rgb 3 '[') $(rgb 4 'PREREQUISITES CHECK') $(rgb 5 '-') $(rgb 4 'FAILED') $(rgb 3 ']')\n" [ 0 -ne "${#FOUND_PROGS[@]}" ] && exit echo -e "\n$(rgb 12 '[') $(rgb 13 'PREREQUISITES CHECK') $(rgb 14 '-') $(rgb 15 'PASSED') $(rgb 12 ']')$(rgb 0)" ############################################################################################################# ############################################################################################################# [ -e storage/bot/status ] || (mkdir -p storage/bot/status) STATUS_ID="storage/bot/status/status_id"; [ -f $STATUS_ID ] && INIT=1; ############################################################################################################# ############################################################################################################# } ##################################################################################################################### ##################################################################################################################### ##################################################################################################################### # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # # ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY POINT ENTRY # ##################################################################################################################### ##################################################################################################################### ##################################################################################################################### if [ -z $1 ]; then ############################################################################################################# ############################################################################################################# if [ ! -e plugins/bot_maple.ini ]; then if [ ! -e plugins/bot_maple.py ]; then prereq; cmd_setup; [ -e bot_maple.py ] && mv bot_maple.py plugins/bot_maple.py [ -e bot_maple.ini ] && mv bot_maple.ini plugins/bot_maple.ini kprompt "MODE" "${sc4}""\nlaunch this bot instance now?${sc5} " "launch bot instance" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then echo -e "\n${sc1}[ ${sc2}exiting ${sc1}]\n" exit 1; fi; fi elif [ ! -e plugins/bot_maple.py ]; then if [ ! -e plugins/bot_maple.ini ]; then prereq; cmd_setup; [ -e bot_maple.py ] && mv bot_maple.py plugins/bot_maple.py [ -e bot_maple.ini ] && mv bot_maple.ini plugins/bot_maple.ini kprompt "MODE" "${sc4}""\nlaunch this bot instance now?${sc5} " "launch bot instance" 1 0 0; RESULT=$? if [ $RESULT -eq 9 ]; then echo -e "\n${sc1}[ ${sc2}exiting ${sc1}]\n" exit 1; fi; fi fi if [ ! -e r3kt.pid ]; then cmd_start; elif [ -e r3kt.pid ]; then cmd_stop; fi ############################################################################################################# ############################################################################################################# else ############################################################################################################# ############################################################################################################# if [ "$CMD" = "setup" ]; then prereq; cmd_setup; [ -e bot_maple.py ] && mv bot_maple.py plugins/bot_maple.py ############################################################################################################# ############################################################################################################# elif [ "$CMD" = "start" ]; then cmd_start; ############################################################################################################# ############################################################################################################# elif [ "$CMD" = "stop" ]; then cmd_stop; ############################################################################################################# ############################################################################################################# elif [ "$CMD" = "cleanup" ]; then cmd_cleanup; ############################################################################################################# ############################################################################################################# elif [ "$CMD" = "autosync" ]; then cmd_autosync; fi; fi; ##################################################################################################################### ################################################################################################################# EOF