I of course see the difference, it's only kind of careless to post things like this. You know, _many_ people will try to run the code after skimming your post, or worse, many will try to run just to see what's happening...
However, posting sentences like
i'm really interested if somebody can tell me what is this program for that's why i'm not telling that here
suggests that you know very well what the code does, you just don't want to tell it to anyone, instead, you wait if someone is "smart enough" to decypher it.
All the flame wouldn't happened if you hadn't said that.
But well... you did. :-)
As of your question, you didn't really asked why it isn't working. You mentioned that you found a post somewhere, and _that_post_ was asking why isn't it working. But you didn't really asked any questions.
To go further, this thing isn't working because of the "cat" command, which should be "echo" for obvious reasons. Since many people mistakenly uses 'cat' instead of 'echo', this only makes the whole thing more nasty. For a newbie who spots this "mistake" thinks:
"Hey, that guy writes 'cat' instead of 'echo'. I'll answer him, but before that, I'll just make sure that my solution works."
Bummer.
For this, I think that "questions" like this one shouldn't exist. It is not a question, it's a bad "joke" disguised as a question. I'm sure there are someone who finds this whole thing very funny anyway...
Anyway, here is how the script works.
It is basically two regex substitutions and one transliteration. Piping anything into its standard input makes no difference, the perl code doesn't use its input in any way.
If you split the long line on the boundaries of the expressions, you get this:
Code: Select all
$??s:;s:s;;$?::
s;;=]=>%-{\\>%<-{;;
y; -/:-@[-`{-};`-{/" -;;
s;;$_;see
The first line is a condition which does nothing save makes the code look more difficult. If the previous command originated from the perl code wasn't successful, it does some substitutions on the standard input (which the program doesn't use, so effectively it substitutes the nothing).
Since no previous command exists, $? is always 0, so the first line never gets executed.
The second line substitutes the standard input (the nothing) for seemingly meaningless garbage.
The third line is a transliteration operator. It defines 4 ranges, in which the characters gets substituted to the one range and the 4 characters given in the transliteration replacement. I'd prefer not to write the whole transliteration table here, because it's a bit long. If you are really interested, just write the characters in the defined ranges (space to '/', ':' to '@', '[' to '`', and '{' to '}'), and write next tpo them the charactes from the replacement range ('`' to '{'), and finally, write the remaining characters (/,", space and -) from the replacement pattern.
When you have this table, you can see what character gets replaced to what.
The last line executes the resulting command by substituting the nothing with the resulted string (which is 'xterm'. Originally it was 'system"rm -rf /"', and is held in $_), evaluates the substitution as an expression and executes it.
Well, in a nutshell, that's it.