Skip to content

Commit 341a8fc

Browse files
Merge pull request #5 from LimberDuck/develop
v0.4.0
2 parents de631d8 + e616a2d commit 341a8fc

21 files changed

+792
-238
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Python package
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
workflow_dispatch:
9+
10+
env:
11+
python_package_name: nessus-file-reader
12+
folder_package_name: nessus_file_reader
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
python-version: [3.7, 3.8, 3.9]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install tools
30+
run: |
31+
python -m pip install --upgrade pip build
32+
- name: Install dependencies
33+
run: |
34+
pip install -r requirements.txt
35+
- name: Build package
36+
run: python -m build
37+
38+
- name: Install locally
39+
run: |
40+
ls
41+
ls dist
42+
TOOL_CURRENT_VERSION=`sed -e 's/.*__version__ = "\(.*\)".*/\1/' ${{ env.folder_package_name }}/_version.py`
43+
pip install dist/${{ env.folder_package_name }}-${TOOL_CURRENT_VERSION}-py3-none-any.whl
44+
shell: bash
45+
- name: pip show package
46+
run: |
47+
pip show ${{ env.python_package_name }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
jobs:
16+
deploy:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '3.x'
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install build
30+
- name: Build package
31+
run: python -m build
32+
- name: Publish package
33+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
34+
with:
35+
user: __token__
36+
password: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ This document records all notable changes to [nessus file reader by LimberDuck][
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.0] - 2022-05-13
9+
10+
### Added
11+
12+
- **commandline interface** - from now on this package will provide you possibility to run `nfr` in commandline. After installation type `nf` or `nfr --help` to find out more.
13+
- **Tenable.io files support** - initial support to pars nessus files coming from Tenable.io
14+
15+
816
## [0.3.0] - 2020-07-25
917

1018
### Added
@@ -26,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2634

2735
- Initial release
2836

37+
[0.4.0]: https://github.com/LimberDuck/nessus-file-reader/compare/v0.3.0...v0.4.0
2938
[0.3.0]: https://github.com/LimberDuck/nessus-file-reader/compare/v0.2.0...v0.3.0
3039
[0.2.0]: https://github.com/LimberDuck/nessus-file-reader/compare/v0.1.0...v0.2.0
3140
[0.1.0]: https://github.com/LimberDuck/nessus-file-reader/releases/tag/v0.1.0

README.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# nessus file reader
2+
3+
**nessus file reader** by LimberDuck (pronounced *ˈlɪm.bɚ dʌk*) is a CLI tool
4+
and python module created to quickly parse nessus files containing the results
5+
of scans performed by using Nessus by (C) Tenable, Inc. This module will let
6+
you get data through functions grouped into categories like file, scan, host
7+
and plugin to get specific information from the provided nessus scan files.
8+
9+
[![Latest Release version](https://img.shields.io/github/v/release/LimberDuck/nessus-file-reader?label=Latest%20release)](https://github.com/LimberDuck/nessus-file-reader/releases)
10+
[![GitHub Release Date](https://img.shields.io/github/release-date/limberduck/nessus-file-reader?label=released&logo=GitHub)](https://github.com/LimberDuck/nessus-file-reader/releases)
11+
[![PyPI - Downloads](https://img.shields.io/pypi/dm/nessus-file-reader?logo=PyPI)](https://pypistats.org/packages/nessus-file-reader)
12+
13+
[![License](https://img.shields.io/github/license/LimberDuck/nessus-file-reader.svg)](https://github.com/LimberDuck/nessus-file-reader/blob/master/LICENSE)
14+
[![Repo size](https://img.shields.io/github/repo-size/LimberDuck/nessus-file-reader.svg)](https://github.com/LimberDuck/nessus-file-reader)
15+
[![Code size](https://img.shields.io/github/languages/code-size/LimberDuck/nessus-file-reader.svg)](https://github.com/LimberDuck/nessus-file-reader)
16+
[![Supported platform](https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux-lightgrey.svg)](https://github.com/LimberDuck/nessus-file-reader)
17+
18+
## Main features
19+
20+
* read data from nessus files containing results of scans performed by using Nessus by (C) Tenable, Inc.
21+
* use it in CLI or as python module
22+
23+
> Check code [examples].
24+
25+
26+
## Installation
27+
28+
> **Note:**
29+
> It's advisable to use python virtual environment for below instructions. Read more about python virtual environment in [The Hitchhiker’s Guide to Python!](https://docs.python-guide.org/dev/virtualenvs/)
30+
>
31+
>Read about [virtualenvwrapper in The Hitchhiker’s Guide to Python!](https://docs.python-guide.org/dev/virtualenvs/#virtualenvwrapper): [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io) provides a set of commands which makes working with virtual environments much more pleasant.
32+
33+
34+
Install **nessus file reader**
35+
36+
`pip install nessus-file-reader`
37+
38+
> To upgrade to newer version run:
39+
>
40+
> `pip install -U nessus-file-reader`
41+
42+
43+
## Use
44+
45+
### Use in CLI
46+
47+
1. Run **nessus file reader**
48+
49+
`nfr`
50+
51+
2. Check help for commands
52+
53+
`nfr [command] --help` e.g. `nfr file --help`
54+
55+
### Use as python module
56+
57+
1. Import `nessus-file-reader` module.
58+
59+
```python
60+
import nessus_file_reader as nfr
61+
```
62+
63+
2. Use `file` functions to get details about provided file e.g. root, file name, file size.
64+
65+
```python
66+
import nessus_file_reader as nfr
67+
68+
nessus_scan_file = './your_nessus_file.nessus'
69+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
70+
file_name = nfr.file.nessus_scan_file_name_with_path(nessus_scan_file)
71+
file_size = nfr.file.nessus_scan_file_size_human(nessus_scan_file)
72+
print(f'File name: {file_name}')
73+
print(f'File size: {file_size}')
74+
```
75+
76+
3. Use `scan` functions to get details about provided scan e.g. report name, number of target/scanned/credentialed hosts, scan time start/end/elapsed and more.
77+
78+
```python
79+
import nessus_file_reader as nfr
80+
nessus_scan_file = './your_nessus_file.nessus'
81+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
82+
83+
report_name = nfr.scan.report_name(root)
84+
number_of_target_hosts = nfr.scan.number_of_target_hosts(root)
85+
number_of_scanned_hosts = nfr.scan.number_of_scanned_hosts(root)
86+
number_of_scanned_hosts_with_credentialed_checks_yes = nfr.scan.number_of_scanned_hosts_with_credentialed_checks_yes(root)
87+
scan_time_start = nfr.scan.scan_time_start(root)
88+
scan_time_end = nfr.scan.scan_time_end(root)
89+
scan_time_elapsed = nfr.scan.scan_time_elapsed(root)
90+
print(f' Report name: {report_name}')
91+
print(f' Number of target/scanned/credentialed hosts: {number_of_target_hosts}/{number_of_scanned_hosts}/{number_of_scanned_hosts_with_credentialed_checks_yes}')
92+
print(f' Scan time START - END (ELAPSED): {scan_time_start} - {scan_time_end} ({scan_time_elapsed})')
93+
```
94+
95+
4. Use `host` functions to get details about hosts from provided scan e.g. report hosts names, operating system, hosts scan time start/end/elapsed, number of Critical/High/Medium/Low/None findings and more.
96+
97+
```python
98+
import nessus_file_reader as nfr
99+
nessus_scan_file = './your_nessus_file.nessus'
100+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
101+
102+
for report_host in nfr.scan.report_hosts(root):
103+
report_host_name = nfr.host.report_host_name(report_host)
104+
report_host_os = nfr.host.detected_os(report_host)
105+
report_host_scan_time_start = nfr.host.host_time_start(report_host)
106+
report_host_scan_time_end = nfr.host.host_time_end(report_host)
107+
report_host_scan_time_elapsed = nfr.host.host_time_elapsed(report_host)
108+
report_host_critical = nfr.host.number_of_plugins_per_risk_factor(report_host, 'Critical')
109+
report_host_high = nfr.host.number_of_plugins_per_risk_factor(report_host, 'High')
110+
report_host_medium = nfr.host.number_of_plugins_per_risk_factor(report_host, 'Medium')
111+
report_host_low = nfr.host.number_of_plugins_per_risk_factor(report_host, 'Low')
112+
report_host_none = nfr.host.number_of_plugins_per_risk_factor(report_host, 'None')
113+
print(f' Report host name: {report_host_name}')
114+
print(f' Report host OS: {report_host_os}')
115+
print(f' Host scan time START - END (ELAPSED): {report_host_scan_time_start} - {report_host_scan_time_end} ({report_host_scan_time_elapsed})')
116+
print(f' Critical/High/Medium/Low/None findings: {report_host_critical}/{report_host_high}/{report_host_medium}/{report_host_low}/{report_host_none}')
117+
```
118+
119+
5. Use `plugin` functions to get details about plugins reported in provided scan e.g. plugins ID, plugins risk factor, plugins name.
120+
121+
```python
122+
import nessus_file_reader as nfr
123+
nessus_scan_file = './your_nessus_file.nessus'
124+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
125+
126+
for report_host in nfr.scan.report_hosts(root):
127+
report_items_per_host = nfr.host.report_items(report_host)
128+
for report_item in report_items_per_host:
129+
plugin_id = int(nfr.plugin.report_item_value(report_item, 'pluginID'))
130+
risk_factor = nfr.plugin.report_item_value(report_item, 'risk_factor')
131+
plugin_name = nfr.plugin.report_item_value(report_item, 'pluginName')
132+
print('\t', plugin_id, ' \t\t\t', risk_factor, ' \t\t\t', plugin_name)
133+
```
134+
135+
6. If you want to get output for interesting you plugin e.g. "Nessus Scan Information" use below function
136+
137+
```python
138+
import nessus_file_reader as nfr
139+
nessus_scan_file = './your_nessus_file.nessus'
140+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
141+
142+
for report_host in nfr.scan.report_hosts(root):
143+
pido_19506 = nfr.plugin.plugin_output(root, report_host, '19506')
144+
print(f'Nessus Scan Information Plugin Output:\n{pido_19506}')
145+
```
146+
147+
7. If you know that interesting you plugin occurs more than ones for particular host e.g. "Netstat Portscanner (SSH)" use below function
148+
149+
```python
150+
import nessus_file_reader as nfr
151+
nessus_scan_file = './your_nessus_file.nessus'
152+
root = nfr.file.nessus_scan_file_root_element(nessus_scan_file)
153+
154+
for report_host in nfr.scan.report_hosts(root):
155+
pidos_14272 = nfr.plugin.plugin_outputs(root, report_host, '14272')
156+
print(f'All findings for Netstat Portscanner (SSH): \n{pidos_14272}')
157+
```
158+
159+
## Meta
160+
161+
### Change log
162+
163+
See [CHANGELOG].
164+
165+
### Licence
166+
167+
GNU GPLv3: [LICENSE].
168+
169+
### Authors
170+
171+
[Damian Krawczyk] created **[nessus file reader]** by [LimberDuck].
172+
173+
[nessus file reader]: https://limberduck.org/en/latest/tools/nessus-file-reader
174+
[Damian Krawczyk]: https://damiankrawczyk.com
175+
[LimberDuck]: https://limberduck.org
176+
[CHANGELOG]: https://github.com/LimberDuck/nessus-file-reader/blob/master/CHANGELOG.md
177+
[LICENSE]: https://github.com/LimberDuck/nessus-file-reader/blob/master/LICENSE
178+
[examples]: https://github.com/LimberDuck/nessus-file-reader/tree/master/examples

0 commit comments

Comments
 (0)