by hellofunk · 11y ago · 0 comments
I did a "cat >/dev/null" before pasting so I could see what it was. Clever masked/hidden content, with embedded shell commands and newline to commit the commands.
I could have just as easily opened vim/emacs/notepad and done the same, or for that matter, written the contents to an actual file instead of redirecting the contents to /dev/null.
dangerous-commands \n
^d #eof
dangerous-commmands \n #repeat
(I'm not actually sure if you can paste ^d in general... but I expect you could?)Another handy convention is the magic "-" filename (which is not actually a file). Many tools interpret that to mean stdin/stdout. For example here is a trick to copy a tree of files:
tar cf - src | (cd dest && tar xvf -)But wrt your trick to copy a tree of files, what's wrong with `cp -r src dest`, or `scp -r src desthostname:/dest` if it's over a network? Is there some advantage this way?
as:
git status
^D
echo foo