Projects

CiberLab - Report Generator

Python
CAPE Sandbox
LLM
Cybersecurity
Automation

Development of a modular Python library to process dynamic malware analysis results and generate PDF reports using large language models, data enrichment, and automation.

Automated malware analysis report generation diagram

Introduction

This project is part of CiberLab, a cybersecurity research initiative developed within the University of León and its Robotics Group.

The objective was to develop a Python library capable of transforming technical results from dynamic malware analysis into structured, understandable PDF reports, making the collected information easier to interpret.

The library integrates into CAPE Sandbox as a reporting module, running after a malware sample has been analyzed. Using the results generated by CAPE, it processes the information, leverages large language models (LLMs) to interpret the findings, and produces a document containing the most relevant results.

From the beginning, I designed the solution to be modular, configurable, and reusable, separating the different processing stages to simplify maintenance and support future integrations with other malware analysis tools and LLM providers.

Architecture and Workflow

The system follows a processing pipeline divided into several independent stages:

  1. Preprocessing: receives JSON results from CAPE Sandbox, extracts relevant information, normalizes the data, and reduces the amount of information that needs to be processed by the language model.

  2. Data enrichment: incorporates additional information from services such as VirusTotal and processes relevant analysis elements, including indicators of compromise, detection signatures, and process behavior.

  3. LLM processing: uses the OpenAI API to interpret the collected information and generate structured content, such as analysis summaries, malware characteristics, and initial recommendations.

  4. Postprocessing: validates, cleans, and normalizes the model’s response, correcting potential inconsistencies and adapting the data to the format expected by the document generator.

  5. Report generation: uses ReportLab to automatically produce a PDF organized into sections, tables, and visual elements.

The library also includes specific functionality for processing images and graphically representing process trees obtained during malware analysis.

Its architecture clearly separates data processing, LLM interaction, and result presentation, reducing dependencies between these responsibilities.

Development and Implementation

One of the main objectives during development was to ensure that the solution could evolve without requiring continuous modifications to its internal logic.

To achieve this, I implemented several mechanisms:

  • Modular architecture: separation of the code into independent packages for preprocessing, LLM integration, postprocessing, and PDF generation.

  • Flexible configuration: use of YAML files, execution profiles, and environment variables to manage paths, parameters, models, processing limits, and credentials.

  • Malware data processing: extraction and normalization of information such as malware families, indicators of compromise (IoCs), detection signatures, hashes, and executed processes.

  • Result validation: use of data schemas and configurable cleaning rules to improve the consistency of information produced by the LLM.

  • VirusTotal enrichment: integration of additional information to provide context for the results obtained during dynamic analysis.

  • Document generation: creation of reports using ReportLab, including executive summaries, file information, indicators of compromise, detection signatures, and visual representations.

This design allows individual processing components to be adapted and facilitates the future integration of other analysis formats or language model providers without redesigning the entire library.

Code Quality and Documentation

The project was developed as a Python package managed with Poetry, accompanied by technical documentation generated using Sphinx.

I also configured a continuous integration workflow with GitHub Actions, automating several checks whenever changes are made to the repository:

  • Static code analysis with Ruff.
  • Code formatting checks with Black.
  • Automated test execution with pytest.
  • Sphinx documentation build and validation.

These tools help maintain an organized development structure and support the project’s long-term maintenance and evolution.

Results

The result was a Python library that can be integrated into CAPE Sandbox, capable of automating the transformation of technical malware analysis results into structured, readable PDF reports.

The reports can include information about the analyzed sample, malware classification and family, detected signatures, indicators of compromise, observed behavior, process trees, and initial recommendations.

Example cover page of an automatically generated PDF report

In addition to generating the final document, the library returns structured information about the processed results, facilitating integration with other CiberLab components.

This project allowed me to deepen my experience in Python library development, cybersecurity data processing, language model integration, and pipeline automation, with particular attention to modularity and code maintainability.

Source Code and Documentation

The project is open source and includes publicly available technical documentation describing its modules, configuration, and main features.