|
OpenVAS Scanner 23.40.3
|
Plugin-specific stuff. More...
#include "plugutils.h"#include "kb_cache.h"#include "network.h"#include "scan_id.h"#include "support.h"#include <errno.h>#include <gvm/base/hosts.h>#include <gvm/base/networking.h>#include <gvm/base/prefs.h>#include <gvm/util/mqtt.h>#include <gvm/util/nvticache.h>#include <magic.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/wait.h>#include <unistd.h>
Go to the source code of this file.
Macros | |
| #define | G_LOG_DOMAIN "lib misc" |
| GLib logging domain. | |
| #define | MAX_CANDIDATES 16 |
Functions | |
| void | init_kb_usage (void) |
| static int | add_kb_usage (struct script_infos *args, size_t size) |
| const char * | plug_current_vhost (void) |
| static int | plug_fork_child (kb_t kb) |
| Spawns a new child process. Setups everything that is needed for a new process. Child must be handled by caller. | |
| void | plug_set_dep (struct script_infos *args, const char *depname) |
| static void | host_add_port_proto (struct script_infos *args, int portnum, char *proto) |
| static int | unscanned_ports_as_closed (port_protocol_t ptype) |
| Report state of preferences "unscanned_closed". | |
| int | kb_get_port_state_proto (kb_t kb, int portnum, char *proto) |
| static int | host_get_port_state_proto (struct script_infos *args, int portnum, char *proto) |
| int | host_get_port_state (struct script_infos *plugdata, int portnum) |
| int | host_get_port_state_udp (struct script_infos *plugdata, int portnum) |
| static int | check_duplicated_vhost (struct script_infos *args, const char *hostname) |
| Check for duplicated vhosts before inserting a new one. | |
| int | plug_add_host_fqdn (struct script_infos *args, const char *hostname, const char *source) |
| char * | plug_get_host_fqdn (struct script_infos *args) |
| GSList * | plug_get_host_fqdn_list (struct script_infos *args) |
| char * | plug_get_host_source (struct script_infos *args, const char *hostname) |
| struct in6_addr * | plug_get_host_ip (struct script_infos *args) |
| char * | plug_get_host_ip_str (struct script_infos *desc) |
| static const char * | msg_type_to_str (msg_t type) |
| Return string representation of the given msg_t. | |
| int | check_kb_inconsistency (kb_t main_kb) |
| Check if the current main kb corresponds to the original scan main kb. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| static int | check_kb_inconsistency_log (void) |
| calls check_kb_inconsistency and logs as debug when local scan_id is missing. | |
| int | kb_item_push_str_with_main_kb_check (kb_t kb, const char *name, const char *value) |
| Check if the current kb corresponds to the original scanid, if it matches it kb_item_push_str. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| int | kb_item_set_str_with_main_kb_check (kb_t kb, const char *name, const char *value, size_t len) |
| Check if the current kb corresponds to the original scanid, if it matches it call kb_item_set_str. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| int | kb_item_add_str_unique_with_main_kb_check (kb_t kb, const char *name, const char *value, size_t len, int pos) |
| Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_str_unique. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| int | kb_item_set_int_with_main_kb_check (kb_t kb, const char *name, int value) |
| Check if the current kb corresponds to the original scanid, if it matches it call kb_item_set_int. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| int | kb_item_add_int_with_main_kb_check (kb_t kb, const char *name, int value) |
| Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_int. @description Compares the scan id in get_scan_id, add at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| int | kb_item_add_int_unique_with_main_kb_check (kb_t kb, const char *name, int value) |
| Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_int_unique. @description Compares the scan id in get_scan_id, add at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb. | |
| static int | is_utf8_encoded (const char *filename) |
| static void | proto_post_wrapped (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, msg_t msg_type, const char *uri) |
| Post a security message (e.g. LOG, NOTE, WARNING ...). | |
| void | proto_post_alarm (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *uri) |
| void | post_alarm (const char *oid, struct script_infos *desc, int port, const char *action, const char *uri) |
| void | proto_post_log (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *uri) |
| Post a log message. | |
| void | post_log (const char *oid, struct script_infos *desc, int port, const char *action) |
| Post a log message about a tcp port. | |
| void | post_log_with_uri (const char *oid, struct script_infos *desc, int port, const char *action, const char *uri) |
| Post a log message about a tcp port with a uri. | |
| void | proto_post_error (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *uri) |
| void | post_error (const char *oid, struct script_infos *desc, int port, const char *action, const char *uri) |
| char * | get_plugin_preference (const char *oid, const char *name, int pref_id) |
| Get the a plugins preference. | |
| const char * | get_plugin_preference_fname (struct script_infos *desc, const char *filename) |
| Get the file name of a plugins preference that is of type "file". | |
| char * | get_plugin_preference_file_content (struct script_infos *desc, const char *identifier) |
| Get the file contents of a plugins preference that is of type "file". | |
| long | get_plugin_preference_file_size (struct script_infos *desc, const char *identifier) |
| Get the file size of a plugins preference that is of type "file". | |
| void | plug_set_key_len (struct script_infos *args, char *name, int type, const void *value, size_t len) |
| void | plug_set_key (struct script_infos *args, char *name, int type, const void *value) |
| void | plug_set_key_len_volatile (struct script_infos *args, char *name, int type, const void *value, int expire, size_t len) |
| Set volatile key with expire. | |
| void | plug_set_key_volatile (struct script_infos *args, char *name, int type, const void *value, int expire) |
| Set volatile key with expire. | |
| void | plug_replace_key_len (struct script_infos *args, char *name, int type, void *value, size_t len) |
| void | plug_replace_key (struct script_infos *args, char *name, int type, void *value) |
| void | scanner_add_port (struct script_infos *args, int port, char *proto) |
| kb_t | plug_get_kb (struct script_infos *args) |
| static void | plug_get_key_sigchld (int s) |
| static void | sig_n (int signo, void(*fnc)(int)) |
| void * | plug_get_key (struct script_infos *args, char *name, int *type, size_t *len, int single) |
| Get values from a kb under the given key name. | |
| unsigned int | plug_get_host_open_port (struct script_infos *desc) |
| void | plug_set_port_transport (struct script_infos *args, int port, int tr) |
| int | plug_get_port_transport (struct script_infos *args, int port) |
| static void | plug_set_ssl_item (struct script_infos *args, char *item, char *itemfname) |
| void | plug_set_ssl_cert (struct script_infos *args, char *cert) |
| void | plug_set_ssl_key (struct script_infos *args, char *key) |
| void | plug_set_ssl_pem_password (struct script_infos *args, char *key) |
| void | plug_set_ssl_CA_file (struct script_infos *args, char *key) |
Variables | |
| int | global_nasl_debug = 0 |
| static size_t | kb_usage = 0 |
| static size_t | max_kb_usage |
| gvm_vhost_t * | current_vhost = NULL |
Plugin-specific stuff.
Definition in file plugutils.c.
| #define G_LOG_DOMAIN "lib misc" |
GLib logging domain.
Definition at line 36 of file plugutils.c.
| #define MAX_CANDIDATES 16 |
Referenced by plug_get_host_open_port().
|
static |
Definition at line 69 of file plugutils.c.
References kb_usage, max_kb_usage, and script_infos::name.
Referenced by plug_replace_key_len(), and plug_set_key_len().

|
static |
Check for duplicated vhosts before inserting a new one.
| args | script info structure |
| hostname | hostname to check |
Definition at line 213 of file plugutils.c.
References host_kb, hostname, script_infos::key, and script_infos::vhosts.
Referenced by plug_add_host_fqdn().

| int check_kb_inconsistency | ( | kb_t | main_kb | ) |
Check if the current main kb corresponds to the original scan main kb. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| main_kb | Current main kb. |
Definition at line 442 of file plugutils.c.
References get_scan_id(), and main_kb.
Referenced by attack_host(), check_kb_inconsistency_log(), and set_scan_status().


|
static |
calls check_kb_inconsistency and logs as debug when local scan_id is missing.
@description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
Definition at line 481 of file plugutils.c.
References check_kb_inconsistency(), get_main_kb(), and get_scan_id().
Referenced by kb_item_add_int_unique_with_main_kb_check(), kb_item_add_int_with_main_kb_check(), kb_item_add_str_unique_with_main_kb_check(), kb_item_push_str_with_main_kb_check(), kb_item_set_int_with_main_kb_check(), and kb_item_set_str_with_main_kb_check().


| char * get_plugin_preference | ( | const char * | oid, |
| const char * | name, | ||
| int | pref_id ) |
Get the a plugins preference.
Search in the preferences set by the client. If it is not present, search in redis cache for the default.
| [in] | oid | Script OID to get the preference from |
| [in] | name | Name of the preference to get |
| [in] | pref_id | Id of the preferences to get |
Definition at line 837 of file plugutils.c.
References name, oid, and prefix().
Referenced by plugin_do_run(), plugin_run_find_service(), plugin_timeout(), script_get_preference(), script_get_preference_file_content(), script_get_preference_file_location(), and user_agent_create().


| char * get_plugin_preference_file_content | ( | struct script_infos * | desc, |
| const char * | identifier ) |
Get the file contents of a plugins preference that is of type "file".
As files sent to the scanner (e.g. as plugin preference) are stored in a hash table with an identifier supplied by the client as the key, the contents have to be looked up here.
| identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier, NULL if not found or setup broken. Definition at line 980 of file plugutils.c.
References scan_globals::files_translation, and script_infos::globals.
Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().

| long get_plugin_preference_file_size | ( | struct script_infos * | desc, |
| const char * | identifier ) |
Get the file size of a plugins preference that is of type "file".
Files sent to the scanner (e.g. as plugin preference) are stored in a hash table with an identifier supplied by the client as the key. The size of the file is stored in a separate hash table with the same identifier as key, which can be looked up here.
| identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier, -1 if not found or setup broken. Definition at line 1011 of file plugutils.c.
References scan_globals::files_size_translation, and script_infos::globals.
Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().

| const char * get_plugin_preference_fname | ( | struct script_infos * | desc, |
| const char * | filename ) |
Get the file name of a plugins preference that is of type "file".
As files sent to the server (e.g. as plugin preference) are stored at pseudo-random locations with different names, the "real" file name has to be looked up in a hashtable.
filename, NULL if not found or setup broken. Definition at line 925 of file plugutils.c.
References get_plugin_preference_file_content(), and get_plugin_preference_file_size().
Referenced by plugin_run_find_service(), and script_get_preference_file_location().


|
static |
Definition at line 124 of file plugutils.c.
References ARG_INT, and plug_set_key().
Referenced by scanner_add_port().


| int host_get_port_state | ( | struct script_infos * | plugdata, |
| int | portnum ) |
Definition at line 193 of file plugutils.c.
References host_get_port_state_proto().
Referenced by get_port_state(), and open_sock_tcp().


|
static |
Definition at line 187 of file plugutils.c.
References kb_get_port_state_proto(), and script_infos::key.
Referenced by host_get_port_state(), and host_get_port_state_udp().


| int host_get_port_state_udp | ( | struct script_infos * | plugdata, |
| int | portnum ) |
Definition at line 199 of file plugutils.c.
References host_get_port_state_proto().
Referenced by get_udp_port_state().


| void init_kb_usage | ( | void | ) |
Definition at line 47 of file plugutils.c.
References max_kb_usage.
Referenced by pluginlaunch_init().

|
static |
Definition at line 664 of file plugutils.c.
Referenced by proto_post_wrapped().

| int kb_get_port_state_proto | ( | kb_t | kb, |
| int | portnum, | ||
| char * | proto ) |
| proto | Protocol (udp/tcp). If NULL, "tcp" will be used. |
Definition at line 149 of file plugutils.c.
References unscanned_ports_as_closed().
Referenced by get_closed_ports(), and host_get_port_state_proto().


| int kb_item_add_int_unique_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| int | value ) |
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_int_unique. @description Compares the scan id in get_scan_id, add at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 657 of file plugutils.c.
References check_kb_inconsistency_log(), and name.
Referenced by set_kb_readable().


| int kb_item_add_int_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| int | value ) |
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_int. @description Compares the scan id in get_scan_id, add at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 633 of file plugutils.c.
References check_kb_inconsistency_log(), and name.

| int kb_item_add_str_unique_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| const char * | value, | ||
| size_t | len, | ||
| int | pos ) |
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_add_str_unique. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 583 of file plugutils.c.
References check_kb_inconsistency_log(), len, and name.

| int kb_item_push_str_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| const char * | value ) |
Check if the current kb corresponds to the original scanid, if it matches it kb_item_push_str. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 533 of file plugutils.c.
References check_kb_inconsistency_log(), and name.
Referenced by attack_host(), call_lsc(), call_rs_notus(), comm_send_status(), comm_send_status_host_dead(), host_set_time(), message_to_client(), open_sock_tcp(), proto_post_wrapped(), security_notus(), and update_running_processes().


| int kb_item_set_int_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| int | value ) |
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_set_int. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 609 of file plugutils.c.
References check_kb_inconsistency_log(), and name.
Referenced by check_host_still_alive(), open_sock_tcp(), and overwrite_openvas_prefs_with_prefs_from_client().


| int kb_item_set_str_with_main_kb_check | ( | kb_t | kb, |
| const char * | name, | ||
| const char * | value, | ||
| size_t | len ) |
Check if the current kb corresponds to the original scanid, if it matches it call kb_item_set_str. @description Compares the scan id in get_scan_id, set at the beginning of the scan, with the one found in the main kb. Therefore it is mandatory that the global main_kb variable to be set. It helps to detect that the kb was not taken by another task/scan, and that the current plugins does not stores results in a wrong kb.
| kb | Kb where to store the item into. |
| name | key for the given value. |
| value | to store under key within kb. |
Definition at line 558 of file plugutils.c.
References check_kb_inconsistency_log(), len, and name.
Referenced by attack_start(), overwrite_openvas_prefs_with_prefs_from_client(), and set_scan_status().


|
static |
Return string representation of the given msg_t.
| msg | msg_t to transform |
Definition at line 390 of file plugutils.c.
References ALARM, DEADHOST, ERRMSG, HOST_DETAIL, HOST_END, HOST_START, and LOG.
Referenced by proto_post_wrapped().

| int plug_add_host_fqdn | ( | struct script_infos * | args, |
| const char * | hostname, | ||
| const char * | source ) |
Definition at line 257 of file plugutils.c.
References check_duplicated_vhost(), hostname, and script_infos::vhosts.
Referenced by add_hostname().


| const char * plug_current_vhost | ( | void | ) |
Definition at line 93 of file plugutils.c.
References current_vhost.
Referenced by nasl_end_denial(), and open_sock_tcp().

|
static |
Spawns a new child process. Setups everything that is needed for a new process. Child must be handled by caller.
| kb | for redis connection |
Definition at line 1191 of file plugutils.c.
References get_main_kb(), pid, and sig_n().
Referenced by plug_get_host_fqdn(), and plug_get_key().


| char * plug_get_host_fqdn | ( | struct script_infos * | args | ) |
Definition at line 291 of file plugutils.c.
References current_vhost, script_infos::ip, script_infos::key, plug_fork_child(), script_infos::standalone, and script_infos::vhosts.
Referenced by _http2_req(), _http_req(), get_hostname(), open_stream_connection_ext(), plug_get_host_source(), plugin_do_run(), retry_stream_connection(), and socket_negotiate_ssl().


| GSList * plug_get_host_fqdn_list | ( | struct script_infos * | args | ) |
Definition at line 325 of file plugutils.c.
References script_infos::ip, and script_infos::vhosts.
Referenced by get_hostnames().

| struct in6_addr * plug_get_host_ip | ( | struct script_infos * | args | ) |
Definition at line 371 of file plugutils.c.
References script_infos::ip.
Referenced by forge_ip_packet(), forge_ip_v6_packet(), get_host_ip(), nasl_get_mtu(), nasl_islocalhost(), nasl_islocalnet(), nasl_open_privileged_socket(), nasl_open_sock_udp(), nasl_pcap_next(), nasl_send(), nasl_send_arp_request(), nasl_send_capture(), nasl_send_frame(), nasl_send_packet(), nasl_send_v6packet(), nasl_smb_connect(), nasl_ssh_connect(), nasl_target_is_ipv6(), nasl_tcp_ping(), nasl_tcp_v6_ping(), nasl_this_host(), nasl_win_cmd_exec(), nasl_wmi_connect(), nasl_wmi_connect_reg(), nasl_wmi_connect_rsop(), open_sock_option(), plug_get_host_ip_str(), plugin_run_synscan(), and proto_post_wrapped().

| char * plug_get_host_ip_str | ( | struct script_infos * | desc | ) |
Definition at line 377 of file plugutils.c.
References plug_get_host_ip().
Referenced by host_reverse_lookup(), nasl_snmpv1v2c_get(), nasl_snmpv3_get_action(), open_sock_tcp(), and socket_negotiate_ssl().


| unsigned int plug_get_host_open_port | ( | struct script_infos * | desc | ) |
Don't always return the first open port, otherwise we might get bitten by OSes doing active SYN flood countermeasures. Also, avoid returning 80 and 21 as open ports, as many transparent proxies are acting for these...
Definition at line 1328 of file plugutils.c.
References MAX_CANDIDATES, and plug_get_kb().
Referenced by get_host_open_port(), nasl_start_denial(), nasl_tcp_ping(), and nasl_tcp_v6_ping().


| char * plug_get_host_source | ( | struct script_infos * | args, |
| const char * | hostname ) |
Definition at line 343 of file plugutils.c.
References current_vhost, hostname, plug_get_host_fqdn(), and script_infos::vhosts.
Referenced by get_hostname_source().


| kb_t plug_get_kb | ( | struct script_infos * | args | ) |
Definition at line 1157 of file plugutils.c.
References script_infos::key.
Referenced by _http_req(), exec_nasl_script(), get_kb_list(), nasl_end_denial(), nasl_ssh_set_login(), nasl_ssh_userauth(), open_sock_tcp(), open_stream_connection_ext(), plug_get_host_open_port(), plug_get_port_transport(), plug_replace_key_len(), plug_set_key_len(), plug_set_key_len_volatile(), plugin_run_find_service(), and socket_negotiate_ssl().

| void * plug_get_key | ( | struct script_infos * | args, |
| char * | name, | ||
| int * | type, | ||
| size_t * | len, | ||
| int | single ) |
Get values from a kb under the given key name.
| [in] | args | The script infos where to get the kb from. |
| [in] | name | Key name to search in the kb. |
| [in/out] | type If 1 is given, the answer is forced to be KB_TYPE_INT type. Otherwise it returns the fetched type. | |
| [in] | len | Desired string length to be returned. |
| [in] | single | In case of a list, fetch only the last element |
Definition at line 1231 of file plugutils.c.
References script_infos::key, len, name, plug_fork_child(), plug_get_key_sigchld(), sig_n(), and script_infos::standalone.
Referenced by banner_grab(), get_kb_item(), get_ssh_port(), nasl_open_sock_kdc(), and plugin_do_run().


|
static |
Definition at line 1163 of file plugutils.c.
Referenced by plug_get_key().

| int plug_get_port_transport | ( | struct script_infos * | args, |
| int | port ) |
Definition at line 1396 of file plugutils.c.
References OPENVAS_ENCAPS_IP, and plug_get_kb().
Referenced by get_port_transport(), and open_stream_auto_encaps_ext().


| void plug_replace_key | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| void * | value ) |
Definition at line 1145 of file plugutils.c.
References name, and plug_replace_key_len().
Referenced by mark_acap_server(), mark_adsgone(), mark_exchg_routing_server(), mark_ftp_server(), mark_fw1(), mark_http_server(), mark_imap_server(), mark_linuxconf(), mark_locked_adsubtract_server(), mark_mon_server(), mark_ncacn_http_server(), mark_nntp_server(), mark_pop3pw_server(), mark_pop_server(), mark_psybnc(), mark_rmserver(), mark_shoutcast_server(), mark_smtp_server(), mark_snpp_server(), mark_unknown_svc(), mark_uucp_server(), mark_vnc_server(), mark_vtun_server(), mark_whois_plus2_server(), mark_zebra_server(), plugin_do_run(), register_service(), and replace_kb_item().


| void plug_replace_key_len | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| void * | value, | ||
| size_t | len ) |
Definition at line 1118 of file plugutils.c.
References add_kb_usage(), ARG_INT, ARG_STRING, global_nasl_debug, len, name, and plug_get_kb().
Referenced by plug_replace_key(), and replace_kb_item().


| void plug_set_dep | ( | struct script_infos * | args, |
| const char * | depname ) |
Definition at line 104 of file plugutils.c.
References script_infos::nvti.
Referenced by script_dependencies().

| void plug_set_key | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| const void * | value ) |
Definition at line 1060 of file plugutils.c.
References name, and plug_set_key_len().
Referenced by banner_grab(), host_add_port_proto(), mark_unknown_svc(), mark_wrapped_svc(), nasl_update_table_driven_lsc_data(), plug_set_port_transport(), plug_set_ssl_item(), plugin_do_run(), plugin_run_openvas_tcp_scanner(), plugin_run_synscan(), register_service(), scan(), set_kb_item(), and simple_register_host_detail().


| void plug_set_key_len | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| const void * | value, | ||
| size_t | len ) |
Definition at line 1033 of file plugutils.c.
References add_kb_usage(), ARG_INT, ARG_STRING, global_nasl_debug, len, name, and plug_get_kb().
Referenced by plug_set_key(), and set_kb_item().


| void plug_set_key_len_volatile | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| const void * | value, | ||
| int | expire, | ||
| size_t | len ) |
Set volatile key with expire.
| args | Script infos. |
| name | Key name. |
| type | Key type. |
| value | Key value. |
| expire | Key expire in seconds. |
| len | Len of value. |
Definition at line 1077 of file plugutils.c.
References ARG_INT, ARG_STRING, global_nasl_debug, len, name, and plug_get_kb().
Referenced by plug_set_key_volatile(), and set_kb_item_volatile().


| void plug_set_key_volatile | ( | struct script_infos * | args, |
| char * | name, | ||
| int | type, | ||
| const void * | value, | ||
| int | expire ) |
Set volatile key with expire.
| args | Script infos. |
| name | Key name. |
| type | Key type. |
| value | Key value. |
| expire | Key expire in seconds. |
Definition at line 1111 of file plugutils.c.
References name, and plug_set_key_len_volatile().
Referenced by set_kb_item_volatile().


| void plug_set_port_transport | ( | struct script_infos * | args, |
| int | port, | ||
| int | tr ) |
Definition at line 1383 of file plugutils.c.
References ARG_INT, and plug_set_key().
Referenced by open_stream_auto_encaps_ext(), and plugin_do_run().


| void plug_set_ssl_CA_file | ( | struct script_infos * | args, |
| char * | key ) |
Definition at line 1442 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().


| void plug_set_ssl_cert | ( | struct script_infos * | args, |
| char * | cert ) |
Definition at line 1420 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().


|
static |
Definition at line 1412 of file plugutils.c.
References ARG_STRING, and plug_set_key().
Referenced by plug_set_ssl_CA_file(), plug_set_ssl_cert(), plug_set_ssl_key(), and plug_set_ssl_pem_password().


| void plug_set_ssl_key | ( | struct script_infos * | args, |
| char * | key ) |
Definition at line 1426 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().


| void plug_set_ssl_pem_password | ( | struct script_infos * | args, |
| char * | key ) |
Definition at line 1432 of file plugutils.c.
References plug_set_ssl_item().
Referenced by plugin_run_find_service().


| void post_alarm | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | action, | ||
| const char * | uri ) |
Definition at line 774 of file plugutils.c.
References oid, and proto_post_alarm().
Referenced by mark_fssniffer(), mark_netbus_server(), mark_sub7_server(), mark_wild_shell(), and security_message().


| void post_error | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | action, | ||
| const char * | uri ) |
Definition at line 818 of file plugutils.c.
References oid, and proto_post_error().
Referenced by error_message2().


| void post_log | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | action ) |
Post a log message about a tcp port.
Definition at line 794 of file plugutils.c.
References oid, and proto_post_log().
Referenced by mark_acap_server(), mark_adsgone(), mark_auth_server(), mark_avotus_mm_server(), mark_BitTorrent_server(), mark_chargen_server(), mark_citrix_server(), mark_cvslockserver(), mark_cvspserver(), mark_cvsupserver(), mark_dameware_server(), mark_dictd_server(), mark_direct_connect_hub(), mark_echo_server(), mark_eggdrop_server(), mark_ens_server(), mark_exchg_routing_server(), mark_finger_server(), mark_ftp_server(), mark_fw1(), mark_giop_server(), mark_gnocatan_server(), mark_gnome14_server(), mark_gnuserv(), mark_gopher_server(), mark_http_proxy(), mark_http_server(), mark_imap_server(), mark_interscan_viruswall(), mark_ircxpro_admin_server(), mark_iss_realsecure(), mark_jabber_server(), mark_linuxconf(), mark_LISa_server(), mark_listserv_server(), mark_locked_adsubtract_server(), mark_lpd_server(), mark_lyskom_server(), mark_mldonkey(), mark_mon_server(), mark_mongodb(), mark_msdtc_server(), mark_mysql(), mark_nagiosd_server(), mark_nntp_server(), mark_ofa_express_server(), mark_pblocald_server(), mark_pbmaster_server(), mark_ph_server(), mark_pnsclient(), mark_pop3pw_server(), mark_pop_server(), mark_postgresql(), mark_ppp_daemon(), mark_psybnc(), mark_quicktime_streaming_server(), mark_remote_nc_server(), mark_rmserver(), mark_rsync(), mark_shoutcast_server(), mark_smppd_server(), mark_smtp_server(), mark_smux_server(), mark_snpp_server(), mark_socks_proxy(), mark_spamd_server(), mark_sphinxql(), mark_ssh_server(), mark_stonegate_auth_server(), mark_tcpmux_server(), mark_teamspeak2_server(), mark_telnet_server(), mark_time_server(), mark_unknown_svc(), mark_upsmon_server(), mark_uucp_server(), mark_veritas_backup(), mark_vmware_auth(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), mark_wrapped_svc(), mark_zebra_server(), and plugin_do_run().

| void post_log_with_uri | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | action, | ||
| const char * | uri ) |
Post a log message about a tcp port with a uri.
Definition at line 804 of file plugutils.c.
References oid, and proto_post_log().
Referenced by log_message().


| void proto_post_alarm | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | proto, | ||
| const char * | action, | ||
| const char * | uri ) |
Definition at line 767 of file plugutils.c.
References ALARM, oid, and proto_post_wrapped().
Referenced by post_alarm(), and security_message().


| void proto_post_error | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | proto, | ||
| const char * | action, | ||
| const char * | uri ) |
Definition at line 811 of file plugutils.c.
References ERRMSG, oid, and proto_post_wrapped().
Referenced by error_message2(), and post_error().


| void proto_post_log | ( | const char * | oid, |
| struct script_infos * | desc, | ||
| int | port, | ||
| const char * | proto, | ||
| const char * | action, | ||
| const char * | uri ) |
Post a log message.
Definition at line 784 of file plugutils.c.
References LOG, oid, and proto_post_wrapped().
Referenced by log_message(), post_log(), and post_log_with_uri().


|
static |
Post a security message (e.g. LOG, NOTE, WARNING ...).
| oid | The oid of the NVT |
| desc | The script infos where to get settings. |
| port | Port number related to the issue. |
| proto | Protocol related to the issue (tcp or udp). |
| action | The actual result text |
| msg_type | The message type. |
| uri | Location like file path or webservice URL. |
Definition at line 709 of file plugutils.c.
References current_vhost, get_main_kb(), hostname, is_utf8_encoded(), kb_item_push_str_with_main_kb_check(), length, msg_type_to_str(), script_infos::name, oid, plug_get_host_ip(), and script_infos::vhosts.
Referenced by proto_post_alarm(), proto_post_error(), and proto_post_log().


| void scanner_add_port | ( | struct script_infos * | args, |
| int | port, | ||
| char * | proto ) |
Definition at line 1151 of file plugutils.c.
References host_add_port_proto().
Referenced by banner_grab(), nasl_scanner_add_port(), sendpacket(), and v6_sendpacket().


|
static |
Definition at line 1172 of file plugutils.c.
Referenced by plug_fork_child(), and plug_get_key().

|
static |
Report state of preferences "unscanned_closed".
Definition at line 137 of file plugutils.c.
Referenced by kb_get_port_state_proto().

| gvm_vhost_t* current_vhost = NULL |
Definition at line 89 of file plugutils.c.
Referenced by plug_current_vhost(), plug_get_host_fqdn(), plug_get_host_source(), and proto_post_wrapped().
| int global_nasl_debug = 0 |
Definition at line 39 of file plugutils.c.
Referenced by main(), plug_replace_key_len(), plug_set_key_len(), and plug_set_key_len_volatile().
|
static |
Definition at line 42 of file plugutils.c.
Referenced by add_kb_usage().
|
static |
Definition at line 44 of file plugutils.c.
Referenced by add_kb_usage(), and init_kb_usage().