bsh: Hide base64 string from process list

This commit is contained in:
Geoffrey Frogeye 2023-12-18 20:59:05 +01:00
parent 6b07cc0cbe
commit c145803881
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -42,12 +42,16 @@ then
grep -o '^\s*[^#]*' $SCRIPT_DIR/.bsh/inputrc | sed 's/^\s\+//' > "${WORK}/i"
grep -o '^\s*[^"]*' $SCRIPT_DIR/.bsh/vimrc | sed 's/^\s\+//' > "${WORK}/v"
# Creating entrypoint
echo "bash --rcfile ${DEST}/b" > "${WORK}/e"
echo "rm -rf ${DEST}" >> "${WORK}/e"
# TODO Do not remove unless last one connected
# Crafting command
b64="$(cd "$CACHE_DIR"; tar czf - "$FOLDER_NAME" | base64 -w 0)"
echo "echo $b64|base64 -d|tar xzC /tmp" > "${CACHE_DIR}/cmd"
echo "bash --rcfile ${DEST}/b" >> "${CACHE_DIR}/cmd"
echo "rm -rf ${DEST}" >> "${CACHE_DIR}/cmd"
# TODO Do not remove unless last one connected
# Due to magic, if the last command executed is bash, it disappears from the list of processes
echo "sh ${DEST}/e" >> "${CACHE_DIR}/cmd"
# Cleanup
rm -rf "$WORK"