将openvas xml转换为报表的工具。
OpenVAS-Reporting的Python项目详细描述
OpenVAS报告:
将OpenVASxml转换为报表的工具。
阅读https://openvas-reporting.stijncrevits.be
上的完整文档我分叉OpenVAS2Report因为它无法转换我向它抛出的所有报告
因为我想学习如何使用python处理xml和创建excel文件。
另外,openvas将自己的威胁级别与CVSS评分混合在一起,后者我更喜欢在我的报告中使用。
寻找修复并通过拉取请求提供实际修复将是太多的工作,
所以我选择放弃回购,尝试我自己的东西。
我重新组织了一些文件,删除了一些功能,添加了一些额外的功能,并重写了一些功能。
此时,脚本只输出一种格式的.xlsx文档,这在将来可能(不会)改变。
要求
安装
# install requirements
apt(-get) install python3 python3-pip # Debian, Ubuntu
yum -y install python3 python3-pip # CentOS
dnf install python3 python3-pip # Fedora
pip3 install -r requirements.txt
# clone repo
git clone git@github.com:TheGroundZero/openvas_to_report.git
或者,您可以通过python包安装程序pip安装包。
# Install pip
apt(-get) install python3 python3-pip # Debian, Ubuntu
yum -y install python3 python3-pip # CentOS
dnf install python3 python3-pip # Fedora
# Install the package
pip install OpenVAS-Reporting
用法
# When working from the Git repo
python3 -m openvasreporting -i [OpenVAS xml file(s)] [-o [Output file]] [-f [Output format]] [-l [minimal threat level (n, l, m, h, c)]] [-f [docx template]]
# When using the pip package
OpenVAS-Reporting -i [OpenVAS xml file(s)] [-o [Output file]] [-f [Output format]] [-l [minimal threat level (n, l, m, h, c)]] [-f [docx template]]
参数
Short param | Long param | Description | Required | Default value |
---|---|---|---|---|
-i | --input | Input file(s) | YES | n/a |
-o | --output | Output filename | No | openvas_report |
-f | --format | Output format | No | xlsx |
-l | --level | Minimal level | No | n |
-t | --template | Docx template | No | openvasreporting/src/openvas-template.docx |
示例
使用默认设置从1个openvas xml报表创建excel报表
python3 -m openvasreporting -i openvasreport.xml -f xlsx
使用默认设置从多个openvas报表创建excel报表
# wildcard select
python3 -m openvasreporting -i *.xml -f xlsx
# selective
python3 -m openvasreporting -i openvasreport1.xml -i openvasreport2.xml -f xlsx
从多个openvas报告创建word报告,仅报告高级别和更高级别的威胁,使用自定义模板
python3 -m openvasreporting -i *.xml -o docxreport -f docx -l h -t "/home/user/myOpenvasTemplate.docx"
结果
最终报告(excel格式)将如下所示:
工作表根据CVSS分数排序,并根据漏洞级别着色。
想法
对于未来的功能,我还有一些想法:
- 列出每个主机的漏洞
- 按主机筛选(作用域/排除),如openvas2report中所示
- 单独选择威胁等级(例如无和低;但不选择中、高和暴击)
- 导入其他格式(不仅仅是xml),例如csv,如this issue