Skip to content

Latest commit

 

History

History
68 lines (53 loc) · 2.7 KB

security-openvas.md

File metadata and controls

68 lines (53 loc) · 2.7 KB

Security - OpenVAS

CLI

# XML handling utils to make life easier
apt-get install -y  libxml2-utils
pip install https://github.com/hay/xml2json/zipball/master

# Update definitions
greenbone-nvt-sync
openvasmd --rebuild --progress

# List all targets
omp -u admin -w admin  --xml='<get_targets/>'

# Create a target
omp --xml='<create_target><name>Docker - Local</name><hosts>192.168.99.101</hosts></create_target>'

# Confirm target was added
omp --xml='<get_targets/>'

# Get tasks running
omp --xml='<get_tasks/>'

# Get config listings of types of scans
omp --pretty-print --xml='<get_configs/>'

# Create a task
omp --xml='<create_task><name>ScanWebserver</name><config id="698f691e-7489-11df-9d8c-002264764cea"/><target id="b34578b3-2c0e-485f-9cda-38ecd63ea40c"/></create_task>'

# Start the task
omp --pretty-print -xml='<start_task task_id="8d5e6664-709f-4275-a661-158feb596386" />'

# Get detailed info on the task
omp --pretty-print --xml='<get_tasks task_id="8d5e6664-709f-4275-a661-158feb596386" details="1"/>'

# Get report formats
omp --xml='<get_report_formats/>' | grep -i -A4 '<report_format id=' | egrep -i '(format|name>[a-z]+)'

# Output the report
omp --pretty-print --xml='<get_reports report_id="adb7dc80-f3e8-4231-9533-56bd45c2c3a5" format_id="c1645568-627a-11e3-a660-406186ea4fc5" max_results="200" />' > report.xml
xmllint --xpath 'string(/get_reports_response/report)' report.xml  | head -n -16 |  base64 --decode > report.csv
from __future__ import print_function
import openvas
manager = openvas.omplib.OMPClient(host=sensor)
manager.open(username, password)
print(manager.get_targets())

Links