Greenbone Vulnerability Manager
9.0.1
|
The Greenbone Vulnerability Manager management library. More...
#include "manage_sql.h"
#include "manage_sql_secinfo.h"
#include "manage_sql_nvts.h"
#include "manage_tickets.h"
#include "manage_sql_configs.h"
#include "manage_sql_tickets.h"
#include "manage_sql_tls_certificates.h"
#include "manage_acl.h"
#include "lsc_user.h"
#include "sql.h"
#include "utils.h"
#include "gmp_get.h"
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <glib/gstdio.h>
#include <locale.h>
#include <pwd.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/time.h>
#include <grp.h>
#include <gpgme.h>
#include <gvm/base/hosts.h>
#include <gvm/base/pwpolicy.h>
#include <gvm/base/logging.h>
#include <gvm/base/proctitle.h>
#include <gvm/util/fileutils.h>
#include <gvm/util/gpgmeutils.h>
#include <gvm/util/serverutils.h>
#include <gvm/util/uuidutils.h>
#include <gvm/util/radiusutils.h>
#include <gvm/util/sshutils.h>
#include <gvm/util/authutils.h>
#include <gvm/util/ldaputils.h>
#include <gvm/gmp/gmp.h>
Data Structures | |
struct | result_buffer |
Some result info, for sorting. More... | |
Macros | |
#define | _GNU_SOURCE |
Enable extra GNU functions. | |
#define | G_LOG_DOMAIN "md manage" |
GLib log domain. | |
#define | OPENVAS_DEFAULT_SOCKET "/tmp/ospd.sock" |
Socket of default scanner. | |
#define | MAX_CONTENT_LENGTH 20000 |
Default max number of bytes of reports included in email alerts. | |
#define | MAX_ATTACH_LENGTH 1048576 |
Default max number of bytes of reports attached to email alerts. | |
#define | MAX_EMAIL_MESSAGE_LENGTH 2000 |
Default max number of bytes of user-defined message in email alerts. | |
#define | AGGREGATE_ITERATOR_OFFSET 3 |
Offset for aggregate iterator. | |
#define | AGGREGATE_ITERATOR_N_STATS 4 |
Number of stats, for aggregate iterator. | |
#define | ALERT_ITERATOR_FILTER_COLUMNS |
Filter columns for alert iterator. More... | |
#define | ALERT_ITERATOR_COLUMNS |
Alert iterator columns. More... | |
#define | ALERT_ITERATOR_TRASH_COLUMNS |
Alert iterator columns for trash case. More... | |
#define | APPEND_VFIRE_PARAM(param) |
Checks a mandatory vFire parameter and adds it to the config XML. More... | |
#define | SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email. More... | |
#define | SECINFO_SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email. More... | |
#define | NEW_NVTS_HEADER |
Header for "New NVTs" alert message. More... | |
#define | NEW_NVTS_HEADER_OID |
Header for "New NVTs" alert message, when there's an OID. More... | |
#define | NEW_CVES_HEADER |
Header for "New CVEs" alert message. More... | |
#define | NEW_CPES_HEADER |
Header for "New CPEs" alert message. More... | |
#define | NEW_CERT_BUNDS_HEADER |
Header for "New CERT-Bund Advisories" alert message. More... | |
#define | NEW_DFN_CERTS_HEADER |
Header for "New DFN-CERT Advisories" alert message. More... | |
#define | NEW_OVAL_DEFS_HEADER |
Header for "New CERT-Bund Advisories" alert message. More... | |
#define | TASK_ITERATOR_FILTER_COLUMNS |
Filter columns for task iterator. More... | |
#define | TASK_ITERATOR_COLUMNS_INNER |
Task iterator columns. | |
#define | TASK_ITERATOR_WHERE_COLUMNS_INNER |
Task iterator WHERE columns. | |
#define | TASK_ITERATOR_WHERE_COLUMNS |
Task iterator WHERE columns. More... | |
#define | TASK_ITERATOR_COLUMNS |
Task iterator columns. More... | |
#define | TASK_ITERATOR_COLUMNS_MIN |
Task iterator minimal columns. More... | |
#define | TASK_ITERATOR_WHERE_COLUMNS_MIN |
Task iterator minimal WHERE columns. More... | |
#define | RANGE(type, start, end) |
Insert a port range. More... | |
#define | CREATE_REPORT_INSERT_SIZE 300 |
Maximum number of values per insert, when uploading report. | |
#define | CREATE_REPORT_CHUNK_SIZE 10 |
Number of results per transaction, when uploading report. | |
#define | CREATE_REPORT_CHUNK_SLEEP 1000 |
Number of microseconds to sleep between insert chunks. | |
#define | REPORT_ITERATOR_FILTER_COLUMNS |
Filter columns for report iterator. More... | |
#define | REPORT_ITERATOR_COLUMNS |
Report iterator columns. More... | |
#define | REPORT_ITERATOR_WHERE_COLUMNS |
Report iterator columns. | |
#define | CVSS_BASE_SQL "(SELECT cvss_base FROM nvts WHERE nvts.oid = results.nvt)" |
SQL for retrieving CVSS base. | |
#define | RESULT_ITERATOR_FILTER_COLUMNS |
Filter columns for result iterator. More... | |
#define | BASE_RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE |
Result iterator filterable columns, for severity only version . | |
#define | RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE |
Result iterator columns. More... | |
#define | RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE_NO_CERT |
Result iterator columns, when CERT db is not loaded. More... | |
#define | BASE_RESULT_ITERATOR_COLUMNS |
Result iterator columns. | |
#define | RESULT_ITERATOR_COLUMNS |
Result iterator columns. More... | |
#define | RESULT_ITERATOR_COLUMNS_NO_CERT |
Result iterator columns, when CERT db is not loaded. More... | |
#define | PRINT(stream, format, args...) |
Write to a file or close stream and exit. More... | |
#define | PRINT_XML(stream, xml) |
Write XML to a file or close stream and return. More... | |
#define | PRINT_REPORT_ERROR(stream, errors, asset_id) |
Write report error message to file stream. More... | |
#define | MANAGE_SEND_REPORT_CHUNK64_SIZE 262144 |
Size of base64 chunk in manage_send_report. | |
#define | MANAGE_SEND_REPORT_CHUNK_SIZE (MANAGE_SEND_REPORT_CHUNK64_SIZE * 3 / 4) |
Size of file chunk in manage_send_report. | |
#define | TARGET_ITERATOR_FILTER_COLUMNS |
Filter columns for target iterator. More... | |
#define | TARGET_ITERATOR_COLUMNS |
Target iterator columns. | |
#define | TARGET_ITERATOR_TRASH_COLUMNS |
Target iterator columns for trash case. | |
#define | PASSWORD_LENGTH 10 |
Length of password generated in create_credential. | |
#define | CREDENTIAL_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "login", "type", "allow_insecure", NULL } |
Filter columns for LSC Credential iterator. | |
#define | CREDENTIAL_ITERATOR_COLUMNS |
LSC Credential iterator columns. | |
#define | CREDENTIAL_ITERATOR_TRASH_COLUMNS |
LSC Credential iterator columns for trash case. | |
#define | AGENT_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "trust", NULL } |
Filter columns for agent iterator. | |
#define | AGENT_ITERATOR_COLUMNS |
Agent iterator columns. More... | |
#define | AGENT_ITERATOR_TRASH_COLUMNS |
Agent iterator columns for trash case. More... | |
#define | NOTE_ITERATOR_FILTER_COLUMNS |
Filter columns for note iterator. More... | |
#define | NOTE_ITERATOR_COLUMNS |
Note iterator columns. | |
#define | NOTE_ITERATOR_TRASH_COLUMNS |
Note iterator columns for trash case. | |
#define | OVERRIDE_ITERATOR_FILTER_COLUMNS |
Filter columns for override iterator. More... | |
#define | OVERRIDE_ITERATOR_COLUMNS |
Override iterator columns. | |
#define | OVERRIDE_ITERATOR_TRASH_COLUMNS |
Override iterator columns for trash case. | |
#define | SCANNER_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "host", "port", "type", NULL } |
Filter columns for scanner iterator. | |
#define | SCANNER_ITERATOR_COLUMNS |
Scanner iterator columns. More... | |
#define | SCANNER_ITERATOR_TRASH_COLUMNS |
Scanner iterator columns for trash case. More... | |
#define | SCHEDULE_ITERATOR_FILTER_COLUMNS |
Filter columns for schedule iterator. More... | |
#define | SCHEDULE_ITERATOR_COLUMNS |
Schedule iterator columns. More... | |
#define | SCHEDULE_ITERATOR_TRASH_COLUMNS |
Schedule iterator columns for trash case. More... | |
#define | REPORT_FORMAT_ITERATOR_FILTER_COLUMNS |
#define | REPORT_FORMAT_ITERATOR_COLUMNS |
#define | REPORT_FORMAT_ITERATOR_TRASH_COLUMNS |
#define | GROUP_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, NULL } |
#define | GROUP_ITERATOR_COLUMNS |
#define | GROUP_ITERATOR_TRASH_COLUMNS |
#define | PERMISSION_ITERATOR_FILTER_COLUMNS |
#define | PERMISSION_ITERATOR_COLUMNS |
#define | PERMISSION_ITERATOR_TRASH_COLUMNS |
#define | PORT_LIST_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "total", "tcp", "udp", NULL } |
#define | PORT_LIST_ITERATOR_COLUMNS |
#define | PORT_LIST_ITERATOR_TRASH_COLUMNS |
#define | ROLE_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, NULL } |
#define | ROLE_ITERATOR_COLUMNS |
#define | ROLE_ITERATOR_TRASH_COLUMNS |
#define | FILTER_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "type", "term", NULL } |
#define | FILTER_ITERATOR_COLUMNS |
#define | FILTER_ITERATOR_TRASH_COLUMNS |
#define | WHERE_OWNER |
#define | HOST_ITERATOR_FILTER_COLUMNS |
#define | HOST_ITERATOR_COLUMNS |
#define | HOST_ITERATOR_WHERE_COLUMNS |
#define | OS_ITERATOR_FILTER_COLUMNS |
#define | OS_ITERATOR_COLUMNS |
#define | OS_ITERATOR_WHERE_COLUMNS |
#define | ASSET_OS_WITH_POSTGRESQL |
#define | SETTING_ITERATOR_FILTER_COLUMNS { "name", "comment", "value", NULL } |
#define | SETTING_ITERATOR_COLUMNS |
#define | USER_ITERATOR_FILTER_COLUMNS |
#define | USER_ITERATOR_COLUMNS |
#define | USER_ITERATOR_TRASH_COLUMNS |
#define | VULN_ITERATOR_FILTER_COLUMNS |
#define | VULN_RESULTS_WHERE |
#define | VULN_ITERATOR_COLUMNS |
#define | TAG_ITERATOR_FILTER_COLUMNS |
#define | TAG_ITERATOR_COLUMNS |
#define | TAG_ITERATOR_TRASH_COLUMNS |
#define | TAG_NAME_ITERATOR_FILTER_COLUMNS { "name", "resource_type", NULL } |
#define | TAG_NAME_ITERATOR_COLUMNS |
Typedefs | |
typedef struct result_buffer | result_buffer_t |
Buffer host type. | |
Enumerations | |
enum | compare_results_t { COMPARE_RESULTS_CHANGED, COMPARE_RESULTS_ERROR, COMPARE_RESULTS_GONE, COMPARE_RESULTS_NEW, COMPARE_RESULTS_SAME } |
Comparison returns. | |
enum | report_format_flag_t { REPORT_FORMAT_FLAG_ACTIVE = 1 } |
Possible port types. | |
Functions | |
int | manage_create_sql_functions () |
Create functions. More... | |
void | create_tables () |
Create all tables. | |
void | check_db_sequences () |
Ensure sequences for automatic ids are in a consistent state. More... | |
static int | check_db_encryption_key () |
Ensure that there is an encryption key. More... | |
void | manage_attach_databases () |
Attach external databases. | |
const char * | threat_message_type (const char *) |
Get the message type of a threat. More... | |
const char * | message_type_threat (const char *) |
Get the threat of a message type. More... | |
int | delete_reports (task_t) |
Delete all the reports for a task. More... | |
int | delete_slave_task (const gchar *, int, const gchar *, const gchar *, const char *) |
Delete a task on a slave. More... | |
gchar * | predefined_report_format_dir (const gchar *) |
Get the directory of a report format. More... | |
int | stop_task_internal (task_t) |
Initiate stopping a task. More... | |
int | validate_username (const gchar *) |
Validates a username. More... | |
void | set_task_interrupted (task_t, const gchar *) |
Set a task to interrupted. More... | |
void | make_port_ranges_iana_tcp_2012 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_iana_tcp_udp_2012 (port_list_t) |
Make port ranges for IANA TCP and UDP 2012. More... | |
void | make_port_ranges_all_tcp_nmap_5_51_top_100 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_all_tcp_nmap_5_51_top_1000 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_nmap_5_51_top_2000_top_100 (port_list_t) |
Make port ranges for Nmap top 2000 top 100. More... | |
void | make_config_base (char *const, char *const) |
Make Base Scan Config. More... | |
void | make_config_discovery (char *const, char *const) |
Make Discovery Scan Config. More... | |
void | make_config_discovery_service_detection (char *const) |
Make Discovery Scan Config. More... | |
void | make_config_host_discovery (char *const, char *const) |
Make Host Discovery Scan Config. More... | |
void | make_config_system_discovery (char *const, char *const) |
Make System Discovery Scan Config. More... | |
int | check_config_discovery (const char *) |
Ensure the Discovery config is up to date. More... | |
void | check_config_host_discovery (const char *) |
Ensure the Host Discovery config is up to date. More... | |
int | check_config_system_discovery (const char *) |
Ensure the Discovery config is up to date. More... | |
static int | report_counts_cache_exists (report_t report, int override, int min_qod) |
Test if a counts cache exists for a report and the current user. More... | |
static void | report_severity_data (report_t report, const char *host, const get_data_t *get, severity_data_t *severity_data, severity_data_t *filtered_severity_data) |
Get the result severity counts for a report. More... | |
static gchar * | apply_report_format (gchar *report_format_id, gchar *xml_start, gchar *xml_file, gchar *xml_dir, GList **used_rfps) |
Applies a report format to an XML report. More... | |
static int | cache_report_counts (report_t report, int override, int min_qod, severity_data_t *data) |
Cache the message counts for a report. More... | |
static char * | task_owner_uuid (task_t task) |
Return the name of the owner of a task. More... | |
static int | validate_param_value (report_format_t report_format, report_format_param_t param, const char *name, const char *value) |
Validate a value for a report format param. More... | |
gchar * | clean_hosts (const char *given_hosts, int *max) |
Clean a hosts string. More... | |
static int | create_port_list_unique (const char *, const char *, const char *, port_list_t *) |
static int | valid_type (const char *type) |
Check whether a resource type name is valid. More... | |
static gboolean | find_user_by_name (const char *, user_t *user) |
static gboolean | find_role_with_permission (const char *, role_t *, const char *) |
static int | user_ensure_in_db (const gchar *name, const gchar *method) |
Ensure the user exists in the database. More... | |
static int | verify_report_format_internal (report_format_t) |
static int | set_password (const gchar *, const gchar *, const gchar *, gchar **) |
static void | permissions_set_subjects (const char *, resource_t, resource_t, int) |
static resource_t | permission_resource (permission_t) |
static resource_t | permission_subject (permission_t) |
static char * | permission_subject_type (permission_t) |
static int | role_is_predefined (role_t) |
static int | role_is_predefined_id (const char *) |
static int | task_second_last_report (task_t task, report_t *report) |
Get the report from second most recently completed invocation of task. More... | |
static gchar * | new_secinfo_message (event_t event, const void *event_data, alert_t alert) |
Create message for New NVTs event. More... | |
static gchar * | new_secinfo_list (event_t event, const void *event_data, alert_t alert, int *count_return) |
Create message for New NVTs event. More... | |
static void | check_for_new_scap () |
Check for new SCAP SecInfo after an update. | |
static void | check_for_new_cert () |
Check for new CERT SecInfo after an update. | |
static void | check_for_updated_scap () |
Check for updated SCAP SecInfo after an update. | |
static void | check_for_updated_cert () |
Check for updated CERT SecInfo after an update. | |
static gchar * | results_extra_where (int trash, report_t report, const gchar *host, int autofp, int apply_overrides, int dynamic_severity, const gchar *filter) |
Get extra_where string for a result iterator or count. More... | |
static int | report_counts_id_full (report_t report, int *debugs, int *holes, int *infos, int *logs, int *warnings, int *false_positives, double *severity, const get_data_t *get, const char *host, int *filtered_debugs, int *filtered_holes, int *filtered_infos, int *filtered_logs, int *filtered_warnings, int *filtered_false_positives, double *filtered_severity) |
Get the message counts for a report. More... | |
static int | check_report_format (const gchar *) |
static gboolean | find_group_with_permission (const char *, group_t *, const char *) |
static gchar * | vulns_extra_where () |
static gboolean | lookup_report_format (const char *name, report_format_t *report_format) |
Find a report format given a name. More... | |
static int | task_last_report_any_status (task_t task, report_t *report) |
Get the report from the most recently invocation of task. More... | |
static int | task_report_previous (task_t task, report_t report, report_t *previous) |
Get most recently completed report that precedes a report. More... | |
static gboolean | find_trash_task (const char *uuid, task_t *task) |
Find a task in the trashcan, given an identifier. More... | |
static gboolean | find_trash_report_with_permission (const char *uuid, report_t *report, const char *permission) |
Find a report in the trashcan for a specific permission, given a UUID. More... | |
static int | cleanup_schedule_times () |
Fixes the DST offset in schedule_next_time of tasks. More... | |
static char * | permission_name (permission_t) |
static int | port_list_is_predefined (port_list_t) |
static void | cache_permissions_for_resource (const char *, resource_t, GArray *) |
static port_protocol_t | port_range_iterator_type_int (iterator_t *iterator) |
static void | cache_all_permissions_for_users (GArray *) |
static void | report_cache_counts (report_t report, int clear_original, int clear_overridden, const char *users_where) |
Cache report counts and clear existing caches if requested. More... | |
static int | report_host_dead (report_host_t) |
static int | report_host_result_count (report_host_t) |
static int | set_credential_data (credential_t credential, const char *type, const char *value) |
Set data for a credential. More... | |
static void | set_credential_name (credential_t credential, const char *name) |
Set the name of a Credential. More... | |
static void | set_credential_comment (credential_t credential, const char *comment) |
Set the comment of a Credential. More... | |
static void | set_credential_login (credential_t credential, const char *login) |
Set the login of a Credential. More... | |
static void | set_credential_certificate (credential_t credential, const char *certificate) |
Set the certificate of a Credential. More... | |
static void | set_credential_auth_algorithm (credential_t credential, const char *algorithm) |
Set the auth_algorithm of a Credential. More... | |
static void | set_credential_private_key (credential_t credential, const char *private_key, const char *passphrase) |
Set the private key and passphrase of a Credential. More... | |
static void | set_credential_password (credential_t credential, const char *password) |
Set the password of a Credential. More... | |
static void | set_credential_snmp_secret (credential_t credential, const char *community, const char *password, const char *privacy_password) |
Set the community, password and privacy password of a Credential. More... | |
static int | setting_value_int (const char *, int *) |
static int | setting_auto_cache_rebuild_int () |
static double | setting_default_severity_dbl () |
static int | setting_dynamic_severity_int () |
static char * | setting_timezone () |
static int | setting_value (const char *, char **) |
static void | set_report_format_name (report_format_t report_format, const char *name) |
Set the name of the report format. More... | |
static void | set_report_format_summary (report_format_t report_format, const char *summary) |
Set the summary of the report format. More... | |
static void | set_report_format_active (report_format_t report_format, int active) |
Set the active flag of a report format. More... | |
static int | set_report_format_param (report_format_t, const char *, const char *) |
static double | task_severity_double (task_t task, int overrides, int min_qod, int offset) |
Return the severity score of a task, taking overrides into account. More... | |
static char * | target_comment (target_t target) |
Return the comment of a target. More... | |
static column_t * | type_select_columns (const char *type) |
static column_t * | type_where_columns (const char *type) |
static char * | trash_filter_uuid (filter_t) |
static char * | trash_filter_name (filter_t) |
static char * | trash_target_hosts (target_t target) |
Return the hosts associated with a trashcan target. More... | |
static char * | trash_target_exclude_hosts (target_t target) |
Return the excluded hosts associated with a trashcan target. More... | |
static char * | trash_target_comment (target_t target) |
Return the comment of a trashcan target. More... | |
static int | user_resources_in_use (user_t, const char *, int(*)(resource_t), const char *, int(*)(resource_t)) |
static const char ** | type_filter_columns (const char *) |
static int | type_build_select (const char *, const char *, const get_data_t *, gboolean, gboolean, const char *, const char *, const char *, gchar **) |
int | valid_gmp_command (const char *name) |
Check whether a command name is valid. More... | |
static gchar * | gmp_command_type (const char *name) |
Get the type associated with a GMP command. More... | |
static int | gmp_command_takes_resource (const char *name) |
Check whether a GMP command takes a resource. More... | |
gboolean | resource_with_name_exists (const char *name, const char *type, resource_t resource) |
Check if a resource with a certain name exists already. More... | |
static gboolean | resource_with_name_exists_global (const char *name, const char *type, resource_t resource) |
Check if a resource with a certain name exists already. More... | |
static void | array_add_new_string (array_t *array, const gchar *string) |
Ensure a string is in an array. More... | |
gboolean | find_trash (const char *type, const char *uuid, resource_t *resource) |
Find a resource in the trashcan given a UUID. More... | |
int | parse_iso_time (const char *text_time) |
Convert an ISO time into seconds since epoch. More... | |
static gchar * | array_find_string (array_t *array, const gchar *string) |
Find a string in an array. More... | |
static const gchar * | vector_find_string (const gchar **vector, const gchar *string) |
Find a string in a glib style string vector. More... | |
static int | vector_find_filter (const gchar **vector, const gchar *string) |
Find a filter string in a glib style string vector. More... | |
gchar * | tag_value (const gchar *tags, const gchar *tag) |
Extract a tag from a pipe separated tag list. More... | |
static int | nvts_check_time () |
Get last time NVT alerts were checked. More... | |
static int | scap_check_time () |
Get last time SCAP SecInfo alerts were checked. More... | |
static int | cert_check_time () |
Get last time CERT SecInfo alerts were checked. More... | |
int | manage_option_setup (GSList *log_config, const gchar *database) |
Setup for an option process. More... | |
void | manage_option_cleanup () |
Cleanup for an option process. | |
static column_t * | column_array_copy (column_t *columns) |
Copy an array of columns. More... | |
static void | column_array_free (column_t *columns) |
Free an array of columns. More... | |
static void | column_array_set (column_t *columns, const gchar *filter, gchar *select) |
Set the select clause of a column in an array of columns. More... | |
const char * | keyword_relation_symbol (keyword_relation_t relation) |
Get the symbol of a keyword relation. More... | |
static void | keyword_free (keyword_t *keyword) |
Free a keyword. More... | |
int | keyword_special (keyword_t *keyword) |
Get whether a keyword is special (like "and"). More... | |
static keyword_relation_t | parse_column_relation (const char relation) |
Parse a filter column relation. More... | |
static void | parse_keyword (keyword_t *keyword) |
Parse a filter keyword. More... | |
static void | cleanup_keyword (keyword_t *keyword) |
Cleans up keywords with special conditions and relations. More... | |
static int | keyword_applies (array_t *array, const keyword_t *keyword) |
Check whether a keyword has any effect in the filter. More... | |
void | filter_free (array_t *split) |
Free a split filter. More... | |
void | split_filter_add_specials (array_t *parts, const gchar *given_filter) |
Ensure filter parts contains the special keywords. More... | |
array_t * | split_filter (const gchar *given_filter) |
Split the filter term into parts. More... | |
void | manage_filter_controls (const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order) |
Get info from a filter. More... | |
static int | filter_control_int (keyword_t **point, const char *column, int *val) |
Get an int column from a filter split. More... | |
static int | filter_control_str (keyword_t **point, const char *column, gchar **string) |
Get a string column from a filter split. More... | |
void | manage_report_filter_controls (const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order, int *result_hosts_only, gchar **min_qod, gchar **levels, gchar **delta_states, gchar **search_phrase, int *search_phrase_exact, int *autofp, int *notes, int *overrides, int *apply_overrides, gchar **zone) |
Get info from a filter for report. More... | |
static void | append_relation (GString *clean, keyword_t *keyword, const char relation) |
Append relation to filter. More... | |
gchar * | manage_clean_filter_remove (const gchar *filter, const gchar *column) |
Clean a filter, removing a keyword in the process. More... | |
gchar * | manage_clean_filter (const gchar *filter) |
Clean a filter. More... | |
static const char * | get_join (int first, int last_was_and, int last_was_not) |
Return SQL join words for filter_clause. More... | |
static gchar * | columns_select_column_single (column_t *select_columns, const char *filter_column, keyword_type_t *type) |
Get the column expression for a filter column. More... | |
static gchar * | columns_select_column (column_t *select_columns, column_t *where_columns, const char *filter_column) |
Get the selection term for a filter column. More... | |
static gchar * | columns_select_column_with_type (column_t *select_columns, column_t *where_columns, const char *filter_column, keyword_type_t *type) |
Get the selection term for a filter column. More... | |
gchar * | columns_build_select (column_t *select_columns) |
Return column list for SELECT statement. More... | |
static int | keyword_applies_to_column (keyword_t *keyword, const char *column) |
Check whether a keyword applies to a column. More... | |
static void | filter_clause_append_tag (GString *clause, keyword_t *keyword, const char *type, int first_keyword, int last_was_and, int last_was_not) |
Append parts for a "tag" keyword to a filter clause. More... | |
static void | filter_clause_append_tag_id (GString *clause, keyword_t *keyword, const char *type, int first_keyword, int last_was_and, int last_was_not) |
Append parts for a "tag_id" keyword to a filter clause. More... | |
gchar * | filter_clause (const char *type, const char *filter, const char **filter_columns, column_t *select_columns, column_t *where_columns, int trash, gchar **order_return, int *first_return, int *max_return, array_t **permissions, gchar **owner_filter) |
Return SQL WHERE clause for restricting a SELECT to a filter term. More... | |
static const char * | type_db_name (const char *type) |
Return DB name of type. More... | |
static int | type_is_asset_subtype (const char *type) |
Check whether a resource type is an asset subtype. More... | |
static int | type_is_info_subtype (const char *type) |
Check whether a resource type is an info subtype, excluding allinfo. More... | |
static int | type_named (const char *type) |
Check whether a type has a name and comment. More... | |
static int | type_globally_unique (const char *type) |
Check whether a type must have globally unique names. More... | |
static int | type_has_comment (const char *type) |
Check whether a type has a comment. More... | |
static int | type_has_trash (const char *type) |
Check whether a resource type uses the trashcan. More... | |
static int | type_owned (const char *type) |
Check whether a resource type has an owner. More... | |
static int | type_trash_in_table (const char *type) |
Check whether the trash is in the real table. More... | |
gboolean | find_resource (const char *type, const char *uuid, resource_t *resource) |
Find a resource given a UUID. More... | |
gboolean | find_resource_with_permission (const char *type, const char *uuid, resource_t *resource, const char *permission, int trash) |
Find a resource given a UUID and a permission. More... | |
static gboolean | find_resource_by_name (const char *type, const char *name, resource_t *resource) |
Find a resource given a name. More... | |
static gboolean | find_resource_by_name_with_permission (const char *type, const char *name, resource_t *resource, const char *permission) |
Find a resource given a UUID and a permission. More... | |
int | copy_resource_lock (const char *type, const char *name, const char *comment, const char *resource_id, const char *columns, int make_name_unique, resource_t *new_resource, resource_t *old_resource) |
Create a resource from an existing resource. More... | |
int | copy_resource (const char *type, const char *name, const char *comment, const char *resource_id, const char *columns, int make_name_unique, resource_t *new_resource, resource_t *old_resource) |
Create a resource from an existing resource. More... | |
int | resource_exists (const char *type, resource_t resource, int location) |
Get whether a resource exists. More... | |
int | resource_name (const char *type, const char *uuid, int location, char **name) |
Get the name of a resource. More... | |
int | manage_resource_name (const char *type, const char *uuid, char **name) |
Get the name of a resource. More... | |
int | manage_trash_resource_name (const char *type, const char *uuid, char **name) |
Get the name of a trashcan resource. More... | |
gchar * | resource_uuid (const gchar *type, resource_t resource) |
Get the UUID of a resource. More... | |
static int | init_get_iterator2_with (iterator_t *iterator, const char *type, const get_data_t *get, column_t *select_columns, column_t *trash_select_columns, column_t *where_columns, column_t *trash_where_columns, const char **filter_columns, int distinct, const char *extra_tables, const char *extra_where, int owned, int ignore_id, const char *extra_order, const char *extra_with, int assume_permitted) |
Initialise a GET iterator, including observed resources. More... | |
static int | init_get_iterator2 (iterator_t *iterator, const char *type, const get_data_t *get, column_t *select_columns, column_t *trash_select_columns, column_t *where_columns, column_t *trash_where_columns, const char **filter_columns, int distinct, const char *extra_tables, const char *extra_where, int owned, int ignore_id, const char *extra_order) |
Initialise a GET iterator, including observed resources. More... | |
int | init_get_iterator (iterator_t *iterator, const char *type, const get_data_t *get, column_t *select_columns, column_t *trash_select_columns, const char **filter_columns, int distinct, const char *extra_tables, const char *extra_where, int owned) |
Initialise a GET iterator, including observed resources. More... | |
static void | append_column (GArray *columns, const gchar *column_name, column_t *select_columns, column_t *where_columns) |
Append expression for a column to an array. More... | |
int | init_aggregate_iterator (iterator_t *iterator, const char *type, const get_data_t *get, int distinct, GArray *data_columns, const char *group_column, const char *subgroup_column, GArray *text_columns, GArray *sort_data, int first_group, int max_groups, const char *extra_tables, const char *given_extra_where) |
Initialise a GET_AGGREGATES iterator, including observed resources. More... | |
int | aggregate_iterator_count (iterator_t *iterator) |
Get the count from an aggregate iterator. More... | |
double | aggregate_iterator_min (iterator_t *iterator, int data_column_index) |
Get the minimum from an aggregate iterator. More... | |
double | aggregate_iterator_max (iterator_t *iterator, int data_column_index) |
Get the maximum from an aggregate iterator. More... | |
double | aggregate_iterator_mean (iterator_t *iterator, int data_column_index) |
Get the mean from an aggregate iterator. More... | |
double | aggregate_iterator_sum (iterator_t *iterator, int data_column_index) |
Get the sum from a statistics iterator. More... | |
const char * | aggregate_iterator_text (iterator_t *iterator, int text_column_index, int data_columns) |
Get the value of a text column from an aggregate iterator. More... | |
const char * | aggregate_iterator_value (iterator_t *iterator) |
Get the value of the group column from a statistics iterator. More... | |
const char * | aggregate_iterator_subgroup_value (iterator_t *iterator) |
Get the value of the subgroup column from an aggregate iterator. More... | |
static int | count2 (const char *type, const get_data_t *get, column_t *select_columns, column_t *trash_select_columns, column_t *where_columns, column_t *trash_where_columns, const char **filter_columns, int distinct, const char *extra_tables, const char *extra_where, const char *extra_with, int owned) |
Count number of a particular resource. More... | |
int | count (const char *type, const get_data_t *get, column_t *select_columns, column_t *trash_select_columns, const char **filter_columns, int distinct, const char *extra_tables, const char *extra_where, int owned) |
Count number of a particular resource. More... | |
int | info_name_count (const char *type, const char *name) |
Count number of info of a given subtype with a given name. More... | |
static int | resource_predefined (const gchar *type, resource_t resource) |
Return whether a resource is predefined. More... | |
static void | resource_set_predefined (const gchar *type, resource_t resource, int enable) |
Mark a resource as predefined. More... | |
int | manage_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_db_version () |
Return the database version of the actual database. More... | |
int | manage_scap_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_scap_db_version () |
Return the database version of the actual database. More... | |
int | manage_cert_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_cert_db_version () |
Return the database version of the actual database. More... | |
char * | manage_port_name (int number, const char *protocol) |
Returns associated name for a tcp/ip port. More... | |
gchar * | port_name_formatted (const char *field) |
Returns formatted port number, protocol and iana name from. More... | |
void | set_db_version (int version) |
Set the database version of the actual database. More... | |
static int | encrypt_all_credentials (gboolean decrypt_flag) |
Encrypt, re-encrypt or decrypt all credentials. More... | |
int | manage_encrypt_all_credentials (GSList *log_config, const gchar *database) |
Encrypt or re-encrypt all credentials. More... | |
int | manage_decrypt_all_credentials (GSList *log_config, const gchar *database) |
Decrypt all credentials. More... | |
static int | collate_ip_compare (const char *one_arg, const char *two_arg) |
Compare two number strings for collate_ip. More... | |
static int | collate_ip (void *data, int one_len, const void *arg_one, int two_len, const void *arg_two) |
Collate two IP addresses. More... | |
static void | init_task_user_iterator (iterator_t *iterator, task_t task) |
Initialise a task user iterator. More... | |
void | init_task_group_iterator (iterator_t *iterator, task_t task) |
Initialise a task group iterator. More... | |
void | init_task_role_iterator (iterator_t *iterator, task_t task) |
Initialise a task role iterator. More... | |
void | check_alerts () |
Check if any SecInfo alerts are due. More... | |
int | manage_check_alerts (GSList *log_config, const gchar *database) |
Check if any SecInfo alerts are due. More... | |
gboolean | find_alert_with_permission (const char *uuid, alert_t *alert, const char *permission) |
Find a alert for a specific permission, given a UUID. More... | |
static int | validate_email (const char *address) |
Validate an email address. More... | |
static int | validate_email_list (const char *list) |
Validate an email address list. More... | |
static int | validate_alert_condition_data (gchar *name, gchar *data, alert_condition_t condition) |
Validate condition data for an alert. More... | |
static int | validate_alert_event_data (gchar *name, gchar *data, event_t event) |
Validate event data for an alert. More... | |
int | validate_email_data (alert_method_t method, const gchar *name, gchar **data, int for_modify) |
Validate method data for the email method. More... | |
static int | validate_scp_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the SCP method. More... | |
static int | validate_send_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the Send method. More... | |
static int | validate_smb_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the Send method. More... | |
static int | validate_tippingpoint_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the TippingPoint method. More... | |
static int | validate_vfire_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the vFire alert method. More... | |
static int | validate_sourcefire_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the Sourcefire method. More... | |
static int | check_alert_params (event_t event, alert_condition_t condition, alert_method_t method) |
Check alert params. More... | |
int | create_alert (const char *name, const char *comment, const char *filter_id, const char *active, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data, alert_t *alert) |
Create an alert. More... | |
int | copy_alert (const char *name, const char *comment, const char *alert_id, alert_t *new_alert) |
Create an alert from an existing alert. More... | |
int | modify_alert (const char *alert_id, const char *name, const char *comment, const char *filter_id, const char *active, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data) |
Modify an alert. More... | |
int | delete_alert (const char *alert_id, int ultimate) |
Delete an alert. More... | |
char * | alert_uuid (alert_t alert) |
Return the UUID of an alert. More... | |
static char * | alert_name (alert_t alert) |
Return the name of an alert. More... | |
static user_t | alert_owner (alert_t alert) |
Return the owner of an alert. More... | |
static char * | alert_owner_uuid (alert_t alert) |
Return the UUID of the owner of an alert. More... | |
static char * | alert_filter_id (alert_t alert) |
Return the UUID of the filter of an alert. More... | |
static alert_condition_t | alert_condition (alert_t alert) |
Return the condition associated with an alert. More... | |
static alert_method_t | alert_method (alert_t alert) |
Return the method associated with an alert. More... | |
static event_t | alert_event (alert_t alert) |
Return the event associated with an alert. More... | |
int | alert_count (const get_data_t *get) |
Count the number of alerts. More... | |
int | alert_in_use (alert_t alert) |
Return whether a alert is in use by a task. More... | |
int | trash_alert_in_use (alert_t alert) |
Return whether a trashcan alert is in use by a task. More... | |
int | alert_writable (alert_t alert) |
Return whether a alert is writable. More... | |
int | trash_alert_writable (alert_t alert) |
Return whether a trashcan alert is writable. More... | |
int | init_alert_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise an alert iterator, including observed alerts. More... | |
int | alert_iterator_event (iterator_t *iterator) |
Return the event from an alert iterator. More... | |
int | alert_iterator_condition (iterator_t *iterator) |
Return the condition from an alert iterator. More... | |
int | alert_iterator_method (iterator_t *iterator) |
Return the method from an alert iterator. More... | |
static filter_t | alert_iterator_filter (iterator_t *iterator) |
Return the filter from an alert iterator. More... | |
char * | alert_iterator_filter_uuid (iterator_t *iterator) |
Return the filter UUID from an alert iterator. More... | |
char * | alert_iterator_filter_name (iterator_t *iterator) |
Return the filter name from an alert iterator. More... | |
int | alert_iterator_filter_trash (iterator_t *iterator) |
Return the location of an alert iterator filter. More... | |
int | alert_iterator_filter_readable (iterator_t *iterator) |
Return the filter readable state from an alert iterator. More... | |
int | alert_iterator_active (iterator_t *iterator) |
Return the active state from an alert. More... | |
void | init_alert_data_iterator (iterator_t *iterator, alert_t alert, int trash, const char *table) |
Initialise an alert data iterator. More... | |
const char * | alert_data_iterator_name (iterator_t *iterator) |
Return the name from an alert data iterator. More... | |
const char * | alert_data_iterator_data (iterator_t *iterator) |
Return the data from an alert data iterator. More... | |
char * | alert_data (alert_t alert, const char *type, const char *name) |
Return data associated with an alert. More... | |
static int | alert_applies_to_task (alert_t alert, task_t task) |
Check whether an alert applies to a task. More... | |
void | init_task_alert_iterator (iterator_t *iterator, task_t task) |
Initialise a task alert iterator. More... | |
static void | init_event_alert_iterator (iterator_t *iterator, event_t event) |
Initialise an event alert iterator. More... | |
static alert_t | event_alert_iterator_alert (iterator_t *iterator) |
Get the alert from a event alert iterator. More... | |
static int | event_alert_iterator_active (iterator_t *iterator) |
Get the active state from an event alert iterator. More... | |
static int | email_write_content (FILE *content_file, const char *to_address, const char *from_address, const char *subject, const char *body, const gchar *attachment, const char *attachment_type, const char *attachment_name, const char *attachment_extension) |
Write the content of a plain text email to a stream. More... | |
static int | email_encrypt_gpg (FILE *plain_file, FILE *encrypted_file, const char *public_key, const char *to_address, const char *from_address, const char *subject) |
Create a PGP encrypted email from a plain text one. More... | |
static int | email_encrypt_smime (FILE *plain_file, FILE *encrypted_file, const char *certificate, const char *to_address, const char *from_address, const char *subject) |
Create an S/MIME encrypted email from a plain text one. More... | |
static int | email (const char *to_address, const char *from_address, const char *subject, const char *body, const gchar *attachment, const char *attachment_type, const char *attachment_name, const char *attachment_extension, credential_t recipient_credential) |
Send an email. More... | |
static int | http_get (const char *url) |
GET an HTTP resource. More... | |
static int | alert_script_init (const char *report_filename, const char *report, size_t report_size, const char *extra_content, size_t extra_size, char *report_dir, gchar **report_path, gchar **error_path, gchar **extra_path) |
Initialize common files and variables for an alert script. More... | |
static int | alert_script_exec (const char *alert_id, const char *command_args, const char *report_path, const char *report_dir, const char *error_path, const char *extra_path, gchar **message) |
Execute the alert script. More... | |
static int | alert_write_data_file (const char *directory, const char *filename, const char *content, gsize content_size, const char *description, gchar **file_path) |
Write data to a file for use by an alert script. More... | |
static int | alert_script_cleanup (const char *report_dir, gchar *report_path, gchar *error_path, gchar *extra_path) |
Clean up common files and variables for running alert script. More... | |
static int | run_alert_script (const char *alert_id, const char *command_args, const char *report_filename, const char *report, size_t report_size, const char *extra_content, size_t extra_size, gchar **message) |
Run an alert's "alert" script with one file of extra data. More... | |
static int | snmp_to_host (const char *community, const char *agent, const char *message, gchar **script_message) |
Send an SNMP TRAP to a host. More... | |
static int | send_to_host (const char *host, const char *port, const char *report, int report_size, gchar **script_message) |
Send a report to a host via TCP. More... | |
static int | scp_to_host (const char *username, const char *password, const char *private_key, const char *host, const char *path, const char *known_hosts, const char *report, int report_size, gchar **script_message) |
Send a report to a host via TCP. More... | |
static int | smb_send_to_host (const char *password, const char *username, const char *share_path, const char *file_path, const char *report, gsize report_size, gchar **script_message) |
Send a report to a host via SMB. More... | |
static int | send_to_sourcefire (const char *ip, const char *port, const char *pkcs12_64, const char *pkcs12_password, const char *report) |
Send a report to a Sourcefire Defense Center. More... | |
static int | send_to_verinice (const char *url, const char *username, const char *password, const char *archive, int archive_size) |
Send a report to a verinice.PRO server. More... | |
gboolean | buffer_vfire_call_input (gchar *key, gchar *value, GString *buffer) |
Appends an XML fragment for vFire call input to a string buffer. More... | |
static int | send_to_vfire (const char *base_url, const char *client_id, const char *session_type, const char *username, const char *password, GPtrArray *report_data, GTree *call_data, const char *description_template, gchar **message) |
Create a new call on an Alemba vFire server. More... | |
static int | send_to_tippingpoint (const char *report, size_t report_size, const char *username, const char *password, const char *hostname, const char *certificate, int cert_workaround, gchar **message) |
Convert an XML report and send it to a TippingPoint SMS. More... | |
static gchar * | alert_subject_print (const gchar *subject, event_t event, const void *event_data, alert_t alert, task_t task, int total) |
Print an alert subject. More... | |
static gchar * | alert_message_print (const gchar *message, event_t event, const void *event_data, task_t task, alert_t alert, alert_condition_t condition, gchar *format_name, filter_t filter, const gchar *term, const gchar *zone, const gchar *host_summary, const gchar *content, gsize content_length, int truncated, int total, int max_length) |
Print an alert message. More... | |
static gchar * | scp_alert_path_print (const gchar *message, task_t task) |
Print an SCP alert file path. More... | |
static int | email_ticket (alert_t alert, ticket_t ticket, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, const gchar *to_address, const gchar *from_address, const gchar *subject) |
Build and send email for a ticket alert. More... | |
static int | email_secinfo (alert_t alert, task_t task, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, const gchar *to_address, const gchar *from_address) |
Build and send email for SecInfo alert. More... | |
static report_t | get_delta_report (alert_t alert, task_t task, report_t report) |
Get the delta report to be used for an alert. More... | |
static int | generate_alert_filter_get (alert_t alert, const get_data_t *base_get_data, get_data_t **alert_filter_get, filter_t *filter_return) |
Generates report results get data for an alert. More... | |
static int | set_missing_task_or_report (task_t *task, report_t *report) |
Sets the task or report if one of them is missing. More... | |
static int | report_content_for_alert (alert_t alert, report_t report, task_t task, const get_data_t *get, const char *report_format_data_name, const char *report_format_lookup, const char *fallback_format_id, int notes_details, int overrides_details, gchar **content, gsize *content_length, gchar **extension, gchar **content_type, gchar **term, gchar **report_zone, gchar **host_summary, report_format_t *used_report_format, filter_t *filter_return) |
Generate report content for alert. More... | |
static gchar * | generate_report_filename (report_t report, task_t task, report_format_t report_format, const char *custom_format, gboolean add_extension) |
Generates a filename or path for a report. More... | |
static int | escalate_to_vfire (alert_t alert, task_t task, report_t report, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, const get_data_t *get, int notes_details, int overrides_details, gchar **script_message) |
Escalate an event. More... | |
static int | escalate_2 (alert_t alert, task_t task, report_t report, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, const get_data_t *get, int notes_details, int overrides_details, gchar **script_message) |
Escalate an event. More... | |
static int | escalate_1 (alert_t alert, task_t task, report_t report, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, gchar **script_message) |
Escalate an event with preset report filtering. More... | |
int | manage_alert (const char *alert_id, const char *task_id, event_t event, const void *event_data, gchar **script_message) |
Escalate an alert with task and event data. More... | |
int | manage_test_alert (const char *alert_id, gchar **script_message) |
Test an alert. More... | |
static int | event_applies (event_t event, const void *event_data, resource_t event_resource, alert_t alert) |
Return whether an event applies to a task and an alert. More... | |
static int | condition_met (task_t task, report_t report, alert_t alert, alert_condition_t condition) |
Return whether the condition of an alert is met by a task. More... | |
void | event (event_t event, void *event_data, resource_t resource_1, resource_t resource_2) |
Produce an event. More... | |
void | init_alert_task_iterator (iterator_t *iterator, alert_t alert, int ascending) |
Initialise an alert task iterator. More... | |
const char * | alert_task_iterator_name (iterator_t *iterator) |
Return the name from an alert task iterator. More... | |
const char * | alert_task_iterator_uuid (iterator_t *iterator) |
Return the uuid from an alert task iterator. More... | |
int | alert_task_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
static gchar * | tasks_extra_where (int trash, const char *usage_type) |
Generate an extra WHERE clause for selecting tasks. More... | |
static void | append_to_task_string (task_t task, const char *field, const char *value) |
Append value to field of task. More... | |
static gchar * | task_iterator_opts_table (int override, int min_qod, int ignore_severity) |
Generate the extra_tables string for a task iterator. More... | |
static void | init_user_task_iterator (iterator_t *iterator, int trash, int ignore_severity) |
Initialise a task iterator, limited to current user's tasks. More... | |
int | init_task_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a task iterator. More... | |
task_status_t | task_iterator_run_status (iterator_t *iterator) |
Get the run status from a task iterator. More... | |
int | task_iterator_total_reports (iterator_t *iterator) |
Get the number of reports of a task iterator. More... | |
const char * | task_iterator_first_report (iterator_t *iterator) |
Get the first report UUID from a task iterator. More... | |
const char * | task_iterator_run_status_name (iterator_t *iterator) |
Get the run status name from a task iterator. More... | |
const char * | task_iterator_last_report (iterator_t *iterator) |
Get the last report UUID from a task iterator. More... | |
int | task_iterator_finished_reports (iterator_t *iterator) |
Get the number of reports of a task iterator. More... | |
const char * | task_iterator_hosts_ordering (iterator_t *iterator) |
Get the hosts ordering value from a task iterator. More... | |
scanner_t | task_iterator_scanner (iterator_t *iterator) |
Get the UUID of task scanner from a task iterator. More... | |
const char * | task_iterator_usage_type (iterator_t *iterator) |
Get the UUID of task scanner from a task iterator. More... | |
int | task_in_use (task_t task) |
Return whether a task is in use by a task. More... | |
int | trash_task_in_use (task_t task) |
Return whether a trashcan task is referenced by a task. More... | |
int | task_alterable (task_t task) |
Return whether a task is an Alterable Task. More... | |
int | task_writable (task_t task) |
Return whether a task is writable. More... | |
int | trash_task_writable (task_t task) |
Return whether a trashcan task is writable. More... | |
int | task_average_scan_duration (task_t task) |
Get the average duration of all finished reports of a task. More... | |
void | init_manage_process (const gchar *database) |
Initialize the manage library for a process. More... | |
void | reinit_manage_process () |
Reinitialize the manage library for a process. More... | |
static void | setup_full_config_prefs (config_t config, int safe_checks, int optimize_test, int port_range) |
Setup config preferences for a config. More... | |
nvti_t * | lookup_nvti (const gchar *nvt) |
Update the memory cache of NVTs. More... | |
static void | update_nvti_cache () |
Update the memory cache of NVTs. | |
int | manage_update_nvti_cache () |
Update the memory cache of NVTs, if this has been requested. More... | |
static void | make_port_ranges_openvas_default (port_list_t list) |
Make port ranges. More... | |
static int | check_db_scanners () |
Ensure the predefined scanner exists. More... | |
static void | check_db_port_lists () |
Ensure that the predefined port lists exist. | |
static void | update_report_format_uuid (const char *old, const char *new) |
Bring UUIDs for single predefined report format up to date. More... | |
static void | update_report_format_uuids () |
Bring report format UUIDs in database up to date. | |
static void | check_db_settings () |
Initialize the default settings. More... | |
static void | add_role_permission (const gchar *role_id, const gchar *permission) |
Add command permission to role. More... | |
static void | add_role_permission_resource (const gchar *role_id, const gchar *permission, const gchar *type, const gchar *resource_id) |
Add resource permission to role. More... | |
static int | check_db_versions () |
Ensure that the databases are the right versions. More... | |
static void | check_db_nvt_selectors () |
Ensures the sanity of nvts cache in DB. | |
static void | check_db_configs () |
Ensure the predefined configs exist. | |
static int | make_report_format_uuids_unique () |
Ensure every report format has a unique UUID. More... | |
static int | check_db_trash_report_formats () |
Check that trash report formats are correct. More... | |
static int | check_db_report_formats () |
Ensure the predefined report formats exist. More... | |
static gchar * | report_format_trash_dir (const gchar *report_format_id) |
Get trash directory of a report format. More... | |
static int | check_db_report_formats_trash () |
Ensure that the report formats trash directory matches the database. More... | |
static void | add_permissions_on_globals (const gchar *role_uuid) |
Add permissions for all global resources. More... | |
static void | check_db_permissions () |
Ensure the predefined permissions exists. | |
static void | check_db_roles () |
Ensure the predefined roles exists. | |
static void | clean_auth_cache () |
Cleanup the auth_cache table. | |
static gchar * | manage_migrate_relay_sensors () |
Tries to migrate sensor type scanners to match the relays. More... | |
static int | check_db (int check_encryption_key) |
Ensure that the database is in order. More... | |
void | check_generate_scripts () |
Ensure the generate scripts are all executable. More... | |
static void | stop_active_tasks () |
Stop any active tasks. | |
static void | cleanup_tables () |
Clean up database tables. More... | |
static int | init_manage_internal (GSList *log_config, const gchar *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, int stop_tasks, manage_connection_forker_t fork_connection, int skip_db_check, int check_encryption_key) |
Initialize the manage library. More... | |
int | init_manage (GSList *log_config, const gchar *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, manage_connection_forker_t fork_connection, int skip_db_check) |
Initialize the manage library. More... | |
int | init_manage_helper (GSList *log_config, const gchar *database, int max_ips_per_target) |
Initialize the manage library for a helper program. More... | |
void | cleanup_manage_process (gboolean cleanup) |
Cleanup the manage library. More... | |
void | manage_cleanup_process_error (int signal) |
Cleanup as immediately as possible. More... | |
void | manage_reset_currents () |
Cleanup as immediately as possible. | |
gchar * | manage_user_hash (const gchar *username) |
Get user hash. More... | |
static gchar * | user_uuid_method (const gchar *username, auth_method_t method) |
Get user uuid. More... | |
static int | ldap_auth_enabled () |
Check whether LDAP is enabled. More... | |
static int | radius_auth_enabled () |
Check whether RADIUS is enabled. More... | |
static int | user_exists_method (const gchar *name, auth_method_t method) |
Check if user exists. More... | |
static gchar * | user_uuid_any_method (const gchar *name) |
Get user uuid, trying all authentication methods. More... | |
static int | user_exists (const gchar *name) |
Check if user exists. More... | |
static int | credentials_setup (credentials_t *credentials) |
Set credentials for authenticate. More... | |
static int | auth_cache_find (const char *username, const char *password, int method) |
Search for LDAP or RADIUS credentials in the recently-used authentication cache. More... | |
static void | auth_cache_insert (const char *username, const char *password, int method) |
Add LDAP or RADIUS credentials to the recently-used authentication cache. More... | |
static int | authenticate_any_method (const gchar *username, const gchar *password, auth_method_t *auth_method) |
Authenticate, trying any method. More... | |
int | authenticate (credentials_t *credentials) |
Authenticate credentials. More... | |
int | resource_count (const char *type, const get_data_t *get) |
Return number of resources of a certain type for current user. More... | |
unsigned int | task_count (const get_data_t *get) |
Return the number of tasks associated with the current user. More... | |
int | task_uuid (task_t task, char **id) |
Return the UUID of a task. More... | |
int | task_in_trash (task_t task) |
Return whether a task is in the trashcan. More... | |
int | task_in_trash_id (const gchar *task_id) |
Return whether a task is in the trashcan. More... | |
char * | task_owner_name (task_t task) |
Return the name of the owner of a task. More... | |
char * | task_name (task_t task) |
Return the name of a task. More... | |
char * | task_comment (task_t task) |
Return the comment of a task. More... | |
char * | task_hosts_ordering (task_t task) |
Return the hosts ordering of a task. More... | |
char * | task_observers (task_t task) |
Return the observers of a task. More... | |
config_t | task_config (task_t task) |
Return the config of a task. More... | |
char * | task_config_uuid (task_t task) |
Return the UUID of the config of a task. More... | |
char * | task_config_name (task_t task) |
Return the name of the config of a task. More... | |
int | task_config_in_trash (task_t task) |
Return whether the config of a task is in the trashcan. More... | |
void | set_task_config (task_t task, config_t config) |
Set the config of a task. More... | |
target_t | task_target (task_t task) |
Return the target of a task. More... | |
void | set_task_target (task_t task, target_t target) |
Set the target of a task. More... | |
void | set_task_hosts_ordering (task_t task, const char *ordering) |
Set the hosts ordering of a task. More... | |
int | task_target_in_trash (task_t task) |
Return whether the target of a task is in the trashcan. More... | |
scanner_t | task_scanner (task_t task) |
Return the scanner of a task. More... | |
void | set_task_scanner (task_t task, scanner_t scanner) |
Set the scanner of a task. More... | |
int | task_scanner_in_trash (task_t task) |
Return whether the scanner of a task is in the trashcan. More... | |
void | set_task_usage_type (task_t task, const char *usage_type) |
Set the usage_type of a task. More... | |
task_status_t | task_run_status (task_t task) |
Return the run state of a task. More... | |
void | set_report_scheduled (report_t report) |
Set a report's scheduled flag. More... | |
static int | report_scheduled (report_t report) |
Get a report's scheduled flag. More... | |
static void | set_task_run_status_internal (task_t task, task_status_t status) |
Set the run state of a task. More... | |
void | set_task_run_status (task_t task, task_status_t status) |
Set the run state of a task. More... | |
int | set_task_requested (task_t task, task_status_t *status) |
Atomically set the run state of a task to requested. More... | |
int | task_result_count (task_t task, int min_qod) |
Return number of results in a task. More... | |
report_t | task_running_report (task_t task) |
Return the running report of a task. More... | |
report_t | task_iterator_current_report (iterator_t *iterator) |
Return the current report of a task. More... | |
int | task_upload_progress (task_t task) |
Return the upload progress of a task. More... | |
static void | set_task_start_time (task_t task, char *time) |
Set the start time of a task. More... | |
void | set_task_start_time_epoch (task_t task, int time) |
Set the start time of a task. More... | |
void | set_task_start_time_ctime (task_t task, char *time) |
Set the start time of a task. More... | |
int | task_last_report (task_t task, report_t *report) |
Get the report from the most recently completed invocation of task. More... | |
int | task_last_resumable_report (task_t task, report_t *report) |
Get the report from the most recently stopped invocation of task. More... | |
gchar * | task_second_last_report_id (task_t task) |
Get report ID from second most recently completed invocation of task. More... | |
void | add_task_alert (task_t task, alert_t alert) |
Add an alert to a task. More... | |
static int | set_task_alerts (task_t task, array_t *alerts, gchar **alert_id_return) |
Set the alerts on a task, removing any previous alerts. More... | |
void | set_task_alterable (task_t task, int alterable) |
Set the alterable state of a task. More... | |
int | set_task_groups (task_t task, array_t *groups, gchar **group_id_return) |
Set observer groups on a task, removing any previous groups. More... | |
int | set_task_schedule (task_t task, schedule_t schedule, int periods) |
Set the schedule of a task. More... | |
int | set_task_schedule_uuid (const gchar *task_id, schedule_t schedule, int periods) |
Set the schedule of a task. More... | |
int | set_task_schedule_periods (const gchar *task_id, int periods) |
Set the schedule periods of a task, given a UUID. More... | |
int | set_task_schedule_periods_id (task_t task, int periods) |
Set the schedule periods of a task, given an ID. More... | |
schedule_t | task_schedule (task_t task) |
Return the schedule of a task. More... | |
schedule_t | task_schedule_uuid (const gchar *task_id) |
Return the schedule of a task. More... | |
int | task_schedule_in_trash (task_t task) |
Get whether the task schedule is in the trash. More... | |
int | task_schedule_periods (task_t task) |
Get the number of times the period schedule should run on the task. More... | |
int | task_schedule_periods_uuid (const gchar *task_id) |
Set the next time a scheduled task will be due. More... | |
int | task_schedule_next_time (task_t task) |
Get next time a scheduled task will run, following schedule timezone. More... | |
time_t | task_schedule_next_time_uuid (const gchar *task_id) |
Get the next time a scheduled task will be due. More... | |
void | set_task_schedule_next_time (task_t task, time_t time) |
Set the next time a scheduled task will be due. More... | |
void | set_task_schedule_next_time_uuid (const gchar *task_id, time_t time) |
Set the next time a scheduled task will be due. More... | |
int | set_task_observers (task_t task, const gchar *observers) |
Set the observers of a task. More... | |
void | clear_duration_schedules (task_t task) |
Clear once-off schedules from tasks where the duration has passed. More... | |
void | update_duration_schedule_periods (task_t task) |
Update tasks with limited run schedules which have durations. More... | |
void | auto_delete_reports () |
Auto delete reports. | |
static char * | task_definitions_file (task_t task) |
Get definitions file from a task's config. More... | |
void | reschedule_task (const gchar *task_id) |
Set a task's schedule so that it runs again next scheduling round. More... | |
gboolean | find_result_with_permission (const char *uuid, result_t *result, const char *permission) |
Find a result for a set of permissions, given a UUID. More... | |
static void | result_nvt_notice (const gchar *nvt) |
Ensure an NVT occurs in the result_nvts table. More... | |
result_t | make_osp_result (task_t task, const char *host, const char *hostname, const char *nvt, const char *type, const char *description, const char *port, const char *severity, int qod) |
Make an OSP result. More... | |
int | qod_from_type (const char *qod_type) |
Get QoD percentage for a qod_type string. More... | |
static host_t | host_identify (const char *host_name, const char *identifier_name, const char *identifier_value, const char *source_type, const char *source) |
Identify a host, given an identifier. More... | |
host_t | host_notice (const char *host_name, const char *identifier_type, const char *identifier_value, const char *source_type, const char *source_id, int check_add_to_assets, int check_for_existing_identifier) |
Notice a host. More... | |
static char * | nvt_severity (const char *nvt_id, const char *type) |
Get a severity string from an nvt and result type. More... | |
result_t | make_result (task_t task, const char *host, const char *hostname, const char *port, const char *nvt, const char *type, const char *description) |
Make a result. More... | |
result_t | make_cve_result (task_t task, const char *host, const char *nvt, double cvss, const char *description) |
Make a CVE result. More... | |
int | result_uuid (result_t result, char **id) |
Return the UUID of a result. More... | |
int | result_detection_reference (result_t result, report_t report, const gchar *host, const char *oid, char **ref, char **product, char **location, char **name) |
Get product detection results corresponding to a given vulnerability detection result. More... | |
gchar * | app_location (report_host_t report_host, const gchar *app) |
Get the location of an App for a report's host. More... | |
void | init_host_prognosis_iterator (iterator_t *iterator, report_host_t report_host) |
Initialise a report host prognosis iterator. More... | |
double | prognosis_iterator_cvss_double (iterator_t *iterator) |
Get the CVSS from a result iterator as a double. More... | |
static GHashTable * | new_resources_hashtable () |
Create a new GHashTable for containing resource rowids. More... | |
static void | reports_add_for_override (GHashTable *reports_table, override_t override) |
Add reports affected by an override to an existing GHashtable. This is used to add more reports to the hashtable from reports_for_override. More... | |
static GHashTable * | reports_for_override (override_t override) |
Get reports affected by an override in a GHashTable. More... | |
static void | reports_add_all (GHashTable *reports_table) |
Add all reports to an existing GHashtable. More... | |
static GHashTable * | reports_hashtable () |
Get all reports in a GHashTable. More... | |
static void | reports_build_count_cache (int clear, int *changes_out) |
Rebuild the report count cache for all reports and users. More... | |
void | init_report_counts_build_iterator (iterator_t *iterator, report_t report, int min_qod_limit, int add_defaults, const char *users_where) |
Initializes an iterator for updating the report cache. More... | |
static int | report_counts_build_iterator_min_qod (iterator_t *iterator) |
Get the min_qod from a report_counts build iterator. More... | |
static int | report_counts_build_iterator_override (iterator_t *iterator) |
Get the override flag from a report_counts build iterator. More... | |
static user_t | report_counts_build_iterator_user (iterator_t *iterator) |
Get the user from a report_counts build iterator. More... | |
static void | report_clear_count_cache (report_t report, int clear_original, int clear_overridden, const char *users_where) |
Clear report counts . More... | |
report_t | make_report (task_t task, const char *uuid, task_status_t status) |
Make a report. More... | |
int | create_current_report (task_t task, char **report_id, task_status_t status) |
Create the current report for a task. More... | |
void | host_detail_free (host_detail_t *detail) |
Free a host detail. More... | |
void | insert_report_host_detail (report_t report, const char *host, const char *s_type, const char *s_name, const char *s_desc, const char *name, const char *value) |
Insert a host detail into a report. More... | |
int | create_report (array_t *results, const char *task_id, const char *in_assets, const char *scan_start, const char *scan_end, array_t *host_starts, array_t *host_ends, array_t *details, char **report_id) |
Create a report from an array of results. More... | |
char * | report_uuid (report_t report) |
Return the UUID of a report. More... | |
gboolean | report_task (report_t report, task_t *task) |
Return the task of a report. More... | |
void | report_compliance_by_uuid (const char *report_id, int *compliance_yes, int *compliance_no, int *compliance_incomplete) |
Get compliance counts for a report. More... | |
static char * | report_slave_uuid (report_t report) |
Return the UUID of a report's slave. More... | |
static char * | report_slave_name (report_t report) |
Return the name of a report's slave. More... | |
static char * | report_slave_host (report_t report) |
Return the host of a report's slave. More... | |
static char * | report_slave_port (report_t report) |
Return the port of a report's slave. More... | |
static int | report_slave_port_int (report_t report) |
Return the port of a report's slave. More... | |
static char * | report_source_iface (report_t report) |
Return the source interface of a report. More... | |
void | report_set_slave_uuid (report_t report, const gchar *uuid) |
Set the UUID of the slave on a report. More... | |
void | report_set_slave_name (report_t report, const gchar *name) |
Set the name of the slave on a report. More... | |
void | report_set_slave_host (report_t report, const gchar *host) |
Set the host of the slave of a report. More... | |
void | report_set_slave_port (report_t report, int port) |
Set the port of the slave of a report. More... | |
void | report_set_source_iface (report_t report, const gchar *iface) |
Set the source interface of a report. More... | |
static void | report_add_result_for_buffer (report_t report, result_t result) |
Add a result to a report. More... | |
void | report_add_result (report_t report, result_t result) |
Add a result to a report. More... | |
static gchar * | report_iterator_opts_table (int override, int min_qod) |
Generate the extra_tables string for a report iterator. More... | |
int | report_count (const get_data_t *get) |
Count number of reports. More... | |
int | init_report_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a report iterator, including observed reports. More... | |
void | init_report_iterator_task (iterator_t *iterator, task_t task) |
Initialise a report iterator. More... | |
gboolean | next_report (iterator_t *iterator, report_t *report) |
Read the next report from an iterator. More... | |
static GString * | where_levels_auto (const char *levels, const char *new_severity_sql, const char *auto_type_sql) |
Return SQL WHERE for restricting a SELECT to levels. More... | |
static gchar * | where_qod (int min_qod) |
Return SQL WHERE for restricting a SELECT to a minimum QoD. More... | |
static gchar * | result_iterator_opts_table (int autofp, int override, int dynamic) |
Generate the extra_tables string for a result iterator. More... | |
static int | init_result_get_iterator_severity (iterator_t *iterator, const get_data_t *get, report_t report, const char *host, const gchar *extra_order) |
Initialise the severity-only result iterator. More... | |
int | init_result_get_iterator (iterator_t *iterator, const get_data_t *get, report_t report, const char *host, const gchar *extra_order) |
Initialise a result iterator. More... | |
int | result_count (const get_data_t *get, report_t report, const char *host) |
Count the number of results. More... | |
result_t | result_iterator_result (iterator_t *iterator) |
Get the result from a result iterator. More... | |
const char * | result_iterator_nvt_name (iterator_t *iterator) |
Get the NVT name from a result iterator. More... | |
const char * | result_iterator_nvt_summary (iterator_t *iterator) |
Get the NVT summary from a result iterator. More... | |
const char * | result_iterator_nvt_insight (iterator_t *iterator) |
Get the NVT insight from a result iterator. More... | |
const char * | result_iterator_nvt_affected (iterator_t *iterator) |
Get the NVT affected from a result iterator. More... | |
const char * | result_iterator_nvt_impact (iterator_t *iterator) |
Get the NVT affected from a result iterator. More... | |
const char * | result_iterator_nvt_solution (iterator_t *iterator) |
Get the NVT solution from a result iterator. More... | |
const char * | result_iterator_nvt_solution_type (iterator_t *iterator) |
Get the NVT solution_type from a result iterator. More... | |
const char * | result_iterator_nvt_detection (iterator_t *iterator) |
Get the NVT detection from a result iterator. More... | |
const char * | result_iterator_nvt_family (iterator_t *iterator) |
Get the NVT family from a result iterator. More... | |
const char * | result_iterator_nvt_cvss_base (iterator_t *iterator) |
Get the NVT CVSS base value from a result iterator. More... | |
void | nvti_refs_append_xml (GString *xml, const char *oid, int *first) |
Get the NVT's references in XML format from a nvti object via oid. More... | |
void | result_iterator_nvt_refs_append (GString *xml, iterator_t *iterator, int *first) |
Get the NVT's references in XML format from a result iterator. More... | |
const char * | result_iterator_nvt_tag (iterator_t *iterator) |
Get the NVT tags from a result iterator. More... | |
static const char * | result_iterator_type (iterator_t *iterator) |
Get the type from a result iterator. More... | |
task_t | result_iterator_task (iterator_t *iterator) |
Get the task from a result iterator. More... | |
report_t | result_iterator_report (iterator_t *iterator) |
Get the report from a result iterator. More... | |
const char * | result_iterator_scan_nvt_version (iterator_t *iterator) |
Get the NVT version used during the scan from a result iterator. More... | |
const char * | result_iterator_original_severity (iterator_t *iterator) |
Get the original severity from a result iterator. More... | |
const char * | result_iterator_severity (iterator_t *iterator) |
Get the severity from a result iterator. More... | |
double | result_iterator_severity_double (iterator_t *iterator) |
Get the severity from a result iterator as double. More... | |
const char * | result_iterator_original_level (iterator_t *iterator) |
Get the original severity/threat level from a result iterator. More... | |
const char * | result_iterator_level (iterator_t *iterator) |
Get the severity/threat level from a result iterator. More... | |
int | result_iterator_may_have_notes (iterator_t *iterator) |
Get whether notes may exist from a result iterator. More... | |
int | result_iterator_may_have_overrides (iterator_t *iterator) |
Get whether overrides may exist from a result iterator. More... | |
int | result_iterator_may_have_tickets (iterator_t *iterator) |
Get whether tickets may exist from a result iterator. More... | |
int | result_iterator_has_cert_bunds (iterator_t *iterator) |
Get whether CERT-Bunds may exist from a result iterator. More... | |
int | result_iterator_has_dfn_certs (iterator_t *iterator) |
Get whether DFN-CERTs may exist from a result iterator. More... | |
int | cleanup_result_nvts () |
Check if the result_nvts are assigned to result. More... | |
void | init_report_host_iterator (iterator_t *iterator, report_t report, const char *host, report_host_t report_host) |
Initialise a host iterator. More... | |
static report_host_t | host_iterator_report_host (iterator_t *iterator) |
Get the report host from a host iterator. More... | |
int | host_iterator_current_port (iterator_t *iterator) |
Get the current port from a host iterator. More... | |
int | host_iterator_max_port (iterator_t *iterator) |
Get the max port from a host iterator. More... | |
void | init_report_errors_iterator (iterator_t *iterator, report_t report) |
Initialise a report errors iterator. More... | |
static result_t | report_errors_iterator_result (iterator_t *iterator) |
Get the result from a report error messages iterator. More... | |
static void | init_report_host_details_iterator (iterator_t *iterator, report_host_t report_host) |
Initialise a report host details iterator. More... | |
void | set_task_end_time (task_t task, char *time) |
Set the end time of a task. More... | |
void | set_task_end_time_epoch (task_t task, time_t time) |
Set the end time of a task. More... | |
static char * | scan_start_time (report_t report) |
Get the start time of a scan. More... | |
int | scan_start_time_epoch (report_t report) |
Get the start time of a scan, in seconds since the epoch. More... | |
char * | scan_start_time_uuid (const char *uuid) |
Get the start time of a scan. More... | |
static void | set_scan_start_time (report_t report, const char *timestamp) |
Set the start time of a scan. More... | |
void | set_scan_start_time_epoch (report_t report, time_t timestamp) |
Set the start time of a scan. More... | |
void | set_scan_start_time_ctime (report_t report, const char *timestamp) |
Set the start time of a scan. More... | |
static char * | scan_end_time (report_t report) |
Get the end time of a scan. More... | |
char * | scan_end_time_uuid (const char *uuid) |
Get the end time of a scan. More... | |
void | set_scan_end_time_epoch (report_t report, time_t timestamp) |
Set the end time of a scan. More... | |
void | set_scan_end_time (report_t report, const char *timestamp) |
Set the end time of a scan. More... | |
void | set_scan_end_time_ctime (report_t report, const char *timestamp) |
Set the end time of a scan. More... | |
int | scan_host_end_time (report_t report, const char *host) |
Get the end time of a scanned host. More... | |
void | set_scan_host_end_time (report_t report, const char *host, const char *timestamp) |
Set the end time of a scanned host. More... | |
void | set_scan_host_end_time_ctime (report_t report, const char *host, const char *timestamp) |
Set the end time of a scanned host. More... | |
static void | set_scan_host_start_time (report_t report, const char *host, const char *timestamp) |
Set the start time of a scanned host. More... | |
void | set_scan_host_start_time_ctime (report_t report, const char *host, const char *timestamp) |
Set the start time of a scanned host. More... | |
int | report_timestamp (const char *report_id, gchar **timestamp) |
Get the timestamp of a report. More... | |
static int | report_scan_run_status (report_t report, task_status_t *status) |
Return the run status of the scan associated with a report. More... | |
int | set_report_scan_run_status (report_t report, task_status_t status) |
Return the run status of the scan associated with a report. More... | |
int | report_counts (const char *report_id, int *debugs, int *holes, int *infos, int *logs, int *warnings, int *false_positives, double *severity, int override, int autofp, int min_qod) |
Get the message counts for a report given the UUID. More... | |
static void | report_counts_from_cache (report_t report, int override, int min_qod, severity_data_t *data) |
Get cached result counts for a report and the current user. More... | |
int | report_counts_id (report_t report, int *debugs, int *holes, int *infos, int *logs, int *warnings, int *false_positives, double *severity, const get_data_t *get, const char *host) |
Get only the filtered message counts for a report. More... | |
double | report_severity (report_t report, int overrides, int min_qod) |
Get the maximum severity of a report. More... | |
int | delete_report_internal (report_t report) |
Delete a report. More... | |
int | modify_report (const char *report_id, const char *comment) |
Modify a report. More... | |
int | delete_report (const char *report_id, int dummy) |
Delete a report. More... | |
static int | report_slave_progress (report_t report) |
Return the slave progress of a report. More... | |
int | set_report_slave_progress (report_t report, int progress) |
Set slave progress of a report. More... | |
char * | report_slave_task_uuid (report_t report) |
Return the UUID of the task on the slave. More... | |
void | set_report_slave_task_uuid (report_t report, const char *uuid) |
Set the UUID of the slave task, on the local task. More... | |
void | trim_report (report_t report) |
Prepare a partial report for restarting the scan from the beginning. More... | |
void | trim_partial_report (report_t report) |
Prepare a partial report for resumption of the scan. More... | |
static gint | compare_severity_desc (gconstpointer arg_one, gconstpointer arg_two) |
Compares two textual port representations, sorting descending. More... | |
static gint | compare_severity_asc (gconstpointer arg_one, gconstpointer arg_two) |
Compares two textual port representations, sorting descending. More... | |
static result_buffer_t * | result_buffer_new (const gchar *host, const gchar *port, const gchar *severity, double severity_double) |
Create a result buffer. More... | |
static void | result_buffer_free (result_buffer_t *result_buffer) |
Free a result buffer. More... | |
static gint | compare_port_severity (gconstpointer arg_one, gconstpointer arg_two) |
Compares two buffered results, sorting by host, port then severity. More... | |
void | buffer_results_xml (GString *, iterator_t *, task_t, int, int, int, int, int, int, int, const char *, iterator_t *, int, int, int) |
Buffer XML for some results. More... | |
static compare_results_t | result_cmp (iterator_t *results, iterator_t *delta_results, int sort_order, const char *sort_field) |
Return the sort order of two results. More... | |
static compare_results_t | compare_results (iterator_t *results, iterator_t *delta_results, int sort_order, const char *sort_field) |
Compare two results. More... | |
static compare_results_t | compare_and_buffer_results (GString *buffer, iterator_t *results, iterator_t *delta_results, task_t task, int notes, int notes_details, int overrides, int overrides_details, int sort_order, const char *sort_field, int changed, int gone, int new, int same, int *max_results, int *first_result, int *used, int *would_use) |
Compare two results, writing associated XML to a buffer. More... | |
static void | add_port (GTree *ports, iterator_t *results) |
Add a port to a port tree. More... | |
static gboolean | print_host_port (gpointer key, gpointer value, gpointer data) |
Print delta host ports. More... | |
static gboolean | print_host_ports (gpointer key, gpointer value, gpointer stream) |
Print delta ports. More... | |
static gboolean | array_add_port (gpointer key, gpointer value, gpointer ports) |
Add port to ports array. More... | |
static gboolean | print_host_ports_desc (gpointer key, gpointer value, gpointer stream) |
Print delta ports, in descending order. More... | |
static gint | compare_ports_severity (gconstpointer one, gconstpointer two) |
Compare port severities, ascending. More... | |
static gint | compare_ports_severity_desc (gconstpointer one, gconstpointer two) |
Compare port severities, descending. More... | |
static gboolean | print_host_ports_by_severity (gpointer key, gpointer value, gpointer stream, int ascending) |
Print delta ports, ordering by severity. More... | |
static gboolean | print_host_ports_by_severity_desc (gpointer key, gpointer value, gpointer stream) |
Print delta ports, ordering by severity descending. More... | |
static gboolean | print_host_ports_by_severity_asc (gpointer key, gpointer value, gpointer stream) |
Print delta ports, ordering by severity ascending. More... | |
static gboolean | free_host_ports (GTree *host_ports, gpointer dummy) |
Free delta host ports. More... | |
gboolean | host_nthlast_report_host (const char *host, report_host_t *report_host, int position) |
Get N'th last report_host given a host. More... | |
int | report_host_count (report_t report) |
Count a report's total number of hosts. More... | |
int | report_result_host_count (report_t report, int min_qod) |
Count a report's total number of hosts with results. More... | |
static int | report_port_count (report_t report) |
Count a report's total number of tcp/ip ports. More... | |
static int | report_closed_cve_count (report_t report) |
Count a report's total number of closed cves. More... | |
static int | report_vuln_count (report_t report) |
Count a report's total number of vulnerabilities. More... | |
static int | report_os_count (report_t report) |
Count a report's total number of detected Operating Systems. More... | |
static int | report_app_count (report_t report) |
Count a report's total number of detected Apps. More... | |
static int | report_ssl_cert_count (report_t report) |
Count a report's total number of found SSL Certificates. More... | |
static int | report_error_count (report_t report) |
Count a report's total number of error messages. More... | |
char * | report_finished_hosts_str (report_t report) |
Get a list string of finished hosts in a report. More... | |
static int | print_report_host_detail (FILE *stream, iterator_t *details, int lean) |
Write report host detail to file stream. More... | |
static int | print_report_host_details_xml (report_host_t report_host, FILE *stream, int lean) |
Print the XML for a report's host details to a file stream. More... | |
static int | print_report_errors_xml (report_t report, FILE *stream) |
Print the XML for a report's error messages to a file stream. More... | |
static int | print_report_port_xml (report_t report, FILE *out, const get_data_t *get, int first_result, int max_results, int sort_order, const char *sort_field, GHashTable *host_ports) |
Print the XML for a report port summary to a file. More... | |
static int | report_active (report_t report) |
Check whether the scan of a report is active. More... | |
static int | report_progress_active (report_t report, long maximum_hosts, gchar **hosts_xml) |
Get progress for active report. More... | |
int | report_progress (report_t report, task_t task, gchar **hosts_xml) |
Calculate the progress of a report. More... | |
static gchar * | severity_class_xml (const gchar *severity) |
Buffer XML for a severity class. More... | |
static int | tz_revert (gchar *zone, char *tz, char *old_tz_override) |
Restore original TZ. More... | |
static void | host_summary_append (GString *host_summary_buffer, const char *host, const char *start_iso, const char *end_iso) |
Print the XML for a report to a file. More... | |
static int | init_delta_iterators (report_t report, iterator_t *results, report_t delta, iterator_t *delta_results, const get_data_t *get, const char *term, const char *sort_field) |
Init delta iterators for print_report_xml. More... | |
static int | print_report_delta_xml (FILE *out, iterator_t *results, iterator_t *delta_results, const char *delta_states, int first_result, int max_results, task_t task, int notes, int notes_details, int overrides, int overrides_details, int sort_order, const char *sort_field, int result_hosts_only, int *orig_filtered_result_count, int *filtered_result_count, int *orig_f_debugs, int *f_debugs, int *orig_f_holes, int *f_holes, int *orig_f_infos, int *f_infos, int *orig_f_logs, int *f_logs, int *orig_f_warnings, int *f_warnings, int *orig_f_false_positives, int *f_false_positives, array_t *result_hosts) |
Print delta results for print_report_xml. More... | |
static int | print_report_xml_start (report_t report, report_t delta, task_t task, gchar *xml_start, const get_data_t *get, int notes_details, int overrides_details, int result_tags, int ignore_pagination, int lean, gchar **filter_term_return, gchar **zone_return, gchar **host_summary) |
Print the main XML content for a report to a file. More... | |
static int | print_report_xml_end (gchar *xml_start, gchar *xml_full, report_format_t report_format) |
Completes a report by adding report format info. More... | |
gchar * | manage_report (report_t report, report_t delta_report, const get_data_t *get, const report_format_t report_format, int notes_details, int overrides_details, gsize *output_length, gchar **extension, gchar **content_type, gchar **filter_term_return, gchar **zone_return, gchar **host_summary) |
Generate a report. More... | |
static int | run_report_format_script (gchar *report_format_id, gchar *xml_file, gchar *xml_dir, gchar *report_format_extra, gchar *output_file) |
Runs the script of a report format. More... | |
int | manage_send_report (report_t report, report_t delta_report, report_format_t report_format, const get_data_t *get, int notes_details, int overrides_details, int result_tags, int ignore_pagination, int lean, int base64, gboolean(*send)(const char *, int(*)(const char *, void *), void *), int(*send_data_1)(const char *, void *), void *send_data_2, const char *alert_id, const gchar *prefix) |
Generate a report. More... | |
gchar * | report_host_ip (const char *host) |
Get the IP of a host, using the 'hostname' report host details. More... | |
int | report_host_noticeable (report_t report, const gchar *host) |
Check if a report host is alive and has at least one result. More... | |
void | parse_osp_report (task_t task, report_t report, const char *report_xml) |
Parse an OSP report. More... | |
static const char * | task_trend_calc (int holes_a, int warns_a, int infos_a, double severity_a, int holes_b, int warns_b, int infos_b, double severity_b) |
Return the trend of a task, given counts. More... | |
const char * | task_iterator_trend_counts (iterator_t *iterator, int holes_a, int warns_a, int infos_a, double severity_a, int holes_b, int warns_b, int infos_b, double severity_b) |
Return the trend of a task, given counts. More... | |
task_t | make_task (char *name, char *comment, int in_assets, int event) |
Make a task. More... | |
void | make_task_complete (task_t task) |
Complete the creation of a task. More... | |
void | set_task_name (task_t task, const char *name) |
Set the name of a task. More... | |
static void | set_task_comment (task_t task, const char *comment) |
Set the comment of a task. More... | |
int | copy_task (const char *name, const char *comment, const char *task_id, int alterable, task_t *new_task) |
Create a task from an existing task. More... | |
static int | delete_task_lock (task_t task, int ultimate) |
Complete deletion of a task. More... | |
int | request_delete_task (task_t *task_pointer) |
Request deletion of a task. More... | |
int | request_delete_task_uuid (const char *task_id, int ultimate) |
Request deletion of a task. More... | |
int | delete_task (task_t task, int ultimate) |
Complete deletion of a task. More... | |
static int | delete_trash_tasks () |
Delete all trash tasks. More... | |
void | append_to_task_comment (task_t task, const char *text, int length) |
Append text to the comment associated with a task. More... | |
void | set_scan_ports (report_t report, const char *host, unsigned int current, unsigned int max) |
Set the ports for a particular host in a scan. More... | |
gboolean | find_task_with_permission (const char *uuid, task_t *task, const char *permission) |
Find a task for a specific permission, given a UUID. More... | |
gboolean | find_trash_task_with_permission (const char *uuid, task_t *task, const char *permission) |
Find a task in the trashcan for a specific permission, given a UUID. More... | |
gboolean | find_report_with_permission (const char *uuid, report_t *report, const char *permission) |
Find a report for a specific permission, given a UUID. More... | |
void | reset_task (task_t task) |
Reset all running information for a task. More... | |
int | manage_task_update_file (const gchar *task_id, const char *name, const void *content) |
Add a file to a task, or update the file on the task. More... | |
int | manage_task_remove_file (const gchar *task_id, const char *name) |
Remove a file on a task. More... | |
void | init_task_file_iterator (iterator_t *iterator, task_t task, const char *file) |
Initialise a task file iterator. More... | |
int | modify_task (const gchar *task_id, const gchar *name, const gchar *comment, const gchar *scanner_id, const gchar *target_id, const gchar *config_id, const gchar *observers, array_t *alerts, const gchar *alterable, array_t *groups, const gchar *schedule_id, const gchar *schedule_periods, array_t *preferences, const gchar *hosts_ordering, gchar **fail_alert_id, gchar **fail_group_id) |
Modify a task. More... | |
int | manage_max_hosts () |
Get the maximum allowed number of hosts per target. More... | |
static void | manage_set_max_hosts (int new_max) |
Set the maximum allowed number of hosts per target. More... | |
gboolean | find_target_with_permission (const char *uuid, target_t *target, const char *permission) |
Find a target for a specific permission, given a UUID. More... | |
int | manage_count_hosts (const char *given_hosts, const char *exclude_hosts) |
Return number of hosts described by a hosts string. More... | |
static gchar * | trim_hosts (gchar *string) |
Trim leading and trailing space from a hosts string. More... | |
void | manage_transaction_start () |
Start a new IMMEDIATE transaction. | |
void | manage_transaction_stop (gboolean force_commit) |
Commit the current transaction, if any. More... | |
static int | validate_port (const char *port) |
Validate a single port. More... | |
static int | validate_results_port (const char *port) |
Validate a single port. More... | |
static int | alive_test_from_string (const char *alive_tests) |
Convert alive test name to alive test bitfield. More... | |
static int | set_target_login_data (target_t target, const char *type, credential_t credential, int port) |
Set login data for a target. More... | |
credential_t | target_credential (target_t target, const char *type) |
Get a credential from a target. More... | |
int | target_login_port (target_t target, const char *type) |
Get a login port from a target. More... | |
int | create_target (const char *name, const char *asset_hosts_filter, const char *hosts, const char *exclude_hosts, const char *comment, const char *port_list_id, const char *port_range, credential_t ssh_credential, const char *ssh_port, credential_t smb_credential, credential_t esxi_credential, credential_t snmp_credential, const char *reverse_lookup_only, const char *reverse_lookup_unify, const char *alive_tests, target_t *target) |
Create a target. More... | |
int | copy_target (const char *name, const char *comment, const char *target_id, target_t *new_target) |
Create a target from an existing target. More... | |
int | delete_target (const char *target_id, int ultimate) |
Delete a target. More... | |
int | modify_target (const char *target_id, const char *name, const char *hosts, const char *exclude_hosts, const char *comment, const char *port_list_id, const char *ssh_credential_id, const char *ssh_port, const char *smb_credential_id, const char *esxi_credential_id, const char *snmp_credential_id, const char *reverse_lookup_only, const char *reverse_lookup_unify, const char *alive_tests) |
Modify a target. More... | |
int | target_count (const get_data_t *get) |
Count number of targets. More... | |
void | init_target_iterator_one (iterator_t *iterator, target_t target) |
Initialise a target iterator, given a single target. More... | |
int | init_target_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a target iterator, including observed targets. More... | |
int | target_iterator_ssh_credential (iterator_t *iterator) |
Get the SSH LSC credential from a target iterator. More... | |
int | target_iterator_smb_credential (iterator_t *iterator) |
Get the SMB LSC credential from a target iterator. More... | |
int | target_iterator_ssh_trash (iterator_t *iterator) |
Get the location of the SSH LSC credential from a target iterator. More... | |
int | target_iterator_smb_trash (iterator_t *iterator) |
Get the location of the SMB LSC credential from a target iterator. More... | |
int | target_iterator_port_list_trash (iterator_t *iterator) |
Get the location of the port list from a target iterator. More... | |
const char * | target_iterator_alive_tests (iterator_t *iterator) |
Get the alive test description from a target iterator. More... | |
int | target_iterator_esxi_credential (iterator_t *iterator) |
Get the ESXi LSC credential from a target iterator. More... | |
int | target_iterator_esxi_trash (iterator_t *iterator) |
Get the ESXi LSC credential from a target iterator. More... | |
int | target_iterator_snmp_credential (iterator_t *iterator) |
Get the SNMP LSC credential from a target iterator. More... | |
int | target_iterator_snmp_trash (iterator_t *iterator) |
Get the SNMP LSC credential location from a target iterator. More... | |
char * | tag_uuid (tag_t tag) |
Return the UUID of a tag. More... | |
char * | target_uuid (target_t target) |
Return the UUID of a target. More... | |
char * | trash_target_uuid (target_t target) |
Return the UUID of a trashcan target. More... | |
char * | target_name (target_t target) |
Return the name of a target. More... | |
char * | trash_target_name (target_t target) |
Return the name of a trashcan target. More... | |
int | trash_target_readable (target_t target) |
Return whether a trashcan target is readable. More... | |
char * | target_hosts (target_t target) |
Return the hosts associated with a target. More... | |
char * | target_exclude_hosts (target_t target) |
Return the excluded hosts associated with a target. More... | |
char * | target_reverse_lookup_only (target_t target) |
Return the reverse_lookup_only value of a target. More... | |
char * | target_reverse_lookup_unify (target_t target) |
Return the reverse_lookup_unify value of a target. More... | |
char * | target_ssh_port (target_t target) |
Return the SSH LSC port of a target. More... | |
credential_t | target_ssh_credential (target_t target) |
Return the SSH credential associated with a target, if any. More... | |
credential_t | target_smb_credential (target_t target) |
Return the SMB credential associated with a target, if any. More... | |
credential_t | target_esxi_credential (target_t target) |
Return the ESXi credential associated with a target, if any. More... | |
port_list_t | target_port_list (target_t target) |
Return the port list associated with a target, if any. More... | |
char * | target_port_range (target_t target) |
Return the port range of a target, in GMP port range list format. More... | |
alive_test_t | target_alive_tests (target_t target) |
Return a target's alive tests. More... | |
int | target_in_use (target_t target) |
Return whether a target is in use by a task. More... | |
int | trash_target_in_use (target_t target) |
Return whether a trashcan target is referenced by a task. More... | |
int | target_writable (target_t target) |
Return whether a target is writable. More... | |
int | trash_target_writable (target_t target) |
Return whether a trashcan target is writable. More... | |
void | init_target_task_iterator (iterator_t *iterator, target_t target) |
Initialise a target task iterator. More... | |
int | target_task_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
static gchar * | alert_url_print (const gchar *url, const gchar *oid, const gchar *type) |
Print an URL for a New NVTs alert. More... | |
static gchar * | new_nvts_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for New NVTs event. More... | |
static gchar * | new_cves_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for New CVEs event. More... | |
static gchar * | new_cpes_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for New CPEs event. More... | |
static gchar * | new_cert_bunds_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for "New CERT-Bund Advisories" event message. More... | |
static gchar * | new_dfn_certs_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for "New DFN-CERT Advisories" event message. More... | |
static gchar * | new_oval_defs_list (event_t event, const void *event_data, alert_t alert, int example, int *count_return) |
Create list for "New OVAL Definitions" event. More... | |
gboolean | find_credential_with_permission (const char *uuid, credential_t *credential, const char *permission) |
Find a credential for a specific permission, given a UUID. More... | |
static int | validate_credential_username (const gchar *username) |
Test if a username is valid to use in a credential. More... | |
static gboolean | validate_credential_username_for_format (const gchar *username, credential_format_t format) |
Test if a username is valid for a credential export format. More... | |
int | create_credential (const char *name, const char *comment, const char *login, const char *given_password, const char *key_private, const char *key_public, const char *certificate, const char *community, const char *auth_algorithm, const char *privacy_password, const char *privacy_algorithm, const char *given_type, const char *allow_insecure, credential_t *credential) |
Create a Credential. More... | |
int | copy_credential (const char *name, const char *comment, const char *credential_id, credential_t *new_credential) |
Create an LSC Credential from an existing one. More... | |
int | modify_credential (const char *credential_id, const char *name, const char *comment, const char *login, const char *password, const char *key_private, const char *key_public, const char *certificate, const char *community, const char *auth_algorithm, const char *privacy_password, const char *privacy_algorithm, const char *allow_insecure) |
Modify a Credential. More... | |
int | delete_credential (const char *credential_id, int ultimate) |
Delete a Credential. More... | |
int | credential_count (const get_data_t *get) |
Count number of LSC Credentials. More... | |
int | credential_in_use (credential_t credential) |
Check whether a Credential is in use. More... | |
int | trash_credential_in_use (credential_t credential) |
Check whether a trashcan Credential is in use. More... | |
int | credential_writable (credential_t credential) |
Check whether a Credential is writable. More... | |
int | trash_credential_writable (credential_t credential) |
Check whether a trashcan Credential is writable. More... | |
gchar * | credential_value (credential_t credential, const char *value_name) |
Get a value from a credential. More... | |
gchar * | credential_encrypted_value (credential_t credential, const char *value_name) |
Get a possibly encrypted credential value in decrypted form. More... | |
void | set_credential_privacy_algorithm (credential_t credential, const char *algorithm) |
Set the privacy_algorithm of a Credential. More... | |
void | set_credential_public_key (credential_t credential, const char *public_key) |
Set the public key of a Credential. More... | |
void | init_credential_iterator_one (iterator_t *iterator, credential_t credential) |
Initialise a Credential iterator, given a single Credential. More... | |
int | init_credential_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a Credential iterator. More... | |
static const char * | credential_iterator_encrypted_data (iterator_t *iterator, const char *type) |
Get possibly encrypted data from credentials. More... | |
int | credential_iterator_allow_insecure (iterator_t *iterator) |
Get the login from a Credential iterator. More... | |
const char * | credential_iterator_password (iterator_t *iterator) |
Get the password from a Credential iterator. More... | |
const char * | credential_iterator_private_key (iterator_t *iterator) |
Get the private_key from a Credential iterator. More... | |
const char * | credential_iterator_community (iterator_t *iterator) |
Get the SNMP community from a Credential iterator. More... | |
const char * | credential_iterator_privacy_password (iterator_t *iterator) |
Get the privacy password from a Credential iterator. More... | |
char * | credential_iterator_rpm (iterator_t *iterator) |
Get the rpm from a Credential iterator. More... | |
char * | credential_iterator_deb (iterator_t *iterator) |
Get the deb from a Credential iterator. More... | |
char * | credential_iterator_exe (iterator_t *iterator) |
Get the exe from a Credential iterator. More... | |
gboolean | credential_iterator_format_available (iterator_t *iterator, credential_format_t format) |
Test if a credential format is available for an iterator. More... | |
gchar * | credential_iterator_formats_xml (iterator_t *iterator) |
Get XML of available formats for a credential iterator. More... | |
char * | credential_uuid (credential_t credential) |
Get the UUID of a Credential. More... | |
char * | trash_credential_uuid (credential_t credential) |
Get the UUID of a Credential in the trashcan. More... | |
char * | credential_name (credential_t credential) |
Get the name of an LSC credential. More... | |
char * | trash_credential_name (credential_t credential) |
Get the name of an LSC credential in the trashcan. More... | |
char * | credential_type (credential_t credential) |
Get the type of a Credential. More... | |
int | trash_credential_readable (credential_t credential) |
Return whether a trashcan credential is readable. More... | |
void | init_credential_target_iterator (iterator_t *iterator, credential_t credential, int ascending) |
Initialise a Credential target iterator. More... | |
int | credential_target_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
void | init_credential_scanner_iterator (iterator_t *iterator, credential_t credential, int ascending) |
Initialise a Credential scanner iterator. More... | |
int | credential_scanner_iterator_readable (iterator_t *iterator) |
Get the read permission status from a Credential Scanner iterator. More... | |
static gboolean | find_agent_with_permission (const char *uuid, agent_t *agent, const char *permission) |
Find a agent for a specific permission, given a UUID. More... | |
static int | find_signature (const gchar *location, const gchar *installer_filename, gchar **signature, gsize *signature_size, gchar **uuid) |
Find a signature in a feed. More... | |
static const char * | get_sysconf_gpghome () |
Return the name of the sysconf GnuPG home directory. More... | |
static const char * | get_trustedkeys_name () |
Return the name of the trusted keys file name. More... | |
static int | verify_signature (const gchar *installer, gsize installer_size, const gchar *signature, gsize signature_size, int *trust) |
Execute gpg to verify an installer signature. More... | |
int | create_agent (const char *name, const char *comment, const char *installer_64, const char *installer_filename, const char *installer_signature_64, const char *howto_install, const char *howto_use, agent_t *agent) |
Create an agent entry. More... | |
int | copy_agent (const char *name, const char *comment, const char *agent_id, agent_t *new_agent) |
Create an agent from an existing agent. More... | |
int | modify_agent (const char *agent_id, const char *name, const char *comment) |
Modify an agent. More... | |
int | delete_agent (const char *agent_id, int ultimate) |
Delete an agent. More... | |
int | agent_in_use (agent_t agent) |
Check whether an agent is in use. More... | |
int | trash_agent_in_use (agent_t agent) |
Check whether a trashcan agent is writable. More... | |
int | agent_writable (agent_t agent) |
Check whether a agent is writable. More... | |
int | trash_agent_writable (agent_t agent) |
Check whether a trashcan agent is writable. More... | |
char * | agent_uuid (agent_t agent) |
Return the UUID of an agent. More... | |
resource_t | get_iterator_resource (iterator_t *iterator) |
Get the resource from a GET iterator. More... | |
const char * | get_iterator_comment (iterator_t *iterator) |
Get the comment from a GET iterator. More... | |
user_t | get_iterator_owner (iterator_t *iterator) |
Get the owner from a GET iterator. More... | |
int | init_agent_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise an agent iterator. More... | |
static gsize | agent_iterator_installer_size (iterator_t *iterator) |
Get the installer size from an agent iterator. More... | |
const char * | agent_iterator_trust (iterator_t *iterator) |
Get the trust value from an agent iterator. More... | |
time_t | agent_iterator_trust_time (iterator_t *iterator) |
Get the installer trust time from a agent iterator. More... | |
int | agent_count (const get_data_t *get) |
Count number of agents. More... | |
int | verify_agent (const char *agent_id) |
Verify an agent. More... | |
gboolean | find_note_with_permission (const char *uuid, note_t *note, const char *permission) |
Find a note for a specific permission, given a UUID. More... | |
static gboolean | nvt_exists (const char *nvt) |
Check if an NVT exists. More... | |
int | create_note (const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *severity, const char *threat, task_t task, result_t result, note_t *note) |
Create a note. More... | |
int | copy_note (const char *note_id, note_t *new_note) |
Create a note from an existing note. More... | |
int | delete_note (const char *note_id, int ultimate) |
Delete a note. More... | |
int | note_uuid (note_t note, char **id) |
Return the UUID of a note. More... | |
int | modify_note (const gchar *note_id, const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *severity, const char *threat, const gchar *task_id, const gchar *result_id) |
Modify a note. More... | |
int | note_count (const get_data_t *get, nvt_t nvt, result_t result, task_t task) |
Count number of notes. More... | |
int | init_note_iterator (iterator_t *iterator, const get_data_t *get, nvt_t nvt, result_t result, task_t task) |
Initialise a note iterator. More... | |
const char * | note_iterator_threat (iterator_t *iterator) |
Get the threat from a note iterator. More... | |
task_t | note_iterator_task (iterator_t *iterator) |
Get the task from a note iterator. More... | |
result_t | note_iterator_result (iterator_t *iterator) |
Get the result from a note iterator. More... | |
time_t | note_iterator_end_time (iterator_t *iterator) |
Get the end time from an note iterator. More... | |
int | note_iterator_active (iterator_t *iterator) |
Get the active status from an note iterator. More... | |
const char * | note_iterator_nvt_type (iterator_t *iterator) |
Get the NVT type from a note iterator. More... | |
gboolean | find_override_with_permission (const char *uuid, override_t *override, const char *permission) |
Find a override for a specific permission, given a UUID. More... | |
int | create_override (const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *threat, const char *new_threat, const char *severity, const char *new_severity, task_t task, result_t result, override_t *override) |
Create an override. More... | |
int | override_uuid (override_t override, char **id) |
Return the UUID of an override. More... | |
int | copy_override (const char *override_id, override_t *new_override) |
Create a override from an existing override. More... | |
int | delete_override (const char *override_id, int ultimate) |
Delete a override. More... | |
int | modify_override (const gchar *override_id, const char *active, const char *nvt, const char *text, const char *hosts, const char *port, const char *threat, const char *new_threat, const char *severity, const char *new_severity, const gchar *task_id, const gchar *result_id) |
Modify an override. More... | |
int | override_count (const get_data_t *get, nvt_t nvt, result_t result, task_t task) |
Count number of overrides. More... | |
int | init_override_iterator (iterator_t *iterator, const get_data_t *get, nvt_t nvt, result_t result, task_t task) |
Initialise an override iterator. More... | |
const char * | override_iterator_threat (iterator_t *iterator) |
Get the threat from a override iterator. More... | |
const char * | override_iterator_new_threat (iterator_t *iterator) |
Get the threat from an override iterator. More... | |
task_t | override_iterator_task (iterator_t *iterator) |
Get the task from a override iterator. More... | |
result_t | override_iterator_result (iterator_t *iterator) |
Get the result from a override iterator. More... | |
time_t | override_iterator_end_time (iterator_t *iterator) |
Get the end time from an override iterator. More... | |
int | override_iterator_active (iterator_t *iterator) |
Get the active status from an override iterator. More... | |
const char * | override_iterator_nvt_type (iterator_t *iterator) |
Get the NVT type from a override iterator. More... | |
int | manage_create_scanner (GSList *log_config, const gchar *database, const char *name, const char *host, const char *port, const char *type, const char *ca_pub_path, const char *credential_id, const char *key_pub_path, const char *key_priv_path) |
Create the given scanner. More... | |
int | manage_delete_scanner (GSList *log_config, const gchar *database, const gchar *uuid) |
Delete the given scanner. More... | |
int | manage_modify_scanner (GSList *log_config, const gchar *database, const char *scanner_id, const char *name, const char *host, const char *port, const char *type, const char *ca_pub_path, const char *credential_id, const char *key_pub_path, const char *key_priv_path) |
Modify the given scanner. More... | |
int | manage_verify_scanner (GSList *log_config, const gchar *database, const gchar *uuid) |
Verify the given scanner. More... | |
gboolean | find_scanner_with_permission (const char *uuid, scanner_t *scanner, const char *permission) |
Find a scanner for a specific permission, given a UUID. More... | |
static void | insert_scanner (const char *name, const char *comment, const char *host, const char *ca_pub, int iport, int itype, scanner_t *new_scanner) |
Insert a scanner for create_scanner. More... | |
int | create_scanner (const char *name, const char *comment, const char *host, const char *port, const char *type, scanner_t *new_scanner, const char *ca_pub, const char *credential_id) |
Create a scanner. More... | |
int | copy_scanner (const char *name, const char *comment, const char *scanner_id, scanner_t *new_scanner) |
Create a scanner from an existing scanner. More... | |
int | modify_scanner (const char *scanner_id, const char *name, const char *comment, const char *host, const char *port, const char *type, const char *ca_pub, const char *credential_id) |
Modify an scanner. More... | |
int | delete_scanner (const char *scanner_id, int ultimate) |
Delete a scanner. More... | |
int | init_scanner_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise an scanner iterator. More... | |
int | scanner_iterator_port (iterator_t *iterator) |
Get the port from an scanner iterator. More... | |
int | scanner_iterator_type (iterator_t *iterator) |
Get the type from an scanner iterator. More... | |
credential_t | scanner_iterator_credential (iterator_t *iterator) |
Get the credential of the scanner from a scanner iterator. More... | |
int | scanner_iterator_credential_trash (iterator_t *iterator) |
Get the credential location of the scanner from a scanner iterator. More... | |
static const char * | scanner_iterator_key_priv (iterator_t *iterator) |
Get the Scanner private key from a scanner iterator. More... | |
void | init_scanner_config_iterator (iterator_t *iterator, scanner_t scanner) |
Initialise a scanner config iterator. More... | |
int | scanner_config_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
void | init_scanner_task_iterator (iterator_t *iterator, scanner_t scanner) |
Initialise a scanner task iterator. More... | |
int | scanner_task_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
int | scanner_in_use (scanner_t scanner) |
Check whether an scanner is in use. More... | |
int | trash_scanner_in_use (scanner_t scanner) |
Check whether a trashcan scanner is writable. More... | |
int | scanner_writable (scanner_t scanner) |
Check whether a scanner is writable. More... | |
int | trash_scanner_writable (scanner_t scanner) |
Check whether a trashcan scanner is writable. More... | |
int | trash_scanner_readable (scanner_t scanner) |
Return whether a trashcan scanner is readable. More... | |
char * | scanner_name (scanner_t scanner) |
Return the name of a scanner. More... | |
char * | scanner_uuid (scanner_t scanner) |
Return the UUID of a scanner. More... | |
const char * | scanner_uuid_default () |
Return the UUID of the default scanner. More... | |
char * | scanner_host (scanner_t scanner) |
Return the host of a scanner. More... | |
int | scanner_port (scanner_t scanner) |
Return the port of a scanner. More... | |
int | scanner_type (scanner_t scanner) |
Return the type of a scanner. More... | |
char * | scanner_ca_pub (scanner_t scanner) |
Return the CA Certificate of a scanner. More... | |
char * | scanner_key_pub (scanner_t scanner) |
Return the Certificate of a scanner. More... | |
char * | scanner_key_priv (scanner_t scanner) |
Return the private key of a scanner. More... | |
char * | scanner_login (scanner_t scanner) |
Return the login associated with a scanner. More... | |
char * | scanner_password (scanner_t scanner) |
Return the password associated with a scanner. More... | |
char * | trash_scanner_name (scanner_t scanner) |
Return the name of a scanner in the trashcan. More... | |
char * | trash_scanner_uuid (scanner_t scanner) |
Return the UUID of a scanner in the trashcan. More... | |
int | scanner_count (const get_data_t *get) |
Count number of scanners. More... | |
char * | openvas_default_scanner_host () |
Get the default scanner path or host. More... | |
static osp_connection_t * | osp_scanner_relay_connect (const char *host, int port, const char *ca_pub, const char *key_pub, const char *key_priv) |
Create a new connection to an OSP scanner relay. More... | |
osp_connection_t * | osp_connect_with_data (const char *host, int port, const char *ca_pub, const char *key_pub, const char *key_priv) |
Create a new connection to an OSP scanner using the scanner data. More... | |
osp_connection_t * | osp_scanner_connect (scanner_t scanner) |
Create a new connection to an OSP scanner. More... | |
int | osp_get_version_from_iterator (iterator_t *iterator, char **s_name, char **s_ver, char **d_name, char **d_ver, char **p_name, char **p_ver) |
Get an OSP Scanner's get_version info. More... | |
int | osp_get_details_from_iterator (iterator_t *iterator, char **desc, GSList **params) |
Get an OSP Scanner's get_scanner_details info. More... | |
static int | connect_unix (const gchar *path) |
Connect a UNIX socket. More... | |
static int | connection_open (gvm_connection_t *connection, const gchar *address, int port) |
Connect to an address. More... | |
int | verify_scanner (const char *scanner_id, char **version) |
Verify a scanner. More... | |
int | manage_get_scanners (GSList *log_config, const gchar *database) |
List scanners. More... | |
gboolean | find_schedule_with_permission (const char *uuid, schedule_t *schedule, const char *permission) |
Find a schedule for a specific permission, given a UUID. More... | |
static int | byday_from_string (const char *byday) |
Get Byday mask from ical style string. More... | |
int | create_schedule (const char *name, const char *comment, const char *ical_string, time_t first_time, time_t period, time_t period_months, const char *byday, time_t duration, const char *zone, schedule_t *schedule, gchar **error_out) |
Create a schedule. More... | |
int | copy_schedule (const char *name, const char *comment, const char *schedule_id, schedule_t *new_schedule) |
Create a schedule from an existing schedule. More... | |
int | delete_schedule (const char *schedule_id, int ultimate) |
Delete a schedule. More... | |
int | schedule_in_use (schedule_t schedule) |
Return whether a schedule is in use by a task. More... | |
int | trash_schedule_in_use (schedule_t schedule) |
Return whether a trashcan schedule is in use by a task. More... | |
int | schedule_writable (schedule_t schedule) |
Return whether a schedule is writable. More... | |
int | trash_schedule_writable (schedule_t schedule) |
Return whether a trashcan schedule is writable. More... | |
int | trash_schedule_readable (schedule_t schedule) |
Return whether a trashcan schedule is readable. More... | |
char * | schedule_uuid (schedule_t schedule) |
Return the UUID of a schedule. More... | |
char * | trash_schedule_uuid (schedule_t schedule) |
Return the UUID of a trash schedule. More... | |
char * | schedule_name (schedule_t schedule) |
Return the name of a schedule. More... | |
char * | trash_schedule_name (schedule_t schedule) |
Return the name of a trash schedule. More... | |
int | schedule_period (schedule_t schedule) |
Return the period of a schedule. More... | |
int | schedule_duration (schedule_t schedule) |
Return the duration of a schedule. More... | |
int | schedule_info (schedule_t schedule, int trash, time_t *first_time, time_t *next_time, int *period, int *period_months, int *duration, gchar **icalendar, gchar **zone) |
Return info about a schedule. More... | |
int | schedule_count (const get_data_t *get) |
Count the number of schedules. More... | |
int | init_schedule_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a schedule iterator. More... | |
time_t | schedule_iterator_first_time (iterator_t *iterator) |
Get the first time from a schedule iterator. More... | |
time_t | schedule_iterator_period (iterator_t *iterator) |
Get the period from a schedule iterator. More... | |
time_t | schedule_iterator_period_months (iterator_t *iterator) |
Get the period months from a schedule iterator. More... | |
gchar * | schedule_iterator_byday_string (iterator_t *iterator) |
Get the byday string from a schedule iterator. More... | |
time_t | schedule_iterator_duration (iterator_t *iterator) |
Get the duration from a schedule iterator. More... | |
time_t | schedule_iterator_next_time (iterator_t *iterator) |
Get the next time a schedule could be schedulable. More... | |
int | init_task_schedule_iterator (iterator_t *iterator) |
Initialise a task schedule iterator. More... | |
void | cleanup_task_schedule_iterator (iterator_t *iterator) |
Cleanup a task schedule iterator. More... | |
task_t | task_schedule_iterator_task (iterator_t *iterator) |
Get the task from a task schedule iterator. More... | |
static time_t | task_schedule_iterator_next_time (iterator_t *iterator) |
Get the next time from a task schedule iterator. More... | |
static time_t | task_schedule_iterator_duration (iterator_t *iterator) |
Get the next time from a task schedule iterator. More... | |
gboolean | task_schedule_iterator_start_due (iterator_t *iterator) |
Get the start due state from a task schedule iterator. More... | |
gboolean | task_schedule_iterator_stop_due (iterator_t *iterator) |
Get the stop due state from a task schedule iterator. More... | |
gboolean | task_schedule_iterator_timed_out (iterator_t *iterator) |
Get if schedule of task in iterator is timed out. More... | |
void | init_schedule_task_iterator (iterator_t *iterator, schedule_t schedule) |
Initialise a schedule task iterator. More... | |
int | schedule_task_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
int | modify_schedule (const char *schedule_id, const char *name, const char *comment, const char *ical_string, time_t first_time, time_t period, time_t period_months, const char *byday, time_t duration, const char *zone, gchar **error_out) |
Modify a schedule. More... | |
gboolean | find_report_format_with_permission (const char *uuid, report_format_t *report_format, const char *permission) |
Find a reportformat for a specific permission, given a UUID. More... | |
static gint | compare_files (gconstpointer one, gconstpointer two) |
Compare files for create_report_format. More... | |
int | create_report_format (const char *uuid, const char *name, const char *content_type, const char *extension, const char *summary, const char *description, int global, array_t *files, array_t *params, array_t *params_options, const char *signature, report_format_t *report_format) |
Create a report format. More... | |
int | copy_report_format (const char *name, const char *source_uuid, report_format_t *new_report_format) |
Create Report Format from an existing Report Format. More... | |
int | modify_report_format (const char *report_format_id, const char *name, const char *summary, const char *active, const char *param_name, const char *param_value, const char *predefined) |
Modify a report format. More... | |
static int | move_report_format_dir (const char *dir, const char *new_dir) |
Move a report format directory. More... | |
static void | delete_report_format_rows (report_format_t report_format) |
Delete a report format from the db. More... | |
int | delete_report_format (const char *report_format_id, int ultimate) |
Delete a report format. More... | |
char * | report_format_uuid (report_format_t report_format) |
Return the UUID of a report format. More... | |
char * | report_format_owner_uuid (report_format_t report_format) |
Return the UUID of the owner of a report format. More... | |
char * | report_format_name (report_format_t report_format) |
Return the name of a report format. More... | |
char * | report_format_content_type (report_format_t report_format) |
Return the content type of a report format. More... | |
int | report_format_in_use (report_format_t report_format) |
Return whether a report format is referenced by an alert. More... | |
int | trash_report_format_in_use (report_format_t report_format) |
Return whether a report format in trash is referenced by an alert. More... | |
int | report_format_writable (report_format_t report_format) |
Return whether a report format is writable. More... | |
int | trash_report_format_writable (report_format_t report_format) |
Return whether a trashcan report_format is writable. More... | |
char * | report_format_extension (report_format_t report_format) |
Return the extension of a report format. More... | |
int | report_format_predefined (report_format_t report_format) |
Return whether a report format is predefined. More... | |
int | report_format_active (report_format_t report_format) |
Return whether a report format is active. More... | |
static report_format_param_type_t | report_format_param_type (report_format_t report_format, const char *name) |
Return the type max of a report format param. More... | |
static long long int | report_format_param_type_max (report_format_t report_format, const char *name) |
Return the type max of a report format param. More... | |
static long long int | report_format_param_type_min (report_format_t report_format, const char *name) |
Return the type min of a report format param. More... | |
Variables | |
int | authenticate_allow_all |
Flag to force authentication to succeed. More... | |
static manage_connection_forker_t | manage_fork_connection |
Function to fork a connection that will accept GMP requests. | |
static int | max_hosts = MANAGE_MAX_HOSTS |
Max number of hosts per target. | |
static int | slave_commit_size = SLAVE_COMMIT_SIZE_DEFAULT |
Maximum number of SQL queries per transaction in slave updates. | |
static int | max_content_length = MAX_CONTENT_LENGTH |
Maximum number of bytes of reports included in email alerts. More... | |
static int | max_attach_length = MAX_ATTACH_LENGTH |
Maximum number of bytes of reports attached to email alerts. More... | |
static int | max_email_message_length = MAX_EMAIL_MESSAGE_LENGTH |
Maximum number of bytes of user-defined message text in email alerts. More... | |
static nvtis_t * | nvti_cache = NULL |
Memory cache of NVT information from the database. | |
gchar * | gvmd_db_name = NULL |
Name of the database file. | |
static gboolean | in_transaction |
Whether a transaction has been opened and not committed yet. | |
static struct timeval | last_msg |
Time of reception of the currently processed message. | |
command_t | gmp_commands [] |
The GMP command list. | |
static int | table_order_if_sort_not_specified = 0 |
Flag to control the default sorting produced by split_filter. More... | |
int | ignore_max_rows_per_page = 0 |
Whether to ignore the Max Rows Per Page settings. | |
The Greenbone Vulnerability Manager management library.
#define AGENT_ITERATOR_COLUMNS |
Agent iterator columns.
#define AGENT_ITERATOR_TRASH_COLUMNS |
Agent iterator columns for trash case.
#define ALERT_ITERATOR_COLUMNS |
Alert iterator columns.
#define ALERT_ITERATOR_FILTER_COLUMNS |
Filter columns for alert iterator.
#define ALERT_ITERATOR_TRASH_COLUMNS |
Alert iterator columns for trash case.
#define APPEND_VFIRE_PARAM | ( | param | ) |
Checks a mandatory vFire parameter and adds it to the config XML.
[in] | param | The parameter to check. |
#define ASSET_OS_WITH_POSTGRESQL |
#define FILTER_ITERATOR_COLUMNS |
#define FILTER_ITERATOR_TRASH_COLUMNS |
#define GROUP_ITERATOR_COLUMNS |
#define GROUP_ITERATOR_TRASH_COLUMNS |
#define HOST_ITERATOR_FILTER_COLUMNS |
#define HOST_ITERATOR_WHERE_COLUMNS |
#define NEW_CERT_BUNDS_HEADER |
Header for "New CERT-Bund Advisories" alert message.
#define NEW_CPES_HEADER |
Header for "New CPEs" alert message.
#define NEW_CVES_HEADER |
Header for "New CVEs" alert message.
#define NEW_DFN_CERTS_HEADER |
Header for "New DFN-CERT Advisories" alert message.
#define NEW_NVTS_HEADER |
Header for "New NVTs" alert message.
#define NEW_NVTS_HEADER_OID |
Header for "New NVTs" alert message, when there's an OID.
#define NEW_OVAL_DEFS_HEADER |
Header for "New CERT-Bund Advisories" alert message.
#define NOTE_ITERATOR_FILTER_COLUMNS |
Filter columns for note iterator.
#define OS_ITERATOR_FILTER_COLUMNS |
#define OS_ITERATOR_WHERE_COLUMNS |
#define OVERRIDE_ITERATOR_FILTER_COLUMNS |
Filter columns for override iterator.
#define PERMISSION_ITERATOR_FILTER_COLUMNS |
#define PRINT | ( | stream, | |
format, | |||
args... | |||
) |
Write to a file or close stream and exit.
[in] | stream | Stream to write to. |
[in] | format | Format specification. |
[in] | args | Arguments. |
#define PRINT_REPORT_ERROR | ( | stream, | |
errors, | |||
asset_id | |||
) |
Write report error message to file stream.
[in] | stream | Stream to write to. |
[in] | errors | Pointer to report error messages iterator. |
[in] | asset_id | Asset ID. |
#define PRINT_XML | ( | stream, | |
xml | |||
) |
Write XML to a file or close stream and return.
[in] | stream | Stream to write to. |
[in] | xml | XML. |
#define RANGE | ( | type, | |
start, | |||
end | |||
) |
Insert a port range.
#define REPORT_FORMAT_ITERATOR_COLUMNS |
#define REPORT_FORMAT_ITERATOR_FILTER_COLUMNS |
#define REPORT_FORMAT_ITERATOR_TRASH_COLUMNS |
#define REPORT_ITERATOR_COLUMNS |
Report iterator columns.
#define REPORT_ITERATOR_FILTER_COLUMNS |
Filter columns for report iterator.
#define RESULT_ITERATOR_COLUMNS |
Result iterator columns.
#define RESULT_ITERATOR_COLUMNS_NO_CERT |
Result iterator columns, when CERT db is not loaded.
#define RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE |
Result iterator columns.
#define RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE_NO_CERT |
Result iterator columns, when CERT db is not loaded.
#define RESULT_ITERATOR_FILTER_COLUMNS |
Filter columns for result iterator.
#define ROLE_ITERATOR_COLUMNS |
#define ROLE_ITERATOR_TRASH_COLUMNS |
#define SCANNER_ITERATOR_COLUMNS |
Scanner iterator columns.
#define SCANNER_ITERATOR_TRASH_COLUMNS |
Scanner iterator columns for trash case.
#define SCHEDULE_ITERATOR_COLUMNS |
Schedule iterator columns.
#define SCHEDULE_ITERATOR_FILTER_COLUMNS |
Filter columns for schedule iterator.
#define SCHEDULE_ITERATOR_TRASH_COLUMNS |
Schedule iterator columns for trash case.
#define SECINFO_SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email.
#define SETTING_ITERATOR_COLUMNS |
#define SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email.
#define TAG_ITERATOR_COLUMNS |
#define TAG_ITERATOR_FILTER_COLUMNS |
#define TAG_ITERATOR_TRASH_COLUMNS |
#define TAG_NAME_ITERATOR_COLUMNS |
#define TARGET_ITERATOR_FILTER_COLUMNS |
Filter columns for target iterator.
#define TASK_ITERATOR_COLUMNS |
Task iterator columns.
#define TASK_ITERATOR_COLUMNS_MIN |
Task iterator minimal columns.
#define TASK_ITERATOR_FILTER_COLUMNS |
Filter columns for task iterator.
#define TASK_ITERATOR_WHERE_COLUMNS |
Task iterator WHERE columns.
#define TASK_ITERATOR_WHERE_COLUMNS_MIN |
Task iterator minimal WHERE columns.
#define USER_ITERATOR_FILTER_COLUMNS |
#define USER_ITERATOR_TRASH_COLUMNS |
#define VULN_ITERATOR_FILTER_COLUMNS |
#define VULN_RESULTS_WHERE |
#define WHERE_OWNER |
|
static |
Add permissions for all global resources.
[in] | role_uuid | UUID of role. |
|
static |
Add a port to a port tree.
[in] | ports | The tree. |
[in] | results | Result iterator on result whose port to add. |
|
static |
Add command permission to role.
Caller must ensure args are SQL escaped.
[in] | role_id | Role. |
[in] | permission | Permission. |
|
static |
Add resource permission to role.
Caller must ensure args are SQL escaped.
[in] | role_id | Role ID. |
[in] | permission | Permission. |
[in] | type | Resource type. |
[in] | resource_id | Resource ID. |
void add_task_alert | ( | task_t | task, |
alert_t | alert | ||
) |
Add an alert to a task.
[in] | task | Task. |
[in] | alert | Alert. |
int agent_count | ( | const get_data_t * | get | ) |
Count number of agents.
[in] | get | GET params. |
int agent_in_use | ( | agent_t | agent | ) |
Check whether an agent is in use.
[in] | agent | Agent. |
|
static |
Get the installer size from an agent iterator.
[in] | iterator | Iterator. |
const char* agent_iterator_trust | ( | iterator_t * | iterator | ) |
Get the trust value from an agent iterator.
[in] | iterator | Iterator. |
time_t agent_iterator_trust_time | ( | iterator_t * | iterator | ) |
Get the installer trust time from a agent iterator.
[in] | iterator | Iterator. |
char* agent_uuid | ( | agent_t | agent | ) |
Return the UUID of an agent.
[in] | agent | Agent. |
int agent_writable | ( | agent_t | agent | ) |
Check whether a agent is writable.
[in] | agent | Agent. |
int aggregate_iterator_count | ( | iterator_t * | iterator | ) |
Get the count from an aggregate iterator.
[in] | iterator | Iterator. |
double aggregate_iterator_max | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the maximum from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get max of. |
double aggregate_iterator_mean | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the mean from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get mean of. |
double aggregate_iterator_min | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the minimum from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get min of. |
const char* aggregate_iterator_subgroup_value | ( | iterator_t * | iterator | ) |
Get the value of the subgroup column from an aggregate iterator.
[in] | iterator | Iterator. |
double aggregate_iterator_sum | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the sum from a statistics iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get sum of. |
const char* aggregate_iterator_text | ( | iterator_t * | iterator, |
int | text_column_index, | ||
int | data_columns | ||
) |
Get the value of a text column from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | text_column_index | Index of the text column to get. |
[in] | data_columns | Number of data columns. |
const char* aggregate_iterator_value | ( | iterator_t * | iterator | ) |
Get the value of the group column from a statistics iterator.
[in] | iterator | Iterator. |
|
static |
Check whether an alert applies to a task.
[in] | alert | Alert. |
[in] | task | Task. |
|
static |
Return the condition associated with an alert.
[in] | alert | Alert. |
int alert_count | ( | const get_data_t * | get | ) |
Count the number of alerts.
[in] | get | GET params. |
char* alert_data | ( | alert_t | alert, |
const char * | type, | ||
const char * | name | ||
) |
Return data associated with an alert.
[in] | alert | Alert. |
[in] | type | Type of data: "condition", "event" or "method". |
[in] | name | Name of the data. |
const char* alert_data_iterator_data | ( | iterator_t * | iterator | ) |
Return the data from an alert data iterator.
[in] | iterator | Iterator. |
const char* alert_data_iterator_name | ( | iterator_t * | iterator | ) |
Return the name from an alert data iterator.
[in] | iterator | Iterator. |
|
static |
Return the event associated with an alert.
[in] | alert | Alert. |
|
static |
Return the UUID of the filter of an alert.
[in] | alert | Alert. |
int alert_in_use | ( | alert_t | alert | ) |
Return whether a alert is in use by a task.
[in] | alert | Alert. |
int alert_iterator_active | ( | iterator_t * | iterator | ) |
Return the active state from an alert.
[in] | iterator | Iterator. |
int alert_iterator_condition | ( | iterator_t * | iterator | ) |
Return the condition from an alert iterator.
[in] | iterator | Iterator. |
int alert_iterator_event | ( | iterator_t * | iterator | ) |
Return the event from an alert iterator.
[in] | iterator | Iterator. |
|
static |
Return the filter from an alert iterator.
[in] | iterator | Iterator. |
char* alert_iterator_filter_name | ( | iterator_t * | iterator | ) |
Return the filter name from an alert iterator.
[in] | iterator | Iterator. |
int alert_iterator_filter_readable | ( | iterator_t * | iterator | ) |
Return the filter readable state from an alert iterator.
[in] | iterator | Iterator. |
int alert_iterator_filter_trash | ( | iterator_t * | iterator | ) |
Return the location of an alert iterator filter.
[in] | iterator | Iterator. |
char* alert_iterator_filter_uuid | ( | iterator_t * | iterator | ) |
Return the filter UUID from an alert iterator.
[in] | iterator | Iterator. |
int alert_iterator_method | ( | iterator_t * | iterator | ) |
Return the method from an alert iterator.
[in] | iterator | Iterator. |
|
static |
Print an alert message.
[in] | message | Format string for message. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | task | Task. |
[in] | alert | Alert. |
[in] | condition | Alert condition. |
[in] | format_name | Report format name. |
[in] | filter | Filter. |
[in] | term | Filter term. |
[in] | zone | Timezone. |
[in] | host_summary | Host summary. |
[in] | content | The report, for inlining. |
[in] | content_length | Length of content. |
[in] | truncated | Whether the report was truncated. |
[in] | total | Total number of resources (for SecInfo alerts). |
[in] | max_length | Max allowed length of content. |
|
static |
Return the method associated with an alert.
[in] | alert | Alert. |
|
static |
Return the name of an alert.
[in] | alert | Alert. |
|
static |
Return the owner of an alert.
[in] | alert | Alert. |
|
static |
Return the UUID of the owner of an alert.
[in] | alert | Alert. |
|
static |
Clean up common files and variables for running alert script.
[in] | report_dir | The temporary directory. |
[in] | report_path | The temporary report file path to free. |
[in] | error_path | The temporary error file path to free. |
[in] | extra_path | The temporary extra data file path to free. |
|
static |
Execute the alert script.
[in] | alert_id | UUID of the alert. |
[in] | command_args | Args for the "alert" script. |
[in] | report_path | Path to temporary file containing the report |
[in] | report_dir | Temporary directory for the report |
[in] | error_path | Path to the script error message file |
[in] | extra_path | Path to the extra data file |
[out] | message | Custom error message generated by the script |
|
static |
Initialize common files and variables for an alert script.
The temporary file / dir parameters will be modified by mkdtemp / mkstemp to contain the actual path. The extra data is meant for data that should not be logged like passwords.
[in] | report_filename | Filename for the report or NULL for default. |
[in] | report | Report that should be sent. |
[in] | report_size | Size of the report. |
[in] | extra_content | Optional extra data, e.g. credentials |
[in] | extra_size | Optional extra data length |
[in,out] | report_dir | Template for temporary report directory |
[out] | report_path | Pointer to store path to report file at |
[out] | error_path | Pointer to temporary file path for error messages |
[out] | extra_path | Pointer to temporary extra data file path |
|
static |
Print an alert subject.
[in] | subject | Format string for subject. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | alert | Alert. |
[in] | task | Task. |
[in] | total | Total number of resources (for SecInfo alerts). |
const char* alert_task_iterator_name | ( | iterator_t * | iterator | ) |
Return the name from an alert task iterator.
[in] | iterator | Iterator. |
int alert_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
const char* alert_task_iterator_uuid | ( | iterator_t * | iterator | ) |
Return the uuid from an alert task iterator.
[in] | iterator | Iterator. |
|
static |
Print an URL for a New NVTs alert.
[in] | url | Format string for url. |
[in] | oid | SecInfo ID. |
[in] | type | SecInfo Type. |
char* alert_uuid | ( | alert_t | alert | ) |
Return the UUID of an alert.
[in] | alert | Alert. |
int alert_writable | ( | alert_t | alert | ) |
Return whether a alert is writable.
[in] | alert | Alert. |
|
static |
Write data to a file for use by an alert script.
[in] | directory | Base directory to create the file in |
[in] | filename | Filename without directory |
[in] | content | The file content |
[in] | content_size | Size of the file content |
[in] | description | Short file description for error messages |
[out] | file_path | Return location of combined file path |
|
static |
Convert alive test name to alive test bitfield.
[in] | alive_tests | Name of alive test. |
gchar* app_location | ( | report_host_t | report_host, |
const gchar * | app | ||
) |
Get the location of an App for a report's host.
[in] | report_host | Report host. |
[in] | app | CPE. |
|
static |
Append expression for a column to an array.
[in] | columns | Array. |
[in] | column_name | Name of column. |
[in] | select_columns | Definition of "SELECT" columns. |
[in] | where_columns | Definition of "WHERE" columns. |
|
static |
Append relation to filter.
[in] | clean | Filter. |
[in] | keyword | Keyword |
[in] | relation | Relation char. |
void append_to_task_comment | ( | task_t | task, |
const char * | text, | ||
int | length | ||
) |
Append text to the comment associated with a task.
[in] | task | A pointer to the task. |
[in] | text | The text to append. |
[in] | length | Length of the text. |
|
static |
Append value to field of task.
[in] | task | Task. |
[in] | field | Field. |
[in] | value | Value. |
|
static |
Applies a report format to an XML report.
[in] | report_format_id | Report format to apply. |
[in] | xml_start | Path to the main part of the report XML. |
[in] | xml_file | Path to the report XML file. |
[in] | xml_dir | Path to the temporary dir. |
[in] | used_rfps | List of already applied report formats. |
|
static |
Ensure a string is in an array.
[in] | array | Array. |
[in] | string | String. Copied into array. |
|
static |
Add port to ports array.
[in] | key | Port. |
[in] | value | Threat. |
[in] | ports | Ports array. |
|
static |
Find a string in an array.
[in] | array | Array. |
[in] | string | String. |
|
static |
Search for LDAP or RADIUS credentials in the recently-used authentication cache.
[in] | username | Username. |
[in] | password | Password. |
[in] | method | 0 for LDAP, 1 for RADIUS. |
|
static |
Add LDAP or RADIUS credentials to the recently-used authentication cache.
[in] | username | Username. |
[in] | password | Password. |
[in] | method | 0 for LDAP, 1 for RADIUS. |
int authenticate | ( | credentials_t * | credentials | ) |
Authenticate credentials.
[in] | credentials | Credentials. |
|
static |
Authenticate, trying any method.
[in] | username | Username. |
[in] | password | Password. |
[out] | auth_method | Auth method return. |
void buffer_results_xml | ( | GString * | buffer, |
iterator_t * | results, | ||
task_t | task, | ||
int | include_notes, | ||
int | include_notes_details, | ||
int | include_overrides, | ||
int | include_overrides_details, | ||
int | include_tags, | ||
int | include_tags_details, | ||
int | include_details, | ||
const char * | delta_state, | ||
iterator_t * | delta_results, | ||
int | changed, | ||
int | cert_loaded, | ||
int | lean | ||
) |
Buffer XML for some results.
Includes cert_loaded arg.
[in] | buffer | Buffer into which to buffer results. |
[in] | results | Result iterator. |
[in] | task | Task associated with results. Only needed with include_notes or include_overrides. |
[in] | include_notes | Whether to include notes. |
[in] | include_notes_details | Whether to include details of notes. |
[in] | include_overrides | Whether to include overrides. |
[in] | include_overrides_details | Whether to include details of overrides. |
[in] | include_tags | Whether to include user tag count. |
[in] | include_tags_details | Whether to include details of tags. |
[in] | include_details | Whether to include details of the result. |
[in] | delta_state | Delta state of result, or NULL. |
[in] | delta_results | Iterator for delta result to include, or NULL. |
[in] | changed | Whether the result is a "changed" delta. |
[in] | cert_loaded | Whether the CERT db is loaded. 0 not loaded, -1 needs to be checked, else loaded. |
[in] | lean | Whether to include less info. |
gboolean buffer_vfire_call_input | ( | gchar * | key, |
gchar * | value, | ||
GString * | buffer | ||
) |
Appends an XML fragment for vFire call input to a string buffer.
[in] | key | The name of the key. |
[in] | value | The value to add. |
[in] | buffer | The string buffer to append to. |
|
static |
Get Byday mask from ical style string.
[in] | byday | Byday string. |
|
static |
Cache the message counts for a report.
[in] | report | Report. |
[in] | override | Whether overrides were applied to the results. |
[in] | min_qod | The minimum QoD of the results. |
[in] | data | Severity data struct containing the message counts. |
|
static |
Get last time CERT SecInfo alerts were checked.
|
static |
Check alert params.
[in] | event | Type of event. |
[in] | condition | Event condition. |
[in] | method | Escalation method. |
void check_alerts | ( | ) |
Check if any SecInfo alerts are due.
int check_config_discovery | ( | const char * | uuid | ) |
Ensure the Discovery config is up to date.
[in] | uuid | UUID of config. |
void check_config_host_discovery | ( | const char * | uuid | ) |
Ensure the Host Discovery config is up to date.
[in] | uuid | UUID of config. |
int check_config_system_discovery | ( | const char * | uuid | ) |
Ensure the Discovery config is up to date.
[in] | uuid | UUID of config. |
|
static |
Ensure that the database is in order.
Only called by init_manage_internal, and ultimately only by the main process.
[in] | check_encryption_key | Whether to check encryption key. |
|
static |
Ensure that there is an encryption key.
This prevents contention problems that can happen when the key is created on the fly during a GMP operation.
Up to caller to create transaction.
|
static |
Ensure the predefined report formats exist.
|
static |
Ensure that the report formats trash directory matches the database.
|
static |
Ensure the predefined scanner exists.
void check_db_sequences | ( | ) |
Ensure sequences for automatic ids are in a consistent state.
Caller must organise a transaction.
|
static |
Initialize the default settings.
Ensure all the default manager settings exist.
|
static |
Check that trash report formats are correct.
|
static |
Ensure that the databases are the right versions.
void check_generate_scripts | ( | ) |
Ensure the generate scripts are all executable.
Used by a migrator.
gchar * clean_hosts | ( | const char * | given_hosts, |
int * | max | ||
) |
Clean a hosts string.
[in] | given_hosts | String describing hosts. |
[out] | max | Max number of hosts, adjusted for duplicates. |
|
static |
Cleans up keywords with special conditions and relations.
[in] | keyword | Keyword to clean up. |
void cleanup_manage_process | ( | gboolean | cleanup | ) |
Cleanup the manage library.
Optionally put any running task in the interrupted state and close the database.
[in] | cleanup | If TRUE perform all cleanup operations, else only those required at the start of a forked process. |
int cleanup_result_nvts | ( | ) |
Check if the result_nvts are assigned to result.
|
static |
Fixes the DST offset in schedule_next_time of tasks.
|
static |
Clean up database tables.
Remove superfluous entries from tables.
void cleanup_task_schedule_iterator | ( | iterator_t * | iterator | ) |
Cleanup a task schedule iterator.
[in] | iterator | Iterator. |
void clear_duration_schedules | ( | task_t | task | ) |
Clear once-off schedules from tasks where the duration has passed.
[in] | task | Task. 0 for all. |
|
static |
Collate two IP addresses.
For example, 127.0.0.2 is less than 127.0.0.3 and 127.0.0.10.
Only works correctly for IPv4 addresses.
[in] | data | Dummy for callback. |
[in] | one_len | Length of first IP (a string). |
[in] | arg_one | First string. |
[in] | two_len | Length of second IP (a string). |
[in] | arg_two | Second string. |
|
static |
Compare two number strings for collate_ip.
[in] | one_arg | First string. |
[in] | two_arg | Second string. |
Copy an array of columns.
[in] | columns | Columns. |
|
static |
Free an array of columns.
[in] | columns | Columns. |
|
static |
Set the select clause of a column in an array of columns.
Frees the existing select clause.
[in] | columns | Columns. |
[in] | filter | Filter term name. |
[in] | select | Select clause. |
gchar* columns_build_select | ( | column_t * | select_columns | ) |
Return column list for SELECT statement.
[in] | select_columns | SELECT columns. |
|
static |
Get the selection term for a filter column.
[in] | select_columns | SELECT columns. |
[in] | where_columns | WHERE "columns". |
[in] | filter_column | Filter column. |
|
static |
Get the column expression for a filter column.
[in] | select_columns | SELECT columns. |
[in] | filter_column | Filter column. |
[out] | type | Type of returned column. |
|
static |
Get the selection term for a filter column.
[in] | select_columns | SELECT columns. |
[in] | where_columns | WHERE "columns". |
[in] | filter_column | Filter column. |
[out] | type | Type of the returned column. |
|
static |
Compare two results, writing associated XML to a buffer.
[in] | buffer | Buffer. |
[in] | results | Iterator containing first result. |
[in] | delta_results | Iterator containing second result. |
[in] | task | Task associated with report. |
[in] | notes | Whether to include notes. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides | Whether to include overrides. |
[in] | overrides_details | If overrides, Whether to include details. |
[in] | sort_order | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on, or NULL for "type". |
[in] | changed | Whether to include changed results. |
[in] | gone | Whether to include gone results. |
[in] | new | Whether to include new results. |
[in] | same | Whether to include same results. |
[in] | max_results | Value to decrement if result is buffered. |
[in] | first_result | Skip result and decrement if positive. |
[in] | used | 0 if used, 1 if skipped. |
[in] | would_use | 0 if would use (first_result aside), 1 if skipped. |
|
static |
Compare files for create_report_format.
[in] | one | First. |
[in] | two | Second. |
|
static |
Compares two buffered results, sorting by host, port then severity.
[in] | arg_one | First result. |
[in] | arg_two | Second result. |
|
static |
Compare port severities, ascending.
[in] | one | First. |
[in] | two | Second. |
|
static |
Compare port severities, descending.
[in] | one | First. |
[in] | two | Second. |
|
static |
Compare two results.
[in] | results | Iterator containing first result. |
[in] | delta_results | Iterator containing second result. |
[in] | sort_order | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on, or NULL for "type". |
|
static |
Compares two textual port representations, sorting descending.
by severity
[in] | arg_one | First port. |
[in] | arg_two | Second port. |
|
static |
Compares two textual port representations, sorting descending.
by severity
[in] | arg_one | First threat level. |
[in] | arg_two | Second threat level. |
|
static |
Return whether the condition of an alert is met by a task.
[in] | task | Task. |
[in] | report | Report. |
[in] | alert | Alert. |
[in] | condition | Condition. |
|
static |
Connect a UNIX socket.
[in] | path | Path. |
|
static |
Connect to an address.
[out] | connection | Connection. |
[out] | address | Address. |
[out] | port | Port. |
int copy_agent | ( | const char * | name, |
const char * | comment, | ||
const char * | agent_id, | ||
agent_t * | new_agent | ||
) |
Create an agent from an existing agent.
[in] | name | Name of new agent. NULL to copy from existing. |
[in] | comment | Comment on new agent. NULL to copy from existing. |
[in] | agent_id | UUID of existing schedule. |
[out] | new_agent | New agent. |
int copy_alert | ( | const char * | name, |
const char * | comment, | ||
const char * | alert_id, | ||
alert_t * | new_alert | ||
) |
Create an alert from an existing alert.
[in] | name | Name of new alert. NULL to copy from existing. |
[in] | comment | Comment on new alert. NULL to copy from existing. |
[in] | alert_id | UUID of existing alert. |
[out] | new_alert | New alert. |
int copy_credential | ( | const char * | name, |
const char * | comment, | ||
const char * | credential_id, | ||
credential_t * | new_credential | ||
) |
Create an LSC Credential from an existing one.
[in] | name | Name of new Credential. NULL to copy from existing. |
[in] | comment | Comment on new Credential. NULL to copy from existing. |
[in] | credential_id | UUID of existing Credential. |
[out] | new_credential | New Credential. |
int copy_note | ( | const char * | note_id, |
note_t * | new_note | ||
) |
Create a note from an existing note.
[in] | note_id | UUID of existing note. |
[out] | new_note | New note. |
int copy_override | ( | const char * | override_id, |
override_t * | new_override | ||
) |
Create a override from an existing override.
[in] | override_id | UUID of existing override. |
[out] | new_override | New override. |
int copy_report_format | ( | const char * | name, |
const char * | source_uuid, | ||
report_format_t * | new_report_format | ||
) |
Create Report Format from an existing Report Format.
[in] | name | Name of new Report Format. NULL to copy from existing. |
[in] | source_uuid | UUID of existing Report Format. |
[out] | new_report_format | New Report Format. |
int copy_resource | ( | const char * | type, |
const char * | name, | ||
const char * | comment, | ||
const char * | resource_id, | ||
const char * | columns, | ||
int | make_name_unique, | ||
resource_t * | new_resource, | ||
resource_t * | old_resource | ||
) |
Create a resource from an existing resource.
[in] | type | Type of resource. |
[in] | name | Name of new resource. NULL to copy from existing. |
[in] | comment | Comment on new resource. NULL to copy from existing. |
[in] | resource_id | UUID of existing resource. |
[in] | columns | Extra columns in resource. |
[in] | make_name_unique | When name NULL, whether to make existing name unique. |
[out] | new_resource | New resource. |
[out] | old_resource | Address for existing resource, or NULL. |
int copy_resource_lock | ( | const char * | type, |
const char * | name, | ||
const char * | comment, | ||
const char * | resource_id, | ||
const char * | columns, | ||
int | make_name_unique, | ||
resource_t * | new_resource, | ||
resource_t * | old_resource | ||
) |
Create a resource from an existing resource.
[in] | type | Type of resource. |
[in] | name | Name of new resource. NULL to copy from existing. |
[in] | comment | Comment on new resource. NULL to copy from existing. |
[in] | resource_id | UUID of existing resource. |
[in] | columns | Extra columns in resource. |
[in] | make_name_unique | When name NULL, whether to make existing name unique. |
[out] | new_resource | Address for new resource, or NULL. |
[out] | old_resource | Address for existing resource, or NULL. |
int copy_scanner | ( | const char * | name, |
const char * | comment, | ||
const char * | scanner_id, | ||
scanner_t * | new_scanner | ||
) |
Create a scanner from an existing scanner.
[in] | name | Name of new scanner. NULL to copy from existing. |
[in] | comment | Comment on new scanner. NULL to copy from existing. |
[in] | scanner_id | UUID of existing scanner. |
[out] | new_scanner | New scanner. |
int copy_schedule | ( | const char * | name, |
const char * | comment, | ||
const char * | schedule_id, | ||
schedule_t * | new_schedule | ||
) |
Create a schedule from an existing schedule.
[in] | name | Name of new schedule. NULL to copy from existing. |
[in] | comment | Comment on new schedule. NULL to copy from existing. |
[in] | schedule_id | UUID of existing schedule. |
[out] | new_schedule | New schedule. |
int copy_target | ( | const char * | name, |
const char * | comment, | ||
const char * | target_id, | ||
target_t * | new_target | ||
) |
Create a target from an existing target.
[in] | name | Name of new target. NULL to copy from existing. |
[in] | comment | Comment on new target. NULL to copy from existing. |
[in] | target_id | UUID of existing target. |
[out] | new_target | New target. |
int copy_task | ( | const char * | name, |
const char * | comment, | ||
const char * | task_id, | ||
int | alterable, | ||
task_t * | new_task | ||
) |
Create a task from an existing task.
[in] | name | Name of new task. NULL to copy from existing. |
[in] | comment | Comment on new task. NULL to copy from existing. |
[in] | task_id | UUID of existing task. |
[in] | alterable | Whether the new task will be alterable. |
[out] | new_task | New task. |
int count | ( | const char * | type, |
const get_data_t * | get, | ||
column_t * | select_columns, | ||
column_t * | trash_select_columns, | ||
const char ** | filter_columns, | ||
int | distinct, | ||
const char * | extra_tables, | ||
const char * | extra_where, | ||
int | owned | ||
) |
Count number of a particular resource.
[in] | type | Type of resource. |
[in] | get | GET params. |
[in] | select_columns | SELECT columns. |
[in] | trash_select_columns | SELECT columns for trashcan. |
[in] | filter_columns | Extra columns. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | extra_tables | Join tables. Skipped for trash and single resource. |
[in] | extra_where | Extra WHERE clauses. Skipped for trash and single resource. |
[in] | owned | Only count items owned by current user. |
|
static |
Count number of a particular resource.
[in] | type | Type of resource. |
[in] | get | GET params. |
[in] | select_columns | SELECT columns. |
[in] | trash_select_columns | SELECT columns for trashcan. |
[in] | where_columns | WHERE columns. |
[in] | trash_where_columns | WHERE columns for trashcan. |
[in] | filter_columns | Extra columns. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | extra_tables | Join tables. Skipped for trash and single resource. |
[in] | extra_where | Extra WHERE clauses. Skipped for trash and single resource. |
[in] | extra_with | Extra WITH clauses. |
[in] | owned | Only count items owned by current user. |
int create_agent | ( | const char * | name, |
const char * | comment, | ||
const char * | installer_64, | ||
const char * | installer_filename, | ||
const char * | installer_signature_64, | ||
const char * | howto_install, | ||
const char * | howto_use, | ||
agent_t * | agent | ||
) |
Create an agent entry.
[in] | name | Name of agent. Must be at least one character long. |
[in] | comment | Comment on agent. |
[in] | installer_64 | Installer, in base64. |
[in] | installer_filename | Installer filename. |
[in] | installer_signature_64 | Installer signature, in base64. |
[in] | howto_install | Install HOWTO, in base64. |
[in] | howto_use | Usage HOWTO, in base64. |
[out] | agent | Created agent. |
int create_alert | ( | const char * | name, |
const char * | comment, | ||
const char * | filter_id, | ||
const char * | active, | ||
event_t | event, | ||
GPtrArray * | event_data, | ||
alert_condition_t | condition, | ||
GPtrArray * | condition_data, | ||
alert_method_t | method, | ||
GPtrArray * | method_data, | ||
alert_t * | alert | ||
) |
Create an alert.
[in] | name | Name of alert. |
[in] | comment | Comment on alert. |
[in] | filter_id | Filter. |
[in] | active | Whether the alert is active. |
[in] | event | Type of event. |
[in] | event_data | Type-specific event data. |
[in] | condition | Event condition. |
[in] | condition_data | Condition-specific data. |
[in] | method | Escalation method. |
[in] | method_data | Data for escalation method. |
[out] | alert | Created alert on success. |
int create_credential | ( | const char * | name, |
const char * | comment, | ||
const char * | login, | ||
const char * | given_password, | ||
const char * | key_private, | ||
const char * | key_public, | ||
const char * | certificate, | ||
const char * | community, | ||
const char * | auth_algorithm, | ||
const char * | privacy_password, | ||
const char * | privacy_algorithm, | ||
const char * | given_type, | ||
const char * | allow_insecure, | ||
credential_t * | credential | ||
) |
Create a Credential.
[in] | name | Name of LSC credential. Must be at least one character long. |
[in] | comment | Comment on LSC credential. |
[in] | login | Name of LSC credential user. Must be at least one character long. |
[in] | given_password | Password for password-only credential, NULL to generate credentials. |
[in] | key_private | Private key, or NULL. |
[in] | key_public | Public key, or NULL. |
[in] | certificate | Certificate, or NULL. |
[in] | community | SNMP community string, or NULL. |
[in] | auth_algorithm | SNMP authentication algorithm, or NULL. |
[in] | privacy_password | SNMP privacy password. |
[in] | privacy_algorithm | SNMP privacy algorithm. |
[in] | given_type | Credential type or NULL. |
[in] | allow_insecure | Whether to allow insecure uses. |
[out] | credential | Created Credential. |
int create_current_report | ( | task_t | task, |
char ** | report_id, | ||
task_status_t | status | ||
) |
Create the current report for a task.
[in] | task | The task. |
[out] | report_id | Report ID. |
[in] | status | Run status of scan associated with report. |
int create_note | ( | const char * | active, |
const char * | nvt, | ||
const char * | text, | ||
const char * | hosts, | ||
const char * | port, | ||
const char * | severity, | ||
const char * | threat, | ||
task_t | task, | ||
result_t | result, | ||
note_t * | note | ||
) |
Create a note.
[in] | active | NULL or -1 on, 0 off, n on for n days. |
[in] | nvt | OID of noted NVT. |
[in] | text | Note text. |
[in] | hosts | Hosts to apply note to, NULL for any host. |
[in] | port | Port to apply note to, NULL for any port. |
[in] | severity | Severity to apply note to, "" or NULL for any. |
[in] | threat | Threat to apply note to, "" or NULL for any threat. Only used if severity is "" or NULL. |
[in] | task | Task to apply note to, 0 for any task. |
[in] | result | Result to apply note to, 0 for any result. |
[out] | note | Created note. |
int create_override | ( | const char * | active, |
const char * | nvt, | ||
const char * | text, | ||
const char * | hosts, | ||
const char * | port, | ||
const char * | threat, | ||
const char * | new_threat, | ||
const char * | severity, | ||
const char * | new_severity, | ||
task_t | task, | ||
result_t | result, | ||
override_t * | override | ||
) |
Create an override.
[in] | active | NULL or -1 on, 0 off, n on for n days. |
[in] | nvt | OID of overridden NVT. |
[in] | text | Override text. |
[in] | hosts | Hosts to apply override to, NULL for any host. |
[in] | port | Port to apply override to, NULL for any port. |
[in] | threat | Threat to apply override to, "" or NULL for any threat. |
[in] | new_threat | Threat to override result to. |
[in] | severity | Severity to apply override to, "" or NULL for any. |
[in] | new_severity | Severity score to override "Alarm" type results to. |
[in] | task | Task to apply override to, 0 for any task. |
[in] | result | Result to apply override to, 0 for any result. |
[out] | override | Created override. |
int create_report | ( | array_t * | results, |
const char * | task_id, | ||
const char * | in_assets, | ||
const char * | scan_start, | ||
const char * | scan_end, | ||
array_t * | host_starts, | ||
array_t * | host_ends, | ||
array_t * | details, | ||
char ** | report_id | ||
) |
Create a report from an array of results.
[in] | results | Array of create_report_result_t pointers. |
[in] | task_id | UUID of container task, or NULL to create new one. |
[in] | in_assets | Whether to create assets from the report. |
[in] | scan_start | Scan start time text. |
[in] | scan_end | Scan end time text. |
[in] | host_starts | Array of create_report_result_t pointers. Host name in host, time in description. |
[in] | host_ends | Array of create_report_result_t pointers. Host name in host, time in description. |
[in] | details | Array of host_detail_t pointers. |
[out] | report_id | Report ID. |
int create_report_format | ( | const char * | uuid, |
const char * | name, | ||
const char * | content_type, | ||
const char * | extension, | ||
const char * | summary, | ||
const char * | description, | ||
int | global, | ||
array_t * | files, | ||
array_t * | params, | ||
array_t * | params_options, | ||
const char * | signature, | ||
report_format_t * | report_format | ||
) |
Create a report format.
[in] | uuid | UUID of format. |
[in] | name | Name of format. |
[in] | content_type | Content type of format. |
[in] | extension | File extension of format. |
[in] | summary | Summary of format. |
[in] | description | Description of format. |
[in] | global | Whether the report is global. |
[in] | files | Array of memory. Each item is a file name string, a terminating NULL, the file contents in base64 and a terminating NULL. |
[in] | params | Array of params. |
[in] | params_options | Array. Each item is an array corresponding to params. Each item of an inner array is a string, the text of an option in a selection. |
[in] | signature | Signature. |
[out] | report_format | Created report format. |
int create_scanner | ( | const char * | name, |
const char * | comment, | ||
const char * | host, | ||
const char * | port, | ||
const char * | type, | ||
scanner_t * | new_scanner, | ||
const char * | ca_pub, | ||
const char * | credential_id | ||
) |
Create a scanner.
[in] | name | Name of scanner. |
[in] | comment | Comment on scanner. |
[in] | host | Host of scanner. |
[in] | port | Port of scanner. |
[in] | type | Type of scanner. |
[out] | new_scanner | The created scanner. |
[in] | ca_pub | CA Certificate for scanner. |
[in] | credential_id | ID of credential for scanner. |
int create_schedule | ( | const char * | name, |
const char * | comment, | ||
const char * | ical_string, | ||
time_t | first_time, | ||
time_t | period, | ||
time_t | period_months, | ||
const char * | byday, | ||
time_t | duration, | ||
const char * | zone, | ||
schedule_t * | schedule, | ||
gchar ** | error_out | ||
) |
Create a schedule.
[in] | name | Name of schedule. |
[in] | comment | Comment on schedule. |
[in] | ical_string | iCalendar string. Overrides first_time, period, period_months, byday and duration. |
[in] | first_time | First time action will run. |
[in] | period | How often the action will run in seconds. 0 means once. |
[in] | period_months | The months part of the period. |
[in] | byday | Which days of week schedule will run. |
[in] | duration | The length of the time window the action will run in. 0 means entire duration of action. |
[in] | zone | Timezone. |
[out] | schedule | Created schedule. |
[out] | error_out | Output for iCalendar errors and warnings. |
int create_target | ( | const char * | name, |
const char * | asset_hosts_filter, | ||
const char * | hosts, | ||
const char * | exclude_hosts, | ||
const char * | comment, | ||
const char * | port_list_id, | ||
const char * | port_range, | ||
credential_t | ssh_credential, | ||
const char * | ssh_port, | ||
credential_t | smb_credential, | ||
credential_t | esxi_credential, | ||
credential_t | snmp_credential, | ||
const char * | reverse_lookup_only, | ||
const char * | reverse_lookup_unify, | ||
const char * | alive_tests, | ||
target_t * | target | ||
) |
Create a target.
[in] | name | Name of target. |
[in] | asset_hosts_filter | Asset host filter to select hosts. Overrides hosts and exclude_hosts . |
[in] | hosts | Host list of target. |
[in] | exclude_hosts | List of hosts to exclude from hosts . |
[in] | comment | Comment on target. |
[in] | port_list_id | Port list of target (overrides port_range ). |
[in] | port_range | Port range of target. |
[in] | ssh_credential | SSH credential. |
[in] | ssh_port | Port for SSH login. |
[in] | smb_credential | SMB credential. |
[in] | esxi_credential | ESXi credential. |
[in] | snmp_credential | SNMP credential. |
[in] | reverse_lookup_only | Scanner preference reverse_lookup_only. |
[in] | reverse_lookup_unify | Scanner preference reverse_lookup_unify. |
[in] | alive_tests | Alive tests. |
[out] | target | Created target. |
int credential_count | ( | const get_data_t * | get | ) |
Count number of LSC Credentials.
[in] | get | GET params. |
gchar* credential_encrypted_value | ( | credential_t | credential, |
const char * | value_name | ||
) |
Get a possibly encrypted credential value in decrypted form.
[in] | credential | The Credential. |
[in] | value_name | Name of the value. |
int credential_in_use | ( | credential_t | credential | ) |
Check whether a Credential is in use.
[in] | credential | Credential. |
int credential_iterator_allow_insecure | ( | iterator_t * | iterator | ) |
Get the login from a Credential iterator.
[in] | iterator | Iterator. |
const char* credential_iterator_community | ( | iterator_t * | iterator | ) |
Get the SNMP community from a Credential iterator.
[in] | iterator | Iterator. |
char* credential_iterator_deb | ( | iterator_t * | iterator | ) |
Get the deb from a Credential iterator.
[in] | iterator | Iterator. |
|
static |
Get possibly encrypted data from credentials.
[in] | iterator | Iterator. |
[in] | type | Type of data. |
char* credential_iterator_exe | ( | iterator_t * | iterator | ) |
Get the exe from a Credential iterator.
[in] | iterator | Iterator. |
gboolean credential_iterator_format_available | ( | iterator_t * | iterator, |
credential_format_t | format | ||
) |
Test if a credential format is available for an iterator.
[in] | iterator | Iterator. |
[in] | format | The format to test availability of. |
gchar* credential_iterator_formats_xml | ( | iterator_t * | iterator | ) |
Get XML of available formats for a credential iterator.
[in] | iterator | Iterator. |
const char* credential_iterator_password | ( | iterator_t * | iterator | ) |
Get the password from a Credential iterator.
[in] | iterator | Iterator. |
const char* credential_iterator_privacy_password | ( | iterator_t * | iterator | ) |
Get the privacy password from a Credential iterator.
[in] | iterator | Iterator. |
const char* credential_iterator_private_key | ( | iterator_t * | iterator | ) |
Get the private_key from a Credential iterator.
[in] | iterator | Iterator. |
char* credential_iterator_rpm | ( | iterator_t * | iterator | ) |
Get the rpm from a Credential iterator.
[in] | iterator | Iterator. |
char* credential_name | ( | credential_t | credential | ) |
Get the name of an LSC credential.
[in] | credential | Credential. |
int credential_scanner_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a Credential Scanner iterator.
[in] | iterator | Iterator. |
int credential_target_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
char* credential_type | ( | credential_t | credential | ) |
Get the type of a Credential.
[in] | credential | Credential. |
char* credential_uuid | ( | credential_t | credential | ) |
Get the UUID of a Credential.
[in] | credential | Credential. |
gchar* credential_value | ( | credential_t | credential, |
const char * | value_name | ||
) |
Get a value from a credential.
[in] | credential | The Credential. |
[in] | value_name | Name of the value. |
int credential_writable | ( | credential_t | credential | ) |
Check whether a Credential is writable.
[in] | credential | Credential. |
|
static |
Set credentials for authenticate.
[in] | credentials | Credentials. |
int delete_agent | ( | const char * | agent_id, |
int | ultimate | ||
) |
Delete an agent.
[in] | agent_id | UUID of agent. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_alert | ( | const char * | alert_id, |
int | ultimate | ||
) |
Delete an alert.
[in] | alert_id | UUID of alert. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_credential | ( | const char * | credential_id, |
int | ultimate | ||
) |
Delete a Credential.
[in] | credential_id | UUID of Credential. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_note | ( | const char * | note_id, |
int | ultimate | ||
) |
Delete a note.
[in] | note_id | UUID of note. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_override | ( | const char * | override_id, |
int | ultimate | ||
) |
Delete a override.
[in] | override_id | UUID of override. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_report | ( | const char * | report_id, |
int | dummy | ||
) |
Delete a report.
[in] | report_id | UUID of report. |
[in] | dummy | Dummy arg to match other delete functions. |
int delete_report_format | ( | const char * | report_format_id, |
int | ultimate | ||
) |
Delete a report format.
[in] | report_format_id | UUID of Report format. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
|
static |
Delete a report format from the db.
[in] | report_format | Report format. |
int delete_report_internal | ( | report_t | report | ) |
Delete a report.
It's up to the caller to provide the transaction.
[in] | report | Report. |
int delete_reports | ( | task_t | task | ) |
Delete all the reports for a task.
It's up to the caller to ensure that this runs in a contention safe context (for example within an SQL transaction).
[in] | task | A task descriptor. |
int delete_scanner | ( | const char * | scanner_id, |
int | ultimate | ||
) |
Delete a scanner.
[in] | scanner_id | UUID of scanner. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_schedule | ( | const char * | schedule_id, |
int | ultimate | ||
) |
Delete a schedule.
[in] | schedule_id | Schedule. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_slave_task | ( | const gchar * | host, |
int | port, | ||
const gchar * | username, | ||
const gchar * | password, | ||
const char * | slave_task_uuid | ||
) |
Delete a task on a slave.
[in] | host | Slave host. |
[in] | port | Slave port. |
[in] | username | Slave username. |
[in] | password | Slave password. |
[in] | slave_task_uuid | UUID of task on slave. |
int delete_target | ( | const char * | target_id, |
int | ultimate | ||
) |
Delete a target.
[in] | target_id | UUID of target. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
int delete_task | ( | task_t | task, |
int | ultimate | ||
) |
Complete deletion of a task.
The caller must do the locking, and must do the hidden check.
The caller must handle the case where the task is already in the trashcan.
[in] | task | The task. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
|
static |
Complete deletion of a task.
This sets up a transaction around the delete.
[in] | task | The task. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
|
static |
Delete all trash tasks.
The caller must do the transaction.
|
static |
Send an email.
[in] | to_address | Address to send to. |
[in] | from_address | Address to send to. |
[in] | subject | Subject of email. |
[in] | body | Body of email. |
[in] | attachment | Attachment in line broken base64, or NULL. |
[in] | attachment_type | Attachment MIME type, or NULL. |
[in] | attachment_name | Base file name of the attachment, or NULL. |
[in] | attachment_extension | Attachment file extension, or NULL. |
[in] | recipient_credential | Optional credential to use for encryption. |
|
static |
Create a PGP encrypted email from a plain text one.
[in] | plain_file | Stream to read the plain text email from. |
[in] | encrypted_file | Stream to write the encrypted email to. |
[in] | public_key | Recipient public key to use for encryption. |
[in] | to_address | Email address to send to. |
[in] | from_address | Email address to use as sender. |
[in] | subject | Subject of email. |
|
static |
Create an S/MIME encrypted email from a plain text one.
[in] | plain_file | Stream to read the plain text email from. |
[in] | encrypted_file | Stream to write the encrypted email to. |
[in] | certificate | Recipient certificate chain for encryption. |
[in] | to_address | Email address to send to. |
[in] | from_address | Email address to use as sender. |
[in] | subject | Subject of email. |
|
static |
Build and send email for SecInfo alert.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[in] | to_address | To address. |
[in] | from_address | From address. |
|
static |
Build and send email for a ticket alert.
[in] | alert | Alert. |
[in] | ticket | Ticket. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[in] | to_address | To address. |
[in] | from_address | From address. |
[in] | subject | Subject. |
|
static |
Write the content of a plain text email to a stream.
[in] | content_file | Stream to write the email content to. |
[in] | to_address | Address to send to. |
[in] | from_address | Address to send to. |
[in] | subject | Subject of email. |
[in] | body | Body of email. |
[in] | attachment | Attachment in line broken base64, or NULL. |
[in] | attachment_type | Attachment MIME type, or NULL. |
[in] | attachment_name | Base file name of the attachment, or NULL. |
[in] | attachment_extension | Attachment file extension, or NULL. |
|
static |
Encrypt, re-encrypt or decrypt all credentials.
All plaintext credentials in the credentials table are encrypted, all already encrypted credentials are encrypted again using the latest key.
[in] | decrypt_flag | If true decrypt all credentials. |
|
static |
Escalate an event with preset report filtering.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | report | Report. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[out] | script_message | Custom error message from alert script. |
|
static |
Escalate an event.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | report | Report. 0 for most recent report. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[in] | get | GET data for report. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides_details | If overrides, Whether to include details. |
[out] | script_message | Custom error message from the script. |
|
static |
Escalate an event.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | report | Report. 0 for most recent report. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[in] | get | GET data for report. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides_details | If overrides, Whether to include details. |
[out] | script_message | Custom error message from the script. |
void event | ( | event_t | event, |
void * | event_data, | ||
resource_t | resource_1, | ||
resource_t | resource_2 | ||
) |
Produce an event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | resource_1 | Event type specific resource 1. For example, a task for EVENT_TASK_RUN_STATUS_CHANGED. |
[in] | resource_2 | Event type specific resource 2. |
|
static |
Get the active state from an event alert iterator.
[in] | iterator | Iterator. |
|
static |
Get the alert from a event alert iterator.
[in] | iterator | Iterator. |
|
static |
Return whether an event applies to a task and an alert.
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | event_resource | Event resource. |
[in] | alert | Alert. |
gchar* filter_clause | ( | const char * | type, |
const char * | filter, | ||
const char ** | filter_columns, | ||
column_t * | select_columns, | ||
column_t * | where_columns, | ||
int | trash, | ||
gchar ** | order_return, | ||
int * | first_return, | ||
int * | max_return, | ||
array_t ** | permissions, | ||
gchar ** | owner_filter | ||
) |
Return SQL WHERE clause for restricting a SELECT to a filter term.
[in] | type | Resource type. |
[in] | filter | Filter term. |
[in] | filter_columns | Filter columns. |
[in] | select_columns | SELECT columns. |
[in] | where_columns | Columns in SQL that only appear in WHERE clause. |
[out] | trash | Whether the trash table is being queried. |
[out] | order_return | If given then order clause. |
[out] | first_return | If given then first row. |
[out] | max_return | If given then max rows. |
[out] | permissions | When given then permissions string vector. |
[out] | owner_filter | When given then value of owner keyword. |
|
static |
Append parts for a "tag" keyword to a filter clause.
[in,out] | clause | Buffer for the filter clause to append to. |
[in] | keyword | The keyword to create the filter clause part for. |
[in] | type | The resource type. |
[in] | first_keyword | Whether keyword is first. |
[in] | last_was_and | Whether last keyword was "and". |
[in] | last_was_not | Whether last keyword was "not". |
|
static |
Append parts for a "tag_id" keyword to a filter clause.
[in,out] | clause | Buffer for the filter clause to append to. |
[in] | keyword | The keyword to create the filter clause part for. |
[in] | type | The resource type. |
[in] | first_keyword | Whether keyword is first. |
[in] | last_was_and | Whether last keyword was "and". |
[in] | last_was_not | Whether last keyword was "not". |
|
static |
Get an int column from a filter split.
[in] | point | Filter split. |
[in] | column | Name of column. |
[out] | val | Value of column. |
|
static |
Get a string column from a filter split.
[in] | point | Filter split. |
[in] | column | Name of column. |
[out] | string | Value of column, freshly allocated. |
void filter_free | ( | array_t * | split | ) |
Free a split filter.
[in] | split | Split filter. |
|
static |
Find a agent for a specific permission, given a UUID.
[in] | uuid | UUID of agent. |
[out] | agent | Agent return, 0 if successfully failed to find agent. |
[in] | permission | Permission. |
gboolean find_alert_with_permission | ( | const char * | uuid, |
alert_t * | alert, | ||
const char * | permission | ||
) |
Find a alert for a specific permission, given a UUID.
[in] | uuid | UUID of alert. |
[out] | alert | Alert return, 0 if successfully failed to find alert. |
[in] | permission | Permission. |
gboolean find_credential_with_permission | ( | const char * | uuid, |
credential_t * | credential, | ||
const char * | permission | ||
) |
Find a credential for a specific permission, given a UUID.
[in] | uuid | UUID of credential. |
[out] | credential | Credential return, 0 if successfully failed to find Credential. |
[in] | permission | Permission. |
gboolean find_note_with_permission | ( | const char * | uuid, |
note_t * | note, | ||
const char * | permission | ||
) |
Find a note for a specific permission, given a UUID.
[in] | uuid | UUID of note. |
[out] | note | Note return, 0 if successfully failed to find note. |
[in] | permission | Permission. |
gboolean find_override_with_permission | ( | const char * | uuid, |
override_t * | override, | ||
const char * | permission | ||
) |
Find a override for a specific permission, given a UUID.
[in] | uuid | UUID of override. |
[out] | override | Override return, 0 if successfully failed to find override. |
[in] | permission | Permission. |
gboolean find_report_format_with_permission | ( | const char * | uuid, |
report_format_t * | report_format, | ||
const char * | permission | ||
) |
Find a reportformat for a specific permission, given a UUID.
[in] | uuid | UUID of report format. |
[out] | report_format | Report format return, 0 if successfully failed to find report_format. |
[in] | permission | Permission. |
gboolean find_report_with_permission | ( | const char * | uuid, |
report_t * | report, | ||
const char * | permission | ||
) |
Find a report for a specific permission, given a UUID.
[in] | uuid | UUID of report. |
[out] | report | Report return, 0 if successfully failed to find report. |
[in] | permission | Permission. |
gboolean find_resource | ( | const char * | type, |
const char * | uuid, | ||
resource_t * | resource | ||
) |
Find a resource given a UUID.
This only looks for resources owned (or effectively owned) by the current user. So no shared resources and no globals.
[in] | type | Type of resource. |
[in] | uuid | UUID of resource. |
[out] | resource | Resource return, 0 if successfully failed to find resource. |
|
static |
Find a resource given a name.
[in] | type | Type of resource. |
[in] | name | A resource name. |
[out] | resource | Resource return, 0 if successfully failed to find resource. |
|
static |
Find a resource given a UUID and a permission.
[in] | type | Type of resource. |
[in] | name | Name of resource. |
[out] | resource | Resource return, 0 if successfully failed to find resource. |
[in] | permission | Permission. |
gboolean find_resource_with_permission | ( | const char * | type, |
const char * | uuid, | ||
resource_t * | resource, | ||
const char * | permission, | ||
int | trash | ||
) |
Find a resource given a UUID and a permission.
[in] | type | Type of resource. |
[in] | uuid | UUID of resource. |
[out] | resource | Resource return, 0 if successfully failed to find resource. |
[in] | permission | Permission. |
[in] | trash | Whether resource is in trashcan. |
gboolean find_result_with_permission | ( | const char * | uuid, |
result_t * | result, | ||
const char * | permission | ||
) |
Find a result for a set of permissions, given a UUID.
[in] | uuid | UUID of result. |
[out] | result | Result return, 0 if successfully failed to find result. |
[in] | permission | Permission. |
gboolean find_scanner_with_permission | ( | const char * | uuid, |
scanner_t * | scanner, | ||
const char * | permission | ||
) |
Find a scanner for a specific permission, given a UUID.
[in] | uuid | UUID of scanner. |
[out] | scanner | Scanner return, 0 if successfully failed to find scanner. |
[in] | permission | Permission. |
gboolean find_schedule_with_permission | ( | const char * | uuid, |
schedule_t * | schedule, | ||
const char * | permission | ||
) |
Find a schedule for a specific permission, given a UUID.
[in] | uuid | UUID of schedule. |
[out] | schedule | Schedule return, 0 if successfully failed to find schedule. |
[in] | permission | Permission. |
|
static |
Find a signature in a feed.
[in] | location | Feed directory to search for signature. |
[in] | installer_filename | Installer filename. |
[out] | signature | Freshly allocated installer signature. |
[out] | signature_size | Size of installer signature. |
[out] | uuid | Address for basename of linked signature when the signature was found in the private directory, if desired, else NULL. Private directory is only checked if this is given. |
gboolean find_target_with_permission | ( | const char * | uuid, |
target_t * | target, | ||
const char * | permission | ||
) |
Find a target for a specific permission, given a UUID.
[in] | uuid | UUID of target. |
[out] | target | Target return, 0 if successfully failed to find target. |
[in] | permission | Permission. |
gboolean find_task_with_permission | ( | const char * | uuid, |
task_t * | task, | ||
const char * | permission | ||
) |
Find a task for a specific permission, given a UUID.
[in] | uuid | UUID of task. |
[out] | task | Task return, 0 if successfully failed to find task. |
[in] | permission | Permission. |
gboolean find_trash | ( | const char * | type, |
const char * | uuid, | ||
resource_t * | resource | ||
) |
Find a resource in the trashcan given a UUID.
[in] | type | Type of resource. |
[in] | uuid | UUID of resource. |
[out] | resource | Resource return, 0 if successfully failed to find resource. |
|
static |
Find a report in the trashcan for a specific permission, given a UUID.
[in] | uuid | UUID of report. |
[out] | report | Report return, 0 if successfully failed to find report. |
[in] | permission | Permission. |
|
static |
Find a task in the trashcan, given an identifier.
[in] | uuid | A task identifier. |
[out] | task | Task return, 0 if successfully failed to find task. |
gboolean find_trash_task_with_permission | ( | const char * | uuid, |
task_t * | task, | ||
const char * | permission | ||
) |
Find a task in the trashcan for a specific permission, given a UUID.
[in] | uuid | UUID of task. |
[out] | task | Task return, 0 if successfully failed to find task. |
[in] | permission | Permission. |
|
static |
Free delta host ports.
[in] | host_ports | Ports. |
[in] | dummy | Dummy. |
|
static |
Generates report results get data for an alert.
[in] | alert | The alert to try to get the filter data from. |
[in] | base_get_data | The get data for fallback and other data. |
[out] | alert_filter_get | Pointer to the newly allocated get_data. |
[out] | filter_return | Pointer to the filter. |
|
static |
Generates a filename or path for a report.
If no custom_format is given, the setting "Report Export File Name" is used instead.
[in] | report | The report to generate the filename for. |
[in] | task | The task the report belongs to. |
[in] | report_format | The report format to use. |
[in] | custom_format | A custom format string to use for the filename. |
[in] | add_extension | Whether to add the filename extension or not. |
|
static |
Get the delta report to be used for an alert.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | report | Report. |
const char* get_iterator_comment | ( | iterator_t * | iterator | ) |
Get the comment from a GET iterator.
[in] | iterator | Iterator. |
user_t get_iterator_owner | ( | iterator_t * | iterator | ) |
Get the owner from a GET iterator.
[in] | iterator | Iterator. |
resource_t get_iterator_resource | ( | iterator_t * | iterator | ) |
Get the resource from a GET iterator.
[in] | iterator | Iterator. |
|
static |
Return SQL join words for filter_clause.
[in] | first | Whether keyword is first. |
[in] | last_was_and | Whether last keyword was "and". |
[in] | last_was_not | Whether last keyword was "not". |
|
static |
Return the name of the sysconf GnuPG home directory.
Returns the name of the GnuPG home directory to use when checking signatures. It is the directory openvas/gnupg under the sysconfdir that was set by configure (usually $prefix/etc).
|
static |
Return the name of the trusted keys file name.
We currently use the name pubring.gpg to be compatible with previous installations. That file should best be installed read-only so that it is not accidentally accessed while we are running a verification. All files in that keyring are assumed to be fully trustworthy.
|
static |
Check whether a GMP command takes a resource.
MODIFY_TARGET, for example, takes a target.
[in] | name | Command name. |
|
static |
Get the type associated with a GMP command.
[in] | name | Command name. |
void host_detail_free | ( | host_detail_t * | detail | ) |
Free a host detail.
[in] | detail | Host detail. |
|
static |
Identify a host, given an identifier.
Find a host which has an identifier of the same name and value, and which has no identifiers of the same name and a different value.
[in] | host_name | Host name. |
[in] | identifier_name | Host identifier name. |
[in] | identifier_value | Value of host identifier. |
[in] | source_type | Source of identification: result. |
[in] | source | Source identifier. |
int host_iterator_current_port | ( | iterator_t * | iterator | ) |
Get the current port from a host iterator.
[in] | iterator | Iterator. |
int host_iterator_max_port | ( | iterator_t * | iterator | ) |
Get the max port from a host iterator.
[in] | iterator | Iterator. |
|
static |
Get the report host from a host iterator.
[in] | iterator | Iterator. |
host_t host_notice | ( | const char * | host_name, |
const char * | identifier_type, | ||
const char * | identifier_value, | ||
const char * | source_type, | ||
const char * | source_id, | ||
int | check_add_to_assets, | ||
int | check_for_existing_identifier | ||
) |
Notice a host.
When a host is detected during a scan, this makes the decision about which asset host is used for the host, as described in asset_rules. This decision is revised at the end of the scan by hosts_set_identifiers if there are any identifiers for the host.
[in] | host_name | Name of host. |
[in] | identifier_type | Type of host identifier. |
[in] | identifier_value | Value of host identifier. |
[in] | source_type | Type of source identifier |
[in] | source_id | Source identifier. |
[in] | check_add_to_assets | Whether to check the 'Add to Assets' task preference. |
[in] | check_for_existing_identifier | Whether to check for an existing identifier like this one. Used for slaves, which call this repeatedly. |
gboolean host_nthlast_report_host | ( | const char * | host, |
report_host_t * | report_host, | ||
int | position | ||
) |
Get N'th last report_host given a host.
The last report_host is at position 1, the second last at position 2, and so on.
[in] | host | Host. |
[in] | report_host | Report host. |
[in] | position | Position from end. |
|
static |
Print the XML for a report to a file.
[in] | host_summary_buffer | Summary. |
[in] | host | Host. |
[in] | start_iso | Start time, in ISO format. |
[in] | end_iso | End time, in ISO format. |
|
static |
GET an HTTP resource.
[in] | url | URL. |
int info_name_count | ( | const char * | type, |
const char * | name | ||
) |
Count number of info of a given subtype with a given name.
[in] | type | GET_INFO subtype. |
[out] | name | Name of the info item. |
int init_agent_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise an agent iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
int init_aggregate_iterator | ( | iterator_t * | iterator, |
const char * | type, | ||
const get_data_t * | get, | ||
int | distinct, | ||
GArray * | data_columns, | ||
const char * | group_column, | ||
const char * | subgroup_column, | ||
GArray * | text_columns, | ||
GArray * | sort_data, | ||
int | first_group, | ||
int | max_groups, | ||
const char * | extra_tables, | ||
const char * | given_extra_where | ||
) |
Initialise a GET_AGGREGATES iterator, including observed resources.
[in] | iterator | Iterator. |
[in] | type | Type of resource. |
[in] | get | GET data. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | data_columns | Columns to calculate statistics for. |
[in] | group_column | Column to group data by. |
[in] | subgroup_column | Column to further group data by. |
[in] | text_columns | Columns to get text from. |
[in] | sort_data | GArray of sorting data. |
[in] | first_group | Row number to start iterating from. |
[in] | max_groups | Maximum number of rows. |
[in] | extra_tables | Join tables. Skipped for trash and single resource. |
[in] | given_extra_where | Extra WHERE clauses. Skipped for single resource. |
void init_alert_data_iterator | ( | iterator_t * | iterator, |
alert_t | alert, | ||
int | trash, | ||
const char * | table | ||
) |
Initialise an alert data iterator.
[in] | iterator | Iterator. |
[in] | alert | Alert. |
[in] | trash | Whether to iterate over trashcan alert data. |
[in] | table | Type of data: "condition", "event" or "method", corresponds to substring of the table to select from. |
int init_alert_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise an alert iterator, including observed alerts.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_alert_task_iterator | ( | iterator_t * | iterator, |
alert_t | alert, | ||
int | ascending | ||
) |
Initialise an alert task iterator.
Iterate over all tasks that use the alert.
[in] | iterator | Iterator. |
[in] | alert | Alert. |
[in] | ascending | Whether to sort ascending or descending. |
int init_credential_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a Credential iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_credential_iterator_one | ( | iterator_t * | iterator, |
credential_t | credential | ||
) |
Initialise a Credential iterator, given a single Credential.
[in] | iterator | Iterator. |
[in] | credential | Single Credential to iterate. |
void init_credential_scanner_iterator | ( | iterator_t * | iterator, |
credential_t | credential, | ||
int | ascending | ||
) |
Initialise a Credential scanner iterator.
Iterates over all scanners that use the credential.
[in] | iterator | Iterator. |
[in] | credential | Name of credential. |
[in] | ascending | Whether to sort ascending or descending. |
void init_credential_target_iterator | ( | iterator_t * | iterator, |
credential_t | credential, | ||
int | ascending | ||
) |
Initialise a Credential target iterator.
Iterates over all targets that use the credential.
[in] | iterator | Iterator. |
[in] | credential | Name of credential. |
[in] | ascending | Whether to sort ascending or descending. |
|
static |
Init delta iterators for print_report_xml.
[in] | report | The report. |
[in] | results | Report result iterator. |
[in] | delta | Delta report. |
[in] | delta_results | Delta report result iterator. |
[in] | get | GET command data. |
[in] | term | Filter term. |
[out] | sort_field | Sort field. |
|
static |
Initialise an event alert iterator.
[in] | iterator | Iterator. |
[in] | event | Event. |
int init_get_iterator | ( | iterator_t * | iterator, |
const char * | type, | ||
const get_data_t * | get, | ||
column_t * | select_columns, | ||
column_t * | trash_select_columns, | ||
const char ** | filter_columns, | ||
int | distinct, | ||
const char * | extra_tables, | ||
const char * | extra_where, | ||
int | owned | ||
) |
Initialise a GET iterator, including observed resources.
[in] | iterator | Iterator. |
[in] | type | Type of resource. |
[in] | get | GET data. |
[in] | select_columns | Columns for SQL. |
[in] | trash_select_columns | Columns for SQL trash case. |
[in] | filter_columns | Columns for filter. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | extra_tables | Extra tables to join in FROM clause. |
[in] | extra_where | Extra WHERE clauses. Skipped for single resource. |
[in] | owned | Only get items owned by the current user. |
|
static |
Initialise a GET iterator, including observed resources.
[in] | iterator | Iterator. |
[in] | type | Type of resource. |
[in] | get | GET data. |
[in] | select_columns | Columns for SQL. |
[in] | trash_select_columns | Columns for SQL trash case. |
[in] | where_columns | WHERE columns. These are columns that can be used for filtering and searching, but are not accessed (so column has no iterator access function). |
[in] | trash_where_columns | WHERE columns for trashcan. |
[in] | filter_columns | Columns for filter. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | extra_tables | Extra tables to join in FROM clause. |
[in] | extra_where | Extra WHERE clauses. Skipped for single resource. |
[in] | owned | Only get items owned by the current user. |
[in] | ignore_id | Whether to ignore id (e.g. for report results). |
[in] | extra_order | Extra ORDER clauses. |
|
static |
Initialise a GET iterator, including observed resources.
This version includes the extra_with arg.
[in] | iterator | Iterator. |
[in] | type | Type of resource. |
[in] | get | GET data. |
[in] | select_columns | Columns for SQL. |
[in] | trash_select_columns | Columns for SQL trash case. |
[in] | where_columns | WHERE columns. These are columns that can be used for filtering and searching, but are not accessed (so column has no iterator access function). |
[in] | trash_where_columns | WHERE columns for trashcan. |
[in] | filter_columns | Columns for filter. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | extra_tables | Extra tables to join in FROM clause. |
[in] | extra_where | Extra WHERE clauses. Skipped for single resource. |
[in] | owned | Only get items owned by the current user. |
[in] | ignore_id | Whether to ignore id (e.g. for report results). |
[in] | extra_order | Extra ORDER clauses. |
[in] | extra_with | Extra WITH clauses. |
[in] | assume_permitted | Whether to skip permission checks. |
void init_host_prognosis_iterator | ( | iterator_t * | iterator, |
report_host_t | report_host | ||
) |
Initialise a report host prognosis iterator.
[in] | iterator | Iterator. |
[in] | report_host | Report host whose prognosis the iterator loops over. All report_hosts if NULL. |
int init_manage | ( | GSList * | log_config, |
const gchar * | database, | ||
int | max_ips_per_target, | ||
int | max_email_attachment_size, | ||
int | max_email_include_size, | ||
int | max_email_message_size, | ||
manage_connection_forker_t | fork_connection, | ||
int | skip_db_check | ||
) |
Initialize the manage library.
Check DB version, do startup database checks, load the NVT cache.
Ensure all tasks are in a clean initial state.
Beware that calling this function while tasks are running may lead to problems.
[in] | log_config | Log configuration. |
[in] | database | Location of database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | max_email_attachment_size | Max size of email attachments. |
[in] | max_email_include_size | Max size of email inclusions. |
[in] | max_email_message_size | Max size of email user message text. |
[in] | fork_connection | Function to fork a connection that will accept GMP requests. Used to start tasks with GMP when an alert occurs. |
[in] | skip_db_check | Skip DB check. |
int init_manage_helper | ( | GSList * | log_config, |
const gchar * | database, | ||
int | max_ips_per_target | ||
) |
Initialize the manage library for a helper program.
This should be called at the beginning of any program that accesses the database. Forked processes should call init_manage_process. The daemon itself calls init_manage, including in NVT cache mode.
[in] | log_config | Log configuration. |
[in] | database | Location of database. |
[in] | max_ips_per_target | Max number of IPs per target. |
|
static |
Initialize the manage library.
Check DB version, do startup database checks, load the NVT cache. Optionally also stop active tasks.
[in] | log_config | Log configuration. |
[in] | database | Location of database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | max_email_attachment_size | Max size of email attachments. |
[in] | max_email_include_size | Max size of email inclusions. |
[in] | max_email_message_size | Max size of email user message text. |
[in] | stop_tasks | Stop any active tasks. |
[in] | fork_connection | Function to fork a connection that will accept GMP requests. Used to start tasks with GMP when an alert occurs. |
[in] | skip_db_check | Skip DB check. |
[in] | check_encryption_key | Check encryption key if doing DB check. |
void init_manage_process | ( | const gchar * | database | ) |
Initialize the manage library for a process.
Open the SQL database, attach secondary databases, and define functions.
[in] | database | Location of manage database. |
int init_note_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get, | ||
nvt_t | nvt, | ||
result_t | result, | ||
task_t | task | ||
) |
Initialise a note iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
[in] | result | Result to limit notes to, 0 for all. |
[in] | task | If result is > 0, task whose notes on result to include, otherwise task to limit notes to. 0 for all tasks. |
[in] | nvt | NVT to limit notes to, 0 for all. |
int init_override_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get, | ||
nvt_t | nvt, | ||
result_t | result, | ||
task_t | task | ||
) |
Initialise an override iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
[in] | result | Result to limit overrides to, 0 for all. |
[in] | task | If result is > 0, task whose overrides on result to include, otherwise task to limit overrides to. 0 for all tasks. |
[in] | nvt | NVT to limit overrides to, 0 for all. |
void init_report_counts_build_iterator | ( | iterator_t * | iterator, |
report_t | report, | ||
int | min_qod_limit, | ||
int | add_defaults, | ||
const char * | users_where | ||
) |
Initializes an iterator for updating the report cache.
[in] | iterator | Iterator. |
[in] | report | Report to select. |
[in] | min_qod_limit | Limit for min_qod. |
[in] | add_defaults | Whether to add default values. |
[in] | users_where | Optional SQL clause to limit users. |
void init_report_errors_iterator | ( | iterator_t * | iterator, |
report_t | report | ||
) |
Initialise a report errors iterator.
[in] | iterator | Iterator. |
[in] | report | The report. |
|
static |
Initialise a report host details iterator.
[in] | iterator | Iterator. |
[in] | report_host | Report host whose details the iterator loops over. All report_hosts if NULL. |
void init_report_host_iterator | ( | iterator_t * | iterator, |
report_t | report, | ||
const char * | host, | ||
report_host_t | report_host | ||
) |
Initialise a host iterator.
[in] | iterator | Iterator. |
[in] | report | Report whose hosts the iterator loops over. |
[in] | host | Single host to iterate over. All hosts if NULL. |
[in] | report_host | Single report host to iterate over. All if 0. |
int init_report_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a report iterator, including observed reports.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_report_iterator_task | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a report iterator.
[in] | iterator | Iterator. |
[in] | task | Task whose reports the iterator loops over. |
int init_result_get_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get, | ||
report_t | report, | ||
const char * | host, | ||
const gchar * | extra_order | ||
) |
Initialise a result iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
[in] | report | Report to restrict returned results to. |
[in] | host | Host to limit results to. |
[in] | extra_order | Extra text for ORDER term in SQL. |
|
static |
Initialise the severity-only result iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
[in] | report | Report to restrict returned results to. |
[in] | host | Host to limit results to. |
[in] | extra_order | Extra text for ORDER term in SQL. |
void init_scanner_config_iterator | ( | iterator_t * | iterator, |
scanner_t | scanner | ||
) |
Initialise a scanner config iterator.
[in] | iterator | Iterator. |
[in] | scanner | Scanner. |
int init_scanner_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise an scanner iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_scanner_task_iterator | ( | iterator_t * | iterator, |
scanner_t | scanner | ||
) |
Initialise a scanner task iterator.
[in] | iterator | Iterator. |
[in] | scanner | Scanner. |
int init_schedule_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a schedule iterator.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_schedule_task_iterator | ( | iterator_t * | iterator, |
schedule_t | schedule | ||
) |
Initialise a schedule task iterator.
[in] | iterator | Iterator. |
[in] | schedule | Schedule. |
int init_target_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a target iterator, including observed targets.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_target_iterator_one | ( | iterator_t * | iterator, |
target_t | target | ||
) |
Initialise a target iterator, given a single target.
[in] | iterator | Iterator. |
[in] | target | Single target to iterate. |
void init_target_task_iterator | ( | iterator_t * | iterator, |
target_t | target | ||
) |
Initialise a target task iterator.
Iterates over all tasks that use the target.
[in] | iterator | Iterator. |
[in] | target | Target. |
void init_task_alert_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task alert iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
void init_task_file_iterator | ( | iterator_t * | iterator, |
task_t | task, | ||
const char * | file | ||
) |
Initialise a task file iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
[in] | file | File name, NULL for all files. |
void init_task_group_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task group iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
int init_task_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a task iterator.
[in] | iterator | Task iterator. |
[in] | get | GET data. |
void init_task_role_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task role iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
int init_task_schedule_iterator | ( | iterator_t * | iterator | ) |
Initialise a task schedule iterator.
Lock the database before initialising.
[in] | iterator | Iterator. |
|
static |
Initialise a task user iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
|
static |
Initialise a task iterator, limited to current user's tasks.
[in] | iterator | Task iterator. |
[in] | trash | Whether to iterate over trashcan tasks. |
[in] | ignore_severity | Whether to ignore severity data. |
void insert_report_host_detail | ( | report_t | report, |
const char * | host, | ||
const char * | s_type, | ||
const char * | s_name, | ||
const char * | s_desc, | ||
const char * | name, | ||
const char * | value | ||
) |
Insert a host detail into a report.
[in] | report | The detail's report. |
[in] | host | The detail's host. |
[in] | s_type | The detail's source type. |
[in] | s_name | The detail's source name. |
[in] | s_desc | The detail's source description. |
[in] | name | The detail's name. |
[in] | value | The detail's value. |
|
static |
Insert a scanner for create_scanner.
[in] | name | Name of scanner. |
[in] | comment | Comment on scanner. |
[in] | host | Host of scanner. |
[in] | ca_pub | CA Certificate for scanner. |
[in] | iport | Port of scanner. |
[in] | itype | Type of scanner. |
[out] | new_scanner | The created scanner. |
|
static |
Check whether a keyword has any effect in the filter.
Some keywords are redundant, like a second sort= keyword.
[in] | array | Array of existing keywords. |
[in] | keyword | Keyword under consideration. |
|
static |
Check whether a keyword applies to a column.
[in] | keyword | Keyword. |
[in] | column | Column. |
|
static |
Free a keyword.
[in] | keyword | Filter keyword. |
const char* keyword_relation_symbol | ( | keyword_relation_t | relation | ) |
Get the symbol of a keyword relation.
[in] | relation | Relation. |
int keyword_special | ( | keyword_t * | keyword | ) |
Get whether a keyword is special (like "and").
[in] | keyword | Keyword. |
|
static |
Check whether LDAP is enabled.
nvti_t* lookup_nvti | ( | const gchar * | nvt | ) |
Update the memory cache of NVTs.
[in] | nvt | NVT. |
|
static |
Find a report format given a name.
[in] | name | Name of report_format. |
[out] | report_format | Report format return, 0 if successfully failed to find report_format. |
void make_config_base | ( | char *const | uuid, |
char *const | selector_name | ||
) |
Make Base Scan Config.
Caller must lock the db.
[in] | uuid | UUID for new scan config. |
[in] | selector_name | Name of NVT selector to use. |
void make_config_discovery | ( | char *const | uuid, |
char *const | selector_name | ||
) |
Make Discovery Scan Config.
Caller must lock the db.
[in] | uuid | UUID for new scan config. |
[in] | selector_name | Name of NVT selector to use. |
void make_config_discovery_service_detection | ( | char *const | selector_name | ) |
Make Discovery Scan Config.
Caller must lock the db.
[in] | selector_name | Name of NVT selector to use. |
void make_config_host_discovery | ( | char *const | uuid, |
char *const | selector_name | ||
) |
Make Host Discovery Scan Config.
Caller must lock the db.
[in] | uuid | UUID for new scan config. |
[in] | selector_name | Name of NVT selector to use. |
void make_config_system_discovery | ( | char *const | uuid, |
char *const | selector_name | ||
) |
Make System Discovery Scan Config.
Caller must lock the db.
[in] | uuid | UUID for new scan config. |
[in] | selector_name | Name of NVT selector to use. |
result_t make_cve_result | ( | task_t | task, |
const char * | host, | ||
const char * | nvt, | ||
double | cvss, | ||
const char * | description | ||
) |
Make a CVE result.
[in] | task | The task associated with the result. |
[in] | host | Host. |
[in] | nvt | The OID of the NVT that produced the result. |
[in] | cvss | CVSS base. |
[in] | description | Description of the result. |
result_t make_osp_result | ( | task_t | task, |
const char * | host, | ||
const char * | hostname, | ||
const char * | nvt, | ||
const char * | type, | ||
const char * | description, | ||
const char * | port, | ||
const char * | severity, | ||
int | qod | ||
) |
Make an OSP result.
[in] | task | The task associated with the result. |
[in] | host | Target host of result. |
[in] | hostname | Hostname of the result. |
[in] | nvt | The uuid of oval definition that produced the result, a title for the result otherwise. |
[in] | type | Type of result. "Alarm", etc. |
[in] | description | Description of the result. |
[in] | port | Result port. |
[in] | severity | Result severity. |
[in] | qod | Quality of detection. |
void make_port_ranges_all_tcp_nmap_5_51_top_100 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
void make_port_ranges_all_tcp_nmap_5_51_top_1000 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
void make_port_ranges_iana_tcp_2012 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
void make_port_ranges_iana_tcp_udp_2012 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP and UDP 2012.
Caller must lock the db.
[in] | list | Port list. |
void make_port_ranges_nmap_5_51_top_2000_top_100 | ( | port_list_t | list | ) |
Make port ranges for Nmap top 2000 top 100.
Caller must lock the db.
[in] | list | Port list. |
|
static |
Make port ranges.
Caller must lock the db.
[in] | list | Port list. |
report_t make_report | ( | task_t | task, |
const char * | uuid, | ||
task_status_t | status | ||
) |
Make a report.
[in] | task | The task associated with the report. |
[in] | uuid | The UUID of the report. |
[in] | status | The run status of the scan associated with the report. |
|
static |
Ensure every report format has a unique UUID.
result_t make_result | ( | task_t | task, |
const char * | host, | ||
const char * | hostname, | ||
const char * | port, | ||
const char * | nvt, | ||
const char * | type, | ||
const char * | description | ||
) |
Make a result.
[in] | task | The task associated with the result. |
[in] | host | Host IP address. |
[in] | hostname | Hostname. |
[in] | port | The port the result refers to. |
[in] | nvt | The OID of the NVT that produced the result. |
[in] | type | Type of result. "Security Hole", etc. |
[in] | description | Description of the result. |
task_t make_task | ( | char * | name, |
char * | comment, | ||
int | in_assets, | ||
int | event | ||
) |
Make a task.
The char* parameters name and comment are used directly and freed when the task is freed.
[in] | name | The name of the task. |
[in] | comment | A comment associated the task. |
[in] | in_assets | Whether task must be considered for assets. |
[in] | event | Whether to be generate event and event log. |
void make_task_complete | ( | task_t | task | ) |
Complete the creation of a task.
[in] | task | The task. |
int manage_alert | ( | const char * | alert_id, |
const char * | task_id, | ||
event_t | event, | ||
const void * | event_data, | ||
gchar ** | script_message | ||
) |
Escalate an alert with task and event data.
[in] | alert_id | Alert UUID. |
[in] | task_id | Task UUID. |
[in] | event | Event. |
[in] | event_data | Event data. |
[out] | script_message | Custom error message from alert script. |
int manage_cert_db_supported_version | ( | ) |
Return the database version supported by this manager.
int manage_cert_db_version | ( | ) |
Return the database version of the actual database.
int manage_check_alerts | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Check if any SecInfo alerts are due.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
gchar* manage_clean_filter | ( | const gchar * | filter | ) |
Clean a filter.
[in] | filter | Filter. |
gchar* manage_clean_filter_remove | ( | const gchar * | filter, |
const gchar * | column | ||
) |
Clean a filter, removing a keyword in the process.
[in] | filter | Filter. |
[in] | column | Keyword to remove, or NULL. |
void manage_cleanup_process_error | ( | int | signal | ) |
Cleanup as immediately as possible.
Put any running task in the error state and close the database.
Intended for handlers for signals like SIGSEGV and SIGABRT.
[in] | signal | Dummy argument for use as signal handler. |
int manage_count_hosts | ( | const char * | given_hosts, |
const char * | exclude_hosts | ||
) |
Return number of hosts described by a hosts string.
[in] | given_hosts | String describing hosts. |
[in] | exclude_hosts | String describing hosts excluded from given set. |
int manage_create_scanner | ( | GSList * | log_config, |
const gchar * | database, | ||
const char * | name, | ||
const char * | host, | ||
const char * | port, | ||
const char * | type, | ||
const char * | ca_pub_path, | ||
const char * | credential_id, | ||
const char * | key_pub_path, | ||
const char * | key_priv_path | ||
) |
Create the given scanner.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
[in] | name | Name of scanner. |
[in] | host | Host of scanner. |
[in] | port | Port of scanner. |
[in] | type | Type of scanner. |
[in] | ca_pub_path | CA Certificate path. |
[in] | credential_id | UUID of credential to use or NULL to create. |
[in] | key_pub_path | Certificate path. |
[in] | key_priv_path | Private key path. |
int manage_create_sql_functions | ( | ) |
Create functions.
int manage_db_supported_version | ( | ) |
Return the database version supported by this manager.
int manage_db_version | ( | ) |
Return the database version of the actual database.
int manage_decrypt_all_credentials | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Decrypt all credentials.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
int manage_delete_scanner | ( | GSList * | log_config, |
const gchar * | database, | ||
const gchar * | uuid | ||
) |
Delete the given scanner.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
[in] | uuid | UUID of scanner. |
int manage_encrypt_all_credentials | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Encrypt or re-encrypt all credentials.
All plaintext credentials in the credentials table are encrypted, all already encrypted credentials are encrypted again using the latest key.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
void manage_filter_controls | ( | const gchar * | filter, |
int * | first, | ||
int * | max, | ||
gchar ** | sort_field, | ||
int * | sort_order | ||
) |
Get info from a filter.
It's up to the caller to ensure that max is adjusted for Max Rows Per Page (by calling manage_max_rows).
[in] | filter | Filter. |
[out] | first | Number of first item. |
[out] | max | Max number of rows. |
[out] | sort_field | Sort field. |
[out] | sort_order | Sort order. |
int manage_get_scanners | ( | GSList * | log_config, |
const gchar * | database | ||
) |
List scanners.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
int manage_max_hosts | ( | ) |
Get the maximum allowed number of hosts per target.
|
static |
Tries to migrate sensor type scanners to match the relays.
int manage_modify_scanner | ( | GSList * | log_config, |
const gchar * | database, | ||
const char * | scanner_id, | ||
const char * | name, | ||
const char * | host, | ||
const char * | port, | ||
const char * | type, | ||
const char * | ca_pub_path, | ||
const char * | credential_id, | ||
const char * | key_pub_path, | ||
const char * | key_priv_path | ||
) |
Modify the given scanner.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
[in] | scanner_id | ID of scanner. |
[in] | name | Name of scanner. |
[in] | host | Host of scanner. |
[in] | port | Port of scanner. |
[in] | type | Type of scanner. |
[in] | ca_pub_path | CA Certificate path. NULL to leave it as is. "" to use the default. |
[in] | credential_id | UUID of credential to use or NULL to create. |
[in] | key_pub_path | Certificate path. |
[in] | key_priv_path | Private key path. |
int manage_option_setup | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Setup for an option process.
[in] | log_config | Log configuration. |
[in] | database | Database. |
char* manage_port_name | ( | int | number, |
const char * | protocol | ||
) |
Returns associated name for a tcp/ip port.
number | Port number to get name for. |
protocol | Protocol type of port. |
gchar* manage_report | ( | report_t | report, |
report_t | delta_report, | ||
const get_data_t * | get, | ||
const report_format_t | report_format, | ||
int | notes_details, | ||
int | overrides_details, | ||
gsize * | output_length, | ||
gchar ** | extension, | ||
gchar ** | content_type, | ||
gchar ** | filter_term_return, | ||
gchar ** | zone_return, | ||
gchar ** | host_summary | ||
) |
Generate a report.
[in] | report | Report. |
[in] | delta_report | Report to compare with. |
[in] | get | GET data for report. |
[in] | report_format | Report format. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides_details | If overrides, Whether to include details. |
[out] | output_length | NULL or location for length of return. |
[out] | extension | NULL or location for report format extension. Only defined on success. |
[out] | content_type | NULL or location for report format content type. Only defined on success. |
[out] | filter_term_return | Filter term used in report. |
[out] | zone_return | Actual timezone used in report. |
[out] | host_summary | Summary of results per host. |
void manage_report_filter_controls | ( | const gchar * | filter, |
int * | first, | ||
int * | max, | ||
gchar ** | sort_field, | ||
int * | sort_order, | ||
int * | result_hosts_only, | ||
gchar ** | min_qod, | ||
gchar ** | levels, | ||
gchar ** | delta_states, | ||
gchar ** | search_phrase, | ||
int * | search_phrase_exact, | ||
int * | autofp, | ||
int * | notes, | ||
int * | overrides, | ||
int * | apply_overrides, | ||
gchar ** | zone | ||
) |
Get info from a filter for report.
It's up to the caller to ensure that max is adjusted for Max Rows Per Page (by calling manage_max_rows).
[in] | filter | Filter. |
[out] | first | Number of first item. |
[out] | max | Max number of rows. |
[out] | sort_field | Sort field. |
[out] | sort_order | Sort order. |
[out] | result_hosts_only | Whether to show only hosts with results. |
[out] | min_qod | Minimum QoD base of included results. All results if NULL. |
[out] | levels | String describing threat levels (message types) to include in count (for example, "hmlgd" for High, Medium, Low, loG and Debug). All levels if NULL. |
[out] | delta_states | String describing delta states to include in count (for example, "sngc" Same, New, Gone and Changed). All levels if NULL. |
[out] | search_phrase | Phrase that results must include. All results if NULL or "". |
[out] | search_phrase_exact | Whether search phrase is exact. |
[out] | autofp | Whether to apply auto FP filter. |
[out] | notes | Whether to include notes. |
[out] | overrides | Whether to include overrides. |
[out] | apply_overrides | Whether to apply overrides. |
[out] | zone | Timezone. |
int manage_resource_name | ( | const char * | type, |
const char * | uuid, | ||
char ** | name | ||
) |
Get the name of a resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[out] | name | Return for freshly allocated name. |
int manage_scap_db_supported_version | ( | ) |
Return the database version supported by this manager.
int manage_scap_db_version | ( | ) |
Return the database version of the actual database.
int manage_send_report | ( | report_t | report, |
report_t | delta_report, | ||
report_format_t | report_format, | ||
const get_data_t * | get, | ||
int | notes_details, | ||
int | overrides_details, | ||
int | result_tags, | ||
int | ignore_pagination, | ||
int | lean, | ||
int | base64, | ||
gboolean(*)(const char *, int(*)(const char *, void *), void *) | send, | ||
int(*)(const char *, void *) | send_data_1, | ||
void * | send_data_2, | ||
const char * | alert_id, | ||
const gchar * | prefix | ||
) |
Generate a report.
[in] | report | Report. |
[in] | delta_report | Report to compare with. |
[in] | report_format | Report format. |
[in] | get | GET command data. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides_details | If overrides, Whether to include details. |
[in] | result_tags | Whether to include tags in results. |
[in] | ignore_pagination | Whether to ignore pagination. |
[in] | lean | Whether to send lean report. |
[in] | base64 | Whether to base64 encode the report. |
[in] | send | Function to write to client. |
[in] | send_data_1 | Second argument to send . |
[in] | send_data_2 | Third argument to send . |
[in] | alert_id | ID of alert to escalate report with, instead of getting report. NULL to get report. |
[in] | prefix | Text to send to client before the report. |
|
static |
Set the maximum allowed number of hosts per target.
[in] | new_max | New max_hosts value. |
int manage_task_remove_file | ( | const gchar * | task_id, |
const char * | name | ||
) |
Remove a file on a task.
[in] | task_id | Task. |
[in] | name | Name of file. |
int manage_task_update_file | ( | const gchar * | task_id, |
const char * | name, | ||
const void * | content | ||
) |
Add a file to a task, or update the file on the task.
[in] | task_id | Task. |
[in] | name | Name of file. |
[in] | content | Content for file in base64 encoding. |
int manage_test_alert | ( | const char * | alert_id, |
gchar ** | script_message | ||
) |
Test an alert.
[in] | alert_id | Alert UUID. |
[out] | script_message | Custom message from the alert script. |
void manage_transaction_stop | ( | gboolean | force_commit | ) |
Commit the current transaction, if any.
The algorithm is extremely naive (time elapsed since the last message was received) but delivers good enough performances when facing bursts of messages.
[in] | force_commit | Force committing the pending transaction. |
int manage_trash_resource_name | ( | const char * | type, |
const char * | uuid, | ||
char ** | name | ||
) |
Get the name of a trashcan resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[out] | name | Return for freshly allocated name. |
int manage_update_nvti_cache | ( | ) |
Update the memory cache of NVTs, if this has been requested.
gchar* manage_user_hash | ( | const gchar * | username | ) |
Get user hash.
This is for "file" users, now entirely stored in db.
[in] | username | User name. |
int manage_verify_scanner | ( | GSList * | log_config, |
const gchar * | database, | ||
const gchar * | uuid | ||
) |
Verify the given scanner.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
[in] | uuid | UUID of scanner. |
const char* message_type_threat | ( | const char * | type | ) |
Get the threat of a message type.
type | Message type. |
int modify_agent | ( | const char * | agent_id, |
const char * | name, | ||
const char * | comment | ||
) |
Modify an agent.
[in] | agent_id | UUID of agent. |
[in] | name | Name of agent. |
[in] | comment | Comment on agent. |
int modify_alert | ( | const char * | alert_id, |
const char * | name, | ||
const char * | comment, | ||
const char * | filter_id, | ||
const char * | active, | ||
event_t | event, | ||
GPtrArray * | event_data, | ||
alert_condition_t | condition, | ||
GPtrArray * | condition_data, | ||
alert_method_t | method, | ||
GPtrArray * | method_data | ||
) |
Modify an alert.
[in] | alert_id | UUID of alert. |
[in] | name | Name of alert. |
[in] | comment | Comment on alert. |
[in] | filter_id | Filter. |
[in] | active | Whether the alert is active. NULL to leave it at the current value. |
[in] | event | Type of event. |
[in] | event_data | Type-specific event data. |
[in] | condition | Event condition. |
[in] | condition_data | Condition-specific data. |
[in] | method | Escalation method. |
[in] | method_data | Data for escalation method. |
int modify_credential | ( | const char * | credential_id, |
const char * | name, | ||
const char * | comment, | ||
const char * | login, | ||
const char * | password, | ||
const char * | key_private, | ||
const char * | key_public, | ||
const char * | certificate, | ||
const char * | community, | ||
const char * | auth_algorithm, | ||
const char * | privacy_password, | ||
const char * | privacy_algorithm, | ||
const char * | allow_insecure | ||
) |
Modify a Credential.
[in] | credential_id | UUID of Credential. |
[in] | name | Name of Credential. |
[in] | comment | Comment on Credential. |
[in] | login | Login of Credential. |
[in] | password | Password or passphrase of Credential. |
[in] | key_private | Private key of Credential. |
[in] | key_public | Public key of Credential. |
[in] | certificate | Certificate of Credential. |
[in] | community | SNMP Community of Credential. |
[in] | auth_algorithm | Authentication algorithm of Credential. |
[in] | privacy_password | Privacy password of Credential. |
[in] | privacy_algorithm | Privacy algorithm of Credential. |
[in] | allow_insecure | Whether to allow insecure use. |
int modify_note | ( | const gchar * | note_id, |
const char * | active, | ||
const char * | nvt, | ||
const char * | text, | ||
const char * | hosts, | ||
const char * | port, | ||
const char * | severity, | ||
const char * | threat, | ||
const gchar * | task_id, | ||
const gchar * | result_id | ||
) |
Modify a note.
[in] | note_id | Note. |
[in] | active | NULL or -2 leave as is, -1 on, 0 off, n on for n days. |
[in] | nvt | OID of noted NVT. |
[in] | text | Note text. |
[in] | hosts | Hosts to apply note to, NULL for any host. |
[in] | port | Port to apply note to, NULL for any port. |
[in] | severity | Severity to apply note to, "" or NULL for any. |
[in] | threat | Threat to apply note to, "" or NULL for any threat. Only used if severity is "" or NULL. |
[in] | task_id | Task to apply note to, NULL for any task. |
[in] | result_id | Result to apply note to, 0 for any result. |
int modify_override | ( | const gchar * | override_id, |
const char * | active, | ||
const char * | nvt, | ||
const char * | text, | ||
const char * | hosts, | ||
const char * | port, | ||
const char * | threat, | ||
const char * | new_threat, | ||
const char * | severity, | ||
const char * | new_severity, | ||
const gchar * | task_id, | ||
const gchar * | result_id | ||
) |
Modify an override.
[in] | override_id | Override. |
[in] | active | NULL or -2 leave as is, -1 on, 0 off, n on for n days. |
[in] | nvt | OID of noted NVT. |
[in] | text | Override text. |
[in] | hosts | Hosts to apply override to, NULL for any host. |
[in] | port | Port to apply override to, NULL for any port. |
[in] | threat | Threat to apply override to, "" or NULL for any threat. |
[in] | new_threat | Threat to override result to. |
[in] | severity | Severity to apply override to, "" or NULL for any threat. |
[in] | new_severity | Severity score to override "Alarm" type results to. |
[in] | task_id | Task to apply override to, 0 for any task. |
[in] | result_id | Result to apply override to, 0 for any result. |
int modify_report | ( | const char * | report_id, |
const char * | comment | ||
) |
Modify a report.
[in] | report_id | UUID of report. |
[in] | comment | Comment on report. |
int modify_report_format | ( | const char * | report_format_id, |
const char * | name, | ||
const char * | summary, | ||
const char * | active, | ||
const char * | param_name, | ||
const char * | param_value, | ||
const char * | predefined | ||
) |
Modify a report format.
[in] | report_format_id | UUID of report format. |
[in] | name | Name of report format. |
[in] | summary | Summary of report format. |
[in] | active | Active flag. |
[in] | param_name | Parameter to modify. |
[in] | param_value | Value of parameter. |
[in] | predefined | Predefined flag. |
int modify_scanner | ( | const char * | scanner_id, |
const char * | name, | ||
const char * | comment, | ||
const char * | host, | ||
const char * | port, | ||
const char * | type, | ||
const char * | ca_pub, | ||
const char * | credential_id | ||
) |
Modify an scanner.
[in] | scanner_id | UUID of scanner. |
[in] | name | Name of scanner. |
[in] | comment | Comment on scanner. |
[in] | host | Host of scanner. |
[in] | port | Port of scanner. |
[in] | type | Type of scanner. |
[in] | ca_pub | CA Certificate of scanner, or "" for default, or to keep existing value. |
[in] | credential_id | UUID of credential or NULL. |
int modify_schedule | ( | const char * | schedule_id, |
const char * | name, | ||
const char * | comment, | ||
const char * | ical_string, | ||
time_t | first_time, | ||
time_t | period, | ||
time_t | period_months, | ||
const char * | byday, | ||
time_t | duration, | ||
const char * | zone, | ||
gchar ** | error_out | ||
) |
Modify a schedule.
[in] | schedule_id | UUID of schedule. |
[in] | name | Name of schedule. |
[in] | comment | Comment on schedule. |
[in] | ical_string | iCalendar string. Overrides first_time, period, period_months, byday and duration. |
[in] | first_time | First time action will run. |
[in] | period | How often the action will run in seconds. 0 means once. |
[in] | period_months | The months part of the period. |
[in] | byday | Which days of week schedule will run. |
[in] | duration | The length of the time window the action will run in. 0 means entire duration of action. |
[in] | zone | Timezone. |
[out] | error_out | Output for iCalendar errors and warnings. |
int modify_target | ( | const char * | target_id, |
const char * | name, | ||
const char * | hosts, | ||
const char * | exclude_hosts, | ||
const char * | comment, | ||
const char * | port_list_id, | ||
const char * | ssh_credential_id, | ||
const char * | ssh_port, | ||
const char * | smb_credential_id, | ||
const char * | esxi_credential_id, | ||
const char * | snmp_credential_id, | ||
const char * | reverse_lookup_only, | ||
const char * | reverse_lookup_unify, | ||
const char * | alive_tests | ||
) |
Modify a target.
[in] | target_id | UUID of target. |
[in] | name | Name of target. |
[in] | hosts | Host list of target. |
[in] | exclude_hosts | List of hosts to exclude from hosts . |
[in] | comment | Comment on target. |
[in] | port_list_id | Port list of target (overrides port_range ). |
[in] | ssh_credential_id | SSH credential. |
[in] | ssh_port | Port for SSH login. |
[in] | smb_credential_id | SMB credential. |
[in] | esxi_credential_id | ESXi credential. |
[in] | snmp_credential_id | SNMP credential. |
[in] | reverse_lookup_only | Scanner preference reverse_lookup_only. |
[in] | reverse_lookup_unify | Scanner preference reverse_lookup_unify. |
[in] | alive_tests | Alive tests. |
int modify_task | ( | const gchar * | task_id, |
const gchar * | name, | ||
const gchar * | comment, | ||
const gchar * | scanner_id, | ||
const gchar * | target_id, | ||
const gchar * | config_id, | ||
const gchar * | observers, | ||
array_t * | alerts, | ||
const gchar * | alterable, | ||
array_t * | groups, | ||
const gchar * | schedule_id, | ||
const gchar * | schedule_periods, | ||
array_t * | preferences, | ||
const gchar * | hosts_ordering, | ||
gchar ** | fail_alert_id, | ||
gchar ** | fail_group_id | ||
) |
Modify a task.
[in] | task_id | Task. |
[in] | name | Name of file. |
[in] | comment | Comment. |
[in] | scanner_id | Scanner. |
[in] | target_id | Target. |
[in] | config_id | Config. |
[in] | observers | Observers. |
[in] | alerts | Alerts. |
[in] | alterable | Alterable. |
[in] | groups | Groups. |
[in] | schedule_id | Schedule. |
[in] | schedule_periods | Period of schedule. |
[in] | preferences | Preferences. |
[in] | hosts_ordering | Host scan order. |
[out] | fail_alert_id | Alert when failed to find alert. |
[out] | fail_group_id | Group when failed to find group. |
|
static |
Move a report format directory.
[in] | dir | Old dir. |
[in] | new_dir | New dir. |
|
static |
Create list for "New CERT-Bund Advisories" event message.
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create list for New CPEs event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create list for New CVEs event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create list for "New DFN-CERT Advisories" event message.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create list for New NVTs event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create list for "New OVAL Definitions" event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
[in] | example | Whether the message is an example only. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create a new GHashTable for containing resource rowids.
|
static |
Create message for New NVTs event.
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | alert | Alert. |
[out] | count_return | NULL, or address for row count. |
|
static |
Create message for New NVTs event.
[in] | event | Event. |
[in] | event_data | Event type specific details. |
[in] | alert | Alert. |
gboolean next_report | ( | iterator_t * | iterator, |
report_t * | report | ||
) |
Read the next report from an iterator.
[in] | iterator | Task iterator. |
[out] | report | Report. |
int note_count | ( | const get_data_t * | get, |
nvt_t | nvt, | ||
result_t | result, | ||
task_t | task | ||
) |
Count number of notes.
[in] | get | GET params. |
[in] | result | Result to limit notes to, 0 for all. |
[in] | task | If result is > 0, task whose notes on result to include, otherwise task to limit notes to. 0 for all tasks. |
[in] | nvt | NVT to limit notes to, 0 for all. |
int note_iterator_active | ( | iterator_t * | iterator | ) |
Get the active status from an note iterator.
[in] | iterator | Iterator. |
time_t note_iterator_end_time | ( | iterator_t * | iterator | ) |
Get the end time from an note iterator.
[in] | iterator | Iterator. |
const char* note_iterator_nvt_type | ( | iterator_t * | iterator | ) |
Get the NVT type from a note iterator.
[in] | iterator | Iterator. |
result_t note_iterator_result | ( | iterator_t * | iterator | ) |
Get the result from a note iterator.
[in] | iterator | Iterator. |
task_t note_iterator_task | ( | iterator_t * | iterator | ) |
Get the task from a note iterator.
[in] | iterator | Iterator. |
const char* note_iterator_threat | ( | iterator_t * | iterator | ) |
Get the threat from a note iterator.
[in] | iterator | Iterator. |
int note_uuid | ( | note_t | note, |
char ** | id | ||
) |
Return the UUID of a note.
[in] | note | Note. |
[out] | id | Pointer to a newly allocated string. |
|
static |
Check if an NVT exists.
[in] | nvt | NVT OID. |
|
static |
Get a severity string from an nvt and result type.
[in] | nvt_id | NVT oid. |
[in] | type | Result type. |
void nvti_refs_append_xml | ( | GString * | xml, |
const char * | oid, | ||
int * | first | ||
) |
Get the NVT's references in XML format from a nvti object via oid.
[in] | xml | The buffer where to append to. |
[in] | oid | The oid of the nvti object from where to collect the refs. |
[in] | first | Marker for first element. |
|
static |
Get last time NVT alerts were checked.
char* openvas_default_scanner_host | ( | ) |
Get the default scanner path or host.
osp_connection_t* osp_connect_with_data | ( | const char * | host, |
int | port, | ||
const char * | ca_pub, | ||
const char * | key_pub, | ||
const char * | key_priv | ||
) |
Create a new connection to an OSP scanner using the scanner data.
[in] | host | Host name or IP address. |
[in] | port | Port. |
[in] | ca_pub | CA certificate. |
[in] | key_pub | Public key. |
[in] | key_priv | Private key. |
int osp_get_details_from_iterator | ( | iterator_t * | iterator, |
char ** | desc, | ||
GSList ** | params | ||
) |
Get an OSP Scanner's get_scanner_details info.
[in] | iterator | Scanner object iterator. |
[out] | desc | Scanner description. |
[out] | params | Scanner parameters. |
int osp_get_version_from_iterator | ( | iterator_t * | iterator, |
char ** | s_name, | ||
char ** | s_ver, | ||
char ** | d_name, | ||
char ** | d_ver, | ||
char ** | p_name, | ||
char ** | p_ver | ||
) |
Get an OSP Scanner's get_version info.
[in] | iterator | Scanner object iterator. |
[out] | s_name | Scanner name. |
[out] | s_ver | Scanner version. |
[out] | d_name | Daemon name. |
[out] | d_ver | Daemon version. |
[out] | p_name | Protocol name. |
[out] | p_ver | Protocol version. |
osp_connection_t* osp_scanner_connect | ( | scanner_t | scanner | ) |
Create a new connection to an OSP scanner.
[in] | scanner | Scanner. |
|
static |
Create a new connection to an OSP scanner relay.
[in] | host | Original host name or IP address. |
[in] | port | Original port. |
[in] | ca_pub | Original CA certificate. |
[in] | key_pub | Public key for authentication. |
[in] | key_priv | Private key for authentication. |
int override_count | ( | const get_data_t * | get, |
nvt_t | nvt, | ||
result_t | result, | ||
task_t | task | ||
) |
Count number of overrides.
[in] | get | GET params. |
[in] | result | Result to limit overrides to, 0 for all. |
[in] | task | If result is > 0, task whose overrides on result to include, otherwise task to limit overrides to. 0 for all tasks. |
[in] | nvt | NVT to limit overrides to, 0 for all. |
int override_iterator_active | ( | iterator_t * | iterator | ) |
Get the active status from an override iterator.
[in] | iterator | Iterator. |
time_t override_iterator_end_time | ( | iterator_t * | iterator | ) |
Get the end time from an override iterator.
[in] | iterator | Iterator. |
const char* override_iterator_new_threat | ( | iterator_t * | iterator | ) |
Get the threat from an override iterator.
[in] | iterator | Iterator. |
const char* override_iterator_nvt_type | ( | iterator_t * | iterator | ) |
Get the NVT type from a override iterator.
[in] | iterator | Iterator. |
result_t override_iterator_result | ( | iterator_t * | iterator | ) |
Get the result from a override iterator.
[in] | iterator | Iterator. |
task_t override_iterator_task | ( | iterator_t * | iterator | ) |
Get the task from a override iterator.
[in] | iterator | Iterator. |
const char* override_iterator_threat | ( | iterator_t * | iterator | ) |
Get the threat from a override iterator.
[in] | iterator | Iterator. |
int override_uuid | ( | override_t | override, |
char ** | id | ||
) |
Return the UUID of an override.
[in] | override | Override. |
[out] | id | Pointer to a newly allocated string. |
|
static |
Parse a filter column relation.
[in] | relation | Filter relation. |
int parse_iso_time | ( | const char * | text_time | ) |
Convert an ISO time into seconds since epoch.
For backward compatibility, if the conversion fails try parse in ctime format.
[in] | text_time | Time as text in ISO format: 2011-11-03T09:23:28+02:00. |
|
static |
Parse a filter keyword.
[in] | keyword | Filter keyword. |
void parse_osp_report | ( | task_t | task, |
report_t | report, | ||
const char * | report_xml | ||
) |
Parse an OSP report.
[in] | task | Task. |
[in] | report | Report. |
[in] | report_xml | Report XML. |
gchar* port_name_formatted | ( | const char * | field | ) |
Returns formatted port number, protocol and iana name from.
field in "number/proto" form.
field | Number/Protocol string. |
gchar* predefined_report_format_dir | ( | const gchar * | uuid | ) |
Get the directory of a report format.
[in] | uuid | Report format UUID. NULL to get parent dir. |
|
static |
Print delta host ports.
[in] | key | Port. |
[in] | value | Threat. |
[in] | data | Host and stream. |
|
static |
Print delta ports.
[in] | key | Host. |
[in] | value | Port tree. |
[in] | stream | Stream. |
|
static |
Print delta ports, ordering by severity.
[in] | key | Host. |
[in] | value | Port tree. |
[in] | stream | Stream. |
[in] | ascending | Ascending or descending. |
|
static |
Print delta ports, ordering by severity ascending.
[in] | key | Host. |
[in] | value | Port tree. |
[in] | stream | Stream. |
|
static |
Print delta ports, ordering by severity descending.
[in] | key | Host. |
[in] | value | Port tree. |
[in] | stream | Stream. |
|
static |
Print delta ports, in descending order.
[in] | key | Host. |
[in] | value | Port tree. |
[in] | stream | Stream. |
|
static |
Print delta results for print_report_xml.
[in] | out | File stream to write to. |
[in] | results | Report result iterator. |
[in] | delta_results | Delta report result iterator. |
[in] | delta_states | String describing delta states to include in count (for example, "sngc" Same, New, Gone and Changed). All levels if NULL. |
[in] | first_result | First result. |
[in] | max_results | Max results. |
[in] | task | The task. |
[in] | notes | Whether to include notes. |
[in] | notes_details | Whether to include note details. |
[in] | overrides | Whether to include overrides. |
[in] | overrides_details | Whether to include override details. |
[in] | sort_order | Sort order. |
[in] | sort_field | Sort field. |
[in] | result_hosts_only | Whether to only include hosts with results. |
[in] | orig_filtered_result_count | Result count. |
[in] | filtered_result_count | Result count. |
[in] | orig_f_debugs | Result count. |
[in] | f_debugs | Result count. |
[in] | orig_f_holes | Result count. |
[in] | f_holes | Result count. |
[in] | orig_f_infos | Result count. |
[in] | f_infos | Result count. |
[in] | orig_f_logs | Result count. |
[in] | f_logs | Result count. |
[in] | orig_f_warnings | Result count. |
[in] | f_warnings | Result count. |
[in] | orig_f_false_positives | Result count. |
[in] | f_false_positives | Result count. |
[in] | result_hosts | Result hosts. |
|
static |
Print the XML for a report's error messages to a file stream.
[in] | report | The report. |
[in] | stream | File stream to write to. |
|
static |
Write report host detail to file stream.
On error close stream.
[in] | stream | Stream to write to. |
[in] | details | Report host details iterator. |
[in] | lean | Whether to return reduced info. |
|
static |
Print the XML for a report's host details to a file stream.
[in] | report_host | The report host. |
[in] | stream | File stream to write to. |
[in] | lean | Report host details iterator. |
|
static |
Print the XML for a report port summary to a file.
[in] | report | The report. |
[in] | out | File stream. |
[in] | get | Result get data. |
[in] | first_result | The result to start from. The results are 0 indexed. |
[in] | max_results | The maximum number of results returned. |
[in] | sort_order | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on. |
[out] | host_ports | Hash table for counting ports per host. |
|
static |
Completes a report by adding report format info.
[in] | xml_start | Path of file containing start of report. |
[in] | xml_full | Path to file to print full report to. |
[in] | report_format | Format of report that will be created from XML. |
|
static |
Print the main XML content for a report to a file.
[in] | report | The report. |
[in] | delta | Report to compare with the report. |
[in] | task | Task associated with report. |
[in] | xml_start | File name. |
[in] | get | GET command data. |
[in] | notes_details | If notes, Whether to include details. |
[in] | overrides_details | If overrides, Whether to include details. |
[in] | result_tags | Whether to include tags in results. |
[in] | ignore_pagination | Whether to ignore pagination data. |
[in] | lean | Whether to return lean report. |
[out] | filter_term_return | Filter term used in report. |
[out] | zone_return | Actual timezone used in report. |
[out] | host_summary | Summary of results per host. |
double prognosis_iterator_cvss_double | ( | iterator_t * | iterator | ) |
Get the CVSS from a result iterator as a double.
[in] | iterator | Iterator. |
int qod_from_type | ( | const char * | qod_type | ) |
Get QoD percentage for a qod_type string.
[in] | qod_type | The QoD type string. |
|
static |
Check whether RADIUS is enabled.
void reinit_manage_process | ( | ) |
Reinitialize the manage library for a process.
This is mandatory after a fork, to not carry open databases around (refer to database documentation).
|
static |
Check whether the scan of a report is active.
[in] | report | Report. |
void report_add_result | ( | report_t | report, |
result_t | result | ||
) |
Add a result to a report.
[in] | report | The report. |
[in] | result | The result. |
|
static |
Add a result to a report.
[in] | report | The report. |
[in] | result | The result. |
|
static |
Count a report's total number of detected Apps.
[in] | report | Report. |
|
static |
Cache report counts and clear existing caches if requested.
[in] | report | Report to cache counts of. |
[in] | clear_original | Whether to clear existing cache for original severity. |
[in] | clear_overridden | Whether to clear existing cache for overridden severity. |
[in] | users_where | Optional SQL clause to limit users. |
|
static |
Clear report counts .
[in] | report | Report. |
[in] | clear_original | Whether to clear existing cache for original severity. |
[in] | clear_overridden | Whether to clear existing cache for overridden severity. |
[in] | users_where | Optional SQL clause to limit users. |
|
static |
Count a report's total number of closed cves.
[in] | report | Report. |
void report_compliance_by_uuid | ( | const char * | report_id, |
int * | compliance_yes, | ||
int * | compliance_no, | ||
int * | compliance_incomplete | ||
) |
Get compliance counts for a report.
[in] | report_id | UUID of the report. |
[out] | compliance_yes | Number of "YES" results. |
[out] | compliance_no | Number of "NO" results. |
[out] | compliance_incomplete | Number of "INCOMPLETE" results. |
|
static |
Generate report content for alert.
[in] | alert | The alert the report is generated for. |
[in] | report | Report or NULL to get last report of task. |
[in] | task | Task the report belongs to. |
[in] | get | GET data for the report. |
[in] | report_format_data_name | Name of alert data with report format, or NULL if not configurable. |
[in] | report_format_lookup | Name of report format to lookup if lookup by name, or NULL if not required. Used if report_format_data_name is NULL or fails. |
[in] | fallback_format_id | UUID of fallback report format. Used if both report_format_data_name and report_format_lookup are NULL or fail. |
[in] | notes_details | Whether to include details of notes in report. |
[in] | overrides_details | Whether to include override details in report. |
[out] | content | Report content location. |
[out] | content_length | Length of report content. |
[out] | extension | File extension of report format. |
[out] | content_type | Content type of report format. |
[out] | term | Filter term. |
[out] | report_zone | Actual timezone used in report. |
[out] | host_summary | Summary of results per host. |
[out] | used_report_format | Report format used. |
[out] | filter_return | Filter used. |
int report_count | ( | const get_data_t * | get | ) |
Count number of reports.
[in] | get | GET params. |
int report_counts | ( | const char * | report_id, |
int * | debugs, | ||
int * | holes, | ||
int * | infos, | ||
int * | logs, | ||
int * | warnings, | ||
int * | false_positives, | ||
double * | severity, | ||
int | override, | ||
int | autofp, | ||
int | min_qod | ||
) |
Get the message counts for a report given the UUID.
[in] | report_id | ID of report. |
[out] | debugs | Number of debug messages. |
[out] | holes | Number of hole messages. |
[out] | infos | Number of info messages. |
[out] | logs | Number of log messages. |
[out] | warnings | Number of warning messages. |
[out] | false_positives | Number of false positives. |
[out] | severity | Maximum severity score. |
[in] | override | Whether to override the threat. |
[in] | autofp | Whether to apply the auto FP filter. |
[in] | min_qod | Min QOD. |
|
static |
Get the min_qod from a report_counts build iterator.
[in] | iterator | Iterator. |
|
static |
Get the override flag from a report_counts build iterator.
[in] | iterator | Iterator. |
|
static |
Get the user from a report_counts build iterator.
[in] | iterator | Iterator. |
|
static |
Test if a counts cache exists for a report and the current user.
[in] | report | The report to check. |
[in] | override | Whether to check for overridden results. |
[in] | min_qod | Minimum QoD of results to count. |
|
static |
Get cached result counts for a report and the current user.
[in] | report | The report to get counts from. |
[in] | override | Whether to get overridden results. |
[in] | min_qod | Minimum QoD of results to count. |
[out] | data | The severity_data_t to save counts in. |
int report_counts_id | ( | report_t | report, |
int * | debugs, | ||
int * | holes, | ||
int * | infos, | ||
int * | logs, | ||
int * | warnings, | ||
int * | false_positives, | ||
double * | severity, | ||
const get_data_t * | get, | ||
const char * | host | ||
) |
Get only the filtered message counts for a report.
[in] | report | Report. |
[out] | debugs | Number of debug messages. |
[out] | holes | Number of hole messages. |
[out] | infos | Number of info messages. |
[out] | logs | Number of log messages. |
[out] | warnings | Number of warning messages. |
[out] | false_positives | Number of false positive messages. |
[out] | severity | Maximum severity score. |
[in] | get | Get data. |
[in] | host | Host to which to limit the count. NULL to allow all. |
|
static |
Get the message counts for a report.
[in] | report | Report. |
[out] | debugs | Number of debug messages. |
[out] | holes | Number of hole messages. |
[out] | infos | Number of info messages. |
[out] | logs | Number of log messages. |
[out] | warnings | Number of warning messages. |
[out] | false_positives | Number of false positive messages. |
[out] | severity | Maximum severity of the report. |
[in] | get | Get data. |
[in] | host | Host to which to limit the count. |
[out] | filtered_debugs | Number of debug messages after filtering. |
[out] | filtered_holes | Number of hole messages after filtering. |
[out] | filtered_infos | Number of info messages after filtering. |
[out] | filtered_logs | Number of log messages after filtering. |
[out] | filtered_warnings | Number of warning messages after filtering. |
[out] | filtered_false_positives | Number of false positive messages after filtering. |
[out] | filtered_severity | Maximum severity after filtering. |
|
static |
Count a report's total number of error messages.
[in] | report | Report. |
|
static |
Get the result from a report error messages iterator.
[in] | iterator | Iterator. |
char* report_finished_hosts_str | ( | report_t | report | ) |
Get a list string of finished hosts in a report.
[in] | report | The report to get the finished hosts from. |
int report_format_active | ( | report_format_t | report_format | ) |
Return whether a report format is active.
[in] | report_format | Report format. |
char* report_format_content_type | ( | report_format_t | report_format | ) |
Return the content type of a report format.
[in] | report_format | Report format. |
char* report_format_extension | ( | report_format_t | report_format | ) |
Return the extension of a report format.
[in] | report_format | Report format. |
int report_format_in_use | ( | report_format_t | report_format | ) |
Return whether a report format is referenced by an alert.
[in] | report_format | Report Format. |
char* report_format_name | ( | report_format_t | report_format | ) |
Return the name of a report format.
[in] | report_format | Report format. |
char* report_format_owner_uuid | ( | report_format_t | report_format | ) |
Return the UUID of the owner of a report format.
[in] | report_format | Report format. |
|
static |
Return the type max of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
|
static |
Return the type max of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
|
static |
Return the type min of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
int report_format_predefined | ( | report_format_t | report_format | ) |
Return whether a report format is predefined.
[in] | report_format | Report format. |
|
static |
Get trash directory of a report format.
[in] | report_format_id | UUID of report format. NULL for the base dir that holds the report format trash. |
char* report_format_uuid | ( | report_format_t | report_format | ) |
Return the UUID of a report format.
[in] | report_format | Report format. |
int report_format_writable | ( | report_format_t | report_format | ) |
Return whether a report format is writable.
[in] | report_format | Report Format. |
int report_host_count | ( | report_t | report | ) |
Count a report's total number of hosts.
[in] | report | Report. |
gchar* report_host_ip | ( | const char * | host | ) |
Get the IP of a host, using the 'hostname' report host details.
The most recent host detail takes preference.
[in] | host | Host name or IP. |
int report_host_noticeable | ( | report_t | report, |
const gchar * | host | ||
) |
Check if a report host is alive and has at least one result.
[in] | report | Report. |
[in] | host | Host name or IP. |
|
static |
Generate the extra_tables string for a report iterator.
[in] | override | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
|
static |
Count a report's total number of detected Operating Systems.
[in] | report | Report. |
|
static |
Count a report's total number of tcp/ip ports.
Ignores port entries in "general/..." form.
[in] | report | Report. |
int report_progress | ( | report_t | report, |
task_t | task, | ||
gchar ** | hosts_xml | ||
) |
Calculate the progress of a report.
[in] | report | Report. |
[in] | task | Report's task. |
[out] | hosts_xml | Return for hosts XML if required, else NULL. |
|
static |
Get progress for active report.
[in] | report | Report. |
[in] | maximum_hosts | Maximum number of hosts in target. |
[out] | hosts_xml | Return for hosts XML if required, else NULL. |
int report_result_host_count | ( | report_t | report, |
int | min_qod | ||
) |
Count a report's total number of hosts with results.
[in] | report | Report. |
[in] | min_qod | Minimum QoD of results to count. |
|
static |
Return the run status of the scan associated with a report.
[in] | report | Report. |
[out] | status | Scan run status. |
|
static |
Get a report's scheduled flag.
[in] | report | Report. |
void report_set_slave_host | ( | report_t | report, |
const gchar * | host | ||
) |
Set the host of the slave of a report.
[in] | report | Report. |
[in] | host | Host. |
void report_set_slave_name | ( | report_t | report, |
const gchar * | name | ||
) |
Set the name of the slave on a report.
[in] | report | Report. |
[in] | name | Name. |
void report_set_slave_port | ( | report_t | report, |
int | port | ||
) |
Set the port of the slave of a report.
[in] | report | Report. |
[in] | port | Port. |
void report_set_slave_uuid | ( | report_t | report, |
const gchar * | uuid | ||
) |
Set the UUID of the slave on a report.
[in] | report | Report. |
[in] | uuid | UUID. |
void report_set_source_iface | ( | report_t | report, |
const gchar * | iface | ||
) |
Set the source interface of a report.
[in] | report | Report. |
[in] | iface | Source interface. |
double report_severity | ( | report_t | report, |
int | overrides, | ||
int | min_qod | ||
) |
Get the maximum severity of a report.
[in] | report | Report. |
[in] | overrides | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
|
static |
Get the result severity counts for a report.
[in] | report | Report. |
[in] | host | Host to which to limit the count. NULL to allow all. |
[in] | get | Report "get" data to retrieve filter info from. |
[out] | severity_data | The severity data struct to store counts in. |
[out] | filtered_severity_data | The severity data struct to store counts in. |
|
static |
Return the host of a report's slave.
[in] | report | Report. |
|
static |
Return the name of a report's slave.
[in] | report | Report. |
|
static |
Return the port of a report's slave.
[in] | report | Report. |
|
static |
Return the port of a report's slave.
[in] | report | Report. |
|
static |
Return the slave progress of a report.
[in] | report | Report. |
char* report_slave_task_uuid | ( | report_t | report | ) |
Return the UUID of the task on the slave.
[in] | report | The report. |
|
static |
Return the UUID of a report's slave.
[in] | report | Report. |
|
static |
Return the source interface of a report.
[in] | report | Report. |
|
static |
Count a report's total number of found SSL Certificates.
[in] | report | Report. |
gboolean report_task | ( | report_t | report, |
task_t * | task | ||
) |
Return the task of a report.
[in] | report | A report. |
[out] | task | Task return, 0 if successfully failed to find task. |
int report_timestamp | ( | const char * | report_id, |
gchar ** | timestamp | ||
) |
Get the timestamp of a report.
[in] | report_id | UUID of report. |
[out] | timestamp | Timestamp on success. Caller must free. |
char* report_uuid | ( | report_t | report | ) |
Return the UUID of a report.
[in] | report | Report. |
|
static |
Count a report's total number of vulnerabilities.
[in] | report | Report. |
|
static |
Add all reports to an existing GHashtable.
[in] | reports_table | The GHashtable to contain the report rowids. |
|
static |
Add reports affected by an override to an existing GHashtable. This is used to add more reports to the hashtable from reports_for_override.
[in] | reports_table | The GHashtable to contain the report rowids. |
[in] | override | The override that selected reports must be affected by. |
|
static |
Rebuild the report count cache for all reports and users.
[in] | clear | Whether to clear the cache before rebuilding. |
[out] | changes_out | The number of processed user/report combinations. |
|
static |
Get reports affected by an override in a GHashTable.
[in] | override | The override that selected reports must be affected by. |
|
static |
Get all reports in a GHashTable.
int request_delete_task | ( | task_t * | task_pointer | ) |
Request deletion of a task.
Stop the task beforehand with stop_task_internal, if it is running.
Used only for CREATE_TASK in gmp.c. Always ultimate.
[in] | task_pointer | A pointer to the task. |
int request_delete_task_uuid | ( | const char * | task_id, |
int | ultimate | ||
) |
Request deletion of a task.
Stop the task beforehand with stop_task_internal, if it is running.
This is only used for DELETE_TASK in gmp.c.
[in] | task_id | UUID of task. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
void reschedule_task | ( | const gchar * | task_id | ) |
Set a task's schedule so that it runs again next scheduling round.
task_id | UUID of task. |
void reset_task | ( | task_t | task | ) |
Reset all running information for a task.
[in] | task | Task. |
int resource_count | ( | const char * | type, |
const get_data_t * | get | ||
) |
Return number of resources of a certain type for current user.
[in] | type | Type. |
[in] | get | GET params. |
int resource_exists | ( | const char * | type, |
resource_t | resource, | ||
int | location | ||
) |
Get whether a resource exists.
[in] | type | Type. |
[in] | resource | Resource. |
[in] | location | Location. |
int resource_name | ( | const char * | type, |
const char * | uuid, | ||
int | location, | ||
char ** | name | ||
) |
Get the name of a resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[in] | location | Location. |
[out] | name | Return for freshly allocated name. |
|
static |
Return whether a resource is predefined.
[in] | type | Type of resource. |
[in] | resource | Resource. |
|
static |
Mark a resource as predefined.
Currently only report formats use this.
[in] | type | Resource type. |
[in] | resource | Resource. |
[in] | enable | If true mark as predefined, else remove mark. |
gchar* resource_uuid | ( | const gchar * | type, |
resource_t | resource | ||
) |
Get the UUID of a resource.
[in] | type | Type. |
[in] | resource | Resource. |
gboolean resource_with_name_exists | ( | const char * | name, |
const char * | type, | ||
resource_t | resource | ||
) |
Check if a resource with a certain name exists already.
Conflicting resource can be global or owned by the current user.
[in] | name | Name of resource to check for. |
[in] | type | Type of resource. |
[in] | resource | Resource to ignore, 0 otherwise. |
|
static |
Check if a resource with a certain name exists already.
Conflicting resource can be owned by anybody.
[in] | name | Name of resource to check for. |
[in] | type | Type of resource. |
[in] | resource | Resource to ignore, 0 otherwise. |
|
static |
Free a result buffer.
[in] | result_buffer | Result buffer. |
|
static |
Create a result buffer.
[in] | host | Host. |
[in] | port | Port. |
[in] | severity | Severity. |
[in] | severity_double | Severity. |
|
static |
Return the sort order of two results.
[in] | results | Iterator containing first result. |
[in] | delta_results | Iterator containing second result. |
[in] | sort_order | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on, or NULL for "type". |
int result_count | ( | const get_data_t * | get, |
report_t | report, | ||
const char * | host | ||
) |
Count the number of results.
[in] | get | GET params. |
[in] | report | Report to limit results to. |
[in] | host | Host to limit results to. |
int result_detection_reference | ( | result_t | result, |
report_t | report, | ||
const gchar * | host, | ||
const char * | oid, | ||
char ** | ref, | ||
char ** | product, | ||
char ** | location, | ||
char ** | name | ||
) |
Get product detection results corresponding to a given vulnerability detection result.
[in] | result | Vulnerability detection result. |
[in] | report | Report of result. |
[in] | host | Host of result. |
[in] | oid | Detection script OID. |
[out] | ref | Detection result UUID. |
[out] | product | Product name. |
[out] | location | Product location. |
[out] | name | Detection script name. |
int result_iterator_has_cert_bunds | ( | iterator_t * | iterator | ) |
Get whether CERT-Bunds may exist from a result iterator.
[in] | iterator | Iterator. |
int result_iterator_has_dfn_certs | ( | iterator_t * | iterator | ) |
Get whether DFN-CERTs may exist from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_level | ( | iterator_t * | iterator | ) |
Get the severity/threat level from a result iterator.
This is the the autofp adjusted overridden level.
[in] | iterator | Iterator. |
int result_iterator_may_have_notes | ( | iterator_t * | iterator | ) |
Get whether notes may exist from a result iterator.
[in] | iterator | Iterator. |
int result_iterator_may_have_overrides | ( | iterator_t * | iterator | ) |
Get whether overrides may exist from a result iterator.
[in] | iterator | Iterator. |
int result_iterator_may_have_tickets | ( | iterator_t * | iterator | ) |
Get whether tickets may exist from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_affected | ( | iterator_t * | iterator | ) |
Get the NVT affected from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_cvss_base | ( | iterator_t * | iterator | ) |
Get the NVT CVSS base value from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_detection | ( | iterator_t * | iterator | ) |
Get the NVT detection from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_family | ( | iterator_t * | iterator | ) |
Get the NVT family from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_impact | ( | iterator_t * | iterator | ) |
Get the NVT affected from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_insight | ( | iterator_t * | iterator | ) |
Get the NVT insight from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_name | ( | iterator_t * | iterator | ) |
Get the NVT name from a result iterator.
[in] | iterator | Iterator. |
void result_iterator_nvt_refs_append | ( | GString * | xml, |
iterator_t * | iterator, | ||
int * | first | ||
) |
Get the NVT's references in XML format from a result iterator.
[in] | xml | The buffer where to append to. |
[in] | iterator | Iterator. |
[in] | first | Marker for first element. |
const char* result_iterator_nvt_solution | ( | iterator_t * | iterator | ) |
Get the NVT solution from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_solution_type | ( | iterator_t * | iterator | ) |
Get the NVT solution_type from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_summary | ( | iterator_t * | iterator | ) |
Get the NVT summary from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_nvt_tag | ( | iterator_t * | iterator | ) |
Get the NVT tags from a result iterator.
[in] | iterator | Iterator. |
|
static |
Generate the extra_tables string for a result iterator.
[in] | autofp | Whether to apply auto FP filter. |
[in] | override | Whether to apply overrides. |
[in] | dynamic | Whether to use dynamic severity scores. |
const char* result_iterator_original_level | ( | iterator_t * | iterator | ) |
Get the original severity/threat level from a result iterator.
This is the original level without overrides and autofp.
[in] | iterator | Iterator. |
const char* result_iterator_original_severity | ( | iterator_t * | iterator | ) |
Get the original severity from a result iterator.
This is the original severity without overrides and autofp.
[in] | iterator | Iterator. |
report_t result_iterator_report | ( | iterator_t * | iterator | ) |
Get the report from a result iterator.
[in] | iterator | Iterator. |
result_t result_iterator_result | ( | iterator_t * | iterator | ) |
Get the result from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_scan_nvt_version | ( | iterator_t * | iterator | ) |
Get the NVT version used during the scan from a result iterator.
[in] | iterator | Iterator. |
const char* result_iterator_severity | ( | iterator_t * | iterator | ) |
Get the severity from a result iterator.
This is the the autofp adjusted overridden severity.
[in] | iterator | Iterator. |
double result_iterator_severity_double | ( | iterator_t * | iterator | ) |
Get the severity from a result iterator as double.
This is the the autofp adjusted overridden severity.
[in] | iterator | Iterator. |
task_t result_iterator_task | ( | iterator_t * | iterator | ) |
Get the task from a result iterator.
[in] | iterator | Iterator. |
|
static |
Get the type from a result iterator.
This is the the autofp adjusted overridden type.
[in] | iterator | Iterator. |
|
static |
Ensure an NVT occurs in the result_nvts table.
[in] | nvt | NVT OID. |
int result_uuid | ( | result_t | result, |
char ** | id | ||
) |
Return the UUID of a result.
[in] | result | Result. |
[out] | id | Pointer to a newly allocated string. |
|
static |
Get extra_where string for a result iterator or count.
[in] | trash | Whether to get results from trashcan. |
[in] | report | Report to restrict returned results to. |
[in] | host | Host to restrict returned results to. |
[in] | autofp | Whether to apply auto FP filter. |
[in] | apply_overrides | Whether to apply overrides. |
[in] | dynamic_severity | Whether to use dynamic severity. |
[in] | filter | Filter string. |
|
static |
Run an alert's "alert" script with one file of extra data.
[in] | alert_id | ID of alert. |
[in] | command_args | Args for the "alert" script. |
[in] | report_filename | Optional report file name, default: "report" |
[in] | report | Report that should be sent. |
[in] | report_size | Size of the report. |
[in] | extra_content | Optional extra data like passwords |
[in] | extra_size | Size of the report. |
[out] | message | Custom error message of the script. |
|
static |
Runs the script of a report format.
[in] | report_format_id | UUID of the report format. |
[in] | xml_file | Path to main part of the report XML. |
[in] | xml_dir | Path of the dir with XML and subreports. |
[in] | report_format_extra | Extra data for report format. |
[in] | output_file | Path to write report to. |
|
static |
Get the end time of a scan.
[in] | report | The report associated with the scan. |
char* scan_end_time_uuid | ( | const char * | uuid | ) |
Get the end time of a scan.
[in] | uuid | The report associated with the scan. |
int scan_host_end_time | ( | report_t | report, |
const char * | host | ||
) |
Get the end time of a scanned host.
[in] | report | Report associated with the scan. |
[in] | host | Host. |
|
static |
Get the start time of a scan.
[in] | report | The report associated with the scan. |
int scan_start_time_epoch | ( | report_t | report | ) |
Get the start time of a scan, in seconds since the epoch.
[in] | report | The report associated with the scan. |
char* scan_start_time_uuid | ( | const char * | uuid | ) |
Get the start time of a scan.
[in] | uuid | The report associated with the scan. |
char* scanner_ca_pub | ( | scanner_t | scanner | ) |
Return the CA Certificate of a scanner.
[in] | scanner | Scanner. |
int scanner_config_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
int scanner_count | ( | const get_data_t * | get | ) |
Count number of scanners.
[in] | get | GET params. |
char* scanner_host | ( | scanner_t | scanner | ) |
Return the host of a scanner.
[in] | scanner | Scanner. |
int scanner_in_use | ( | scanner_t | scanner | ) |
Check whether an scanner is in use.
[in] | scanner | Scanner. |
credential_t scanner_iterator_credential | ( | iterator_t * | iterator | ) |
Get the credential of the scanner from a scanner iterator.
[in] | iterator | Iterator. |
int scanner_iterator_credential_trash | ( | iterator_t * | iterator | ) |
Get the credential location of the scanner from a scanner iterator.
[in] | iterator | Iterator. |
|
static |
Get the Scanner private key from a scanner iterator.
[in] | iterator | Iterator. |
int scanner_iterator_port | ( | iterator_t * | iterator | ) |
Get the port from an scanner iterator.
[in] | iterator | Iterator. |
int scanner_iterator_type | ( | iterator_t * | iterator | ) |
Get the type from an scanner iterator.
[in] | iterator | Iterator. |
char* scanner_key_priv | ( | scanner_t | scanner | ) |
Return the private key of a scanner.
[in] | scanner | Scanner. |
char* scanner_key_pub | ( | scanner_t | scanner | ) |
Return the Certificate of a scanner.
[in] | scanner | Scanner. |
char* scanner_login | ( | scanner_t | scanner | ) |
Return the login associated with a scanner.
[in] | scanner | Scanner. |
char* scanner_name | ( | scanner_t | scanner | ) |
Return the name of a scanner.
[in] | scanner | Scanner. |
char* scanner_password | ( | scanner_t | scanner | ) |
Return the password associated with a scanner.
[in] | scanner | Scanner. |
int scanner_port | ( | scanner_t | scanner | ) |
Return the port of a scanner.
[in] | scanner | Scanner. |
int scanner_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
int scanner_type | ( | scanner_t | scanner | ) |
Return the type of a scanner.
[in] | scanner | Scanner. |
char* scanner_uuid | ( | scanner_t | scanner | ) |
Return the UUID of a scanner.
[in] | scanner | Scanner. |
const char* scanner_uuid_default | ( | ) |
Return the UUID of the default scanner.
int scanner_writable | ( | scanner_t | scanner | ) |
Check whether a scanner is writable.
[in] | scanner | Scanner. |
|
static |
Get last time SCAP SecInfo alerts were checked.
int schedule_count | ( | const get_data_t * | get | ) |
Count the number of schedules.
[in] | get | GET params. |
int schedule_duration | ( | schedule_t | schedule | ) |
Return the duration of a schedule.
[in] | schedule | Schedule. |
int schedule_in_use | ( | schedule_t | schedule | ) |
Return whether a schedule is in use by a task.
[in] | schedule | Schedule. |
int schedule_info | ( | schedule_t | schedule, |
int | trash, | ||
time_t * | first_time, | ||
time_t * | next_time, | ||
int * | period, | ||
int * | period_months, | ||
int * | duration, | ||
gchar ** | icalendar, | ||
gchar ** | zone | ||
) |
Return info about a schedule.
[in] | schedule | Schedule. |
[in] | trash | Whether to get schedule from trash. |
[out] | first_time | First time schedule ran. |
[out] | next_time | Next time schedule will run. |
[out] | period | Period. |
[out] | period_months | Period months. |
[out] | duration | Duration. |
[out] | icalendar | iCalendar string. |
[out] | zone | Timezone string. |
gchar* schedule_iterator_byday_string | ( | iterator_t * | iterator | ) |
Get the byday string from a schedule iterator.
[in] | iterator | Iterator. |
time_t schedule_iterator_duration | ( | iterator_t * | iterator | ) |
Get the duration from a schedule iterator.
[in] | iterator | Iterator. |
time_t schedule_iterator_first_time | ( | iterator_t * | iterator | ) |
Get the first time from a schedule iterator.
[in] | iterator | Iterator. |
time_t schedule_iterator_next_time | ( | iterator_t * | iterator | ) |
Get the next time a schedule could be schedulable.
[in] | iterator | Iterator. |
time_t schedule_iterator_period | ( | iterator_t * | iterator | ) |
Get the period from a schedule iterator.
[in] | iterator | Iterator. |
time_t schedule_iterator_period_months | ( | iterator_t * | iterator | ) |
Get the period months from a schedule iterator.
[in] | iterator | Iterator. |
char* schedule_name | ( | schedule_t | schedule | ) |
Return the name of a schedule.
[in] | schedule | Schedule. |
int schedule_period | ( | schedule_t | schedule | ) |
Return the period of a schedule.
[in] | schedule | Schedule. |
int schedule_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
char* schedule_uuid | ( | schedule_t | schedule | ) |
Return the UUID of a schedule.
[in] | schedule | Schedule. |
int schedule_writable | ( | schedule_t | schedule | ) |
Return whether a schedule is writable.
[in] | schedule | Schedule. |
|
static |
Print an SCP alert file path.
[in] | message | Format string for message. |
[in] | task | Task. |
|
static |
Send a report to a host via TCP.
[in] | username | Username. |
[in] | password | Password or passphrase of private key. |
[in] | private_key | Private key or NULL for password-only auth. |
[in] | host | Address of host. |
[in] | path | Destination filename with path. |
[in] | known_hosts | Content for known_hosts file. |
[in] | report | Report that should be sent. |
[in] | report_size | Size of the report. |
[out] | script_message | Custom error message of the alert script. |
|
static |
Send a report to a host via TCP.
[in] | host | Address of host. |
[in] | port | Port of host. |
[in] | report | Report that should be sent. |
[in] | report_size | Size of the report. |
[out] | script_message | Custom error message of the script. |
|
static |
Send a report to a Sourcefire Defense Center.
[in] | ip | IP of center. |
[in] | port | Port of center. |
[in] | pkcs12_64 | PKCS12 content in base64. |
[in] | pkcs12_password | Password for encrypted PKCS12. |
[in] | report | Report in "Sourcefire" format. |
|
static |
Convert an XML report and send it to a TippingPoint SMS.
[in] | report | Report to send. |
[in] | report_size | Size of report. |
[in] | username | Username. |
[in] | password | Password. |
[in] | hostname | Hostname. |
[in] | certificate | Certificate. |
[in] | cert_workaround | Whether to use cert workaround. |
[out] | message | Custom error message of the script. |
|
static |
Send a report to a verinice.PRO server.
[in] | url | URL of the server. |
[in] | username | Username for server access. |
[in] | password | Password for server access. |
[in] | archive | Verinice archive that should be sent. |
[in] | archive_size | Size of the verinice archive |
|
static |
Create a new call on an Alemba vFire server.
[in] | base_url | Base url of the vFire server. |
[in] | client_id | The Alemba API Client ID to authenticate with. |
[in] | session_type | Alemba session type to use, e.g. "Analyst". |
[in] | username | Username. |
[in] | password | Password. |
[in] | report_data | Data for vFire call report attachments. |
[in] | call_data | Data for creating the vFire call. |
[in] | description_template | Template for the description text. |
[out] | message | Error message. |
|
static |
Set the auth_algorithm of a Credential.
[in] | credential | The Credential. |
[in] | algorithm | Authentication algorithm. |
|
static |
Set the certificate of a Credential.
[in] | credential | The Credential. |
[in] | certificate | Certificate. |
|
static |
Set the comment of a Credential.
[in] | credential | The Credential. |
[in] | comment | Comment. |
|
static |
Set data for a credential.
[in] | credential | The credential. |
[in] | type | The data type (e.g. "username" or "secret"). |
[in] | value | The value to set or NULL to remove data entry. |
|
static |
Set the login of a Credential.
[in] | credential | The Credential. |
[in] | login | Login. |
|
static |
Set the name of a Credential.
[in] | credential | The Credential. |
[in] | name | Name. |
|
static |
Set the password of a Credential.
[in] | credential | The Credential. |
[in] | password | Password. |
void set_credential_privacy_algorithm | ( | credential_t | credential, |
const char * | algorithm | ||
) |
Set the privacy_algorithm of a Credential.
[in] | credential | The Credential. |
[in] | algorithm | Privacy algorithm. |
|
static |
Set the private key and passphrase of a Credential.
[in] | credential | The Credential. |
[in] | private_key | Private key. |
[in] | passphrase | Passphrase. |
void set_credential_public_key | ( | credential_t | credential, |
const char * | public_key | ||
) |
Set the public key of a Credential.
[in] | credential | The Credential. |
[in] | public_key | Public key. |
|
static |
Set the community, password and privacy password of a Credential.
[in] | credential | The Credential. |
[in] | community | SNMP community. |
[in] | password | Authentication password. |
[in] | privacy_password | Privacy password. |
void set_db_version | ( | int | version | ) |
Set the database version of the actual database.
Caller must organise transaction.
version | New version number. |
|
static |
Sets the task or report if one of them is missing.
[in,out] | task | Pointer to the task |
[in,out] | report | Pointer to the report |
|
static |
Set the active flag of a report format.
[in] | report_format | The report format. |
[in] | active | Active flag. |
|
static |
Set the name of the report format.
[in] | report_format | The report format. |
[in] | name | Name. |
|
static |
Set the summary of the report format.
[in] | report_format | The report format. |
[in] | summary | Summary. |
int set_report_scan_run_status | ( | report_t | report, |
task_status_t | status | ||
) |
Return the run status of the scan associated with a report.
[in] | report | Report. |
[out] | status | Scan run status. |
void set_report_scheduled | ( | report_t | report | ) |
Set a report's scheduled flag.
Set flag if task was scheduled, else clear flag.
[in] | report | Report. |
int set_report_slave_progress | ( | report_t | report, |
int | progress | ||
) |
Set slave progress of a report.
[in] | report | The report. |
[in] | progress | The new progress value. |
void set_report_slave_task_uuid | ( | report_t | report, |
const char * | uuid | ||
) |
Set the UUID of the slave task, on the local task.
[in] | report | The report. |
[in] | uuid | UUID. |
void set_scan_end_time | ( | report_t | report, |
const char * | timestamp | ||
) |
Set the end time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | End time. ISO format. If NULL, clear end time. |
void set_scan_end_time_ctime | ( | report_t | report, |
const char * | timestamp | ||
) |
Set the end time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | End time. In UTC ctime format. If NULL, clear end time. |
void set_scan_end_time_epoch | ( | report_t | report, |
time_t | timestamp | ||
) |
Set the end time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | End time. Epoch format. |
void set_scan_host_end_time | ( | report_t | report, |
const char * | host, | ||
const char * | timestamp | ||
) |
Set the end time of a scanned host.
[in] | report | Report associated with the scan. |
[in] | host | Host. |
[in] | timestamp | End time. ISO format. |
void set_scan_host_end_time_ctime | ( | report_t | report, |
const char * | host, | ||
const char * | timestamp | ||
) |
Set the end time of a scanned host.
[in] | report | Report associated with the scan. |
[in] | host | Host. |
[in] | timestamp | End time. In UTC ctime format. |
|
static |
Set the start time of a scanned host.
[in] | report | Report associated with the scan. |
[in] | host | Host. |
[in] | timestamp | Start time. ISO format. |
void set_scan_host_start_time_ctime | ( | report_t | report, |
const char * | host, | ||
const char * | timestamp | ||
) |
Set the start time of a scanned host.
[in] | report | Report associated with the scan. |
[in] | host | Host. |
[in] | timestamp | Start time. In UTC ctime format. |
void set_scan_ports | ( | report_t | report, |
const char * | host, | ||
unsigned int | current, | ||
unsigned int | max | ||
) |
Set the ports for a particular host in a scan.
[in] | report | Report associated with scan. |
[in] | host | Host. |
[in] | current | New value for port currently being scanned. |
[in] | max | New value for last port to be scanned. |
|
static |
Set the start time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | Start time. In ISO format. |
void set_scan_start_time_ctime | ( | report_t | report, |
const char * | timestamp | ||
) |
Set the start time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | Start time. In UTC ctime format. |
void set_scan_start_time_epoch | ( | report_t | report, |
time_t | timestamp | ||
) |
Set the start time of a scan.
[in] | report | The report associated with the scan. |
[in] | timestamp | Start time. Epoch format. |
|
static |
Set login data for a target.
[in] | target | The target. |
[in] | type | The credential type (e.g. "ssh" or "smb"). |
[in] | credential | The credential or 0 to remove. |
[in] | port | The port to authenticate at with credential. |
|
static |
Set the alerts on a task, removing any previous alerts.
[in] | task | Task. |
[in] | alerts | Alerts. |
[out] | alert_id_return | ID of alert on "failed to find" error. |
void set_task_alterable | ( | task_t | task, |
int | alterable | ||
) |
Set the alterable state of a task.
[in] | task | Task. |
[in] | alterable | Whether task is alterable. |
|
static |
Set the comment of a task.
[in] | task | A task. |
[in] | comment | New comment. |
void set_task_config | ( | task_t | task, |
config_t | config | ||
) |
Set the config of a task.
[in] | task | Task. |
[in] | config | Config. |
void set_task_end_time | ( | task_t | task, |
char * | time | ||
) |
Set the end time of a task.
[in] | task | Task. |
[in] | time | New time. Freed before return. If NULL, clear end time. |
void set_task_end_time_epoch | ( | task_t | task, |
time_t | time | ||
) |
Set the end time of a task.
[in] | task | Task. |
[in] | time | New time. Freed before return. If NULL, clear end time. |
int set_task_groups | ( | task_t | task, |
array_t * | groups, | ||
gchar ** | group_id_return | ||
) |
Set observer groups on a task, removing any previous groups.
[in] | task | Task. |
[in] | groups | Groups. |
[out] | group_id_return | ID of group on "failed to find" error. |
void set_task_hosts_ordering | ( | task_t | task, |
const char * | ordering | ||
) |
Set the hosts ordering of a task.
[in] | task | Task. |
[in] | ordering | Hosts ordering. |
void set_task_interrupted | ( | task_t | task, |
const gchar * | message | ||
) |
Set a task to interrupted.
Expects global_current_report to match the task.
[in] | task | Task |
[in] | message | Message for error result. |
void set_task_name | ( | task_t | task, |
const char * | name | ||
) |
Set the name of a task.
[in] | task | A task. |
[in] | name | New name. |
int set_task_observers | ( | task_t | task, |
const gchar * | observers | ||
) |
Set the observers of a task.
[in] | task | Task. |
[in] | observers | Observers. |
int set_task_requested | ( | task_t | task, |
task_status_t * | status | ||
) |
Atomically set the run state of a task to requested.
Only used by run_gmp_slave_task.
[in] | task | Task. |
[out] | status | Old run status of task. |
void set_task_run_status | ( | task_t | task, |
task_status_t | status | ||
) |
Set the run state of a task.
Logs and generates event.
[in] | task | Task. |
[in] | status | New run status. |
|
static |
Set the run state of a task.
[in] | task | Task. |
[in] | status | New run status. |
void set_task_scanner | ( | task_t | task, |
scanner_t | scanner | ||
) |
Set the scanner of a task.
[in] | task | Task. |
[in] | scanner | Scanner. |
int set_task_schedule | ( | task_t | task, |
schedule_t | schedule, | ||
int | periods | ||
) |
Set the schedule of a task.
[in] | task | Task. |
[in] | schedule | Schedule. |
[in] | periods | Number of schedule periods. |
void set_task_schedule_next_time | ( | task_t | task, |
time_t | time | ||
) |
Set the next time a scheduled task will be due.
[in] | task | Task. |
[in] | time | New next time. |
void set_task_schedule_next_time_uuid | ( | const gchar * | task_id, |
time_t | time | ||
) |
Set the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
[in] | time | New next time. |
int set_task_schedule_periods | ( | const gchar * | task_id, |
int | periods | ||
) |
Set the schedule periods of a task, given a UUID.
The task modification time stays the same.
[in] | task_id | Task UUID. |
[in] | periods | Schedule periods. |
int set_task_schedule_periods_id | ( | task_t | task, |
int | periods | ||
) |
Set the schedule periods of a task, given an ID.
The task modification time stays the same.
[in] | task | Task UUID. |
[in] | periods | Schedule periods. |
int set_task_schedule_uuid | ( | const gchar * | task_id, |
schedule_t | schedule, | ||
int | periods | ||
) |
Set the schedule of a task.
[in] | task_id | Task UUID. |
[in] | schedule | Schedule. |
[in] | periods | Number of schedule periods. |
|
static |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. ISO format. Freed before return. |
void set_task_start_time_ctime | ( | task_t | task, |
char * | time | ||
) |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. UTC ctime format. Freed before return. |
void set_task_start_time_epoch | ( | task_t | task, |
int | time | ||
) |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. Seconds since epoch. |
void set_task_target | ( | task_t | task, |
target_t | target | ||
) |
Set the target of a task.
[in] | task | Task. |
[in] | target | Target. |
void set_task_usage_type | ( | task_t | task, |
const char * | usage_type | ||
) |
Set the usage_type of a task.
[in] | task | Task. |
[in] | usage_type | New usage type ("scan" or "audit"). |
|
static |
Setup config preferences for a config.
[in] | config | The config. |
[in] | safe_checks | safe_checks option: 1 for "yes", 0 for "no". |
[in] | optimize_test | optimize_test option: 1 for "yes", 0 for "no". |
[in] | port_range | port_range option: 1 for "yes", 0 for "no". |
|
static |
Buffer XML for a severity class.
[in] | severity | Severity name. |
|
static |
Send a report to a host via SMB.
[in] | password | Password. |
[in] | username | Username. |
[in] | share_path | Name/address of host and name of the share. |
[in] | file_path | Destination filename with path inside the share. |
[in] | report | Report that should be sent. |
[in] | report_size | Size of the report. |
[out] | script_message | Custom error message of the alert script. |
|
static |
Send an SNMP TRAP to a host.
[in] | community | Community. |
[in] | agent | Agent. |
[in] | message | Message. |
[out] | script_message | Custom error message of the script. |
array_t* split_filter | ( | const gchar * | given_filter | ) |
Split the filter term into parts.
[in] | given_filter | Filter term. |
void split_filter_add_specials | ( | array_t * | parts, |
const gchar * | given_filter | ||
) |
Ensure filter parts contains the special keywords.
[in] | parts | Array of keyword strings. |
[in] | given_filter | Filter term. |
int stop_task_internal | ( | task_t | task | ) |
Initiate stopping a task.
[in] | task | Task. |
char* tag_uuid | ( | tag_t | tag | ) |
Return the UUID of a tag.
[in] | tag | Tag. |
gchar* tag_value | ( | const gchar * | tags, |
const gchar * | tag | ||
) |
Extract a tag from a pipe separated tag list.
[in] | tags | Tag list. |
[out] | tag | Tag name. |
alive_test_t target_alive_tests | ( | target_t | target | ) |
Return a target's alive tests.
[in] | target | Target. |
|
static |
Return the comment of a target.
[in] | target | Target. |
int target_count | ( | const get_data_t * | get | ) |
Count number of targets.
[in] | get | GET params. |
credential_t target_credential | ( | target_t | target, |
const char * | type | ||
) |
Get a credential from a target.
[in] | target | The target. |
[in] | type | The credential type (e.g. "ssh" or "smb"). |
credential_t target_esxi_credential | ( | target_t | target | ) |
Return the ESXi credential associated with a target, if any.
[in] | target | Target. |
char* target_exclude_hosts | ( | target_t | target | ) |
Return the excluded hosts associated with a target.
[in] | target | Target. |
char* target_hosts | ( | target_t | target | ) |
Return the hosts associated with a target.
[in] | target | Target. |
int target_in_use | ( | target_t | target | ) |
Return whether a target is in use by a task.
[in] | target | Target. |
const char* target_iterator_alive_tests | ( | iterator_t * | iterator | ) |
Get the alive test description from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_esxi_credential | ( | iterator_t * | iterator | ) |
Get the ESXi LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_esxi_trash | ( | iterator_t * | iterator | ) |
Get the ESXi LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_port_list_trash | ( | iterator_t * | iterator | ) |
Get the location of the port list from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_smb_credential | ( | iterator_t * | iterator | ) |
Get the SMB LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_smb_trash | ( | iterator_t * | iterator | ) |
Get the location of the SMB LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_snmp_credential | ( | iterator_t * | iterator | ) |
Get the SNMP LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_snmp_trash | ( | iterator_t * | iterator | ) |
Get the SNMP LSC credential location from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_ssh_credential | ( | iterator_t * | iterator | ) |
Get the SSH LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_iterator_ssh_trash | ( | iterator_t * | iterator | ) |
Get the location of the SSH LSC credential from a target iterator.
[in] | iterator | Iterator. |
int target_login_port | ( | target_t | target, |
const char * | type | ||
) |
Get a login port from a target.
[in] | target | The target. |
[in] | type | The credential type (e.g. "ssh" or "smb"). |
char* target_name | ( | target_t | target | ) |
Return the name of a target.
[in] | target | Target. |
port_list_t target_port_list | ( | target_t | target | ) |
Return the port list associated with a target, if any.
[in] | target | Target. |
char* target_port_range | ( | target_t | target | ) |
Return the port range of a target, in GMP port range list format.
For "OpenVAS Default", return the explicit port ranges instead of "default".
[in] | target | Target. |
char* target_reverse_lookup_only | ( | target_t | target | ) |
Return the reverse_lookup_only value of a target.
[in] | target | Target. |
char* target_reverse_lookup_unify | ( | target_t | target | ) |
Return the reverse_lookup_unify value of a target.
[in] | target | Target. |
credential_t target_smb_credential | ( | target_t | target | ) |
Return the SMB credential associated with a target, if any.
[in] | target | Target. |
credential_t target_ssh_credential | ( | target_t | target | ) |
Return the SSH credential associated with a target, if any.
[in] | target | Target. |
char* target_ssh_port | ( | target_t | target | ) |
Return the SSH LSC port of a target.
[in] | target | Target. |
int target_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
char* target_uuid | ( | target_t | target | ) |
Return the UUID of a target.
[in] | target | Target. |
int target_writable | ( | target_t | target | ) |
Return whether a target is writable.
[in] | target | Target. |
int task_alterable | ( | task_t | task | ) |
Return whether a task is an Alterable Task.
[in] | task | Task. |
int task_average_scan_duration | ( | task_t | task | ) |
Get the average duration of all finished reports of a task.
[in] | task | Task. |
char* task_comment | ( | task_t | task | ) |
Return the comment of a task.
[in] | task | Task. |
config_t task_config | ( | task_t | task | ) |
Return the config of a task.
[in] | task | Task. |
int task_config_in_trash | ( | task_t | task | ) |
Return whether the config of a task is in the trashcan.
[in] | task | Task. |
char* task_config_name | ( | task_t | task | ) |
Return the name of the config of a task.
[in] | task | Task. |
char* task_config_uuid | ( | task_t | task | ) |
Return the UUID of the config of a task.
[in] | task | Task. |
unsigned int task_count | ( | const get_data_t * | get | ) |
Return the number of tasks associated with the current user.
[in] | get | GET params. |
|
static |
Get definitions file from a task's config.
[in] | task | Task. |
char* task_hosts_ordering | ( | task_t | task | ) |
Return the hosts ordering of a task.
[in] | task | Task. |
int task_in_trash | ( | task_t | task | ) |
Return whether a task is in the trashcan.
[in] | task | Task. |
int task_in_trash_id | ( | const gchar * | task_id | ) |
Return whether a task is in the trashcan.
Assume the UUID is properly formatted.
[in] | task_id | Task UUID. |
int task_in_use | ( | task_t | task | ) |
Return whether a task is in use by a task.
[in] | task | Task. |
report_t task_iterator_current_report | ( | iterator_t * | iterator | ) |
Return the current report of a task.
[in] | iterator | Iterator. |
int task_iterator_finished_reports | ( | iterator_t * | iterator | ) |
Get the number of reports of a task iterator.
[in] | iterator | Iterator. |
const char* task_iterator_first_report | ( | iterator_t * | iterator | ) |
Get the first report UUID from a task iterator.
[in] | iterator | Iterator. |
const char* task_iterator_hosts_ordering | ( | iterator_t * | iterator | ) |
Get the hosts ordering value from a task iterator.
[in] | iterator | Iterator. |
const char* task_iterator_last_report | ( | iterator_t * | iterator | ) |
Get the last report UUID from a task iterator.
[in] | iterator | Iterator. |
|
static |
Generate the extra_tables string for a task iterator.
[in] | override | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
[in] | ignore_severity | Whether to ignore severity data. |
task_status_t task_iterator_run_status | ( | iterator_t * | iterator | ) |
Get the run status from a task iterator.
[in] | iterator | Iterator. |
const char* task_iterator_run_status_name | ( | iterator_t * | iterator | ) |
Get the run status name from a task iterator.
[in] | iterator | Iterator. |
scanner_t task_iterator_scanner | ( | iterator_t * | iterator | ) |
Get the UUID of task scanner from a task iterator.
[in] | iterator | Iterator. |
int task_iterator_total_reports | ( | iterator_t * | iterator | ) |
Get the number of reports of a task iterator.
[in] | iterator | Iterator. |
const char* task_iterator_trend_counts | ( | iterator_t * | iterator, |
int | holes_a, | ||
int | warns_a, | ||
int | infos_a, | ||
double | severity_a, | ||
int | holes_b, | ||
int | warns_b, | ||
int | infos_b, | ||
double | severity_b | ||
) |
Return the trend of a task, given counts.
[in] | iterator | Task iterator. |
[in] | holes_a | Number of holes on earlier report. |
[in] | warns_a | Number of warnings on earlier report. |
[in] | infos_a | Number of infos on earlier report. |
[in] | severity_a | Severity score of earlier report. |
[in] | holes_b | Number of holes on later report. |
[in] | warns_b | Number of warnings on later report. |
[in] | infos_b | Number of infos on later report. |
[in] | severity_b | Severity score of later report. |
const char* task_iterator_usage_type | ( | iterator_t * | iterator | ) |
Get the UUID of task scanner from a task iterator.
[in] | iterator | Iterator. |
int task_last_report | ( | task_t | task, |
report_t * | report | ||
) |
Get the report from the most recently completed invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if successfully failed to select report. |
|
static |
Get the report from the most recently invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if successfully failed to select report. |
int task_last_resumable_report | ( | task_t | task, |
report_t * | report | ||
) |
Get the report from the most recently stopped invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if successfully failed to select report. |
char* task_name | ( | task_t | task | ) |
Return the name of a task.
[in] | task | Task. |
char* task_observers | ( | task_t | task | ) |
Return the observers of a task.
[in] | task | Task. |
char* task_owner_name | ( | task_t | task | ) |
Return the name of the owner of a task.
[in] | task | Task. |
|
static |
Return the name of the owner of a task.
[in] | task | Task. |
|
static |
Get most recently completed report that precedes a report.
[in] | task | The task. |
[out] | report | Report. |
[out] | previous | Report return, 0 if successfully failed to select report. |
int task_result_count | ( | task_t | task, |
int | min_qod | ||
) |
Return number of results in a task.
[in] | task | Task. |
[in] | min_qod | Minimum QOD. |
task_status_t task_run_status | ( | task_t | task | ) |
Return the run state of a task.
[in] | task | Task. |
report_t task_running_report | ( | task_t | task | ) |
Return the running report of a task.
[in] | task | Task. |
scanner_t task_scanner | ( | task_t | task | ) |
Return the scanner of a task.
[in] | task | Task. |
int task_scanner_in_trash | ( | task_t | task | ) |
Return whether the scanner of a task is in the trashcan.
[in] | task | Task. |
schedule_t task_schedule | ( | task_t | task | ) |
Return the schedule of a task.
[in] | task | Task. |
int task_schedule_in_trash | ( | task_t | task | ) |
Get whether the task schedule is in the trash.
[in] | task | Task. |
|
static |
Get the next time from a task schedule iterator.
[in] | iterator | Iterator. |
|
static |
Get the next time from a task schedule iterator.
[in] | iterator | Iterator. |
gboolean task_schedule_iterator_start_due | ( | iterator_t * | iterator | ) |
Get the start due state from a task schedule iterator.
[in] | iterator | Iterator. |
gboolean task_schedule_iterator_stop_due | ( | iterator_t * | iterator | ) |
Get the stop due state from a task schedule iterator.
[in] | iterator | Iterator. |
task_t task_schedule_iterator_task | ( | iterator_t * | iterator | ) |
Get the task from a task schedule iterator.
[in] | iterator | Iterator. |
gboolean task_schedule_iterator_timed_out | ( | iterator_t * | iterator | ) |
Get if schedule of task in iterator is timed out.
[in] | iterator | Iterator. |
int task_schedule_next_time | ( | task_t | task | ) |
Get next time a scheduled task will run, following schedule timezone.
[in] | task | Task. |
time_t task_schedule_next_time_uuid | ( | const gchar * | task_id | ) |
Get the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
int task_schedule_periods | ( | task_t | task | ) |
Get the number of times the period schedule should run on the task.
[in] | task | Task. |
int task_schedule_periods_uuid | ( | const gchar * | task_id | ) |
Set the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
schedule_t task_schedule_uuid | ( | const gchar * | task_id | ) |
Return the schedule of a task.
[in] | task_id | ID of task. |
|
static |
Get the report from second most recently completed invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if successfully failed to select report. |
gchar* task_second_last_report_id | ( | task_t | task | ) |
Get report ID from second most recently completed invocation of task.
[in] | task | The task. |
|
static |
Return the severity score of a task, taking overrides into account.
[in] | task | Task. |
[in] | overrides | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
[in] | offset | Offset of report to get severity from: 0 = use last report, 1 = use next to last report |
target_t task_target | ( | task_t | task | ) |
Return the target of a task.
[in] | task | Task. |
int task_target_in_trash | ( | task_t | task | ) |
Return whether the target of a task is in the trashcan.
[in] | task | Task. |
|
static |
Return the trend of a task, given counts.
[in] | holes_a | Number of holes on earlier report. |
[in] | warns_a | Number of warnings on earlier report. |
[in] | infos_a | Number of infos on earlier report. |
[in] | severity_a | Severity of earlier report. |
[in] | holes_b | Number of holes on later report. |
[in] | warns_b | Number of warnings on later report. |
[in] | infos_b | Number of infos on later report. |
[in] | severity_b | Severity of later report. |
int task_upload_progress | ( | task_t | task | ) |
Return the upload progress of a task.
[in] | task | Task. |
int task_uuid | ( | task_t | task, |
char ** | id | ||
) |
Return the UUID of a task.
[in] | task | Task. |
[out] | id | Pointer to a newly allocated string. |
int task_writable | ( | task_t | task | ) |
Return whether a task is writable.
[in] | task | Task. |
|
static |
Generate an extra WHERE clause for selecting tasks.
[in] | trash | Whether to get tasks from the trashcan. |
[in] | usage_type | The usage type to limit the selection to. |
const char* threat_message_type | ( | const char * | threat | ) |
Get the message type of a threat.
threat | Threat. |
int trash_agent_in_use | ( | agent_t | agent | ) |
Check whether a trashcan agent is writable.
[in] | agent | Agent. |
int trash_agent_writable | ( | agent_t | agent | ) |
Check whether a trashcan agent is writable.
[in] | agent | Agent. |
int trash_alert_in_use | ( | alert_t | alert | ) |
Return whether a trashcan alert is in use by a task.
[in] | alert | Alert. |
int trash_alert_writable | ( | alert_t | alert | ) |
Return whether a trashcan alert is writable.
[in] | alert | Alert. |
int trash_credential_in_use | ( | credential_t | credential | ) |
Check whether a trashcan Credential is in use.
[in] | credential | Credential. |
char* trash_credential_name | ( | credential_t | credential | ) |
Get the name of an LSC credential in the trashcan.
[in] | credential | Credential. |
int trash_credential_readable | ( | credential_t | credential | ) |
Return whether a trashcan credential is readable.
[in] | credential | Credential. |
char* trash_credential_uuid | ( | credential_t | credential | ) |
Get the UUID of a Credential in the trashcan.
[in] | credential | Credential. |
int trash_credential_writable | ( | credential_t | credential | ) |
Check whether a trashcan Credential is writable.
[in] | credential | Credential. |
int trash_report_format_in_use | ( | report_format_t | report_format | ) |
Return whether a report format in trash is referenced by an alert.
[in] | report_format | Report Format. |
int trash_report_format_writable | ( | report_format_t | report_format | ) |
Return whether a trashcan report_format is writable.
[in] | report_format | Report Format. |
int trash_scanner_in_use | ( | scanner_t | scanner | ) |
Check whether a trashcan scanner is writable.
[in] | scanner | Scanner. |
char* trash_scanner_name | ( | scanner_t | scanner | ) |
Return the name of a scanner in the trashcan.
[in] | scanner | Scanner. |
int trash_scanner_readable | ( | scanner_t | scanner | ) |
Return whether a trashcan scanner is readable.
[in] | scanner | Scanner. |
char* trash_scanner_uuid | ( | scanner_t | scanner | ) |
Return the UUID of a scanner in the trashcan.
[in] | scanner | Scanner. |
int trash_scanner_writable | ( | scanner_t | scanner | ) |
Check whether a trashcan scanner is writable.
[in] | scanner | Scanner. |
int trash_schedule_in_use | ( | schedule_t | schedule | ) |
Return whether a trashcan schedule is in use by a task.
[in] | schedule | schedule. |
char* trash_schedule_name | ( | schedule_t | schedule | ) |
Return the name of a trash schedule.
[in] | schedule | Schedule. |
int trash_schedule_readable | ( | schedule_t | schedule | ) |
Return whether a trashcan schedule is readable.
[in] | schedule | Schedule. |
char* trash_schedule_uuid | ( | schedule_t | schedule | ) |
Return the UUID of a trash schedule.
[in] | schedule | Schedule. |
int trash_schedule_writable | ( | schedule_t | schedule | ) |
Return whether a trashcan schedule is writable.
[in] | schedule | Schedule. |
|
static |
Return the comment of a trashcan target.
[in] | target | Target. |
|
static |
Return the excluded hosts associated with a trashcan target.
[in] | target | Target. |
|
static |
Return the hosts associated with a trashcan target.
[in] | target | Target. |
int trash_target_in_use | ( | target_t | target | ) |
Return whether a trashcan target is referenced by a task.
[in] | target | Target. |
char* trash_target_name | ( | target_t | target | ) |
Return the name of a trashcan target.
[in] | target | Target. |
int trash_target_readable | ( | target_t | target | ) |
Return whether a trashcan target is readable.
[in] | target | Target. |
char* trash_target_uuid | ( | target_t | target | ) |
Return the UUID of a trashcan target.
[in] | target | Target. |
int trash_target_writable | ( | target_t | target | ) |
Return whether a trashcan target is writable.
[in] | target | Target. |
int trash_task_in_use | ( | task_t | task | ) |
Return whether a trashcan task is referenced by a task.
[in] | task | Task. |
int trash_task_writable | ( | task_t | task | ) |
Return whether a trashcan task is writable.
[in] | task | Task. |
|
static |
Trim leading and trailing space from a hosts string.
[in] | string | String. May be modified. |
void trim_partial_report | ( | report_t | report | ) |
Prepare a partial report for resumption of the scan.
[in] | report | The report. |
void trim_report | ( | report_t | report | ) |
Prepare a partial report for restarting the scan from the beginning.
[in] | report | The report. |
|
static |
Return DB name of type.
[in] | type | Database or pretty name. |
|
static |
Check whether a type must have globally unique names.
[in] | type | Type of resource. |
|
static |
Check whether a type has a comment.
[in] | type | Type of resource. |
|
static |
Check whether a resource type uses the trashcan.
[in] | type | Type of resource. |
|
static |
Check whether a resource type is an asset subtype.
[in] | type | Type of resource. |
|
static |
Check whether a resource type is an info subtype, excluding allinfo.
[in] | type | Type of resource. |
|
static |
Check whether a type has a name and comment.
[in] | type | Type of resource. |
|
static |
Check whether a resource type has an owner.
[in] | type | Type of resource. |
|
static |
Check whether the trash is in the real table.
[in] | type | Type of resource. |
|
static |
Restore original TZ.
[in] | zone | Only revert if this is at least one character. Freed here always. |
[in] | tz | Original TZ. Freed here if revert occurs. |
[in] | old_tz_override | Original tz_override. Freed here on revert. |
void update_duration_schedule_periods | ( | task_t | task | ) |
Update tasks with limited run schedules which have durations.
If a task is given, assume that the task has finished. Otherwise only update the task if more time than the duration has passed the start time.
[in] | task | Task. 0 for all. |
|
static |
Bring UUIDs for single predefined report format up to date.
[in] | old | Old UUID. |
[in] | new | New UUID. |
|
static |
Ensure the user exists in the database.
[in] | name | User name. |
[in] | method | Auth method. |
|
static |
Check if user exists.
[in] | name | User name. |
|
static |
Check if user exists.
[in] | name | User name. |
[in] | method | Auth method. |
|
static |
Get user uuid, trying all authentication methods.
[in] | name | User name. |
|
static |
Get user uuid.
[in] | username | User name. |
[in] | method | Authentication method. |
int valid_gmp_command | ( | const char * | name | ) |
Check whether a command name is valid.
[in] | name | Command name. |
|
static |
Check whether a resource type name is valid.
[in] | type | Type of resource. |
|
static |
Validate condition data for an alert.
[in] | name | Name. |
[in] | data | Data to validate. |
[in] | condition | The condition. |
|
static |
Validate event data for an alert.
[in] | name | Name. |
[in] | data | Data to validate. |
[in] | event | The event. |
|
static |
Test if a username is valid to use in a credential.
Valid usernames may only contain alphanumeric characters and a few special ones to avoid problems with installer package generation.
[in] | username | The username string to test. |
|
static |
Test if a username is valid for a credential export format.
[in] | username | The username string to test. |
[in] | format | The credential format to validate for. |
|
static |
Validate an email address.
[in] | address | Email address. |
int validate_email_data | ( | alert_method_t | method, |
const gchar * | name, | ||
gchar ** | data, | ||
int | for_modify | ||
) |
Validate method data for the email method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
[in] | for_modify | Whether to return error codes for modify_alert. |
|
static |
Validate an email address list.
[in] | list | Comma separated list of email addresses. |
|
static |
Validate a value for a report format param.
[in] | report_format | Report format. |
[in] | param | Param. |
[in] | name | Name of param. |
[in] | value | Potential value of param. |
|
static |
Validate a single port.
[in] | port | A port. |
|
static |
Validate a single port.
May come in values such as 100/foo and 100/foo (IANA: bar). Will also validate values such as: general/tcp.
[in] | port | A port. |
|
static |
Validate method data for the SCP method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
|
static |
Validate method data for the Send method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
|
static |
Validate method data for the Send method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
|
static |
Validate method data for the Sourcefire method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
|
static |
Validate method data for the TippingPoint method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
int validate_username | ( | const gchar * | name | ) |
Validates a username.
[in] | name | The name. |
|
static |
Validate method data for the vFire alert method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
|
static |
Find a filter string in a glib style string vector.
[in] | vector | Vector. |
[in] | string | String. |
|
static |
Find a string in a glib style string vector.
[in] | vector | Vector. |
[in] | string | String. |
int verify_agent | ( | const char * | agent_id | ) |
Verify an agent.
[in] | agent_id | Agent UUID. |
int verify_scanner | ( | const char * | scanner_id, |
char ** | version | ||
) |
Verify a scanner.
[in] | scanner_id | Scanner UUID. |
[out] | version | Version returned by the scanner. |
|
static |
Execute gpg to verify an installer signature.
[in] | installer | Installer. |
[in] | installer_size | Size of installer. |
[in] | signature | Installer signature. |
[in] | signature_size | Size of installer signature. |
[out] | trust | Trust value. |
|
static |
Return SQL WHERE for restricting a SELECT to levels.
[in] | levels | String describing threat levels (message types) to include in report (for example, "hmlgd" for High, Medium, Low, loG and Debug). All levels if NULL. |
[in] | new_severity_sql | SQL for new severity. |
[in] | auto_type_sql | SQL for auto type. |
|
static |
Return SQL WHERE for restricting a SELECT to a minimum QoD.
[in] | min_qod | Minimum value for QoD. |
int authenticate_allow_all |
Flag to force authentication to succeed.
1 if set via scheduler, 2 if set via event, else 0.
Flag to force authentication to succeed.
1 if set via scheduler, 2 if set via event, else 0.
|
static |
Maximum number of bytes of reports attached to email alerts.
A value less or equal to 0 allows any size.
|
static |
Maximum number of bytes of reports included in email alerts.
A value less or equal to 0 allows any size.
|
static |
Maximum number of bytes of user-defined message text in email alerts.
A value less or equal to 0 allows any size.
|
static |
Flag to control the default sorting produced by split_filter.
If this is true, and the filter does not specify a sort field, then split_filter will not insert a default sort term, so that the random (and fast) table order in the database will be used.