Skip to content

Commit f536cc0

Browse files
committed
lxc,OpenVZ
1 parent 31f4fb6 commit f536cc0

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

hackshell.sh

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,14 @@ enc() {
589589
[ $# -eq 0 ] && {
590590
# Encrypt
591591
_once dec_help && echo -e 1>&2 "${CDY}>>>${CN} To decrypt, use: ${CDC}HS_TOKEN='${HS_TOKEN}' dec${CN}"
592-
openssl enc -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}"
592+
openssl enc "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" 2>/dev/null
593593
return
594594
}
595595

596596
# Check if already encrypted:
597-
openssl enc -d -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}" <"${1}" &>/dev/null && { HS_WARN "Already encrypted"; return; }
597+
openssl enc -d "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" <"${1}" &>/dev/null && { HS_WARN "Already encrypted"; return; }
598598

599-
data="$(openssl enc -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}" -a <"${1}")"
599+
data="$(openssl enc "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" -a <"${1}" 2>/dev/null)"
600600
openssl base64 -d <<<"${data}" >"${1}"
601601
_once dec_help && echo -e 1>&2 "${CDY}>>>${CN} To decrypt, use: ${CDC}HS_TOKEN='${HS_TOKEN}' dec '${1}'${CN}"
602602
}
@@ -607,16 +607,14 @@ dec() {
607607

608608
_hs_enc_init
609609
[ $# -eq 0 ] && {
610-
# Decrypt
611-
openssl enc -d -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}"
610+
openssl enc -d "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" 2>/dev/null
612611
return
613612
}
614-
# Decrypt
615-
616613
# Check if encrypted:
617-
openssl enc -d -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}" <"${1}" &>/dev/null || { HS_WARN "Not encrypted or wrong HS_TOKEN."; return; }
614+
openssl enc -d "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" <"${1}" &>/dev/null || { HS_WARN "Not encrypted or wrong HS_TOKEN."; return; }
618615

619-
data="$(openssl enc -d -aes-256-cbc -pbkdf2 -nosalt -k "${HS_TOKEN:?}" <"${1}" | openssl base64)" || { HS_WARN "Not encrypted or wrong HS_TOKEN."; return; }
616+
data="$(openssl enc -d "${_HS_SSL_OPTS[@]}" "${HS_TOKEN:?}" <"${1}" 2>/dev/null | openssl base64)" || { HS_WARN "Not encrypted or wrong HS_TOKEN."; return; }
617+
[ -z "$data" ] && { HS_WARN "Failed to decrypt."; return; }
620618
openssl base64 -d <<<"${data}" >"${1}"
621619
}
622620

@@ -1371,6 +1369,26 @@ _lootmore_docker() {
13711369
echo -en "${CN}"
13721370
}
13731371
1372+
_lootmore_lxc() {
1373+
command -v pct >/dev/null || return
1374+
1375+
str="$(pct list 2>/dev/null | grep -v ^VMID)"
1376+
[ -z "$str" ] && return
1377+
echo -e "${CB}LXC ${CDY}${CF}"
1378+
echo "$str"
1379+
echo -en "${CN}"
1380+
}
1381+
1382+
_lootmore_vz() {
1383+
command -v vzlist >/dev/null || return
1384+
1385+
str="$(vzlist -a -t -H 2>/dev/null)"
1386+
[ -z "$str" ] && return
1387+
echo -e "${CB}OpenVZ${CDY}${CF}"
1388+
echo "$str"
1389+
echo -en "${CN}"
1390+
}
1391+
13741392
lootmore() {
13751393
local hn fn str arr
13761394
@@ -1422,6 +1440,8 @@ lootmore() {
14221440
}
14231441
_lootmore_last
14241442
_lootmore_docker
1443+
_lootmore_lxc
1444+
_lootmore_vz
14251445
14261446
str="$(grep -sE '^[[:digit:]]' "${ROOTFS}/etc/hosts" |grep -vF -e localhost -e 127.0.0.1)"
14271447
[ -n "$str" ] && {
@@ -1802,6 +1822,10 @@ ${CY}>>>>> ${CDC}curl -obash -SsfL '$str' && chmod 700 bash && exec ./bash -il"
18021822
[ "$HS_ARCH" == "aarch64" ] && HS_ARCH_ALT="arm64"
18031823
[ -z "$HS_ARCH_ALT" ] && HS_ARCH_ALT="$HS_ARCH"
18041824
1825+
# Old OpenSSL don't have -pbkdf2.
1826+
# _HS_SSL_OPTS=("-aes-256-cbc" "-pbkdf2" "-nosalt" "-k")
1827+
_HS_SSL_OPTS=("-aes-256-cbc" "-md" "sha256" "-nosalt" "-k")
1828+
18051829
_HS_GREP_COLOR_NEVER=()
18061830
echo test | grep --color=never -qF test 2>/dev/null && _HS_GREP_COLOR_NEVER=("--color=never")
18071831
@@ -2061,5 +2085,5 @@ lootlight
20612085
unset -f hs_init hs_init_alias hs_init_dl hs_init_shell
20622086
unset SSH_CONNECTION SSH_CLIENT _HSURLORIGIN
20632087
2064-
# Do exit with TRUE in case parent shell ues 'set -e':
2088+
# Exit with TRUE in case parent shell ues 'set -e':
20652089
:

0 commit comments

Comments
 (0)