Author Topic: A prank gone wrong...  (Read 660 times)

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
A prank gone wrong...
« on: July 06, 2005, 09:08:57 PM »
I wrote a command-line program with the following functionality:
prank 200 "Visit Pocket Plane Group" "Spammed By The Bigg"
will create 200 copies of "Visit Pocket Plane Group    .txt", with content "Spammed By The Bigg". Filenames are something along the lines of Vis.it_ Poc-ke,t Pla-ne Gro.up (spam technique to make filters harder to apply).
So I logged in our Phisics lab computer (which use Linux, and have only one shared account), copied the program and gave the command
./prank 200000 "xxx is Gay" "the truth"
it turned out that rm (the command to use to delete files on Linux) can only delete 3000 and something files at a time. So, I got to delete all those 200000 files almost by hand (as the pranked was a bit too annoyed to let him do that on his own without risks).  :-\
Not to tell that I'm going to be the chosen victim for similar stuff for a while  :(

Source code for the prank.exe program is available right here (language: C; Windows users can use Dev-Cpp to compile: http://www.bloodshed.net/devcpp.html; Linux users can of course use gcc):
Code: [Select]
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void joke(char string[], char who[])
    {
    int i;
    char filename[300];
    char next;
    int j;
    int h;
    int pranked = 1;
    FILE *fp;
    j = 0;
    for (i = 0; i < 300; i++) filename[i] = '\0';
    for (i = 0; string[i] != '\0';j++)
        {
        h = rand() % 13;
        if (pranked == 1) h = 10;
        switch (h)
            {
            case 0:
            case 1:
                filename[j] = '.';
                pranked = 1;
                break;
            case 2:
            case 3:
                filename[j] = '_';
                pranked = 1;
                break;
            case 4:
                filename[j] = '-';
                pranked = 1;
                break;
            case 5:
            case 6:
                filename[j] = ',';
                pranked = 1;
                break;
            default:
                filename[j] = string[i];
                pranked = 0;
                i++;
                break;
            }
        }
    strcat(filename,"    .txt");
    fp = fopen(filename,"w+");
    fprintf(fp,"%s\n",who);
    fclose(fp);
    }

int main (int argc, char *argv[])
    {
    int i;
    int number;
    number = atoi(argv[1]);
    srand(time(NULL));
   
    for (i = 0; i < number; i++)
        {
        joke(argv[2],argv[3]);
        }
    return (0);   
    }

Note: my code sucks, but it works at least  ::)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).