This is the code for the exercise in Java code introduction for beginners workshop. The exercise is to build a simple profiler in java to test and see how instrumentation in java using works.
The workshop was presented in DevConf.us 2022.
Then it transformed to Interactive Application Security Testing (IAST) - Under the hood workshop in Hackeriot 2024
There are three modules this project:
-
tested-app
A simple app that just writes to a log a constant message. It is used to test the profiler. -
profiler
A profiler agent that instruments the log method. You should work onh this folder to improve the profiler. It instruments the java.util.logging.Logger.log using JavaAssist. -
profiler-solution
A profiler agent that instruments the log method. This is a solution to the exercises given in the workshop. It instruments the java.util.logging.Logger.log using JavaAssist. -
riddles folder
The riddles folder contains two riddles that can be solved using the profiler. You can find there aREADME
file with the run instructions.
To prepare your work environment, follow these steps:
- IDE.
If you don't have a preferred working IDE, download and install Intellij Community Edition for free. - Maven
Download Maven, the build tool used in this project, from here and extract it to a folder (no installation required). Then, add the maven/build folder to the PATH variable. - JDK
If you don't have a JDK installed, download any version of JDK. The project was tested with JDK 1.8 and JDK 23. You can use IntelliJ to download the JDK by following the steps explained here.
Build the project
mvn install
To execute the tested app without the profiler run
java -jar ./tested-app/target/tested-app-1.0.jar
To execute the tested app with the profiler run
java -javaagent:./profiler/target/profiler-1.0-jar-with-dependencies.jar -jar ./tested-app/target/tested-app-1.0.jar