Skip to content

Commit dc6e9ca

Browse files
author
explodeo
committed
fixed prokect structure and api build process and nessus policy updater
1 parent c4674e4 commit dc6e9ca

10 files changed

Lines changed: 486 additions & 453 deletions

File tree

.gitignore

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
**/__pycache__
2-
3-
# ignore built TGZs and config files
4-
**/dist/*
5-
**.json
6-
**.nmconnection
7-
8-
# ignore RPMs and python deps (download them yourself)
9-
**.exe
10-
**.whl
11-
**.tar.gz
12-
**.tgz
13-
**.zip
14-
**.rpm
15-
16-
**/example-plugins
17-
18-
**/.other
19-
20-
# ignore Nessus Policy files
21-
**.nessus
22-
**.xml
23-
24-
# Ignore system-specific notes
25-
**/Notes
26-
**/notes
27-
28-
# Ignore compiled virtual disks
29-
**.vmdk
30-
**.vhd
31-
**.vdi
32-
33-
# ignore distribution
34-
**/dist
35-
36-
# only keep setup notes
37-
# !./src/Notes/setup.md
38-
39-
# ignore system-specific SCAP data
40-
**/SCAP/*
41-
42-
# only keep the example config JSON
43-
!**example-config.json
1+
**/__pycache__
2+
3+
# ignore built TGZs and config files
4+
**/dist/*
5+
**.json
6+
**.nmconnection
7+
8+
# ignore RPMs and python deps (download them yourself)
9+
**.exe
10+
**.whl
11+
**.tar.gz
12+
**.tgz
13+
**.zip
14+
**.rpm
15+
16+
**/example-plugins
17+
18+
**/.other
19+
20+
# ignore Nessus Policy files
21+
**.nessus
22+
**.xml
23+
24+
# Ignore system-specific notes
25+
**/Notes
26+
**/notes
27+
28+
# Ignore compiled virtual disks
29+
**.vmdk
30+
**.vhd
31+
**.vdi
32+
33+
# ignore distribution
34+
**/dist
35+
36+
# only keep setup notes
37+
# !./src/Notes/setup.md
38+
39+
# ignore system-specific SCAP data
40+
**/SCAP/*
41+
42+
# only keep the example config JSON
43+
!**example-config.json

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2024 Christopher Morcom
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2024 Christopher Morcom
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 131 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,131 @@
1-
# NessusAPI
2-
3-
This project creates provides a couple utilities that culminate in a shrunken-down version of [TenableCore + Nessus](https://docs.tenable.com/tenable-core/Nessus/Content/TenableCore/Introduction_Nessus.htm)
4-
5-
It's annoying that without any of the paid options by Tenable, I can't have a monolithic config file that instantiates scans, and imports credentials into a policy file.
6-
7-
***This fixes that***
8-
9-
The only thing you still have to do is install or rebuild plugins (useful for troubleshooting):
10-
11-
```sh
12-
# Install new plugins
13-
$ nessuscli update PLUGINS.tar.gz
14-
15-
# Recompile plugins manually
16-
$ nessusd -R
17-
```
18-
19-
## NessusAPI
20-
21-
An extension of the [pyTenable](https://github.com/tenable/pyTenable) library for Python written for Python 3.9+.
22-
23-
### [`nessusapi.py`](src/NessusAPI/nessusapi.py)
24-
The [nessusapi](src/NessusAPI/nessusapi.py) implements a few methods, namely `import_policy()` and `add_credentials()` which send a PUT/POST request to the Nessus backend API to add credentials to a specific policy.
25-
26-
The [`example-config.json`](src/NessusAPI/configs/example-config.json) is an example config file. The `credentials` object inside it closely mimics the PUT request data that Nessus executes when it adds credentials to a policy file.
27-
28-
### [`nessus-configure.py`](src/NessusAPI/nessus-configure.py)
29-
Creates a `Nessus` API instance using [`pyTenable`](https://github.com/tenable/pyTenable) and loads Policies/Credentials and scans in using a passed `config.json`
30-
31-
```sh
32-
33-
# Load the Policies/Configs into Nessus
34-
$ nessus-configure -i /path/to/config.json
35-
36-
# Export Complete or Imported Scans
37-
$ nessus-configure -e /path/to/config.json
38-
39-
# You can also programatically interact with nessus:
40-
$ nessus-configure --interactive /path/to/config.json
41-
```
42-
**TODO:** Update nessus-configure to pass args to allow exporting as pdf and csv with all columns.
43-
44-
***NOTE:*** I have a TODO to document the code properly later -- this was a rush job needed for another project of mine.
45-
46-
47-
## "TenableCore" Imitation
48-
49-
This is broken into a couple parts.
50-
51-
- [TenableCore.sh](src/TenableCore/TenableCore.sh) automates installing a built VDI image in virtualbox.
52-
- [build.sh](build.sh) packages this project into `./dist/installer/TenableCore-Builder.tar.gz` which can be installed using this script from within an Oracle 9 VM
53-
- [build_tenablecore.sh](install/build_tenablecore.sh) extracts the tar and configures Nessus for automation provided you have the right pip packages and RPMs from the [DoD Patch Repository](https://patches.csd.disa.mil/)
54-
55-
## NetworkCtl
56-
57-
A small utility script that wraps `nmcli` to clear, list, and load network profiles.</br>
58-
All you need to do is create a `*.nmconnection` file manually or with `nmtui` and put it in `./TenableCore/NetworkManager` and the `build.sh` will install it with permissions: `rw------- root:root /etc/NetworkManager/system-connections/*.nmconnection`
59-
60-
Make sure the syntax is good otherwise it won't load.
61-
62-
The main benefit here is `networkctl load PROFILE` will load all profiles starting with `PROFILE` -- a useful utility for loading an interface and all its VLANs simultaneously.
63-
64-
```sh
65-
# list connection profiles (nmcli con show)
66-
$ networkctl list
67-
68-
# restart networking only loading connections starting with the name eth0_vlan
69-
$ sudo networkctl load eth0_vlan
70-
71-
# clear all network connection profiles
72-
$ sudo networkctl clear
73-
```
74-
75-
***
76-
77-
## Build Process
78-
79-
This is currently in process to be **fully** automated
80-
81-
Recreate distribution files and `scp` them to the VM:
82-
```sh
83-
$ ./build.sh
84-
$ scp ./dist/installer/* root@192.168.56.101:/opt
85-
```
86-
87-
Log into the VM and install/configure ACAS:
88-
```sh
89-
$ cd /opt
90-
$ sudo ./build_tenablecore.sh
91-
```
92-
93-
Watch the prompts in the output to:
94-
- Create and administrative Nessus account
95-
- Set your ACAS classification and other options
96-
- Set 'Enable XML Plugin Attributes' to yes
97-
- exit the nessus configuration script
98-
99-
You can install plugins at this point, load additional configs into `/opt/NessusAPI/configs`, or shut down. </br>
100-
To load plugins, run: `nessuscli update <plugins.tar.gz>`
101-
102-
Remove the build script:
103-
```sh
104-
# rm /tmp/build_tenablecore.sh
105-
```
106-
107-
Once complete, copy the VM virtual disk into `./dist/vm/`. Pack this entire folder to make the portable installation. </br>
108-
You can compress the VM and copy the archive instead using this example:
109-
```sh
110-
$ tar -czvf ./dist/vm/TenableCore.tar.gz -C "~/VirtualBox VMs/TenableCore" TenableCore.vdi
111-
```
112-
113-
***
114-
***
115-
116-
## Test Setup
117-
118-
Note that the purpose of this VM is to scan things on-demand --- as in you plug it in, scan, export, and delete it.
119-
120-
- VirtualBox 7.1
121-
- 8 GB RAM
122-
- 4 Threads
123-
- No usb, shared folders, or audio
124-
- No optical/floppy drives
125-
126-
The VM in use is Oracle 9.4 with the Unbreakable Enterprise Kernel (UEK). <br>
127-
I install using LVM Thin Partitioning on a 20GB disk. KDump is turned off with no security policy enabled.
128-
129-
***
130-
131-
**Side Note:** *I should **probably** rename this to ACAS-API since it's more fitting and I don't want to get sued by Tenable*
1+
# NessusAPI
2+
3+
This project creates provides a couple utilities that culminate in a shrunken-down version of [TenableCore + Nessus](https://docs.tenable.com/tenable-core/Nessus/Content/TenableCore/Introduction_Nessus.htm)
4+
5+
It's annoying that without any of the paid options by Tenable, I can't have a monolithic config file that instantiates scans, and imports credentials into a policy file.
6+
7+
***This fixes that***
8+
9+
The only thing you still have to do is install or rebuild plugins (useful for troubleshooting):
10+
11+
```sh
12+
# Install new plugins
13+
$ nessuscli update PLUGINS.tar.gz
14+
15+
# Recompile plugins manually
16+
$ nessusd -R
17+
```
18+
19+
## NessusAPI
20+
21+
An extension of the [pyTenable](https://github.com/tenable/pyTenable) library for Python written for Python 3.9+.
22+
23+
### [`nessusapi.py`](src/NessusAPI/nessusapi.py)
24+
The [nessusapi](src/NessusAPI/nessusapi.py) implements a few methods, namely `import_policy()` and `add_credentials()` which send a PUT/POST request to the Nessus backend API to add credentials to a specific policy.
25+
26+
The [`example-config.json`](src/NessusAPI/configs/example-config.json) is an example config file. The `credentials` object inside it closely mimics the PUT request data that Nessus executes when it adds credentials to a policy file.
27+
28+
### [`nessus-configure.py`](src/NessusAPI/nessus-configure.py)
29+
Creates a `Nessus` API instance using [`pyTenable`](https://github.com/tenable/pyTenable) and loads Policies/Credentials and scans in using a passed `config.json`
30+
31+
```sh
32+
33+
# Load the Policies/Configs into Nessus
34+
$ nessus-configure -i /path/to/config.json
35+
36+
# Export Complete or Imported Scans
37+
$ nessus-configure -e /path/to/config.json
38+
39+
# You can also programatically interact with nessus:
40+
$ nessus-configure --interactive /path/to/config.json
41+
```
42+
**TODO:** Update nessus-configure to pass args to allow exporting as pdf and csv with all columns.
43+
44+
***NOTE:*** I have a TODO to document the code properly later -- this was a rush job needed for another project of mine.
45+
46+
47+
## "TenableCore" Imitation
48+
49+
This is broken into a couple parts.
50+
51+
- [TenableCore.sh](src/TenableCore/TenableCore.sh) automates installing a built VDI image in virtualbox.
52+
- [build.sh](build.sh) packages this project into `./dist/installer/TenableCore-Builder.tar.gz` which can be installed using this script from within an Oracle 9 VM
53+
- [build_tenablecore.sh](install/build_tenablecore.sh) extracts the tar and configures Nessus for automation provided you have the right pip packages and RPMs from the [DoD Patch Repository](https://patches.csd.disa.mil/)
54+
55+
## NetworkCtl
56+
57+
A small utility script that wraps `nmcli` to clear, list, and load network profiles.</br>
58+
All you need to do is create a `*.nmconnection` file manually or with `nmtui` and put it in `./TenableCore/NetworkManager` and the `build.sh` will install it with permissions: `rw------- root:root /etc/NetworkManager/system-connections/*.nmconnection`
59+
60+
Make sure the syntax is good otherwise it won't load.
61+
62+
The main benefit here is `networkctl load PROFILE` will load all profiles starting with `PROFILE` -- a useful utility for loading an interface and all its VLANs simultaneously.
63+
64+
```sh
65+
# list connection profiles (nmcli con show)
66+
$ networkctl list
67+
68+
# restart networking only loading connections starting with the name eth0_vlan
69+
$ sudo networkctl load eth0_vlan
70+
71+
# clear all network connection profiles
72+
$ sudo networkctl clear
73+
```
74+
75+
***
76+
77+
## Build Process
78+
79+
This is currently in process to be **fully** automated
80+
81+
Recreate distribution files and `scp` them to the VM:
82+
```sh
83+
$ ./build.sh
84+
$ scp ./dist/installer/* root@192.168.56.101:/opt
85+
```
86+
87+
Log into the VM and install/configure ACAS:
88+
```sh
89+
$ cd /opt
90+
$ sudo ./build_tenablecore.sh
91+
```
92+
93+
Watch the prompts in the output to:
94+
- Create and administrative Nessus account
95+
- Set your ACAS classification and other options
96+
- Set 'Enable XML Plugin Attributes' to yes
97+
- exit the nessus configuration script
98+
99+
You can install plugins at this point, load additional configs into `/opt/NessusAPI/configs`, or shut down. </br>
100+
To load plugins, run: `nessuscli update <plugins.tar.gz>`
101+
102+
Remove the build script:
103+
```sh
104+
# rm /tmp/build_tenablecore.sh
105+
```
106+
107+
Once complete, copy the VM virtual disk into `./dist/vm/`. Pack this entire folder to make the portable installation. </br>
108+
You can compress the VM and copy the archive instead using this example:
109+
```sh
110+
$ tar -czvf ./dist/vm/TenableCore.tar.gz -C "~/VirtualBox VMs/TenableCore" TenableCore.vdi
111+
```
112+
113+
***
114+
***
115+
116+
## Test Setup
117+
118+
Note that the purpose of this VM is to scan things on-demand --- as in you plug it in, scan, export, and delete it.
119+
120+
- VirtualBox 7.1
121+
- 8 GB RAM
122+
- 4 Threads
123+
- No usb, shared folders, or audio
124+
- No optical/floppy drives
125+
126+
The VM in use is Oracle 9.4 with the Unbreakable Enterprise Kernel (UEK). <br>
127+
I install using LVM Thin Partitioning on a 20GB disk. KDump is turned off with no security policy enabled.
128+
129+
***
130+
131+
**Side Note:** *I should **probably** rename this to ACAS-API since it's more fitting and I don't want to get sued by Tenable*

0 commit comments

Comments
 (0)