package ysoserial.test.exploit;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RMIRegistryExploitTest {
	public static void createRegistry(int port) throws RemoteException {
		Registry registry = LocateRegistry.createRegistry(port);
	}

	public static void main(String[] args) throws RemoteException, InterruptedException {
		String portStr = args.length > 0 && args[0] != null ? args[0] : "1099";
		int port = Integer.parseInt(portStr);
		createRegistry(port);
		while (true) Thread.sleep(1000);
	}
}
