184
57
A troll has captured you and is forcing you to write malware (defined as a program that damages the computer that runs it). The troll can read and understand code, but is not so good at spotting bugs.
Your goal is to write a program that:
- Looks like malware; i.e., a beginning programmer reading the code will be convinced that the code causes damage to the computer running it.
- Actually does no damage at all.
NOTE: The troll reads only the code - not the comments. So the code itself should be clear and convincing enough.
EXAMPLE (bash):
rm - rf /home
This example looks like rm -rf /home
which removes all home folders from the system, but actually, because of the space before the rf, this will not work and cause only a harmless error message.
This is an acceptable solution but it is not very good, because the bug is quite easy to detect.
On the other hand, a program that is complex and unreadable will also not be a very good solution, because it will not look like malware.
A good solution should be readable enough to convince the reader that it's malware, but contain a bug that is difficult to detect and renders it harmless.
This is a popularity contest, so the code with the most upvotes wins.
Dear god, I pity the poor programmer who forgets the one character that makes his code harmless. – Ashwin Gupta – 2016-02-22T04:40:47.490
I'm closing this challenge because underhanded contests are now considered off topic.
– Dennis – 2016-02-22T06:14:58.870160I feel like you're trying to trick me into pasting
rm - rf /
into my shell... – undergroundmonorail – 2014-03-10T08:28:17.0073
@undergroundmonorail you can use a shell simulator like this: http://www.compileonline.com/execute_bash_online.php
– Erel Segal-Halevi – 2014-03-10T08:29:45.1902I was making a joke, but that's a cool site actually. – undergroundmonorail – 2014-03-10T08:30:16.843
2Looks like someone is looking advices for malware – ST3 – 2014-03-10T09:06:21.930
19Bash
rm -rf /
. Unless the system is very old , it will require--no-preserve-root
:) – user80551 – 2014-03-10T10:59:50.64310-1 because a) code-trolling and more importantly b) I'm very concerned by any questions regarding creating malware (even though it's fake it skirts very close). – Gareth – 2014-03-10T11:00:13.533
@user80551 right, fixed the example – Erel Segal-Halevi – 2014-03-10T11:04:46.563
2@ErelSegalHalevi I actually meant that as an answer. – user80551 – 2014-03-10T11:09:33.350
13@Gareth It's not really malware, though (which typically tries to be hidden and/or steal data these days), it's mostly completely obvious attempts to delete things, which any beginner programmer could write with little effort. – Bob – 2014-03-11T00:01:04.670
29
rm - rf /
isn't a valid example! It can cause damage if you have a file calledrf
in the current directory – gnibbler – 2014-03-11T05:17:14.4703c:>fórmat c: /q /s – Sam – 2014-03-12T02:55:47.433
8@Gareth It "skirts fairly close" to malware by appearing to delete a file? You've got to be kidding me. – Navin – 2014-03-12T03:13:46.153
5Someone who uses other people's attack programs with little to no understanding is a script kiddie, not a troll. – JdeBP – 2014-03-12T16:55:11.017
2Yeah, and now I am gonna fix these answers(including the example given in question) and use them as malware! – Mukul Kumar – 2014-03-13T02:26:02.813
1@Gareth Spoil sport :P it's only theoretical... – w4etwetewtwet – 2014-03-15T12:09:04.973
3I wonder how many systems were ruined by guys testing their solution and failing – Sergey Telshevsky – 2014-03-19T14:03:16.760
2This question is very dangerous. Because when trying to create code for answer, I made some bugs in it and it worked 'properly' because of them. And this 'proper work' cost me some data :p – Alma Do – 2014-03-20T08:06:41.993
I would offer VimL
blast
but I'm not sure that actually satisfies the criteria... (presumably the troll is Vim-savvy?) – Kazark – 2014-04-01T16:48:03.8801@gnibbler Or a file called
-
. – nyuszika7h – 2014-05-04T17:26:12.563