FSHook/README.md

22 lines
1.5 KiB
Markdown
Raw Normal View History

2022-11-09 23:06:01 +00:00
# Getting Started
## Dependencies
- FirstSpirit installation
- OpenJDK11 (On Windows this gets installed together with FS `C:/Users/<User>/.firstspirit/FSLauncher/jre/11.0.11/jre-win/jdk-11.0.11+9-jre/bin/java.exe`)
- AspectJ https://www.eclipse.org/aspectj/ (already included)
- copy `.firstspirit/FSLauncher/jar/*`, `.firstspirit_<version>/jars/*` (usually located in $HOME) of the FS installation into `lib/`
2022-11-09 23:11:37 +00:00
- Fix some FirstSpirit crap: open `.firstspirit/FSLauncher/jar/fs-isolated-client-<version>.jar` and replace `de/javasoft\plaf\synthetica\SyntheticaIcon.class` with `META-INF\versions\9\de\javasoft\plaf\synthetica\SyntheticaIcon.class`
2022-11-09 23:06:01 +00:00
## Paths
- `<java>` point to your (or FSs) OpenJDK11 installation
- `<aspectjweaver.jar>` can be found in `FSHook/tool`
- `<classpath>` points to `lib/*` and `tool/*`
- The seperator is `:` on Linux and `;` on Windows.
## Building
``` java -cp <classpath> org.aspectj.tools.ajc.Main -sourceroots 'src/' -injars lib/fs-isolated-client-*.jar -outjar bin/uploadPlugin.jar -outxml -9 -Xlintfile .vscode/ajc.properties", ```
2022-11-09 23:14:53 +00:00
(Should give a few warnings but no errors)
2022-11-09 23:06:01 +00:00
## What the hell?
AspectJ is a bytecode manipulation framework. In our case the method `Plugins.getPlugins(ServerConnection, Class, BaseContext)` from `de.espirit.firstspirit.client.plugin.Plugins` gets overriden to load the plugins registered in `com.kallendorf.fshook.CustomLoader.pluginsToLoad` in addition to the default ones.
This allows th execution of arbitrary code within the FirstSprit client.