Issue
General description
I don’t understand the next script; the general idea is the script takes stdout and
writes down a file encoded(or shifted characters).
tr 'A-Za-z' 'N-ZA-Mn-za-m' <<EOF | bash -
#!/ova/onfu
ge '!-~' 'C-~!-B' < f-04-erfhygnqbf-rap.fu | onfu -
EOF
The first line seems to shifht characters based on two sets:
'A-Za-z'
and
'N-ZA-Mn-za-m'
in some (random?) order. Then pipe it to bash.
Then it is defined a path
#!/ova/onfu
but there isnt this path in the system nor interpreter, then whats the use?
next
ge '!-~' 'C-~!-B' < f-04-erfhygnqbf-rap.fu | onfu -
ge ,I understand, is an option meaning greather than, but
'!-~' 'C-~!-B'
how can be greather than a character (using the utf8 code?, I mean their
hex values?)
this is taken of
f-04-erfhygnqbf-rap.fu
(is this a temporary file?). But then this is piped to onfu.
This scripts output a file with a whole mess of characters.
Questions
The general question: is what is this script doing?
As interesting points, I’d say :
- How does it work tr here?
- How does it work <<EOF?
- What is /ova/onfu?
- How does function the
ge
comparation? - This script seems to reencode a stdout output, how can it be recovered?
Thanks.
Solution
The tr
command is translating every letter to the letter 13 places ahead in the alphabet, wrapping around at Z
. This is the ROT13 encoding.
The output of this is then piped to bash
, so it will execute it as a shell script.
<<EOF
indicates that the input to tr
is a here-doc. It passes all the lines until the EOF
line as the input.
If you want to see the decoded script without executing it, get rid of | bash
and it will be printed on the screen.
Answered By – Barmar
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0