Kotmem
Kotmem copied to clipboard
Easy process, module and memory interfacing through Kotlin on the JVM
##Kotmem Easy process, module and memory interfacing through Kotlin on the JVM
Gradle
compile 'org.jire.kotmem:Kotmem:0.86'
Maven
<dependency>
<groupId>org.jire.kotmem</groupId>
<artifactId>Kotmem</artifactId>
<version>0.86</version>
</dependency>
###One Minute Intro
You can open a process by name:
val process = Processes["just_for_fun.exe"]
Or by ID:
val process = Processes[1337]
Now let's use the process to read at some address. Note that the type can't be inferred by the compiler here, it must be explicit in the value declaration.
val cafeBabe: Int = process[0xCAFEBABE]
Here the compiler can infer that the type is Boolean
, thus we can omit.
if (process[0xBADCAFE]) println("We're in a bad cafe!")
We're also able to write at some address. The data argument provides the type thus the type can always be inferred by the compiler.
process[0xBADCAFE] = false
We can resolve a process' module as well. These are cached by name on first call.
val awesomeDLL = process["awesome.dll"]
With the module we are able to query its address awesomeDLL.address
and name awesomeDLL.name
. These are lazily
initiated and are cached once accessed.
We can also use a module to read and write. Doing so will use the module's address as a base and an offset of such is supplied by the user.
val faceFeed: Short = awesomeDLL[0xFACEFEED]
awesomeDLL[0xFACEFEED] = faceFeed + 1