The OpenVAS vulnerability scanner is a comprehensive vulnerability assessment system that can detect security issues in all manner of servers and network devices. It is a powerful tool that can be used to identify and remediate vulnerabilities before they can be exploited by attackers.
OpenVAS is a free and open-source tool, which means that it is available for anyone to use and modify. It is also a modular tool, which means that it can be customized to meet the specific needs of an organization.
OpenVAS uses a variety of techniques to scan for vulnerabilities, including:
- Network scanning: OpenVAS can scan for vulnerabilities on a network by scanning the ports of each device on the network.
- Host scanning: OpenVAS can scan for vulnerabilities on a host by scanning the files and services on the host.
- Web application scanning: OpenVAS can scan for vulnerabilities in web applications by scanning the code of the application.
Once OpenVAS has scanned a device, it will generate a report that lists the vulnerabilities that were found. The report will also include information about the severity of each vulnerability and how to remediate it.
OpenVAS is a powerful tool that can be used to improve the security of any organization’s network. It is a free and open-source tool, which makes it an attractive option for organizations of all sizes.
Here are some of the benefits of using OpenVAS:
- Improved security: OpenVAS can help to identify and remediate vulnerabilities before they can be exploited by attackers.
- Reduced costs: OpenVAS can help to reduce the costs of security breaches by identifying vulnerabilities before they can be exploited.
- Increased compliance: OpenVAS can help to ensure compliance with security regulations.
If you are looking for a way to improve the security of your network, then you should consider using OpenVAS. It is a powerful tool that can help you to identify and remediate vulnerabilities before they can be exploited by attackers.
Installing the openVAS vulnerability scanner
OpenVAS (Open Vulnerability Assessment System) is a powerful open-source vulnerability scanner. The installation steps can vary slightly depending on the Linux distribution you are using. Below are general instructions for installing OpenVAS on Ubuntu, which is a widely used Linux distribution.
Install OpenVAS on Ubuntu:
- Update Package Lists:
sudo apt-get update- Install Required Packages:
sudo apt-get install -y openvas- Initialize OpenVAS:
sudo gvm-setup
sudo openvas-setup
sudo gvm-check-setupFollow the prompts during the setup to configure OpenVAS. This process may take some time as it downloads and installs various components.
- Start OpenVAS:
sudo systemctl start openvas-scanner
sudo systemctl start openvas-manager
sudo systemctl start openvas-gsa- Enable OpenVAS Services to Start on Boot:
sudo systemctl enable openvas-scanner
sudo systemctl enable openvas-manager
sudo systemctl enable openvas-gsa- Access OpenVAS Web Interface:
Open a web browser and go tohttps://localhost:4000(or replacelocalhostwith the IP address of your server). The default login credentials are:
- Username:
admin - Password:
adminChange the password immediately after the first login.
- Update NVTs (Network Vulnerability Tests):
After the initial setup, it’s essential to update the NVTs to ensure the scanner has the latest vulnerability information.
sudo openvas-feed-update
sudo openvas-nvt-sync
sudo openvas-scapdata-sync
sudo openvas-certdata-syncNotes:
- The setup process might prompt you to configure various settings. Follow the on-screen instructions.
- Ensure that your server has sufficient resources (CPU, RAM) to run OpenVAS effectively.
- The default setup uses self-signed SSL certificates. For a production environment, you might consider replacing them with valid certificates.
- Remember to keep OpenVAS and its NVTs up to date for accurate vulnerability scanning.
These instructions are tailored for Ubuntu. If you are using a different Linux distribution, the package manager and specific package names may vary. Always refer to the official documentation or community resources for your specific distribution for the most accurate information.
Accessing openVAS with python
GVM (Greenbone Vulnerability Management)
The provided Python script uses the gvm library to interact with the Greenbone Vulnerability Management (GVM) protocol. This script specifically connects to a GVM server, retrieves the GMP (Greenbone Management Protocol) version, and prints it.
#!/usr/bin/env python3
import gvm
from gvm.protocols.latest import Gmp
# Establish a TLS connection to the GVM server
connection = gvm.connections.TLSConnection(hostname='localhost')
# Use the GMP protocol to interact with the GVM server
with Gmp(connection=connection) as gmp:
# Get and print the GMP version
version = gmp.get_version()
print(version)Explanation:
Shebang and Imports:
#!/usr/bin/env python3: Specifies the Python interpreter to be used.import gvm: Imports thegvmlibrary, which provides an interface for interacting with the Greenbone Vulnerability Management (GVM) protocol.from gvm.protocols.latest import Gmp: Specifically imports the GMP (Greenbone Management Protocol) from the latest version of the GVM protocol.
TLS Connection to GVM Server:
connection = gvm.connections.TLSConnection(hostname='localhost')- Creates a TLS (Transport Layer Security) connection object to the GVM server running on
localhost. Adjust thehostnameparameter based on the actual GVM server address.
Using GMP Protocol:
with Gmp(connection=connection) as gmp:- Initiates a connection to the GVM server using the GMP protocol within a
withstatement. Thewithstatement ensures proper handling of resources.
Getting and Printing GMP Version:
version = gmp.get_version()
print(version)- Calls the
get_versionmethod to retrieve the GMP version from the connected GVM server. - Prints the retrieved GMP version to the console.
Note:
- The script assumes that a GVM server is running on
localhost. Update thehostnameparameter in theTLSConnectionconstructor to match the actual address of your GVM server. - Ensure that the
gvmlibrary is installed before running the script. You can install it usingpip install gvm-tools. - The
TLSConnectionindicates that the script is using a secure TLS connection. Ensure that your GVM server is configured to support TLS connections. - This script provides a simple example of how to establish a connection to a GVM server and retrieve information. Depending on your use case, you may need to extend the script to perform additional tasks with the GVM API.
GVM
This Python script interacts with the Greenbone Vulnerability Management (GVM) API to retrieve information about users, tasks, targets, scanners, configurations, feeds, and Network Vulnerability Tests (NVTs). Here’s an explanation of the code:
#!/usr/bin/env python3
import gvm
from gvm.protocols.latest import Gmp
from gvm.transforms import EtreeCheckCommandTransform
from gvm.errors import GvmError
# Create a TLS connection to the GVM server
connection = gvm.connections.TLSConnection(hostname='localhost')
# GVM server login credentials
username = 'admin'
password = 'admin'
# Create a command transform for processing XML output
transform = EtreeCheckCommandTransform()
try:
# Connect to GVM server using the Gmp class
with Gmp(connection=connection, transform=transform) as gmp:
# Authenticate with GVM server
gmp.authenticate(username, password)
# Get information about users, tasks, targets, scanners, configs, feeds, and nvts
users = gmp.get_users()
tasks = gmp.get_tasks()
targets = gmp.get_targets()
scanners = gmp.get_scanners()
configs = gmp.get_configs()
feeds = gmp.get_feeds()
nvts = gmp.get_nvts()
# Print information about users
print("Users\n------------")
for user in users.xpath('user'):
print(user.find('name').text)
# Print information about tasks
print("\nTasks\n------------")
for task in tasks.xpath('task'):
print(task.find('name').text)
# Print information about targets
print("\nTargets\n-------------")
for target in targets.xpath('target'):
print(target.find('name').text)
print(target.find('hosts').text)
# Print information about scanners
print("\nScanners\n-------------")
for scanner in scanners.xpath('scanner'):
print(scanner.find('name').text)
# Print information about configs
print("\nConfigs\n-------------")
for config in configs.xpath('config'):
print(config.find('name').text)
# Print information about feeds
print("\nFeeds\n-------------")
for feed in feeds.xpath('feed'):
print(feed.find('name').text)
# Print information about NVTs
print("\nNVTs\n-------------")
for nvt in nvts.xpath('nvt'):
print(nvt.attrib.get('oid'), "-->", nvt.find('name').text)
except GvmError as error:
print('Error connecting with the GVM server:', error)Explanation:
- TLS Connection:
- The script creates a TLS connection to the GVM server with the specified hostname (‘localhost’ in this case).
- GVM Server Credentials:
- The GVM server login credentials (
usernameandpassword) are provided for authentication.
- The GVM server login credentials (
- Command Transform:
- The
EtreeCheckCommandTransformis used to transform XML command output for processing.
- The
- GVM Authentication:
- The script authenticates with the GVM server using the
Gmpclass.
- The script authenticates with the GVM server using the
- Retrieve Information:
- Information about users, tasks, targets, scanners, configs, feeds, and nvts is retrieved using various
get_methods provided by the Gmp class.
- Information about users, tasks, targets, scanners, configs, feeds, and nvts is retrieved using various
- Print Information:
- The script prints information about users, tasks, targets, scanners, configs, feeds, and NVTs to the console.
- Exception Handling:
- If there is an error connecting with the GVM server, a
GvmErrorexception is caught, and an error message is printed.
- If there is an error connecting with the GVM server, a
Usage:
- Save this script in a file, e.g.,
gvm_script.py. - Run the script from the command line, providing the GVM server login credentials:
python gvm_script.py --login admin --password adminNote:
- Ensure that the GVM server is running and accessible.
- Modify the
hostname,username, andpasswordvariables based on your GVM server configuration. - Adjust the script as needed based on the specific requirements of your GVM environment.
