fix JSONS.sh download, obfuscate joke hack

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-06-08 15:48:07 +02:00
parent 6f86036809
commit 19c45c4771
3 changed files with 22 additions and 4 deletions

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.96-dev3-20-gbd22e2a
#### $$VERSION$$ v0.96-dev3-21-g6f86036
#
# Exit Codes:
# - 0 sucess (hopefully)
@ -820,7 +820,7 @@ JSONSHFILE="${BASHBOT_JSONSH:-${SCRIPTDIR}/JSON.sh/JSON.sh}"
if [ ! -f "${JSONSHFILE}" ]; then
echo "Seems to be first run, Downloading ${JSONSHFILE}..."
[[ "${JSONSHFILE}" = "${RUNDIR}/JSON.sh/JSON.sh" ]] && mkdir "JSON.sh" 2>/dev/null && chmod +w "JSON.sh"
mkdir "${SCRIPTDIR}/JSON.sh" 2>/dev/null && chmod +w "${SCRIPTDIR}/JSON.sh"
getJson "https://cdn.jsdelivr.net/gh/dominictarr/JSON.sh/JSON.sh" >"${JSONSHFILE}"
chmod +x "${JSONSHFILE}"
fi

View File

@ -5,7 +5,7 @@
# If you your bot is finished you can use make-standalone.sh to create the
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
#
#### $$VERSION$$ v0.96-dev3-20-gbd22e2a
#### $$VERSION$$ v0.96-dev3-21-g6f86036
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -18,7 +18,7 @@ fi
#DISTNAME="telegram-bot-bash"
DISTDIR="./STANDALONE/${DISTNAME}"
DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh modules LICENSE README.txt token count botacl botadmin"
DISTFILES="bashbot.sh bashbot.rc commands.sh mycommands.sh dev/obfuscate.sh modules LICENSE README.txt token count botacl botadmin"
# run pre_commit on files
dev/hooks/pre-commit.sh

18
dev/obfuscate.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# shellcheck disable=SC2028,2016
# joke hack to obfuscate bashbot.min.sh
infile="bashbot.sh"
outfile="./bashbot.obf.sh"
[ ! -f "${infile}" ] && echo "Hey, this is a joke hack to obfuscate ${infile}, copy me to STANDANLONE first" && exit
{
echo '#!/bin/bash'
echo 'b="./bashbot";h="$PWD";cd "$(mktemp -d)"||exit'
echo 'printf '"'%s\n'"' '"'$(gzip -9 <bashbot.sh | base64)'"'|base64 -d|gunzip >"$b";export BASHBOT_HOME="$h";chmod +x "$b";"$b" "$@";b="$(pwd)";cd ..;#rm -rf "$b"'
} >"${outfile}"
chmod +x "${outfile}"
ls -l "${outfile}"
echo "Try to run ${outfile} init ;-)"