Skip to content
Alex Gowers edited this page Mar 1, 2021 · 1 revision

Java Integration

Lucifer is able to run java code inline with python modules. This means you can switch back and forth between running python functions and java functions at will with modules. The main reason for doing this is to get full access to the speeds of the JVM which contains precompiled java libraries when you run code through it enabling a much faster execution time. This is very powerful for such things as hash cracking or directory busting.

How it works

You first will need a java installation within the .lucifer-jdk directory, you can manually do this or use the in-built command with lucifer to download the JDK automatically and install it to the directory. First choose a java major version from 8 onwards, if you want earlier version than 8 or if you want a specific build of java you will need to do it manually. Then use the following command install_java <java_major> such as install_java 8 . This will download and install the specified major version of the java JDK.

You can remove java version by using uninstall_java <version> where the version is the java version you want to uninstall. For instance if I have jdk8u282-b08 installed I can run uninstall_java 8 which will uninstall ALL jdk8 version installed or I can run uninstall_java 8u282-b08 which will only uninstall the jdk8u282-b08 installed.

To get the listing of java versions lucifer can interact with and their IDs run the command get_java_installs which will show the table of java installs. The ID given to each install will change each time you add a new java version and the ID is used in future commands.

Next we want to set the Java JDK we want to use, to do this we run the following command: set_jdk <id> where the id is equal to the id shown for the specified java version in the get_java_installs command.

Once the JDK is set in lucifer we then want to build all of lucifer's javaModules this contains all the classes, functions and packages that lucifer modules are able to run, each time you change or update any of the java source code you will need to rebuild the javaModules. You cannot rebuild or reload this jar while the jar is already loaded into the JVM.

To load the built lucifer Java Modules jar file into the JVM first we need to start the JVM. To do this run the start_jvm command, the you can load the jar file with load_lucifer_jar which will load all of lucifer's java classes, functions and packages. Note that you do not need to rebuild the lucifer jar file every time before the load_lucifer_jar command because lucifer automatically caches the jar ready for next use, you only need to rebuild if you update or change any java code.

Now that the lucifer JVM is running, you are able to run lucifer modules that depend of java code to run. If you want to test if you setup everything correctly run the java test module by running use auxiliary/test_java the run the module. It will then tell you if you have everything setup correctly or if you need to make changes.

Clone this wiki locally