-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: Tooling for documentation manual and NASL man (#1194)
* Initial documentation scheme This PR introduces a documentation scheme, which has the goal to centralize the documentation of openvas, including a complete description of NASL * Add: Base documentation Tools This PR adds tools, which allows to generate a HTML Page from the complete documentation and man pages of NASL library functions and programs within the OpenVAS project The man-pages for the nasl library can be generated with './man.sh' or 'make nasl-man' (after build). A HTML documentation can be generated with './html.sh' or 'make manual' (after build). It contains also the man pages as well as the redis documentation. In addition it contains a few discriptions of NASL built-in functions.
- Loading branch information
Showing
35 changed files
with
1,255 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# OpenVAS Documentation (WORK IN PROGRESS) | ||
The new documentation is still a WORK IN PROGRESS!! | ||
|
||
The documentation of this project contains three parts: | ||
1. Doxygen | ||
It is used as a documentation of the internal c library. To build the doxygen documentation call `make doxygen-full`. | ||
|
||
2. Man | ||
In the man folder you can find man pages of the executables of the project. These are automatically installed when calling `make install`. Additionally it is possible to generate man pages of the built-in nasl functions. These can be generated with `make nasl-man`. Be aware that those are currently not automatically installed and pandoc is required in order to be able to generate those. | ||
|
||
3. Manual | ||
It is also possible to generate a general purpose manual of the openvas project. The manual can be generated with `make manual` and contains various information about the OpenVAS project including the NASL-documentation. Also for this pandoc is required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#!/bin/bash | ||
|
||
make_entry() { | ||
toc="$toc<li>" | ||
|
||
line=$(head -n 1 "$entry") | ||
title=${line:2} | ||
|
||
link=$entry | ||
link=${link//manual/html} | ||
link=${link//.md/.html} | ||
link=${link#"$root_dir_prefix"} | ||
|
||
toc="$toc<a href=%ROOT%$link>$title</a>" | ||
|
||
toc="$toc</li>" | ||
} | ||
|
||
recursive_toc() { | ||
if [ $first == 0 ]; then | ||
first=1 | ||
toc="$toc<ul class=\"collapsible\">" | ||
entry="$search_dir"/index.md | ||
make_entry | ||
toc="$toc</ul>" | ||
fi | ||
for entry in "$search_dir"/* | ||
do | ||
toc="$toc<ul class=\"collapsible\">" | ||
# In case of folder iterate through it | ||
if [[ -d $entry ]]; then | ||
search_dir="$entry" | ||
entry="$entry"/index.md | ||
make_entry | ||
entry=${entry//\/index.md/""} | ||
recursive_toc | ||
# Else make an entry for the file | ||
elif [[ -f $entry ]]; then | ||
filename="$(basename -- $entry)" | ||
if [ $filename != index.md ]; then | ||
make_entry | ||
fi | ||
fi | ||
toc="$toc</ul>" | ||
done | ||
} | ||
|
||
create_html_dict() { | ||
dict=$entry | ||
dict=${dict//manual/html} | ||
mkdir $dict | ||
} | ||
|
||
make_html() { | ||
content=$(pandoc -f markdown -t html $entry) | ||
content=${content//.md/.html} | ||
|
||
head_name=$(head -n 1 $entry) | ||
head_name=${head_name//\# /} | ||
|
||
html=$template | ||
html=${html//\%TITLE\%/${head_name}} | ||
html=${html//\%CSS\%/${root_dir}${css_path}} | ||
html=${html//\%JS\%/${root_dir}${js_path}} | ||
toc_relative=${toc//\%ROOT\%/${root_dir}} | ||
html=${html//\%TOC\%/${toc_relative}} | ||
html=${html//\%CONTENT\%/${content}} | ||
|
||
file=$entry | ||
file=${file//manual/html} | ||
file=${file//.md/.html} | ||
|
||
echo "$html" > "$file" | ||
} | ||
|
||
recursive_html() { | ||
for entry in "$search_dir"/* | ||
do | ||
# In case of folder iterate through it | ||
if [[ -d $entry ]]; then | ||
create_html_dict | ||
search_dir="$entry" | ||
root_dir="$root_dir../" | ||
recursive_html | ||
root_dir=${root_dir%"../"} | ||
# Else make an entry for the file | ||
elif [[ -f $entry ]]; then | ||
filename="$(basename -- $entry)" | ||
make_html | ||
fi | ||
done | ||
} | ||
|
||
rm -rf html | ||
mkdir html | ||
mkdir html/css | ||
mkdir html/js | ||
|
||
first=0 | ||
base_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )/ | ||
template=$(<templates/template.html) | ||
root_dir="" | ||
root_dir_prefix="$base_dir"html/ | ||
|
||
cp templates/style.css html/css/ | ||
css_path=css/style.css | ||
cp templates/script.js html/js/ | ||
js_path=js/script.js | ||
|
||
toc="" | ||
|
||
search_dir="$base_dir"manual | ||
recursive_toc | ||
|
||
search_dir="$base_dir"manual | ||
recursive_html | ||
|
||
exit 0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
version=0.1 | ||
date=$(date +"%B %Y") | ||
|
||
make_man () { | ||
head_name=$(head -n 1 $entry) | ||
head_name=${head_name//\# /} | ||
|
||
file=$(tail -n +3 $entry) | ||
file=${file//\#\# /\# } | ||
file="% $head_name($file_ext) Version 1.0 | OpenVAS User Manual"$'\n'$file | ||
|
||
filename=${filename//.md/.${file_ext}} | ||
|
||
echo "$file" | pandoc --standalone -f markdown -t man -o $man_dir/$filename /dev/stdin | ||
} | ||
|
||
recursive_functions () { | ||
for entry in "$search_dir"/* | ||
do | ||
# In case of folder iterate through it | ||
if [[ -d $entry ]]; then | ||
search_dir="$entry" | ||
recursive_functions | ||
# Else make an entry for the file | ||
elif [[ -f $entry ]]; then | ||
filename="$(basename -- $entry)" | ||
if [ $filename != index.md ] && [ $filename ]; then | ||
make_man | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
rm -rf man | ||
mkdir man | ||
|
||
base_dir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
search_dir="$base_dir"/manual/nasl/built-in-functions | ||
man_dir="$base_dir"/man | ||
file_ext="3" | ||
recursive_functions | ||
|
||
exit 0 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# greenbone-nvt-sync | ||
|
||
## NAME | ||
|
||
greenbone-nvt-sync - updates the OpenVAS NVTs from Greenbone Security | ||
Feed or Community Feed | ||
|
||
## SYNOPSIS | ||
|
||
**greenbone-nvt-sync** | ||
|
||
## DESCRIPTION | ||
|
||
The **OpenVAS Scanner** performs several security checks. These are | ||
called Network Vulnerability Tests (NVTs) and are implemented in the | ||
programming language NASL. Some NVTs are wrappers for external tools. As | ||
new vulnerabilities are published every day, new NVTs appear in the | ||
Greenbone Security Feed. This feed is commercial and requires a | ||
respective subscription key. In case no subscription key is present, the | ||
update synchronisation will use the Community Feed instead. | ||
|
||
\ | ||
The script **greenbone-nvt-sync** will fetch all new and updated | ||
security checks and install them at the proper location. Once this is | ||
done OpenVAS Scanner, openvas(1) will automatically detect that new and | ||
updated NVTs are present and consider them for next activities. | ||
|
||
## SEE ALSO | ||
|
||
**[openvas(1)](openvas/openvas.md)** | ||
|
||
## AUTHOR | ||
|
||
This manual page was written by Jan-Oliver Wagner | ||
\<jan-oliver.wagner@greenbone.net\>. | ||
|
||
The **greenbone-nvt-sync** script was written by Greenbone Networks | ||
GmbH. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Introduction | ||
|
||
## GENERAL | ||
|
||
This documentation is meant to get the new standard for the OpenVAS documentation. It will contain general information about different parts of the project, as well as a technical description of the language NASL with its grammar and library functions. In the current state this documentation is far from complete and will fill up by time. | ||
|
||
## SUMMARY | ||
|
||
OpenVAS is a project containing several parts and programs. In general there are two main parts: the OpenVAS Scanner and NASL. The OpenVAS Scanner is more like an engine consisting of a scan management part, which manages different hosts and plugins. Plugins are scripts, interpreted by the NASL interpreter. There is also a standalone program, which allows to run NASL scripts directly without having a running scan. | ||
|
||
To run a scan additional programs are needed. Currently the best way is to use the [Greenbone Vulnerability Manager](https://github.com/greenbone/gvmd), [Greenbone Security Assistant](https://github.com/greenbone/gsa)/[Greenbone Security Assistant HTTP server](https://github.com/greenbone/gsad) and [OSPD-OpenVAS](https://github.com/greenbone/ospd-openvas) | ||
|
||
## SEE ALSO | ||
|
||
**[openvas](openvas/index.md)**, **[NASL](nasl/index.md)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Built-in Functions | ||
|
||
## GENERAL | ||
|
||
The NASL language contains a collection of built-in functions to provide many tools to detect vulnerabilities of a network device. |
26 changes: 26 additions & 0 deletions
26
doc/manual/nasl/built-in-functions/knowledge-base/get_host_kb_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# get_host_kb_index | ||
|
||
## NAME | ||
|
||
**get_host_kb_index** - Get the KB index of the host running the current script | ||
|
||
## SYNOPSIS | ||
|
||
*int* **get_host_kb_index**(name: *string*, value: *any*); | ||
|
||
**get_host_kb_index** takes no arguments | ||
|
||
|
||
## DESCRIPTION | ||
|
||
This function will return the index number of the currently used Redis Database. This index belongs to the host, which is currently scanned. | ||
|
||
|
||
## RETURN VALUE | ||
|
||
KB index, *int* or None, when redis index cannot be determined | ||
|
||
|
||
## SEE ALSO | ||
|
||
**[get_kb_item(3)](get_kb_item.md)**, **[get_kb_list(3)](get_kb_list.md)**, **[replace_kb_item(3)](replace_kb_item.md)**, **[set_kb_item(3)](set_kb_item.md)**, **[openvas-nasl(1)](../../openvas-nasl.md)** |
Oops, something went wrong.