OpenVAS Libraries
9.0.1
|
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"
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... | |
nvti_t * | nvti_from_keyfile (const gchar *fn) |
Read NVT Info from a keyfile. More... | |
int | nvti_to_keyfile (const nvti_t *n, const char *src, const gchar *fn) |
Store NVT Info into a keyfile. 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.
#define G_LOG_DOMAIN "lib nvti" |
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. |
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. |
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. |
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. |
Add a preference to the NVT Info.
n | The NVT Info structure. |
np | The NVT preference to add. |
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. |
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. |
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. |
gchar* nvti_bid | ( | const nvti_t * | n | ) |
Get the bid references.
n | The NVT Info structure of which the name should be returned. |
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. |
gchar* nvti_copyright | ( | const nvti_t * | n | ) |
Get the copyright notice.
n | The NVT Info structure of which the name should be returned. |
gchar* nvti_cve | ( | const nvti_t * | n | ) |
Get the CVE references.
n | The NVT Info structure of which the name should be returned. |
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. |
gchar* nvti_dependencies | ( | const nvti_t * | n | ) |
Get the dependencies list.
n | The NVT Info structure of which the name should be returned. |
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. |
gchar* nvti_family | ( | const nvti_t * | n | ) |
Get the family name.
n | The NVT Info structure of which the name should be returned. |
void nvti_free | ( | nvti_t * | n | ) |
Free memory of a nvti structure.
n | The structure to be freed. |
nvti_t* nvti_from_keyfile | ( | const gchar * | fn | ) |
Read NVT Info from a keyfile.
fn | The filename to read from. |
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. |
gchar* nvti_name | ( | const nvti_t * | n | ) |
Get the name.
n | The NVT Info structure of which the name should be returned. |
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. |
Get the n'th preferences of the NVT.
n | The NVT Info structure. |
p | The position of the preference to return. |
guint nvti_pref_len | ( | const nvti_t * | n | ) |
Get the number of preferences of the NVT.
n | The NVT Info structure. |
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. |
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. |
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. |
int nvti_set_bid | ( | nvti_t * | n, |
const gchar * | bid | ||
) |
Set the bid references of a NVT.
n | The NVT Info structure. |
bid | The bid to set. A copy will be created from this. |
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. |
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. |
int nvti_set_cve | ( | nvti_t * | n, |
const gchar * | cve | ||
) |
Set the CVE references of a NVT.
n | The NVT Info structure. |
cve | The cve list to set. A copy will be created from this. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
gchar* nvti_tag | ( | const nvti_t * | n | ) |
Get the tag.
n | The NVT Info structure of which the name should be returned. |
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. |
int nvti_to_keyfile | ( | const nvti_t * | n, |
const char * | src, | ||
const gchar * | fn | ||
) |
Store NVT Info into a keyfile.
n | The NVT Info object to store. |
fn | The filename to write to. |
gchar* nvti_version | ( | const nvti_t * | n | ) |
Get the version.
n | The NVT Info structure of which the OID should be returned. |
gchar* nvti_xref | ( | const nvti_t * | n | ) |
Get the xref's.
n | The NVT Info structure of which the name should be returned. |
Add an NVT Info to a collection of NVT Infos.
nvtis | The collection of NVT Infos. |
nvti | The NVT Info to add. |
void nvtis_free | ( | nvtis_t * | nvtis | ) |
Free a collection of NVT Infos.
nvtis | The collection of NVT Infos. |
Add an NVT Info to a collection of NVT Infos.
nvtis | The collection of NVT Infos. |
oid | The OID of the NVT. |
nvtis_t* nvtis_new | ( | void | ) |
Make a collection of NVT Infos.
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. |
void nvtpref_free | ( | nvtpref_t * | np | ) |
Free memory of a nvtpref structure.
np | The structure to be freed. |
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. |
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. |
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. |