├── Images ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png ├── 17.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── fifth.png ├── first.png ├── third.png ├── fourth.png └── second.png ├── downloadVPN.py ├── README.md └── htbExplorer /Images/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/10.png -------------------------------------------------------------------------------- /Images/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/11.png -------------------------------------------------------------------------------- /Images/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/12.png -------------------------------------------------------------------------------- /Images/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/13.png -------------------------------------------------------------------------------- /Images/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/14.png -------------------------------------------------------------------------------- /Images/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/15.png -------------------------------------------------------------------------------- /Images/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/16.png -------------------------------------------------------------------------------- /Images/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/17.png -------------------------------------------------------------------------------- /Images/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/6.png -------------------------------------------------------------------------------- /Images/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/7.png -------------------------------------------------------------------------------- /Images/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/8.png -------------------------------------------------------------------------------- /Images/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/9.png -------------------------------------------------------------------------------- /Images/fifth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/fifth.png -------------------------------------------------------------------------------- /Images/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/first.png -------------------------------------------------------------------------------- /Images/third.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/third.png -------------------------------------------------------------------------------- /Images/fourth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/fourth.png -------------------------------------------------------------------------------- /Images/second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s4vitar/htbExplorer/HEAD/Images/second.png -------------------------------------------------------------------------------- /downloadVPN.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | #coding: utf-8 3 | 4 | # Author: Marcelo Váquez (aka S4vitar) 5 | 6 | import requests, re, getpass, urllib3, sys, pdb 7 | 8 | main_url="https://www.hackthebox.eu/login" 9 | download_vpn_url="http://www.hackthebox.eu/home/htb/access/ovpnfile" 10 | 11 | if len(sys.argv) != 2: 12 | print("\n[!] An error has ocurred\n") 13 | print("\t[+] Usage: ./%s output.ovpn" % sys.argv[0]) 14 | sys.exit(1) 15 | 16 | filename = sys.argv[1] 17 | 18 | if __name__ == '__main__': 19 | 20 | s = None 21 | urllib3.disable_warnings() 22 | s = requests.session() 23 | s.verify = False 24 | s.keep_alive = False 25 | 26 | email = input("Email: ") 27 | password = getpass.getpass() 28 | 29 | headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36'} 30 | 31 | r = s.get(main_url, headers=headers) 32 | token_value = re.findall(r'name="_token" value="(.*?)"', r.text)[0] 33 | 34 | data_post = { 35 | 'email': '%s' % (email), 36 | 'password': '%s' % (password), 37 | '_token': '%s' % (token_value) 38 | } 39 | 40 | r = s.post(main_url, data=data_post, headers=headers) 41 | r = s.get(download_vpn_url, headers=headers) 42 | 43 | f = open("%s" % filename, "w") 44 | f.write(r.text) 45 | f.close() 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # htbExplorer 2 | 3 | **htbExplorer** es un cliente de terminal hecho en Bash ideal para trabajar cómodamente desde consola sobre la plataforma de HackTheBox. 4 | 5 | ¿Cómo ejecuto la herramienta? 6 | ====== 7 | Para empezar, tras ejecutar la herramienta, veremos lo siguiente: 8 | 9 |

10 | First 13 |

14 | 15 | Esto es así dado que en primer lugar, necesitamos proporcionar nuestra API Key de HackTheBox. 16 | 17 | Para ello, iniciaremos sesión en el panel de HackTheBox. Una vez logueados, haremos click derecho en nuestro perfil y posteriormente nos iremos a '**Settings**'. Dentro de esta pestaña, podremos ver un apartado con nombre '**API KEY**', desde donde podremos visualizar nuestra API Key (valga la redundancia): 18 | 19 |

20 | Second 23 |

24 | 25 | Ya en tenencia de esta API Key, es necesario introducirla en esta porción del código: 26 | 27 |

28 | Third 31 |

32 | 33 | Una vez introducida, podremos ejecutar la aplicación. Tras su ejecución, veremos el siguiente panel: 34 | 35 |

36 | Fourth 39 |

40 | 41 | La utilidad **htbExplorer** cuenta con múltiples opciones: 42 | 43 |

44 | Fifth 47 |

48 | 49 | Una de ellas, es el modo de exploración. Para hacer uso de este modo, a través del parámetro '**-e**', podemos indicar el modo de exploración que queremos realizar. 50 | 51 | Por ejemplo, para listar las máquinas activas, haríamos '**-e active_machines**', obteniendo los siguientes resultados: 52 | 53 |

54 | 6 57 |

58 | 59 | O por el contrario, para listar las máquinas spawneadas, haríamos '**-e spawned_machines**', entre los otros 14 modos de exploración (es bastante intuitivo y sencillo de usar): 60 | 61 |

62 | 7 65 |

66 | 67 | La utilidad **htbExplorer** cuenta con un buscador de máquinas por palabras clave, de forma que en todo momento podemos extraer la información más relevante de una máquina, aún sin saber su nombre entero: 68 | 69 |

70 | 8 73 |

74 | 75 | De igual manera, podemos encontrar las máquinas proporcionando la dirección IP de estas: 76 | 77 |

78 | 9 81 |

82 | 83 | A través del parámetro '**-r**', tenemos la capacidad de reiniciar una máquina en base al nombre de máquina que especifiquemos, debiendo esperar 1 minuto para poder reiniciar otra de las activas: 84 | 85 |

86 | 10 89 |

90 | 91 | Asimismo, es posible desplegar una nueva máquina del LAB (siempre y cuando seas VIP), haciendo uso para ello del parámetro '**-d**': 92 | 93 |

94 | 11 97 |

98 | 99 | En caso de querer extender el tiempo de una máquina, o parar aquella máquina que hayamos desplegado, se puede hacer uso de los parámetros '**-x**' y '**-k**' respectivamente: 100 | 101 |

102 | 12 105 |

106 | 107 | Dado que solo podemos extender el tiempo en aquella máquina de la cual seamos propietarios, para asignarte como propietario de una máquina, puedes hacer uso del parámetro '**-a**'. De esta forma, posteriormente, podrás extender su tiempo de vida a 24 horas: 108 | 109 |

110 | 13 113 |

114 | 115 | **htbExplorer** cuenta con un buscador de usuarios, representando la información más relevante de estos en tablas: 116 | 117 |

118 | 14 121 |

122 | 123 | ¿Quieres saber lo que se está hablando en el ShoutBox?, a través del parámetro '**-c**', puedes indicar el número de mensajes a cargar, pudiendo así ver toda la actividad: 124 | 125 |

126 | 15 129 |

130 | 131 | ¿Eres un curioso y te gustaría saber quiénes están hablando?, no te preocupes, con el parámetro '**-w**', podrás representar la información más relevante de aquellos usuarios que estén hablando o generando actividad (siempre y cuando tengan el perfil público). También es necesario indicar el número de mensajes a cargar: 132 | 133 |

134 | 16 137 |

138 | 139 | En caso de querer descargarte la VPN, ya no es necesario abrir el navegador. A través del parámetro '**-v**', podrás descargar tu VPN cómodamente indicando para ello un nombre de exportación: 140 | 141 |

142 | 17 145 |

146 | 147 | Para enviar una flag desde htbExplorer, tan sólo será necesario seguir la siguiente sintaxis de ejecución: 148 | 149 | * htbExplorer -f Mirai=abdbfa61bdfa617abdfa9d8b98fe98a 150 | -------------------------------------------------------------------------------- /htbExplorer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Author: Marcelo Vázquez (aka S4vitar) 4 | 5 | #Colours 6 | declare -r greenColour="\e[0;32m\033[1m" 7 | declare -r endColour="\033[0m\e[0m" 8 | declare -r redColour="\e[0;31m\033[1m" 9 | declare -r blueColour="\e[0;34m\033[1m" 10 | declare -r yellowColour="\e[0;33m\033[1m" 11 | declare -r purpleColour="\e[0;35m\033[1m" 12 | declare -r turquoiseColour="\e[0;36m\033[1m" 13 | declare -r grayColour="\e[0;37m\033[1m" 14 | 15 | # Global Variables 16 | declare -r USER_AGENT="User-Agent: htbExplorer" 17 | declare -r url_machines_get_all="https://hackthebox.eu/api/machines/get/all" 18 | declare -r url_user_id="https://www.hackthebox.eu/api/user/id" 19 | declare -r url_reset_machine="https://www.hackthebox.eu/api/vm/reset/" 20 | declare -r url_shoutbox_messages="https://www.hackthebox.eu/api/shouts/get/initial/html/" 21 | declare -r url_spawned_machines="https://www.hackthebox.eu/api/machines/spawned" 22 | declare -r url_owned_machines="https://www.hackthebox.eu/api/machines/owns" 23 | declare -r url_deploy_machine="https://hackthebox.eu/api/vm/vip/assign/" 24 | declare -r url_stop_machine="https://hackthebox.eu/api/vm/vip/remove/" 25 | declare -r url_extend_machine="https://hackthebox.eu/api/vm/vip/extend/" 26 | declare -r url_assign_machine="https://hackthebox.eu/api/vm/vip/assign/" 27 | declare -r tmp_file="tmp.json" 28 | declare -r API_TOKEN="" # 29 | 30 | trap ctrl_c INT 31 | 32 | if [ ! "$API_TOKEN" ]; then 33 | echo -e "\n${redColour}[!] You have to enter your API TOKEN in the code${endColour}\n" 34 | exit 1 35 | fi 36 | 37 | function banner(){ 38 | echo -e "${greenColour} 39 | . 40 | %%%%%%%. 41 | %%%%%%. %%%%%%. 42 | %%%%%% *%%%%%%. 43 | %%%%% .%%%%%% 44 | %%%%%%%% %%%%%%%% 45 | %% %%%%%%% .%%%%%%% %%% 46 | %% #%%%%%%%%%%%# %%% ${endColour}${grayColour}htbExplorer - HackTheBox Terminal Client${endColour}${greenColour} 47 | %% %%%%# %%% ${endColour}${blueColour}\t\t\t by S4vitar${endColour}${redColour} <3${endColour}${greenColour} 48 | %% %%% %%% 49 | %% %%% %%% 50 | %%%%% %%% %%%% 51 | %%%%%%% %%% %%%%%%. 52 | #%%%%%%%%%%%%%%%%% 53 | %%%%%%%%# 54 | .${endColour}\n" 55 | 56 | for i in $(seq 1 80); do echo -ne "${redColour}-"; done; echo -ne "${endColour}" 57 | } 58 | 59 | function ctrl_c(){ 60 | tput cnorm 61 | echo -e "\n\n${redColour}[!] Exiting...${endColour}" 62 | rm getAllMachines shout* user* searchUserName searchMachineName tmp.json 2>/dev/null 63 | exit 1 64 | } 65 | 66 | function printTable(){ 67 | 68 | local -r delimiter="${1}" 69 | local -r data="$(removeEmptyLines "${2}")" 70 | 71 | if [[ "${delimiter}" != '' && "$(isEmptyString "${data}")" = 'false' ]] 72 | then 73 | local -r numberOfLines="$(wc -l <<< "${data}")" 74 | 75 | if [[ "${numberOfLines}" -gt '0' ]] 76 | then 77 | local table='' 78 | local i=1 79 | 80 | for ((i = 1; i <= "${numberOfLines}"; i = i + 1)) 81 | do 82 | local line='' 83 | line="$(sed "${i}q;d" <<< "${data}")" 84 | 85 | local numberOfColumns='0' 86 | numberOfColumns="$(awk -F "${delimiter}" '{print NF}' <<< "${line}")" 87 | 88 | if [[ "${i}" -eq '1' ]] 89 | then 90 | table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")" 91 | fi 92 | 93 | table="${table}\n" 94 | 95 | local j=1 96 | 97 | for ((j = 1; j <= "${numberOfColumns}"; j = j + 1)) 98 | do 99 | table="${table}$(printf '#| %s' "$(cut -d "${delimiter}" -f "${j}" <<< "${line}")")" 100 | done 101 | 102 | table="${table}#|\n" 103 | 104 | if [[ "${i}" -eq '1' ]] || [[ "${numberOfLines}" -gt '1' && "${i}" -eq "${numberOfLines}" ]] 105 | then 106 | table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")" 107 | fi 108 | done 109 | 110 | if [[ "$(isEmptyString "${table}")" = 'false' ]] 111 | then 112 | echo -e "${table}" | column -s '#' -t | awk '/^\+/{gsub(" ", "-", $0)}1' 113 | fi 114 | fi 115 | fi 116 | } 117 | 118 | function removeEmptyLines(){ 119 | 120 | local -r content="${1}" 121 | echo -e "${content}" | sed '/^\s*$/d' 122 | } 123 | 124 | function repeatString(){ 125 | 126 | local -r string="${1}" 127 | local -r numberToRepeat="${2}" 128 | 129 | if [[ "${string}" != '' && "${numberToRepeat}" =~ ^[1-9][0-9]*$ ]] 130 | then 131 | local -r result="$(printf "%${numberToRepeat}s")" 132 | echo -e "${result// /${string}}" 133 | fi 134 | } 135 | 136 | function isEmptyString(){ 137 | 138 | local -r string="${1}" 139 | 140 | if [[ "$(trimString "${string}")" = '' ]] 141 | then 142 | echo 'true' && return 0 143 | fi 144 | 145 | echo 'false' && return 1 146 | } 147 | 148 | function trimString(){ 149 | 150 | local -r string="${1}" 151 | sed 's,^[[:blank:]]*,,' <<< "${string}" | sed 's,[[:blank:]]*$,,' 152 | } 153 | 154 | function generateFiles(){ 155 | 156 | echo '' > $tmp_file 157 | 158 | while [ "$(cat $tmp_file | wc -l)" != "0" ]; do 159 | curl -s -H "$USER_AGENT" "$url_machines_get_all?api_token=$API_TOKEN" -X GET -L | tr "'" '"' | sed 's/None/\"None\"/g' | sed 's/True/\"True\"/g' | sed 's/False/\"False\"/g' > $tmp_file 160 | done 161 | } 162 | 163 | getAllMachines(){ 164 | 165 | 166 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getAllMachines 167 | 168 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 169 | 170 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 171 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 172 | break 173 | fi 174 | 175 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getAllMachines 176 | let id+=1 177 | done 178 | 179 | echo -ne "${greenColour}" 180 | printTable ',' "$(cat getAllMachines)" 181 | echo -e "${endColour}" 182 | rm getAllMachines 2>/dev/null 183 | } 184 | 185 | function getActiveMachines(){ 186 | 187 | 188 | 189 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 190 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 191 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 192 | break 193 | fi 194 | 195 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveMachines 196 | let id+=1 197 | done 198 | 199 | sed -i '/Is Active/!d' getActiveMachines 200 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveMachines 201 | 202 | echo -ne "${greenColour}" 203 | printTable ',' "$(cat getActiveMachines)" 204 | echo -e "${endColour}" 205 | rm getActiveMachines 2>/dev/null 206 | } 207 | 208 | function getRetiredMachines(){ 209 | 210 | 211 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredMachines 212 | 213 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 214 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 215 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 216 | break 217 | fi 218 | 219 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredMachines 220 | let id+=1 221 | done 222 | 223 | sed -i '/Is Active/d' getRetiredMachines 224 | 225 | echo -ne "${greenColour}" 226 | printTable ',' "$(cat getRetiredMachines)" 227 | echo -e "${endColour}" 228 | rm getRetiredMachines 2>/dev/null 229 | } 230 | 231 | function getActiveLinuxMachines(){ 232 | 233 | 234 | 235 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 236 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 237 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 238 | break 239 | fi 240 | 241 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveLinuxMachines 242 | let id+=1 243 | done 244 | 245 | sed -i '/Is Active/!d' getActiveLinuxMachines 246 | sed -i '/Windows/d' getActiveLinuxMachines 247 | sed -i '/Other/d' getActiveLinuxMachines 248 | sed -i '/Solaris/d' getActiveLinuxMachines 249 | sed -i '/OpenBSD/d' getActiveLinuxMachines 250 | sed -i '/FreeBSD/d' getActiveLinuxMachines 251 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveLinuxMachines 252 | 253 | echo -ne "${greenColour}" 254 | printTable ',' "$(cat getActiveLinuxMachines)" 255 | echo -e "${endColour}" 256 | rm getActiveLinuxMachines 2>/dev/null 257 | } 258 | 259 | function getActiveWindowsMachines(){ 260 | 261 | 262 | 263 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 264 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 265 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 266 | break 267 | fi 268 | 269 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveWindowsMachines 270 | let id+=1 271 | done 272 | 273 | sed -i '/Is Active/!d' getActiveWindowsMachines 274 | sed -i '/Linux/d' getActiveWindowsMachines 275 | sed -i '/FreeBSD/d' getActiveWindowsMachines 276 | sed -i '/OpenBSD/d' getActiveWindowsMachines 277 | sed -i '/Other/d' getActiveWindowsMachines 278 | sed -i '/Solaris/d' getActiveWindowsMachines 279 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveWindowsMachines 280 | 281 | echo -ne "${greenColour}" 282 | printTable ',' "$(cat getActiveWindowsMachines)" 283 | echo -e "${endColour}" 284 | rm getActiveWindowsMachines 2>/dev/null 285 | } 286 | 287 | function getActiveFreebsdMachines(){ 288 | 289 | 290 | 291 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 292 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 293 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 294 | break 295 | fi 296 | 297 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveFreebsdMachines 298 | let id+=1 299 | done 300 | 301 | sed -i '/Is Active/!d' getActiveFreebsdMachines 302 | sed -i '/Linux/d' getActiveFreebsdMachines 303 | sed -i '/Windows/d' getActiveFreebsdMachines 304 | sed -i '/OpenBSD/d' getActiveFreebsdMachines 305 | sed -i '/Other/d' getActiveFreebsdMachines 306 | sed -i '/Solaris/d' getActiveFreebsdMachines 307 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveFreebsdMachines 308 | 309 | echo -ne "${greenColour}" 310 | printTable ',' "$(cat getActiveFreebsdMachines)" 311 | echo -e "${endColour}" 312 | rm getActiveFreebsdMachines 2>/dev/null 313 | } 314 | 315 | function getActiveOpenbsdMachines(){ 316 | 317 | 318 | 319 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 320 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 321 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 322 | break 323 | fi 324 | 325 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveOpenbsdMachines 326 | let id+=1 327 | done 328 | 329 | sed -i '/Is Active/!d' getActiveOpenbsdMachines 330 | sed -i '/Linux/d' getActiveOpenbsdMachines 331 | sed -i '/Windows/d' getActiveOpenbsdMachines 332 | sed -i '/FreeBSD/d' getActiveOpenbsdMachines 333 | sed -i '/Other/d' getActiveOpenbsdMachines 334 | sed -i '/Solaris/d' getActiveOpenbsdMachines 335 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveOpenbsdMachines 336 | 337 | echo -ne "${greenColour}" 338 | printTable ',' "$(cat getActiveOpenbsdMachines)" 339 | echo -e "${endColour}" 340 | rm getActiveOpenbsdMachines 2>/dev/null 341 | } 342 | 343 | function getActiveOtherMachines(){ 344 | 345 | 346 | 347 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 348 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 349 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 350 | break 351 | fi 352 | 353 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getActiveOtherMachines 354 | let id+=1 355 | done 356 | 357 | sed -i '/Is Active/!d' getActiveOtherMachines 358 | sed -i '/Linux/d' getActiveOtherMachines 359 | sed -i '/Windows/d' getActiveOtherMachines 360 | sed -i '/FreeBSD/d' getActiveOtherMachines 361 | sed -i '/OpenBSD/d' getActiveOtherMachines 362 | sed -i '/Solaris/d' getActiveOtherMachines 363 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getActiveOtherMachines 364 | 365 | echo -ne "${greenColour}" 366 | printTable ',' "$(cat getActiveOtherMachines)" 367 | echo -e "${endColour}" 368 | rm getActiveOtherMachines 2>/dev/null 369 | } 370 | 371 | function getRetiredWindowsMachines(){ 372 | 373 | 374 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredWindowsMachines 375 | 376 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 377 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 378 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 379 | break 380 | fi 381 | 382 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredWindowsMachines 383 | let id+=1 384 | done 385 | 386 | sed -i '/Is Active/d' getRetiredWindowsMachines 387 | sed -i '/Linux/d' getRetiredWindowsMachines 388 | sed -i '/FreeBSD/d' getRetiredWindowsMachines 389 | sed -i '/OpenBSD/d' getRetiredWindowsMachines 390 | sed -i '/Other/d' getRetiredWindowsMachines 391 | sed -i '/Solaris/d' getRetiredWindowsMachines 392 | 393 | echo -ne "${greenColour}" 394 | printTable ',' "$(cat getRetiredWindowsMachines)" 395 | echo -e "${endColour}" 396 | rm getRetiredWindowsMachines 2>/dev/null 397 | } 398 | 399 | function getRetiredFreebsdMachines(){ 400 | 401 | 402 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredFreebsdMachines 403 | 404 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 405 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 406 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 407 | break 408 | fi 409 | 410 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredFreebsdMachines 411 | let id+=1 412 | done 413 | 414 | sed -i '/Is Active/d' getRetiredFreebsdMachines 415 | sed -i '/Linux/d' getRetiredFreebsdMachines 416 | sed -i '/Windows/d' getRetiredFreebsdMachines 417 | sed -i '/OpenBSD/d' getRetiredFreebsdMachines 418 | sed -i '/Other/d' getRetiredFreebsdMachines 419 | sed -i '/Solaris/d' getRetiredFreebsdMachines 420 | 421 | echo -ne "${greenColour}" 422 | printTable ',' "$(cat getRetiredFreebsdMachines)" 423 | echo -e "${endColour}" 424 | rm getRetiredFreebsdMachines 2>/dev/null 425 | } 426 | 427 | function getRetiredOpenbsdMachines(){ 428 | 429 | 430 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredOpenbsdMachines 431 | 432 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 433 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 434 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 435 | break 436 | fi 437 | 438 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredOpenbsdMachines 439 | let id+=1 440 | done 441 | 442 | sed -i '/Is Active/d' getRetiredOpenbsdMachines 443 | sed -i '/Linux/d' getRetiredOpenbsdMachines 444 | sed -i '/Windows/d' getRetiredOpenbsdMachines 445 | sed -i '/FreeBSD/d' getRetiredOpenbsdMachines 446 | sed -i '/Other/d' getRetiredOpenbsdMachines 447 | sed -i '/Solaris/d' getRetiredOpenbsdMachines 448 | 449 | echo -ne "${greenColour}" 450 | printTable ',' "$(cat getRetiredOpenbsdMachines)" 451 | echo -e "${endColour}" 452 | rm getRetiredOpenbsdMachines 2>/dev/null 453 | } 454 | 455 | function getRetiredLinuxMachines(){ 456 | 457 | 458 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredLinuxMachines 459 | 460 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 461 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 462 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 463 | break 464 | fi 465 | 466 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredLinuxMachines 467 | let id+=1 468 | done 469 | 470 | sed -i '/Is Active/d' getRetiredLinuxMachines 471 | sed -i '/Windows/d' getRetiredLinuxMachines 472 | sed -i '/FreeBSD/d' getRetiredLinuxMachines 473 | sed -i '/OpenBSD/d' getRetiredLinuxMachines 474 | sed -i '/Other/d' getRetiredLinuxMachines 475 | sed -i '/Solaris/d' getRetiredLinuxMachines 476 | 477 | echo -ne "${greenColour}" 478 | printTable ',' "$(cat getRetiredLinuxMachines)" 479 | echo -ne "${endColour}" 480 | rm getRetiredLinuxMachines 2>/dev/null 481 | } 482 | 483 | function getRetiredOtherMachines(){ 484 | 485 | 486 | echo "Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID" >> getRetiredOtherMachines 487 | 488 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 489 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 490 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 491 | break 492 | fi 493 | 494 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getRetiredOtherMachines 495 | let id+=1 496 | done 497 | 498 | sed -i '/Is Active/d' getRetiredOtherMachines 499 | sed -i '/Windows/d' getRetiredOtherMachines 500 | sed -i '/Linux/d' getRetiredOtherMachines 501 | sed -i '/FreeBSD/d' getRetiredOtherMachines 502 | sed -i '/OpenBSD/d' getRetiredOtherMachines 503 | sed -i '/Solaris/d' getRetiredOtherMachines 504 | 505 | echo -ne "${greenColour}" 506 | printTable ',' "$(cat getRetiredOtherMachines)" 507 | echo -e "${endColour}" 508 | rm getRetiredOtherMachines 2>/dev/null 509 | } 510 | 511 | function getSpawnedMachines(){ 512 | 513 | 514 | 515 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 516 | 517 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 518 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 519 | break 520 | fi 521 | 522 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getAllMachines 523 | let id+=1 524 | done 525 | 526 | spawned_machines_response=$(curl -s -X GET "$url_spawned_machines?api_token=$API_TOKEN" | jq | grep "status") 527 | 528 | if [ "$(echo $?)" != "0" ]; then 529 | 530 | curl -s -X GET "$url_spawned_machines?api_token=$API_TOKEN" | jq | grep id | awk 'NF{print $NF}' | tr -d ',' | while read spawned_id_machine; do 531 | cat getAllMachines | grep ",$spawned_id_machine$" >> getSpawnedMachines 532 | done 533 | 534 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getSpawnedMachines 535 | 536 | echo -ne "${greenColour}" 537 | printTable ',' "$(cat getSpawnedMachines)" 538 | echo -ne "${endColour}" 539 | 540 | rm getAllMachines getSpawnedMachines 2>/dev/null; tput cnorm 541 | else 542 | spawned_machines_response=$(curl -s -X GET "$url_spawned_machines?api_token=$API_TOKEN" | jq '.["status"]' | tr -d '"') 543 | echo -e "\n${redColour}[!] $spawned_machines_response${endColour}\n" 544 | rm getAllMachines 2>/dev/null; tput cnorm 545 | fi 546 | } 547 | 548 | function getOwnedMachines(){ 549 | 550 | 551 | 552 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 553 | 554 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 555 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 556 | break 557 | fi 558 | 559 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getAllMachines 560 | let id+=1 561 | done 562 | 563 | curl -s "$url_owned_machines?api_token=$API_TOKEN" | jq | grep id | awk 'NF{print $NF}' | tr -d ',' | while read owned_id_machine; do 564 | cat getAllMachines | grep ",$owned_id_machine$" >> getOwnedMachines 565 | done 566 | 567 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getOwnedMachines 568 | 569 | echo -ne "${greenColour}" 570 | printTable ',' "$(cat getOwnedMachines)" 571 | echo -ne "${endColour}" 572 | 573 | rm getAllMachines getOwnedMachines 2>/dev/null; tput cnorm 574 | } 575 | 576 | function getActiveOwnedMachines(){ 577 | 578 | 579 | 580 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 581 | 582 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 583 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 584 | break 585 | fi 586 | 587 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> getAllMachines 588 | let id+=1 589 | done 590 | 591 | curl -s "$url_owned_machines?api_token=$API_TOKEN" | jq | grep id | awk 'NF{print $NF}' | tr -d ',' | while read owned_id_machine; do 592 | cat getAllMachines | grep ",$owned_id_machine$" >> getOwnedMachines 593 | done 594 | 595 | sed -i '/Is Active/!d' getOwnedMachines 596 | 597 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' getOwnedMachines 598 | 599 | echo -ne "${greenColour}" 600 | printTable ',' "$(cat getOwnedMachines)" 601 | echo -ne "${endColour}" 602 | 603 | rm getAllMachines getOwnedMachines 2>/dev/null; tput cnorm 604 | } 605 | 606 | function searchMachineName(){ 607 | 608 | 609 | s_machine_name=$1 610 | 611 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 612 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 613 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 614 | break 615 | fi 616 | 617 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 618 | let id+=1 619 | done 620 | 621 | sed -i "/$s_machine_name/!d" searchMachineName 622 | 623 | if [ "$(cat searchMachineName | wc -l)" != "0" ]; then 624 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' searchMachineName 625 | 626 | echo -ne "${greenColour}" 627 | printTable ',' "$(cat searchMachineName)" 628 | echo -ne "${endColour}" 629 | tput cnorm; rm searchMachineName 2>/dev/null 630 | else 631 | echo -e "\n${redColour}[!] There is no machine with that name${endColour}\n" 632 | rm searchMachineName 2>/dev/null; tput cnorm 633 | exit 1 634 | fi 635 | } 636 | 637 | function searchIPAddress(){ 638 | 639 | 640 | ipAddress=$1 641 | 642 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 643 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 644 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 645 | break 646 | fi 647 | 648 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchIPAddress 649 | let id+=1 650 | done 651 | 652 | sed -i "/$ipAddress,/!d" searchIPAddress 653 | 654 | if [ "$(cat searchIPAddress | wc -l)" != "0" ]; then 655 | sed -i '1 i\Name, IP Address, Operating System, Points, Rating, User Owns, Root Owns, Retired, Release Date, Retired Date, Free Lab, Machine ID' searchIPAddress 656 | 657 | echo -ne "${greenColour}" 658 | printTable ',' "$(cat searchIPAddress)" 659 | echo -ne "${endColour}" 660 | tput cnorm; rm searchIPAddress 2>/dev/null 661 | else 662 | echo -e "\n${redColour}[!] There is no machine with that IP address${endColour}\n" 663 | rm searchIPAddress 2>/dev/null; tput cnorm 664 | exit 1 665 | fi 666 | } 667 | 668 | function searchUserName(){ 669 | 670 | username=$1 671 | id_username=$(curl -s -X POST "$url_user_id?api_token=$API_TOKEN" -L --data "username=$username" | tr "'" '"' | sed 's/None/\"None\"/g' | sed 's/True/\"True\"/g' | sed 's/False/\"False\"/g' | jq '.["id"]') 672 | 673 | curl -s "https://www.hackthebox.eu/profile/$id_username" | html2text > user_info 674 | 675 | little_check=$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $3}') 676 | 677 | if [ $little_check ]; then 678 | if [ $id_username ]; then 679 | echo "Username,ID,User Owns,System Owns,HallOfFame,Challenges Solved,Respected by,Badges,Rank" > searchUserName 680 | echo "$username,$id_username,$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $3}'),$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $2}'),$(cat user_info | grep "is at position" | awk '{print $5}'),$(cat user_info | grep "challenges" | awk '{print $4}'),$(cat user_info | grep "respected by" | awk '{print $5}'),$(cat user_info | grep "badges" | awk '{print $5}'),$(cat user_info | grep "\[image\]" -A 3 | awk 'NR==4')" >> searchUserName 681 | 682 | echo -ne "${yellowColour}" 683 | printTable ',' "$(cat searchUserName)" 684 | echo -ne "${endColour}" 685 | tput cnorm; rm searchUserName 2>/dev/null 686 | fi; rm user_info 2>/dev/null 687 | else 688 | echo -e "\n${redColour}[!] User has not public profile${endColour}\n" 689 | rm searchUserName user_info 2>/dev/null 690 | tput cnorm 691 | fi 692 | 693 | tput cnorm; rm user_info 2>/dev/null 694 | } 695 | 696 | function resetMachineName(){ 697 | 698 | reset_machineName=$1 699 | 700 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 701 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 702 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 703 | break 704 | fi 705 | 706 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 707 | let id+=1 708 | done 709 | 710 | machine_to_reset_id=$(cat searchMachineName | grep "$reset_machineName," | tr ',' ' ' | awk 'NF{print $NF}') 711 | 712 | response=$(curl -s -X POST "${url_reset_machine}${machine_to_reset_id}?api_token=$API_TOKEN" -L | jq '.["output"]' | tr -d '"') 713 | 714 | if [ "$(echo $response)" == "null" ]; then 715 | echo -e "\n${redColour}[!] It was not posible to restart the machine${endColour}\n" 716 | else 717 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} $response${endColour}\n" 718 | fi 719 | 720 | tput cnorm; rm searchMachineName 2>/dev/null 721 | } 722 | 723 | function shoutBoxMessages(){ 724 | shoutbox_chat_value=$1 725 | curl -s -X POST "$url_shoutbox_messages$shoutbox_chat_value?api_token=$API_TOKEN" -L | jq '.["html"]' | tr -d '[]' | html2text | grep ":" | awk '{print $1}' FS="&" | sed 's/\">//' | grep ":" | sed 's/became a/became a VIP/g' | sed 's/(+1/+1/g' | sed 's/01\\//' | sed 's/ / /g' > shoutBox.tmp 726 | 727 | cat shoutBox.tmp | while read line_in_shoutbox; do 728 | user=$(echo $line_in_shoutbox | awk '{print $4}') 729 | echo $user >> users.txt 730 | echo -e "${blueColour}[$user]:${endColour}${grayColour} $line_in_shoutbox${endColour}" | grep -v -E '\[\]|\["\]' 731 | done 732 | 733 | rm shoutBox.tmp users.txt user_info 2>/dev/null; tput cnorm 734 | } 735 | 736 | function whoisChatting(){ 737 | tput civis; shoutbox_chat_value=$1 738 | curl -s -X POST "$url_shoutbox_messages$shoutbox_chat_value?api_token=$API_TOKEN" -L | jq '.["html"]' | tr -d '[]' | html2text | grep ":" | awk '{print $1}' FS="&" | sed 's/\">//' | grep ":" | sed 's/became a/became a VIP/g' | sed 's/(+1/+1/g' | sed 's/01\\//' | sed 's/ / /g' > shoutBox.tmp 739 | 740 | cat shoutBox.tmp | while read line_in_shoutbox; do 741 | user=$(echo $line_in_shoutbox | awk '{print $4}') 742 | echo $user >> users.txt 743 | done 744 | 745 | echo "Username,ID,User Owns,System Owns,HallOfFame,Challenges Solved,Respected by,Badges,Rank" > searchUserName 746 | 747 | cat users.txt | sort -u | while read username; do 748 | id_username=$(curl -s -X POST "$url_user_id?api_token=$API_TOKEN" -L --data "username=$username" | tr "'" '"' | sed 's/None/\"None\"/g' | sed 's/True/\"True\"/g' | sed 's/False/\"False\"/g' | jq '.["id"]') 749 | 750 | curl -s "https://www.hackthebox.eu/profile/$id_username" | html2text > user_info 751 | 752 | little_check=$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $3}') 753 | 754 | if [ $little_check ]; then 755 | if [ $id_username ]; then 756 | echo "$username,$id_username,$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $3}'),$(cat user_info | grep "\[image\]" -A 2 | awk 'NR==3' | awk '{print $2}'),$(cat user_info | grep "is at position" | awk '{print $5}'),$(cat user_info | grep "challenges" | awk '{print $4}'),$(cat user_info | grep "respected by" | awk '{print $5}'),$(cat user_info | grep "badges" | awk '{print $5}'),$(cat user_info | grep "\[image\]" -A 3 | awk 'NR==4')" >> searchUserName 757 | echo -ne "${yellowColour}" 758 | echo -ne "${endColour}" 759 | tput cnorm; 760 | fi; rm user_info 2>/dev/null 761 | fi 762 | done 763 | 764 | echo -ne "${yellowColour}" 765 | printTable ',' "$(cat searchUserName)" 766 | echo -ne "${endColour}" 767 | rm shoutBox.tmp users.txt user_info searchUserName 2>/dev/null; tput cnorm 768 | } 769 | 770 | function deployMachine(){ 771 | 772 | deployMachineName=$1 773 | 774 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 775 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 776 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 777 | break 778 | fi 779 | 780 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 781 | let id+=1 782 | done 783 | 784 | machine_to_deploy_id=$(cat searchMachineName | grep "$deployMachineName," | tr ',' ' ' | awk 'NF{print $NF}') 785 | 786 | response=$(curl -s -X POST "${url_deploy_machine}${machine_to_deploy_id}?api_token=$API_TOKEN" -L | jq '.["status"]' | tr -d '"') 787 | 788 | if [ "$(echo $response)" == "null" ]; then 789 | echo -e "\n${redColour}[!] It was not posible to deploy the machine${endColour}\n" 790 | else 791 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} $response${endColour}\n" 792 | fi 793 | 794 | tput cnorm; rm searchMachineName 2>/dev/null 795 | } 796 | 797 | function stopMachine(){ 798 | 799 | stopMachineName=$1 800 | 801 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 802 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 803 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 804 | break 805 | fi 806 | 807 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 808 | let id+=1 809 | done 810 | 811 | machine_to_stop_id=$(cat searchMachineName | grep "$stopMachineName," | tr ',' ' ' | awk 'NF{print $NF}') 812 | response=$(curl -s -X POST "${url_stop_machine}${machine_to_stop_id}?api_token=$API_TOKEN" -L | jq '.["status"]' | tr -d '"') 813 | 814 | if [ "$(echo $response)" == "null" ]; then 815 | echo -e "\n${redColour}[!] It was not posible to stop the machine${endColour}\n" 816 | else 817 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} $response${endColour}\n" 818 | fi 819 | 820 | tput cnorm; rm searchMachineName 2>/dev/null 821 | } 822 | 823 | function extendMachine(){ 824 | 825 | extendMachineName=$1 826 | 827 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 828 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 829 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 830 | break 831 | fi 832 | 833 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 834 | let id+=1 835 | done 836 | 837 | machine_to_extend_id=$(cat searchMachineName | grep $extendMachineName | tr ',' ' ' | awk 'NF{print $NF}') 838 | 839 | response=$(curl -s -X POST "${url_extend_machine}${machine_to_extend_id}?api_token=$API_TOKEN" -L | jq '.["status"]' | tr -d '"') 840 | 841 | if [ "$(echo $response)" == "null" ]; then 842 | echo -e "\n${redColour}[!] It was not posible to extend the machine time${endColour}\n" 843 | else 844 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} $response${endColour}\n" 845 | fi 846 | 847 | tput cnorm; rm searchMachineName 2>/dev/null 848 | } 849 | 850 | function assignMachine(){ 851 | assignMachineName=$1 852 | 853 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 854 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 855 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 856 | break 857 | fi 858 | 859 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 860 | let id+=1 861 | done 862 | 863 | machine_to_assign_id=$(cat searchMachineName | grep $assignMachineName | tr ',' ' ' | awk 'NF{print $NF}') 864 | 865 | response=$(curl -s -X POST "${url_assign_machine}${machine_to_assign_id}?api_token=$API_TOKEN" -L | jq '.["status"]' | tr -d '"') 866 | 867 | if [ "$(echo $response)" == "null" ]; then 868 | echo -e "\n${redColour}[!] It was not posible to assign the machine time${endColour}\n" 869 | else 870 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} $response${endColour}\n" 871 | fi 872 | 873 | tput cnorm; rm searchMachineName 2>/dev/null 874 | } 875 | 876 | function sendFlags(){ 877 | 878 | if [[ ! $(echo $1) =~ "=" ]]; then 879 | helpPanel 880 | exit 1 881 | fi 882 | 883 | f_machine_name=$(echo $1 | cut -d "=" -f1) 884 | flag=$(echo $1 | cut -d "=" -f2) 885 | 886 | id=0; while [ "$field_value" != "null,null,null,null,null,null,null,null,null,null,null,null" ]; do 887 | field_value=$(cat $tmp_file | jq ".[$id][\"name\",\"ip\",\"os\",\"points\",\"rating\",\"user_owns\",\"root_owns\",\"retired\",\"release\",\"retired_date\",\"free\",\"id\"]" | tr -d '"' | xargs | tr ' ' ',') 888 | if [ "$(echo $field_value)" == "null,null,null,null,null,null,null,null,null,null,null,null" ]; then 889 | break 890 | fi 891 | 892 | echo $field_value | sed 's/true/Yes/g' | sed 's/false/No/g' | sed 's/null/Is Active/' >> searchMachineName 893 | let id+=1 894 | done 895 | 896 | id=$(cat searchMachineName | grep -i $f_machine_name | cut -d "," -f12 2>/dev/null) 897 | 898 | if [ "$(cat searchMachineName | wc -l)" != "0" ]; then 899 | response=$(curl -s "https://www.hackthebox.eu/api/machines/own" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0" -H "Authorization: Bearer $API_TOKEN" -H "Content-Type: application/x-www-form-urlencoded" -d "flag=$flag&difficulty=50&id=$id" | jq ".[\"status\"]" | tr -d '"') 900 | if [[ $response =~ "Incorrect" ]]; then 901 | echo -e "${redColour}[!] $response${endColour}" 902 | elif [[ $response =~ "found" ]]; then 903 | echo -e "${redColour}[!] $response${endColour}" 904 | else 905 | echo -e "${greenColour}[+] $response${endColour}" 906 | fi 907 | echo -ne "${greenColour}" 908 | echo -ne "${endColour}" 909 | tput cnorm; rm searchMachineName 2>/dev/null 910 | else 911 | echo -e "\n${redColour}[!] There is no machine with that name${endColour}\n" 912 | rm searchMachineName 2>/dev/null; tput cnorm 913 | exit 1 914 | fi 915 | } 916 | 917 | function downloadVPN(){ 918 | tput cnorm 919 | echo -e "\n${yellowColour}[*]${endColour}${grayColour} You need to login first...${endColour}\n" 920 | python3 downloadVPN.py $1 921 | echo -e "\n${greenColour}[V]${endColour}${grayColour} The VPN has been download successfuly${endColour}" 922 | } 923 | 924 | function dependencies(){ 925 | 926 | ## Detect base OS for better package management. Can't use "$OSTYPE" by default, 927 | ## it returns linux-gnu for different Linuxes. Fine for Fruitbook Computers... 928 | if [ -f /etc/os-release ]; then 929 | OS_RELEASE=$(awk -F= '/^NAME/{print $2}' /etc/os-release | sed 's/"//g') 930 | else 931 | OS_RELEASE=echo "$OSTYPE" 932 | fi 933 | 934 | ## Based on what we find, select the appropriate package manager 935 | if [ "$(echo $UID)" == "0" ]; then 936 | 937 | tput civis 938 | dependencies_array=(html2text jq) 939 | 940 | echo; for program in "${dependencies_array[@]}"; do 941 | if [ ! "$(command -v $program)" ]; then 942 | echo -e "${redColour}[X]${endColour}${grayColour} $program${endColour}${yellowColour} is not installed${endColour}"; sleep 1 943 | echo -e "\n${yellowColour}[i]${endColour}${grayColour} Installing...${endColour}"; sleep 1 944 | 945 | apt install $program -y > /dev/null 2>&1 946 | 947 | echo -e "\n${greenColour}[V]${endColour}${grayColour} $program${endColour}${yellowColour} installed${endColour}\n"; sleep 2 948 | fi 949 | done 950 | else 951 | echo -e "\n${redColour}[!] You need to run the program as root${endColour}\n" 952 | exit 1 953 | fi 954 | 955 | # if [ "$(echo $counter)" == "1" ]; then 956 | # sleep 957 | # fi 958 | } 959 | 960 | function helpPanel(){ 961 | banner 962 | echo -e "\n${redColour}[!] Usage: ./htbExplorer${endColour}" 963 | for i in $(seq 1 80); do echo -ne "${redColour}-"; done; echo -ne "${endColour}" 964 | echo -e "\n\n\t${grayColour}[-e]${endColour}${yellowColour} Exploration Mode${endColour}" 965 | echo -e "\t\t${purpleColour}all_machines${endColour}${yellowColour}:\t\t\t List all machines${endColour}" 966 | echo -e "\t\t${purpleColour}active_machines${endColour}${yellowColour}:\t\t List active machines${endColour}" 967 | echo -e "\t\t${purpleColour}retired_machines${endColour}${yellowColour}:\t\t List retired machines${endColour}" 968 | echo -e "\t\t${purpleColour}active_linux_machines${endColour}${yellowColour}:\t\t List active Linux machines${endColour}" 969 | echo -e "\t\t${purpleColour}active_windows_machines${endColour}${yellowColour}:\t List active Windows machines${endColour}" 970 | echo -e "\t\t${purpleColour}active_freebsd_machines${endColour}${yellowColour}:\t List active FreeBSD machines${endColour}" 971 | echo -e "\t\t${purpleColour}active_openbsd_machines${endColour}${yellowColour}:\t List active OpenBSD machines${endColour}" 972 | echo -e "\t\t${purpleColour}active_other_machines${endColour}${yellowColour}:\t\t List active Other machines${endColour}" 973 | echo -e "\t\t${purpleColour}retired_linux_machines${endColour}${yellowColour}:\t\t List retired Linux machines${endColour}" 974 | echo -e "\t\t${purpleColour}retired_windows_machines${endColour}${yellowColour}:\t List retired Windows machines${endColour}" 975 | echo -e "\t\t${purpleColour}retired_freebsd_machines${endColour}${yellowColour}:\t List retired FreeBSD machines${endColour}" 976 | echo -e "\t\t${purpleColour}retired_openbsd_machines${endColour}${yellowColour}:\t List retired OpenBSD machines${endColour}" 977 | echo -e "\t\t${purpleColour}retired_other_machines${endColour}${yellowColour}:\t\t List retired Other machines${endColour}" 978 | echo -e "\t\t${purpleColour}spawned_machines${endColour}${yellowColour}:\t\t List spawned machines${endColour}${redColour} [Only for VIP members]${endColour}" 979 | echo -e "\t\t${purpleColour}owned_machines${endColour}${yellowColour}:\t\t\t List owned machines${endColour}" 980 | echo -e "\t\t${purpleColour}owned_active_machines${endColour}${yellowColour}:\t\t List owned active machines${endColour}\n" 981 | echo -e "\t${grayColour}[-s]${endColour}${yellowColour} Search by machine name${endColour} ${blueColour}\t\t (Example: -s Rope)${endColour}\n" 982 | echo -e "\t${grayColour}[-i]${endColour}${yellowColour} Search by IP Address${endColour} ${blueColour}\t\t (Example: -i 10.10.10.10)${endColour}\n" 983 | echo -e "\t${grayColour}[-r]${endColour}${yellowColour} Reset a machine${endColour} ${blueColour}\t\t\t (Example: -r Mantis)${endColour}\n" 984 | echo -e "\t${grayColour}[-d]${endColour}${yellowColour} Deploy a machine${endColour} ${blueColour}\t\t\t (Example: -d Aragog)${endColour}${redColour} [Only for VIP members]${endColour}\n" 985 | echo -e "\t${grayColour}[-k]${endColour}${yellowColour} Stop a machine${endColour} ${blueColour}\t\t\t (Example: -k Hawk)${endColour}${redColour} [Only for VIP members]${endColour}\n" 986 | echo -e "\t${grayColour}[-a]${endColour}${yellowColour} Assign a machine${endColour} ${blueColour}\t\t\t (Example: -a Lame)${endColour}${redColour} [Only for VIP members]${endColour}\n" 987 | echo -e "\t${grayColour}[-x]${endColour}${yellowColour} Extend a machine time${endColour} ${blueColour}\t\t (Example: -x Legacy)${endColour}${redColour} [Only for VIP members]${endColour}\n" 988 | echo -e "\t${grayColour}[-f]${endColour}${yellowColour} Send a flag${endColour} ${blueColour}\t\t\t (Example: -f Bucket=flag123)${endColour}\n" 989 | echo -e "\t${grayColour}[-u]${endColour}${yellowColour} Search username${endColour} ${blueColour}\t\t\t (Example: -u s4vitar)${endColour}\n" 990 | echo -e "\t${grayColour}[-c]${endColour}${yellowColour} Show latest shoutbox messages${endColour}${blueColour}\t (Example: -c 50)${endColour}\n" 991 | echo -e "\t${grayColour}[-w]${endColour}${yellowColour} Who is chatting${endColour}${blueColour}\t\t\t (Example: -w 50)${endColour}\n" 992 | echo -e "\t${grayColour}[-v]${endColour}${yellowColour} Download VPN${endColour}${blueColour}\t\t\t (Example: -v s4vitar.ovpn)${endColour}\n" 993 | tput cnorm; exit 1 994 | } 995 | 996 | dependencies; parameter_counter=0 997 | tput civis; while getopts ":e:s:i:u:r:c:w:d:k:x:a:v:f:h:" arg; do 998 | case $arg in 999 | e) explorer_mode=$OPTARG && let parameter_counter+=1;; 1000 | s) search_machine_name=$OPTARG && let parameter_counter+=1;; 1001 | i) ip_address=$OPTARG && let parameter_counter+=1;; 1002 | u) user_name=$OPTARG && let parameter_counter+=1;; 1003 | r) reset_machineName=$OPTARG && let parameter_counter+=1;; 1004 | c) shoutbox_messages=$OPTARG && let parameter_counter+=1;; 1005 | w) whois_messages=$OPTARG && let parameter_counter+=1;; 1006 | d) machine_to_deploy=$OPTARG && let parameter_counter+=1;; 1007 | k) machine_to_stop=$OPTARG && let parameter_counter+=1;; 1008 | x) machine_to_extend=$OPTARG && let parameter_counter+=1;; 1009 | a) machine_to_assign=$OPTARG && let parameter_counter+=1;; 1010 | f) send_flag=$OPTARG && let parameter_counter+=1;; 1011 | v) download_vpn=$OPTARG;; 1012 | h) helpPanel;; 1013 | esac 1014 | done 1015 | 1016 | if [ "$parameter_counter" != "0" ]; then 1017 | generateFiles 1018 | fi 1019 | 1020 | if [ $search_machine_name ] && [ $API_TOKEN ]; then 1021 | searchMachineName $search_machine_name 1022 | rm tmp.json 2>/dev/null; exit 0 1023 | fi 1024 | 1025 | if [ $ip_address ] && [ $API_TOKEN ]; then 1026 | searchIPAddress $ip_address 1027 | rm tmp.json 2>/dev/null; exit 0 1028 | fi 1029 | 1030 | if [ $user_name ] && [ $API_TOKEN ]; then 1031 | searchUserName $user_name 1032 | rm tmp.json 2>/dev/null; exit 0 1033 | fi 1034 | 1035 | if [ $reset_machineName ] && [ $API_TOKEN ]; then 1036 | resetMachineName $reset_machineName 1037 | rm tmp.json 2>/dev/null; exit 0 1038 | fi 1039 | 1040 | if [ $machine_to_deploy ] && [ $API_TOKEN ]; then 1041 | deployMachine $machine_to_deploy 1042 | rm tmp.json 2>/dev/null; exit 0 1043 | fi 1044 | 1045 | if [ $machine_to_stop ] && [ $API_TOKEN ]; then 1046 | stopMachine $machine_to_stop 1047 | rm tmp.json 2>/dev/null; exit 0 1048 | fi 1049 | 1050 | if [ $send_flag ] && [ $API_TOKEN ]; then 1051 | sendFlags $send_flag 1052 | rm tmp.json 2>/dev/null; exit 0 1053 | fi 1054 | 1055 | if [ $machine_to_extend ] && [ $API_TOKEN ]; then 1056 | extendMachine $machine_to_extend 1057 | rm tmp.json 2>/dev/null; exit 0 1058 | fi 1059 | 1060 | if [ $machine_to_assign ] && [ $API_TOKEN ]; then 1061 | assignMachine $machine_to_assign 1062 | rm tmp.json 2>/dev/null; exit 0 1063 | fi 1064 | 1065 | if [ $shoutbox_messages ] && [ $API_TOKEN ]; then 1066 | shoutBoxMessages $shoutbox_messages 1067 | rm tmp.json 2>/dev/null; exit 0 1068 | fi 1069 | 1070 | if [ $whois_messages ] && [ $API_TOKEN ]; then 1071 | whoisChatting $whois_messages 1072 | rm tmp.json 2>/dev/null; exit 0 1073 | fi 1074 | 1075 | if [ $download_vpn ]; then 1076 | downloadVPN $download_vpn 1077 | exit 0 1078 | fi 1079 | 1080 | if [ $explorer_mode ] && [ $API_TOKEN ]; then 1081 | if [ "$(echo $explorer_mode)" == "all_machines" ]; then 1082 | getAllMachines 1083 | elif [ "$(echo $explorer_mode)" == "active_machines" ]; then 1084 | getActiveMachines 1085 | elif [ "$(echo $explorer_mode)" == "retired_machines" ]; then 1086 | getRetiredMachines 1087 | elif [ "$(echo $explorer_mode)" == "active_linux_machines" ]; then 1088 | getActiveLinuxMachines 1089 | elif [ "$(echo $explorer_mode)" == "active_windows_machines" ]; then 1090 | getActiveWindowsMachines 1091 | elif [ "$(echo $explorer_mode)" == "retired_linux_machines" ]; then 1092 | getRetiredLinuxMachines 1093 | elif [ "$(echo $explorer_mode)" == "retired_windows_machines" ]; then 1094 | getRetiredWindowsMachines 1095 | elif [ "$(echo $explorer_mode)" == "active_freebsd_machines" ]; then 1096 | getActiveFreebsdMachines 1097 | elif [ "$(echo $explorer_mode)" == "retired_freebsd_machines" ]; then 1098 | getRetiredFreebsdMachines 1099 | elif [ "$(echo $explorer_mode)" == "retired_openbsd_machines" ]; then 1100 | getRetiredOpenbsdMachines 1101 | elif [ "$(echo $explorer_mode)" == "active_openbsd_machines" ]; then 1102 | getActiveOpenbsdMachines 1103 | elif [ "$(echo $explorer_mode)" == "active_other_machines" ]; then 1104 | getActiveOtherMachines 1105 | elif [ "$(echo $explorer_mode)" == "retired_other_machines" ]; then 1106 | getRetiredOtherMachines 1107 | elif [ "$(echo $explorer_mode)" == "spawned_machines" ]; then 1108 | getSpawnedMachines 1109 | elif [ "$(echo $explorer_mode)" == "owned_machines" ]; then 1110 | getOwnedMachines 1111 | elif [ "$(echo $explorer_mode)" == "owned_active_machines" ]; then 1112 | getActiveOwnedMachines 1113 | fi 1114 | else 1115 | helpPanel 1116 | fi 1117 | 1118 | rm tmp.json 2>/dev/null; tput cnorm 1119 | --------------------------------------------------------------------------------