ansible/roles/cheat/templates/cheat/glowpager.sh aktualisiert

This commit is contained in:
2025-02-17 17:25:18 +01:00
parent 23f77f2331
commit 065d04f9d3

View File

@@ -6,8 +6,23 @@ FILENAME=$(mktemp)
# Save the original file name in our temp file
cat > $FILENAME
# make sure variables exist and set default values otherwise
export LHOST="${LHOST:-$(command ip a | grep eth1 | grep inet | awk '{print($2)}' | cut -d '/' -f 1)}"
export LHOST="${LHOST:-$(command ip a | grep tun0 | grep inet | awk '{print($2)}' | cut -d '/' -f 1)}"
export LHOST="${LHOST:-\$LHOST}"
export LPORT="${LPORT:-\$LPORT}"
if [ $USER = "kali" ]; then
unset USER
fi
export USER="${USER:-\$USER}"
export PASS="${PASS:-\$PASS}"
export DOMAIN="${DOMAIN:-\$DOMAIN}"
export DCIP="${DCIP:-\$DCIP}"
export DC="${DC:-\$DC}"
# Get the file content and substitute environment variables
TEMPCONTENT=$(command cat $FILENAME | envsubst '$LHOST')
TEMPCONTENT=$(command cat $FILENAME | envsubst '$LPORT' | envsubst '$LHOST' | envsubst '$USER' | envsubst '$PASS' | envsubst '$DOMAIN' | envsubst '$DC' | envsubst '$DCIP' )
# Delete the tempfile again
rm $TEMPFILE