OpenVAS XML Parser
A Python library for converting OpenVAS XML scan reports to structured JSON format. This parser filters results to only include entries with CVE identifiers, making it easier to process and analyze vulnerability data.
Features
- XML to JSON Conversion: Convert OpenVAS XML reports to structured JSON
- CVE Filtering: Only include results with CVE identifiers
- Structured Output: Clean, consistent JSON format
- CLI Interface: Command-line tool for batch processing
- Minimal Dependencies: Only requires
lxmllibrary
Installation
pip install openvas-xml-parser
Usage
As a Python Library
from openvas_parser import convert_openvas_xml_to_json
# Convert OpenVAS XML to JSON
convert_openvas_xml_to_json("scan_report.xml", "output.json")
As a Command Line Tool
# Convert a single file
openvas-parser scan_report.xml output.json
# Convert multiple files
for file in *.xml; do
openvas-parser "$file" "${file%.xml}.json"
done
Output Format
The parser extracts the following information for each vulnerability:
{
"report": {
"results": {
"result": [
{
"result_id": "result-id",
"result_name": "Vulnerability Name",
"host": {"ip": "192.168.1.1"},
"port": "80",
"threat": "High",
"severity": "8.5",
"cve": "CVE-2021-44228",
"additional_cves": ["CVE-2021-45046"],
"description": "Vulnerability description",
"nvt": {
"name": "NVT Name",
"description": "Detailed description",
"solution": {"text": "Remediation steps"},
"refs": {"ref": [{"type": "cve", "id": "CVE-2021-44228"}]}
}
}
]
}
}
}
API Reference
convert_openvas_xml_to_json(xml_path, json_path)
Convert an OpenVAS XML report to JSON format.
Parameters:
xml_path(str): Path to the OpenVAS XML filejson_path(str): Path where the JSON output will be saved
Returns:
str: Path to the generated JSON file
Raises:
FileNotFoundError: If the XML file doesn't existET.ParseError: If the XML file is malformed
Examples
Basic Usage
from openvas_parser import convert_openvas_xml_to_json
try:
result = convert_openvas_xml_to_json("scan.xml", "output.json")
print(f"Conversion successful: {result}")
except Exception as e:
print(f"Conversion failed: {e}")
Batch Processing
import os
from openvas_parser import convert_openvas_xml_to_json
xml_files = [f for f in os.listdir(".") if f.endswith(".xml")]
for xml_file in xml_files:
json_file = xml_file.replace(".xml", ".json")
try:
convert_openvas_xml_to_json(xml_file, json_file)
print(f"Converted {xml_file} to {json_file}")
except Exception as e:
print(f"Failed to convert {xml_file}: {e}")
Development
Setup Development Environment
git clone https://github.com/yourusername/openvas-xml-parser.git
cd openvas-xml-parser
pip install -e .
Running Tests
python -m pytest tests/
Building Distribution
python setup.py sdist bdist_wheel
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- OpenVAS project for the XML format specification
- Advanced Vulnerability Management System for the original implementation
Changelog
1.0.0
- Initial release
- XML to JSON conversion
- CVE filtering
- CLI interface
Metadata
Release files for openvas-xml-parser 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openvas_xml_parser-1.0.0.tar.gz | 6.6 kB | Without provenance | Details for openvas_xml_parser-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openvas_xml_parser-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for openvas_xml_parser-1.0.0-py3-none-any.whl |
Total release size: 13.3 kB
Release files / openvas_xml_parser-1.0.0.tar.gz
| Download URL | openvas_xml_parser-1.0.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6661b03b6217c7880fdb1ed2dfa64e8f2f811f45be7f7d4c7a7344bb70d48f7
|
|
BLAKE2b-256 checksum How to use checksums |
bbeb5495ad2d3f875f3cb322bcd13ccccfd1752194b4a8e7bff72853a86170d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / openvas_xml_parser-1.0.0-py3-none-any.whl
| Download URL | openvas_xml_parser-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88aaa5c7f4b6879f6245407ca9f359e861adeba425d7fc59e2d989c966e9ecb7
|
|
BLAKE2b-256 checksum How to use checksums |
e11459bfcb256c38e43abd60319a9963e098c5dd4df80b23e56b7f2ddab2c650
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Security for openvas-xml-parser 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.