OpenVAS Libraries
9.0.3
|
Implementation of API to handle NVT Info datasets. More...
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <utime.h>
#include "nvti.h"
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "lib nvti" |
Functions | |
nvtpref_t * | nvtpref_new (gchar *name, gchar *type, gchar *dflt) |
Create a new nvtpref structure filled with the given values. More... | |
void | nvtpref_free (nvtpref_t *np) |
Free memory of a nvtpref structure. More... | |
gchar * | nvtpref_name (const nvtpref_t *np) |
Get the Name of a NVT Preference. More... | |
gchar * | nvtpref_type (const nvtpref_t *np) |
Get the Type of a NVT Preference. More... | |
gchar * | nvtpref_default (const nvtpref_t *np) |
Get the Default of a NVT Preference. More... | |
nvti_t * | nvti_new (void) |
Create a new (empty) nvti structure. More... | |
void | nvti_free (nvti_t *n) |
Free memory of a nvti structure. More... | |
gchar * | nvti_oid (const nvti_t *n) |
Get the OID string. More... | |
gchar * | nvti_version (const nvti_t *n) |
Get the version. More... | |
gchar * | nvti_name (const nvti_t *n) |
Get the name. More... | |
gchar * | nvti_copyright (const nvti_t *n) |
Get the copyright notice. More... | |
gchar * | nvti_cve (const nvti_t *n) |
Get the CVE references. More... | |
gchar * | nvti_bid (const nvti_t *n) |
Get the bid references. More... | |
gchar * | nvti_xref (const nvti_t *n) |
Get the xref's. More... | |
gchar * | nvti_tag (const nvti_t *n) |
Get the tag. More... | |
gchar * | nvti_cvss_base (const nvti_t *n) |
Get the CVSS base. More... | |
gchar * | nvti_dependencies (const nvti_t *n) |
Get the dependencies list. More... | |
gchar * | nvti_required_keys (const nvti_t *n) |
Get the required keys list. More... | |
gchar * | nvti_mandatory_keys (const nvti_t *n) |
Get the mandatory keys list. More... | |
gchar * | nvti_excluded_keys (const nvti_t *n) |
Get the excluded keys list. More... | |
gchar * | nvti_required_ports (const nvti_t *n) |
Get the required ports list. More... | |
gchar * | nvti_required_udp_ports (const nvti_t *n) |
Get the required udp ports list. More... | |
gchar * | nvti_family (const nvti_t *n) |
Get the family name. More... | |
guint | nvti_pref_len (const nvti_t *n) |
Get the number of preferences of the NVT. More... | |
const nvtpref_t * | nvti_pref (const nvti_t *n, guint p) |
Get the n'th preferences of the NVT. More... | |
gint | nvti_timeout (const nvti_t *n) |
Get the timeout for this NVT. More... | |
gint | nvti_category (const nvti_t *n) |
Get the category for this NVT. More... | |
int | nvti_set_oid (nvti_t *n, const gchar *oid) |
Set the OID of a NVT Info. More... | |
int | nvti_set_version (nvti_t *n, const gchar *version) |
Set the version of a NVT. More... | |
int | nvti_set_name (nvti_t *n, const gchar *name) |
Set the name of a NVT. More... | |
int | nvti_set_copyright (nvti_t *n, const gchar *copyright) |
Set the copyright of a NVT. More... | |
int | nvti_set_cve (nvti_t *n, const gchar *cve) |
Set the CVE references of a NVT. More... | |
int | nvti_set_bid (nvti_t *n, const gchar *bid) |
Set the bid references of a NVT. More... | |
int | nvti_set_xref (nvti_t *n, const gchar *xref) |
Set the xrefs of a NVT. More... | |
int | nvti_set_tag (nvti_t *n, const gchar *tag) |
Set the tags of a NVT. More... | |
int | nvti_set_cvss_base (nvti_t *n, const gchar *cvss_base) |
Set the CVSS base of an NVT. More... | |
int | nvti_set_dependencies (nvti_t *n, const gchar *dependencies) |
Set the dependencies of a NVT. More... | |
int | nvti_set_required_keys (nvti_t *n, const gchar *required_keys) |
Set the required keys of a NVT. More... | |
int | nvti_set_mandatory_keys (nvti_t *n, const gchar *mandatory_keys) |
Set the mandatory keys of a NVT. More... | |
int | nvti_set_excluded_keys (nvti_t *n, const gchar *excluded_keys) |
Set the excluded keys of a NVT. More... | |
int | nvti_set_required_ports (nvti_t *n, const gchar *required_ports) |
Set the required ports of a NVT. More... | |
int | nvti_set_required_udp_ports (nvti_t *n, const gchar *required_udp_ports) |
Set the required udp ports of a NVT. More... | |
int | nvti_set_family (nvti_t *n, const gchar *family) |
Set the family of a NVT. More... | |
int | nvti_set_timeout (nvti_t *n, const gint timeout) |
Set the timout of a NVT Info. More... | |
int | nvti_set_category (nvti_t *n, const gint category) |
Set the category type of a NVT Info. More... | |
int | nvti_add_cve (nvti_t *n, const gchar *cve_id) |
Add a single CVE ID of a NVT. More... | |
int | nvti_add_bid (nvti_t *n, const gchar *bid_id) |
Add a single BID ID of a NVT. More... | |
int | nvti_add_required_keys (nvti_t *n, const gchar *key) |
Add a required key of a NVT. More... | |
int | nvti_add_mandatory_keys (nvti_t *n, const gchar *key) |
Add a mandatory key of a NVT. More... | |
int | nvti_add_excluded_keys (nvti_t *n, const gchar *key) |
Add a excluded key of a NVT. More... | |
int | nvti_add_required_ports (nvti_t *n, const gchar *port) |
Add a required port of a NVT. More... | |
int | nvti_add_required_udp_ports (nvti_t *n, const gchar *port) |
Add a required udp port of a NVT. More... | |
int | nvti_add_pref (nvti_t *n, nvtpref_t *np) |
Add a preference to the NVT Info. More... | |
nvtis_t * | nvtis_new (void) |
Make a collection of NVT Infos. More... | |
void | nvtis_free (nvtis_t *nvtis) |
Free a collection of NVT Infos. More... | |
void | nvtis_add (nvtis_t *nvtis, nvti_t *nvti) |
Add an NVT Info to a collection of NVT Infos. More... | |
nvti_t * | nvtis_lookup (nvtis_t *nvtis, const char *oid) |
Add an NVT Info to a collection of NVT Infos. More... | |
Implementation of API to handle NVT Info datasets.
This file contains all methods to handle NVT Information datasets (nvti_t).
The module consequently uses glib datatypes and api for memory management etc.
Definition in file nvti.c.
int nvti_add_bid | ( | nvti_t * | n, |
const gchar * | bid_id | ||
) |
Add a single BID ID of a NVT.
n | The NVT Info structure. |
bid_id | The BID ID to add. A copy will be created from this. |
Definition at line 929 of file nvti.c.
References nvti::bid.
Referenced by script_bugtraq_id().
int nvti_add_cve | ( | nvti_t * | n, |
const gchar * | cve_id | ||
) |
Add a single CVE ID of a NVT.
n | The NVT Info structure. |
cve_id | The CVE ID to add. A copy will be created from this. |
Definition at line 899 of file nvti.c.
References nvti::cve.
Referenced by script_cve_id().
int nvti_add_excluded_keys | ( | nvti_t * | n, |
const gchar * | key | ||
) |
Add a excluded key of a NVT.
n | The NVT Info structure. |
key | The excluded key to add. A copy will be created from this. |
Definition at line 1019 of file nvti.c.
References nvti::excluded_keys.
Referenced by script_exclude_keys().
int nvti_add_mandatory_keys | ( | nvti_t * | n, |
const gchar * | key | ||
) |
Add a mandatory key of a NVT.
n | The NVT Info structure. |
key | The mandatory key to add. A copy will be created from this. |
Definition at line 989 of file nvti.c.
References nvti::mandatory_keys.
Referenced by script_mandatory_keys().
Add a preference to the NVT Info.
n | The NVT Info structure. |
np | The NVT preference to add. |
Definition at line 1109 of file nvti.c.
References nvti::prefs.
Referenced by add_plugin_preference().
int nvti_add_required_keys | ( | nvti_t * | n, |
const gchar * | key | ||
) |
Add a required key of a NVT.
n | The NVT Info structure. |
key | The required key to add. A copy will be created from this. |
Definition at line 959 of file nvti.c.
References nvti::required_keys.
Referenced by script_require_keys().
int nvti_add_required_ports | ( | nvti_t * | n, |
const gchar * | port | ||
) |
Add a required port of a NVT.
n | The NVT Info structure. |
port | The required port to add. A copy will be created from this. |
Definition at line 1049 of file nvti.c.
References nvti::required_ports.
Referenced by script_require_ports().
int nvti_add_required_udp_ports | ( | nvti_t * | n, |
const gchar * | port | ||
) |
Add a required udp port of a NVT.
n | The NVT Info structure. |
port | The required udp port to add. A copy will be created from this. |
Definition at line 1079 of file nvti.c.
References nvti::required_udp_ports.
Referenced by script_require_udp_ports().
gchar* nvti_bid | ( | const nvti_t * | n | ) |
gint nvti_category | ( | const nvti_t * | n | ) |
Get the category for this NVT.
n | The NVT Info structure of which the category should be returned. |
Definition at line 483 of file nvti.c.
References nvti::category.
gchar* nvti_copyright | ( | const nvti_t * | n | ) |
Get the copyright notice.
n | The NVT Info structure of which the name should be returned. |
Definition at line 260 of file nvti.c.
References nvti::copyright.
gchar* nvti_cve | ( | const nvti_t * | n | ) |
gchar* nvti_cvss_base | ( | const nvti_t * | n | ) |
Get the CVSS base.
n | The NVT Info structure of which the CVSS base should be returned. |
Definition at line 330 of file nvti.c.
References nvti::cvss_base.
gchar* nvti_dependencies | ( | const nvti_t * | n | ) |
Get the dependencies list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 344 of file nvti.c.
References nvti::dependencies.
Referenced by plug_set_dep().
gchar* nvti_excluded_keys | ( | const nvti_t * | n | ) |
Get the excluded keys list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 386 of file nvti.c.
References nvti::excluded_keys.
gchar* nvti_family | ( | const nvti_t * | n | ) |
Get the family name.
n | The NVT Info structure of which the name should be returned. |
Definition at line 428 of file nvti.c.
References nvti::family.
void nvti_free | ( | nvti_t * | n | ) |
Free memory of a nvti structure.
n | The structure to be freed. |
Definition at line 162 of file nvti.c.
References nvti::bid, nvti::copyright, nvti::cve, nvti::cvss_base, nvti::dependencies, nvti::excluded_keys, nvti::family, nvti::mandatory_keys, nvti::name, nvtpref_free(), nvti::oid, nvti::prefs, nvti::required_keys, nvti::required_ports, nvti::required_udp_ports, nvti::tag, nvti::version, and nvti::xref.
gchar* nvti_mandatory_keys | ( | const nvti_t * | n | ) |
Get the mandatory keys list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 372 of file nvti.c.
References nvti::mandatory_keys.
gchar* nvti_name | ( | const nvti_t * | n | ) |
Get the name.
n | The NVT Info structure of which the name should be returned. |
Definition at line 246 of file nvti.c.
References nvti::name.
nvti_t* nvti_new | ( | void | ) |
Create a new (empty) nvti structure.
gchar* nvti_oid | ( | const nvti_t * | n | ) |
Get the OID string.
n | The NVT Info structure of which the OID should be returned. |
Definition at line 218 of file nvti.c.
References nvti::oid.
Referenced by nvticache_add(), and nvtis_add().
Get the n'th preferences of the NVT.
n | The NVT Info structure. |
p | The position of the preference to return. |
Definition at line 456 of file nvti.c.
References nvti::prefs.
guint nvti_pref_len | ( | const nvti_t * | n | ) |
Get the number of preferences of the NVT.
n | The NVT Info structure. |
Definition at line 441 of file nvti.c.
References nvti::prefs.
gchar* nvti_required_keys | ( | const nvti_t * | n | ) |
Get the required keys list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 358 of file nvti.c.
References nvti::required_keys.
gchar* nvti_required_ports | ( | const nvti_t * | n | ) |
Get the required ports list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 400 of file nvti.c.
References nvti::required_ports.
gchar* nvti_required_udp_ports | ( | const nvti_t * | n | ) |
Get the required udp ports list.
n | The NVT Info structure of which the name should be returned. |
Definition at line 414 of file nvti.c.
References nvti::required_udp_ports.
int nvti_set_bid | ( | nvti_t * | n, |
const gchar * | bid | ||
) |
int nvti_set_category | ( | nvti_t * | n, |
const gint | category | ||
) |
Set the category type of a NVT Info.
n | The NVT Info structure. |
category | The category to set. Values <= 0 will indicate it is not set. |
Definition at line 880 of file nvti.c.
References nvti::category.
Referenced by script_category().
int nvti_set_copyright | ( | nvti_t * | n, |
const gchar * | copyright | ||
) |
Set the copyright of a NVT.
n | The NVT Info structure. |
copyright | The copyright to set. A copy will be created from this. |
Definition at line 561 of file nvti.c.
References nvti::copyright.
Referenced by script_copyright().
int nvti_set_cve | ( | nvti_t * | n, |
const gchar * | cve | ||
) |
int nvti_set_cvss_base | ( | nvti_t * | n, |
const gchar * | cvss_base | ||
) |
Set the CVSS base of an NVT.
n | The NVT Info structure. |
cvss_base | The CVSS base to set. A copy will be created from this. |
Definition at line 672 of file nvti.c.
References nvti::cvss_base.
int nvti_set_dependencies | ( | nvti_t * | n, |
const gchar * | dependencies | ||
) |
Set the dependencies of a NVT.
n | The NVT Info structure. |
dependencies | The dependencies to set. A copy will be created from this. |
Definition at line 696 of file nvti.c.
References nvti::dependencies.
Referenced by plug_set_dep().
int nvti_set_excluded_keys | ( | nvti_t * | n, |
const gchar * | excluded_keys | ||
) |
Set the excluded keys of a NVT.
n | The NVT Info structure. |
excluded_keys | The excluded keys to set. A copy will be created from this. |
Definition at line 768 of file nvti.c.
References nvti::excluded_keys.
int nvti_set_family | ( | nvti_t * | n, |
const gchar * | family | ||
) |
Set the family of a NVT.
n | The NVT Info structure. |
family | The family to set. A copy will be created from this. |
Definition at line 840 of file nvti.c.
References nvti::family.
Referenced by script_family().
int nvti_set_mandatory_keys | ( | nvti_t * | n, |
const gchar * | mandatory_keys | ||
) |
Set the mandatory keys of a NVT.
n | The NVT Info structure. |
mandatory_keys | The mandatory keys to set. A copy will be created from this. |
Definition at line 744 of file nvti.c.
References nvti::mandatory_keys.
int nvti_set_name | ( | nvti_t * | n, |
const gchar * | name | ||
) |
Set the name of a NVT.
n | The NVT Info structure. |
name | The name to set. A copy will be created from this. |
Definition at line 540 of file nvti.c.
References nvti::name, and name.
Referenced by script_name().
int nvti_set_oid | ( | nvti_t * | n, |
const gchar * | oid | ||
) |
Set the OID of a NVT Info.
n | The NVT Info structure. |
oid | The OID to set. A copy will be created from this. |
Definition at line 498 of file nvti.c.
References oid, and nvti::oid.
Referenced by script_id(), and script_oid().
int nvti_set_required_keys | ( | nvti_t * | n, |
const gchar * | required_keys | ||
) |
Set the required keys of a NVT.
n | The NVT Info structure. |
required_keys | The required keys to set. A copy will be created from this. |
Definition at line 720 of file nvti.c.
References nvti::required_keys.
int nvti_set_required_ports | ( | nvti_t * | n, |
const gchar * | required_ports | ||
) |
Set the required ports of a NVT.
n | The NVT Info structure. |
required_ports | The required ports to set. A copy will be created from this. |
Definition at line 792 of file nvti.c.
References nvti::required_ports.
int nvti_set_required_udp_ports | ( | nvti_t * | n, |
const gchar * | required_udp_ports | ||
) |
Set the required udp ports of a NVT.
n | The NVT Info structure. |
required_udp_ports | The required udp ports to set. A copy will be created from this. |
Definition at line 816 of file nvti.c.
References nvti::required_udp_ports.
int nvti_set_tag | ( | nvti_t * | n, |
const gchar * | tag | ||
) |
Set the tags of a NVT.
n | The NVT Info structure. |
tag | The tags to set. A copy will be created from this. |
Definition at line 648 of file nvti.c.
References nvti::tag.
Referenced by plug_set_tag().
int nvti_set_timeout | ( | nvti_t * | n, |
const gint | timeout | ||
) |
Set the timout of a NVT Info.
n | The NVT Info structure. |
timeout | The timeout to set. Values <= 0 will indicate it is not set. |
Definition at line 861 of file nvti.c.
References nvti::timeout.
Referenced by script_timeout().
int nvti_set_version | ( | nvti_t * | n, |
const gchar * | version | ||
) |
Set the version of a NVT.
n | The NVT Info structure. |
version | The version to set. A copy will be created from this. |
Definition at line 519 of file nvti.c.
References nvti::version.
Referenced by script_version().
int nvti_set_xref | ( | nvti_t * | n, |
const gchar * | xref | ||
) |
Set the xrefs of a NVT.
n | The NVT Info structure. |
xref | The xrefs to set. A copy will be created from this. |
Definition at line 624 of file nvti.c.
References nvti::xref.
Referenced by plug_set_xref().
gchar* nvti_tag | ( | const nvti_t * | n | ) |
Get the tag.
n | The NVT Info structure of which the name should be returned. |
Definition at line 316 of file nvti.c.
References nvti::tag.
Referenced by plug_set_tag().
gint nvti_timeout | ( | const nvti_t * | n | ) |
Get the timeout for this NVT.
n | The NVT Info structure of which the timeout should be returned. |
Definition at line 470 of file nvti.c.
References nvti::timeout.
gchar* nvti_version | ( | const nvti_t * | n | ) |
Get the version.
n | The NVT Info structure of which the OID should be returned. |
Definition at line 232 of file nvti.c.
References nvti::version.
gchar* nvti_xref | ( | const nvti_t * | n | ) |
Get the xref's.
n | The NVT Info structure of which the name should be returned. |
Definition at line 302 of file nvti.c.
References nvti::xref.
Referenced by plug_set_xref().
Add an NVT Info to a collection of NVT Infos.
nvtis | The collection of NVT Infos. |
nvti | The NVT Info to add. |
Definition at line 1160 of file nvti.c.
References nvti_oid().
void nvtis_free | ( | nvtis_t * | nvtis | ) |
nvtis_t* nvtis_new | ( | void | ) |
gchar* nvtpref_default | ( | const nvtpref_t * | np | ) |
Get the Default of a NVT Preference.
np | The NVT Pref structure of which the Default should be returned. |
Definition at line 137 of file nvti.c.
References nvtpref::dflt.
Referenced by get_plugin_preference().
void nvtpref_free | ( | nvtpref_t * | np | ) |
Free memory of a nvtpref structure.
np | The structure to be freed. |
Definition at line 86 of file nvti.c.
References nvtpref::dflt, nvtpref::name, and nvtpref::type.
Referenced by get_plugin_preference(), and nvti_free().
gchar* nvtpref_name | ( | const nvtpref_t * | np | ) |
Get the Name of a NVT Preference.
np | The NVT Pref structure of which the Name should be returned. |
Definition at line 109 of file nvti.c.
References nvtpref::name.
Referenced by get_plugin_preference().
nvtpref_t* nvtpref_new | ( | gchar * | name, |
gchar * | type, | ||
gchar * | dflt | ||
) |
Create a new nvtpref structure filled with the given values.
name | The name to be set. A copy will created of this. |
type | The type to be set. A copy will created of this. |
dflt | The default to be set. A copy will created of this. |
Definition at line 63 of file nvti.c.
References nvtpref::dflt, nvtpref::name, name, and nvtpref::type.
Referenced by add_plugin_preference().
gchar* nvtpref_type | ( | const nvtpref_t * | np | ) |
Get the Type of a NVT Preference.
np | The NVT Pref structure of which the Type should be returned. |
Definition at line 123 of file nvti.c.
References nvtpref::type.