// Path: src/main/java/ysoserial/GeneratePayload.java
// @SuppressWarnings("rawtypes")
// public class GeneratePayload {
// 
// 	private static final int INTERNAL_ERROR_CODE = 70;
// 	private static final int USAGE_CODE = 64;
// 	private static final List<String> terminalTypes = Arrays.asList("cmd", "bash", "powershell", "none");
// 
// 	public static void main(final String[] args) {
// 		if (args.length != 3) {
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 		}
// 		final String payloadType = args[0];
// 		final String terminalType = args[1];
// 		final String command = args[2];
// 
// 		final Class<? extends ObjectPayload> payloadClass = Utils.getPayloadClass(payloadType);
// 		if (payloadClass == null) {
// 			System.err.println("Invalid payload type '" + payloadType + "'");
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 			return; // make null analysis happy
// 		}
// 		
// 		if (!terminalTypes.contains(terminalType)) {
// 			System.err.println("Invalid terminal type '" + terminalType + "'");
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 			return; // make null analysis happy
// 		}
// 
// 		try {
// 			final ObjectPayload payload = payloadClass.newInstance();
// 			CmdExecuteHelper cmdHelper = new CmdExecuteHelper(terminalType, command);
// 			final Object object = payload.getObject(cmdHelper);
// 			PrintStream out = System.out;
// 			Serializer.serialize(object, out);
// 			ObjectPayload.Utils.releasePayload(payload, object);
// 		} catch (Throwable e) {
// 			System.err.println("Error while generating or serializing payload");
// 			e.printStackTrace();
// 			System.exit(INTERNAL_ERROR_CODE);
// 		}
// 		System.exit(0);
// 	}
// 
// 	private static void printUsage() {
// 		System.err.println("Y SO SERIAL?");
// 		System.err.println("Usage: java -jar ysoserial-[version]-all.jar [payload type] [terminal type: cmd / bash / powershell / none] '[command to execute]'");
// 		System.err.println("   ex: java -jar ysoserial-[version]-all.jar CommonsCollections5 bash 'touch /tmp/ysoserial'");
// 		System.err.println("\tAvailable payload types:");
// 		final List<Class<? extends ObjectPayload>> payloadClasses =
// 			new ArrayList<Class<? extends ObjectPayload>>(ObjectPayload.Utils.getPayloadClasses());
// 		Collections.sort(payloadClasses, new ToStringComparator()); // alphabetize
// 		for (Class<? extends ObjectPayload> payloadClass : payloadClasses) {
// 			System.err.println("\t\t" + payloadClass.getSimpleName() + " " + Arrays.asList(Dependencies.Utils.getDependencies(payloadClass)));
// 		}
// 	}
// 
// 	public static class ToStringComparator implements Comparator<Object> {
// 		public int compare(Object o1, Object o2) { return o1.toString().compareTo(o2.toString()); }
// 	}
// 
// }
// 
// Path: src/main/java/ysoserial/payloads/util/CmdExecuteHelper.java
// public class CmdExecuteHelper {
// 	
// 	private String terminalType;
// 	
// 	private String[] commandArray;
// 	
// 	private String command;
// 
// 	public CmdExecuteHelper(String terminalType, String command) {
// 		super();
// 		this.terminalType = terminalType;
// 		this.command = command;
// 		
// 		switch (terminalType) {
// 		case "cmd":
// 			this.commandArray = new String[]{"cmd.exe","/c", command};
// 			break;
// 		case "bash":
// 			this.commandArray = new String[]{"/bin/bash","-c", command};
// 			break;
// 		case "powershell":
// 			this.commandArray = new String[]{"powershell.exe","-c", command};
// 			break;
// 		default:
// 			this.commandArray = new String[]{command};
// 			break;
// 		}
// 	}
// 
// 	public String[] getCommandArray() {
// 		return commandArray;
// 	}
// 
// 	public void setCommandArray(String[] commandArray) {
// 		this.commandArray = commandArray;
// 	}
// 
// 	public String getCommand() {
// 		return command;
// 	}
// 
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getTerminalType() {
// 		return terminalType;
// 	}
// 
// 	public void setTerminalType(String terminalType) {
// 		this.terminalType = terminalType;
// 	}
// 
// }


import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.Set;
import org.reflections.Reflections;
import ysoserial.GeneratePayload;
import ysoserial.payloads.util.CmdExecuteHelper;
package ysoserial.payloads;






@SuppressWarnings ( "rawtypes" )
public interface ObjectPayload <T> {

    /*
     * return armed payload object to be serialized that will execute specified
     * command on deserialization
     */
// Path: src/main/java/ysoserial/GeneratePayload.java
// @SuppressWarnings("rawtypes")
// public class GeneratePayload {
// 
// 	private static final int INTERNAL_ERROR_CODE = 70;
// 	private static final int USAGE_CODE = 64;
// 	private static final List<String> terminalTypes = Arrays.asList("cmd", "bash", "powershell", "none");
// 
// 	public static void main(final String[] args) {
// 		if (args.length != 3) {
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 		}
// 		final String payloadType = args[0];
// 		final String terminalType = args[1];
// 		final String command = args[2];
// 
// 		final Class<? extends ObjectPayload> payloadClass = Utils.getPayloadClass(payloadType);
// 		if (payloadClass == null) {
// 			System.err.println("Invalid payload type '" + payloadType + "'");
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 			return; // make null analysis happy
// 		}
// 		
// 		if (!terminalTypes.contains(terminalType)) {
// 			System.err.println("Invalid terminal type '" + terminalType + "'");
// 			printUsage();
// 			System.exit(USAGE_CODE);
// 			return; // make null analysis happy
// 		}
// 
// 		try {
// 			final ObjectPayload payload = payloadClass.newInstance();
// 			CmdExecuteHelper cmdHelper = new CmdExecuteHelper(terminalType, command);
// 			final Object object = payload.getObject(cmdHelper);
// 			PrintStream out = System.out;
// 			Serializer.serialize(object, out);
// 			ObjectPayload.Utils.releasePayload(payload, object);
// 		} catch (Throwable e) {
// 			System.err.println("Error while generating or serializing payload");
// 			e.printStackTrace();
// 			System.exit(INTERNAL_ERROR_CODE);
// 		}
// 		System.exit(0);
// 	}
// 
// 	private static void printUsage() {
// 		System.err.println("Y SO SERIAL?");
// 		System.err.println("Usage: java -jar ysoserial-[version]-all.jar [payload type] [terminal type: cmd / bash / powershell / none] '[command to execute]'");
// 		System.err.println("   ex: java -jar ysoserial-[version]-all.jar CommonsCollections5 bash 'touch /tmp/ysoserial'");
// 		System.err.println("\tAvailable payload types:");
// 		final List<Class<? extends ObjectPayload>> payloadClasses =
// 			new ArrayList<Class<? extends ObjectPayload>>(ObjectPayload.Utils.getPayloadClasses());
// 		Collections.sort(payloadClasses, new ToStringComparator()); // alphabetize
// 		for (Class<? extends ObjectPayload> payloadClass : payloadClasses) {
// 			System.err.println("\t\t" + payloadClass.getSimpleName() + " " + Arrays.asList(Dependencies.Utils.getDependencies(payloadClass)));
// 		}
// 	}
// 
// 	public static class ToStringComparator implements Comparator<Object> {
// 		public int compare(Object o1, Object o2) { return o1.toString().compareTo(o2.toString()); }
// 	}
// 
// }
// 
// Path: src/main/java/ysoserial/payloads/util/CmdExecuteHelper.java
// public class CmdExecuteHelper {
// 	
// 	private String terminalType;
// 	
// 	private String[] commandArray;
// 	
// 	private String command;
// 
// 	public CmdExecuteHelper(String terminalType, String command) {
// 		super();
// 		this.terminalType = terminalType;
// 		this.command = command;
// 		
// 		switch (terminalType) {
// 		case "cmd":
// 			this.commandArray = new String[]{"cmd.exe","/c", command};
// 			break;
// 		case "bash":
// 			this.commandArray = new String[]{"/bin/bash","-c", command};
// 			break;
// 		case "powershell":
// 			this.commandArray = new String[]{"powershell.exe","-c", command};
// 			break;
// 		default:
// 			this.commandArray = new String[]{command};
// 			break;
// 		}
// 	}
// 
// 	public String[] getCommandArray() {
// 		return commandArray;
// 	}
// 
// 	public void setCommandArray(String[] commandArray) {
// 		this.commandArray = commandArray;
// 	}
// 
// 	public String getCommand() {
// 		return command;
// 	}
// 
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getTerminalType() {
// 		return terminalType;
// 	}
// 
// 	public void setTerminalType(String terminalType) {
// 		this.terminalType = terminalType;
// 	}
// 
// }


// Path: src/main/java/ysoserial/payloads/ObjectPayload.java
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.Set;
import org.reflections.Reflections;
import ysoserial.GeneratePayload;
import ysoserial.payloads.util.CmdExecuteHelper;

package ysoserial.payloads;






@SuppressWarnings ( "rawtypes" )
public interface ObjectPayload <T> {

    /*
     * return armed payload object to be serialized that will execute specified
     * command on deserialization
     */
    public T getObject (CmdExecuteHelper cmdHelper) throws Exception;