This initiative consist of three parts:
- scraper
- Targeted on Spring projects.
- Go through the source code of the Java program and extract the information about exposed endpoints.
- Uses spring annotations like
@RequestMapping
,@GetMapping
,PathVariable
. - Result is a list of endpoints with their HTTP methods and parameters (format accepted by the invoker).
- see the scraper for more information.
- injector
- Works on java bytecode level.
- Injects printing statement to the beginning of each method providing information about how many times and who called the application.
- Running as a Java agent.
- see the injector for more information.
- invoker
- The invoker is a tool that sends requests to the exposed endpoints of the target application.
- The implementation is written in Python.
- see the invoker in this GitHub repository.
- Run the scraper on the target project to easily identify endpoint to call to be able to collect dynamic data in the next steps.
- Run
java -jar scraper.jar <path-to-analyzed-project>
to get the list of endpoints.
- Run
- Run your project jar with the injector as a java agent.
- Run
java -javaagent=injector.jar -jar <path-to-analyzed-jar>
to inject the printing statements to the bytecode of the given jar file.
- Run
- There are two approaches how to collect the dynamic calls:
- Use the injected jar and use it as you usually do. This approach is the best possible as it will collect the calls based on the real usage of the application.
- Use the invoker to send requests to the exposed endpoints. The invoker will create an artificial load for your application.