ReflectionChecker

class ReflectionChecker(val id: Int, val checks: List<ReflectionChecker.ReflectionCheck>) : OutgoingGameMessage

Reflection checker packet will attempt to use java.lang.reflect to perform a lookup or invocation on a method or field in the client, using information provided in this packet. These invocations/lookups may fail completely, which is fully supported, as various exceptions get caught and special return codes are provided in such cases. An important thing to note, however, is that the server is responsible for not requesting too much, as the client's reply packet has a var-byte size, meaning the entire reply for a reflection check must fit into 255 bytes or fewer. There is no protection against this. Additionally worth noting that the InvokeMethod variant, while very powerful, is not utilized in OldSchool, and is rather dangerous to invoke due to the aforementioned size limitation.

Constructors

Link copied to clipboard
constructor(id: Int, checks: List<ReflectionChecker.ReflectionCheck>)

Types

Link copied to clipboard
class GetFieldModifiers(val className: String, val fieldName: String) : ReflectionChecker.ReflectionCheck

Get field modifiers aims to try to look up a given field's modifiers, if possible.

Link copied to clipboard
class GetFieldValue(val className: String, val fieldName: String) : ReflectionChecker.ReflectionCheck

Get field value is a reflection check which will aim to call the java.lang.reflect.Field.getInt function on the respective field. The value is submitted back in the reply, if a value was obtained.

Link copied to clipboard
class GetMethodModifiers(val className: String, val methodName: String, val parameterClasses: List<String>, val returnClass: String) : ReflectionChecker.ReflectionCheck

Get method modifiers will aim to try and look up a method's modifiers.

Link copied to clipboard
class InvokeMethod(val className: String, val methodName: String, val parameterClasses: List<String>, val parameterValues: List<ByteArray>, val returnClass: String) : ReflectionChecker.ReflectionCheck

Invoke method check aims to try to invoke a function in a class with the provided parameters. The parameterValues are turned into an object using java.io.ObjectInputStream.readObject function.

Link copied to clipboard
sealed interface ReflectionCheck
Link copied to clipboard
class SetFieldValue(val className: String, val fieldName: String, val value: Int) : ReflectionChecker.ReflectionCheck

Set field value aims to try to assign the provided int value to a field in the class.

Properties

Link copied to clipboard
open override val category: ServerProtCategory
Link copied to clipboard

the list of reflection checks to perform.

Link copied to clipboard
val id: Int

the id of the reflection check, sent back in the reply and used to link together the request and reply, which is needed to fully decode the respective replies.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun estimateSize(): Int
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String