-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: documentation for NASL host-functions (#1264)
- Loading branch information
Showing
8 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
doc/manual/nasl/built-in-functions/host-functions/TARGET_IS_IPV6.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,24 @@ | ||
# TARGET_IS_IPV6 | ||
|
||
## NAME | ||
|
||
**TARGET_IS_IPV6** - | ||
|
||
## SYNOPSIS | ||
|
||
*bool* **TARGET_IS_IPV6**(); | ||
|
||
**TARGET_IS_IPV6** takes no arguments | ||
|
||
## DESCRIPTION | ||
|
||
Check if the currently scanned target is an IPv6 address. | ||
|
||
## RETURN VALUE | ||
|
||
*TRUE* if the current target is an IPv6 address, else *FALSE*. In case of an error, *NULL* is returned. | ||
|
||
|
||
## ERROR | ||
|
||
No IP address for the current target is set. |
27 changes: 27 additions & 0 deletions
27
doc/manual/nasl/built-in-functions/host-functions/add_host_name.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,27 @@ | ||
# add_host_name | ||
|
||
## NAME | ||
|
||
**add_host_name** - add a host name to the vhost list | ||
|
||
## SYNOPSIS | ||
|
||
*void* **add_host_name**(hostname: *string*, source: *string*); | ||
|
||
**add_host_name** takes up to 2 named arguments | ||
|
||
## DESCRIPTION | ||
|
||
Expands the with the given hostname. | ||
|
||
The mandatory parameter *hostname* is of type *string*. It contains the hostname which should be added to the list of VHosts | ||
|
||
Additionally a source, how the hostname was detected can be added with the named argument *source* as a *string*. If it is not given, the value *NASL* is set as default. | ||
|
||
## RETURN VALUE | ||
|
||
None | ||
|
||
## ERRORS | ||
|
||
The named argument *hostname* is missing. |
29 changes: 29 additions & 0 deletions
29
doc/manual/nasl/built-in-functions/host-functions/get_host_name_source.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,29 @@ | ||
# get_host_name_source | ||
|
||
## NAME | ||
|
||
**get_host_name_source** - get the hostname source | ||
|
||
## SYNOPSIS | ||
|
||
*string* **get_host_name_source**(hostname: *string*); | ||
|
||
**get_host_name_source** takes one named argument | ||
|
||
## DESCRIPTION | ||
|
||
This function returns the source of detection of a given hostname. | ||
|
||
The named parameter *hostname* is a *string* containing the hostname. | ||
|
||
When no hostname is given, the current scanned host is taken. | ||
|
||
If no virtual hosts are found yet this function always returns *IP-address*. | ||
|
||
## RETURN VALUE | ||
|
||
Source of detection of a given hostname as *string* or *NULL* if hostname unknown | ||
|
||
## SEE ALSO | ||
|
||
**[add_host_name(3)](add_host_name.md)** |
23 changes: 23 additions & 0 deletions
23
doc/manual/nasl/built-in-functions/host-functions/get_host_names.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,23 @@ | ||
# get_host_name | ||
|
||
## NAME | ||
|
||
**get_host_names** - get a list with found hostnames | ||
|
||
## SYNOPSIS | ||
|
||
*array* **get_host_names**(); | ||
|
||
**get_host_names** takes no arguments | ||
|
||
## DESCRIPTION | ||
|
||
Get a list of found hostnames or a IP of the current target in case no hostnames were found yet. | ||
|
||
## RETURN VALUE | ||
|
||
An *array* containing all found hostnames as *string*. The return type is always a NASL array. | ||
|
||
## SEE ALSO | ||
|
||
**[add_host_name(3)](add_host_name.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,7 @@ | ||
# HostFunctions | ||
|
||
## GENERAL | ||
|
||
Host functions are used to get, resolve, compare and add hosts to the vhosts list | ||
|
||
## TABLE OF CONTENT |
25 changes: 25 additions & 0 deletions
25
doc/manual/nasl/built-in-functions/host-functions/resolve_host_name.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,25 @@ | ||
# resolve_host_name | ||
|
||
## NAME | ||
|
||
**resolve_host_name** - get an IP address corresponding to the host name | ||
|
||
## SYNOPSIS | ||
|
||
*string* **resolve_host_name**(hostname: *string*); | ||
|
||
**resolve_host_name** takes one named argument | ||
|
||
## DESCRIPTION | ||
|
||
Tries to resolve the IP of a given hostname as IPv6. | ||
|
||
The named parameter *hostname* is a *string* containing the hostname to resolve. | ||
|
||
## RETURN VALUE | ||
|
||
The resolve IPv6 as *string* or *NULL*, when the hostname could not be resolved or on an error | ||
|
||
## ERRORS | ||
|
||
The named parameter *hostname* is missing |
29 changes: 29 additions & 0 deletions
29
...nual/nasl/built-in-functions/host-functions/resolve_hostname_to_multiple_ips.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,29 @@ | ||
# resolve_hostname_to_multiple_ips | ||
|
||
## NAME | ||
|
||
**resolve_hostname_to_multiple_ips** - resolve a hostname to all found addresses | ||
|
||
## SYNOPSIS | ||
|
||
*array* **resolve_hostname_to_multiple_ips**(hostname: *string*); | ||
|
||
**resolve_hostname_to_multiple_ips** takes one named argument | ||
|
||
## DESCRIPTION | ||
|
||
This function creates a list of addresses a given host resolves to. | ||
|
||
The named argument *hostname* is a *string* containing the hostname to resolve. | ||
|
||
## RETURN VALUE | ||
|
||
A *array* containing all found addresses or *NULL* on error. | ||
|
||
## ERROR | ||
|
||
The named parameter *hostname* is missing | ||
|
||
## NOTE | ||
|
||
Even if no address could be found, an empty NASL array is returned. A NASL array is always resolved to TRUE value even though it is empty. |
29 changes: 29 additions & 0 deletions
29
doc/manual/nasl/built-in-functions/host-functions/same_host.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,29 @@ | ||
# same_host | ||
|
||
## NAME | ||
|
||
**same_host** - compare two hosts | ||
|
||
## SYNOPSIS | ||
|
||
*bool* **same_host**(0: *string*, 1: *string*, cmp_hostname: *bool*); | ||
|
||
**same_host** takes two unnamed arguments and one named argument | ||
|
||
## DESCRIPTION | ||
|
||
Compare if two hosts are the same. | ||
|
||
The first two unnamed arguments are *string* containing the host to compare | ||
|
||
If the named argument *cmp_hostname* is set to *TRUE*, the given hosts are resolved into their hostnames | ||
|
||
## RETURN VALUE | ||
|
||
TRUE if both hosts are the same, else FALSE. In case of an error a *NULL* is returned instead | ||
|
||
## ERRORS | ||
|
||
One of the two positional arguments are missing | ||
|
||
One of the hostnames is too long, max length: 255 |