OpenVAS Scanner 23.32.3
plugutils.h File Reference

Header file for module plugutils. More...

#include "scanneraux.h"
#include <gvm/base/nvti.h>
Include dependency graph for plugutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARG_STRING   1
#define ARG_INT   2
#define post_alarm_tcp   post_alarm
#define post_error_tcp   post_error
#define post_log_tcp   post_log

Enumerations

enum  msg_t {
  ERRMSG , HOST_START , HOST_END , LOG ,
  HOST_DETAIL , ALARM , DEADHOST , HOSTS_COUNT
}

Functions

void init_kb_usage (void)
void scanner_add_port (struct script_infos *, int, char *)
void plug_set_dep (struct script_infos *, const char *)
void plug_set_ssl_cert (struct script_infos *, char *)
void plug_set_ssl_key (struct script_infos *, char *)
void plug_set_ssl_pem_password (struct script_infos *, char *)
void plug_set_ssl_CA_file (struct script_infos *, char *)
const char * plug_current_vhost (void)
char * plug_get_host_fqdn (struct script_infos *)
int plug_add_host_fqdn (struct script_infos *, const char *, const char *)
GSList * plug_get_host_fqdn_list (struct script_infos *)
char * plug_get_host_source (struct script_infos *, const char *)
unsigned int plug_get_host_open_port (struct script_infos *desc)
void plug_set_port_transport (struct script_infos *, int, int)
int plug_get_port_transport (struct script_infos *, int)
struct script_infosplug_create_from_nvti_and_prefs (const nvti_t *)
void proto_post_alarm (const char *, struct script_infos *, int, const char *, const char *, const char *)
void post_alarm (const char *, struct script_infos *, int, const char *, const char *)
void post_alarm_udp (struct script_infos *, int, const char *, const char *)
void proto_post_error (const char *, struct script_infos *, int, const char *, const char *, const char *)
void post_error (const char *, struct script_infos *, int, const char *, const char *)
void proto_post_log (const char *, struct script_infos *, int, const char *, const char *, const char *)
 Post a log message.
void post_log (const char *, struct script_infos *, int, const char *)
 Post a log message about a tcp port.
void post_log_with_uri (const char *, struct script_infos *, int, const char *, const char *)
 Post a log message about a tcp port with a uri.
int host_get_port_state (struct script_infos *, int)
int host_get_port_state_udp (struct script_infos *, int)
int check_kb_inconsistency (kb_t)
 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.
int kb_item_push_str_with_main_kb_check (kb_t, const char *, const char *)
 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, const char *, const char *, size_t)
 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, const char *, const char *, size_t, int)
 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, const char *, int)
 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, const char *, int)
 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, const char *, int)
 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.
void plug_set_key (struct script_infos *, char *, int, const void *)
void plug_set_key_len (struct script_infos *, char *, int, const void *, size_t)
void plug_set_key_volatile (struct script_infos *, char *, int, const void *, int)
 Set volatile key with expire.
void plug_set_key_len_volatile (struct script_infos *, char *, int, const void *, int, size_t)
 Set volatile key with expire.
void plug_replace_key (struct script_infos *, char *, int, void *)
void plug_replace_key_len (struct script_infos *, char *, int, void *, size_t)
kb_t plug_get_kb (struct script_infos *)
void * plug_get_key (struct script_infos *, char *, int *, size_t *, int)
 Get values from a kb under the given key name.
struct in6_addr * plug_get_host_ip (struct script_infos *)
char * plug_get_host_ip_str (struct script_infos *)
char * get_plugin_preference (const char *, const char *, int)
 Get the a plugins preference.
const char * get_plugin_preference_fname (struct script_infos *, const char *)
 Get the file name of a plugins preference that is of type "file".
char * get_plugin_preference_file_content (struct script_infos *, const char *)
 Get the file contents of a plugins preference that is of type "file".
long get_plugin_preference_file_size (struct script_infos *, const char *)
 Get the file size of a plugins preference that is of type "file".
int kb_get_port_state_proto (kb_t kb, int portnum, char *proto)

Detailed Description

Header file for module plugutils.

Definition in file plugutils.h.

Macro Definition Documentation

◆ ARG_INT

◆ ARG_STRING

◆ post_alarm_tcp

#define post_alarm_tcp   post_alarm

Definition at line 101 of file plugutils.h.

◆ post_error_tcp

#define post_error_tcp   post_error

Definition at line 110 of file plugutils.h.

◆ post_log_tcp

#define post_log_tcp   post_log

Definition at line 123 of file plugutils.h.

Enumeration Type Documentation

◆ msg_t

enum msg_t
Enumerator
ERRMSG 
HOST_START 
HOST_END 
LOG 
HOST_DETAIL 
ALARM 
DEADHOST 
HOSTS_COUNT 

Definition at line 78 of file plugutils.h.

79{
80 ERRMSG,
83 LOG,
85 ALARM,
88} msg_t;
msg_t
Definition plugutils.h:79
@ HOST_DETAIL
Definition plugutils.h:84
@ HOSTS_COUNT
Definition plugutils.h:87
@ HOST_END
Definition plugutils.h:82
@ ALARM
Definition plugutils.h:85
@ DEADHOST
Definition plugutils.h:86
@ LOG
Definition plugutils.h:83
@ ERRMSG
Definition plugutils.h:80
@ HOST_START
Definition plugutils.h:81

Function Documentation

◆ check_kb_inconsistency()

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.

Parameters
main_kbCurrent main kb.
Returns
0 on success, -1 on missing global scan_id, -2 on missing current_scan_id, -3 when inconsistent.

Definition at line 442 of file plugutils.c.

443{
444 const char *original_scan_id;
445 char *current_scan_id;
446
447 original_scan_id = get_scan_id ();
448 if (original_scan_id == NULL)
449 return -1;
450 current_scan_id = kb_item_get_str (main_kb, ("internal/scanid"));
451 if (current_scan_id == NULL)
452 return -2;
453
454 if (!g_strcmp0 (original_scan_id, current_scan_id))
455 {
456 g_free (current_scan_id);
457 return 0;
458 }
459
460 g_warning ("KB inconsitency. %s writing into %s KB", original_scan_id,
461 current_scan_id);
462 g_free (current_scan_id);
463 return -3;
464}
kb_t main_kb
Definition kb_cache.c:15
const char * get_scan_id()
Definition scan_id.c:22

References get_scan_id(), and main_kb.

Referenced by attack_host(), check_kb_inconsistency_log(), and set_scan_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_plugin_preference()

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.

Parameters
[in]oidScript OID to get the preference from
[in]nameName of the preference to get
[in]pref_idId of the preferences to get
Returns
script preference on success, Null otherwise.

Definition at line 832 of file plugutils.c.

833{
834 GHashTable *prefs;
835 GHashTableIter iter;
836 char *cname = NULL, *retval = NULL;
837 void *itername, *itervalue;
838 char prefix[1024], suffix[1024];
839
840 prefs = preferences_get ();
841 if (!prefs || !nvticache_initialized () || !oid || (!name && pref_id < 0))
842 return NULL;
843
844 g_hash_table_iter_init (&iter, prefs);
845
846 if (pref_id >= 0)
847 {
848 snprintf (prefix, sizeof (prefix), "%s:%d:", oid, pref_id);
849 while (g_hash_table_iter_next (&iter, &itername, &itervalue))
850 {
851 if (g_str_has_prefix (itername, prefix))
852 {
853 retval = g_strdup (itervalue);
854 break;
855 }
856 }
857 }
858 else
859 {
860 cname = g_strdup (name);
861 g_strchomp (cname);
862 snprintf (prefix, sizeof (prefix), "%s:", oid);
863 snprintf (suffix, sizeof (suffix), ":%s", cname);
864 /* NVT preferences received in OID:PrefID:PrefType:PrefName form */
865 while (g_hash_table_iter_next (&iter, &itername, &itervalue))
866 {
867 if (g_str_has_prefix (itername, prefix)
868 && g_str_has_suffix (itername, suffix))
869 {
870 retval = g_strdup (itervalue);
871 break;
872 }
873 }
874 }
875
876 /* If no value set by the user, get the default one. */
877 if (!retval)
878 {
879 GSList *nprefs, *tmp;
880
881 tmp = nprefs = nvticache_get_prefs (oid);
882 while (tmp)
883 {
884 if ((cname && !strcmp (cname, nvtpref_name (tmp->data)))
885 || (pref_id >= 0 && pref_id == nvtpref_id (tmp->data)))
886 {
887 if (!strcmp (nvtpref_type (tmp->data), "radio"))
888 {
889 char **opts =
890 g_strsplit (nvtpref_default (tmp->data), ";", -1);
891
892 retval = g_strdup (opts[0]);
893 g_strfreev (opts);
894 }
895 else
896 retval = g_strdup (nvtpref_default (tmp->data));
897
898 break;
899 }
900 tmp = tmp->next;
901 }
902 g_slist_free_full (nprefs, (void (*) (void *)) nvtpref_free);
903 }
904 if (cname)
905 g_free (cname);
906 return retval;
907}
const char * oid
const char * name
Definition nasl_init.c:439
static void prefix(int n, int i)
Definition nasl_tree.c:219

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_plugin_preference_file_content()

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.

Parameters
identifierIdentifier that was supplied by the client when the file was uploaded.
Returns
Contents of the file identified by identifier, NULL if not found or setup broken.

Definition at line 975 of file plugutils.c.

977{
978 struct scan_globals *globals = desc->globals;
979 GHashTable *trans;
980
981 if (!globals)
982 return NULL;
983
984 trans = globals->files_translation;
985 if (!trans)
986 return NULL;
987
988 return g_hash_table_lookup (trans, identifier);
989}
GHashTable * files_translation
Definition scanneraux.h:20
struct scan_globals * globals
Definition scanneraux.h:30

References scan_globals::files_translation, and script_infos::globals.

Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().

Here is the caller graph for this function:

◆ get_plugin_preference_file_size()

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.

Parameters
identifierIdentifier that was supplied by the client when the file was uploaded.
Returns
Size of the file identified by identifier, -1 if not found or setup broken.

Definition at line 1006 of file plugutils.c.

1008{
1009 struct scan_globals *globals = desc->globals;
1010 GHashTable *trans;
1011 gchar *filesize_str;
1012
1013 if (!globals)
1014 return -1;
1015
1016 trans = globals->files_size_translation;
1017 if (!trans)
1018 return -1;
1019
1020 filesize_str = g_hash_table_lookup (trans, identifier);
1021 if (filesize_str == NULL)
1022 return -1;
1023
1024 return atol (filesize_str);
1025}
GHashTable * files_size_translation
Definition scanneraux.h:21

References scan_globals::files_size_translation, and script_infos::globals.

Referenced by get_plugin_preference_fname(), and script_get_preference_file_content().

Here is the caller graph for this function:

◆ get_plugin_preference_fname()

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.

Returns
Filename on disc for filename, NULL if not found or setup broken.

Definition at line 920 of file plugutils.c.

921{
922 const char *content;
923 long contentsize = 0;
924 gint tmpfile;
925 gchar *tmpfilename;
926 GError *error = NULL;
927
928 content = get_plugin_preference_file_content (desc, filename);
929 if (content == NULL)
930 {
931 return NULL;
932 }
933 contentsize = get_plugin_preference_file_size (desc, filename);
934 if (contentsize <= 0)
935 return NULL;
936
937 tmpfile =
938 g_file_open_tmp ("openvas-file-upload.XXXXXX", &tmpfilename, &error);
939 if (tmpfile == -1)
940 {
941 g_message ("get_plugin_preference_fname: Could not open temporary"
942 " file for %s: %s",
943 filename, error->message);
944 g_error_free (error);
945 return NULL;
946 }
947 close (tmpfile);
948
949 if (!g_file_set_contents (tmpfilename, content, contentsize, &error))
950 {
951 g_message ("get_plugin_preference_fname: could set contents of"
952 " temporary file for %s: %s",
953 filename, error->message);
954 g_error_free (error);
955 return NULL;
956 }
957
958 return tmpfilename;
959}
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".
Definition plugutils.c:975
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".
Definition plugutils.c:1006

References get_plugin_preference_file_content(), and get_plugin_preference_file_size().

Referenced by plugin_run_find_service(), and script_get_preference_file_location().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_get_port_state()

int host_get_port_state ( struct script_infos * plugdata,
int portnum )

Definition at line 193 of file plugutils.c.

194{
195 return (host_get_port_state_proto (plugdata, portnum, "tcp"));
196}
static int host_get_port_state_proto(struct script_infos *args, int portnum, char *proto)
Definition plugutils.c:187

References host_get_port_state_proto().

Referenced by get_port_state(), and open_sock_tcp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

200{
201 return (host_get_port_state_proto (plugdata, portnum, "udp"));
202}

References host_get_port_state_proto().

Referenced by get_udp_port_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_kb_usage()

void init_kb_usage ( void )

Definition at line 47 of file plugutils.c.

48{
49 const char *usage_char;
50 int usage_int;
51 usage_char = prefs_get ("max_mem_kb");
52 if (usage_char)
53 {
54 usage_int = atoi (usage_char);
55 if (usage_int < 0)
56 {
57 max_kb_usage = 0;
58 }
59 else
60 {
61 max_kb_usage = (size_t) usage_int * 1024 * 1024;
62 }
63 }
64 else
65 max_kb_usage = 0;
66}
static size_t max_kb_usage
Definition plugutils.c:44

References max_kb_usage.

Referenced by pluginlaunch_init().

Here is the caller graph for this function:

◆ kb_get_port_state_proto()

int kb_get_port_state_proto ( kb_t kb,
int portnum,
char * proto )
Parameters
protoProtocol (udp/tcp). If NULL, "tcp" will be used.

Definition at line 149 of file plugutils.c.

150{
151 char port_s[255], *kbstr;
152 const char *prange = prefs_get ("port_range");
153 port_protocol_t port_type;
154 array_t *port_ranges;
155
156 if (!proto)
157 proto = "tcp";
158 if (!strcmp (proto, "udp"))
159 {
160 port_type = PORT_PROTOCOL_UDP;
161 kbstr = "Host/udp_scanned";
162 }
163 else
164 {
165 port_type = PORT_PROTOCOL_TCP;
166 kbstr = "Host/scanned";
167 }
168
169 /* Check that we actually scanned the port */
170 if (kb_item_get_int (kb, kbstr) <= 0)
171 return unscanned_ports_as_closed (port_type);
172
173 port_ranges = port_range_ranges (prange);
174 if (!port_in_port_ranges (portnum, port_type, port_ranges))
175 {
176 array_free (port_ranges);
177 return unscanned_ports_as_closed (port_type);
178 }
179 array_free (port_ranges);
180
181 /* Ok, we scanned it. What is its state ? */
182 snprintf (port_s, sizeof (port_s), "Ports/%s/%d", proto, portnum);
183 return kb_item_get_int (kb, port_s) > 0;
184}
static int unscanned_ports_as_closed(port_protocol_t ptype)
Report state of preferences "unscanned_closed".
Definition plugutils.c:137

Referenced by host_get_port_state_proto().

Here is the caller graph for this function:

◆ kb_item_add_int_unique_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 657 of file plugutils.c.

658{
659 int result = check_kb_inconsistency_log ();
660 return result == 0 ? kb_item_add_int_unique (kb, name, value) : -1;
661}
static int check_kb_inconsistency_log(void)
calls check_kb_inconsistency and logs as debug when local scan_id is missing.
Definition plugutils.c:481

References check_kb_inconsistency_log(), and name.

Referenced by set_kb_readable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kb_item_add_int_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 633 of file plugutils.c.

634{
635 int result = check_kb_inconsistency_log ();
636 return result == 0 ? kb_item_add_int (kb, name, value) : -1;
637}

References check_kb_inconsistency_log(), and name.

Here is the call graph for this function:

◆ kb_item_add_str_unique_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 583 of file plugutils.c.

586{
587 int result = check_kb_inconsistency_log ();
588 return result == 0 ? kb_item_add_str_unique (kb, name, value, len, pos) : -1;
589}
uint8_t len

References check_kb_inconsistency_log(), len, and name.

Here is the call graph for this function:

◆ kb_item_push_str_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 533 of file plugutils.c.

535{
536 int result = check_kb_inconsistency_log ();
537 return result == 0 ? kb_item_push_str (kb, name, value) : -1;
538}

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kb_item_set_int_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 609 of file plugutils.c.

610{
611 int result = check_kb_inconsistency_log ();
612 return result == 0 ? kb_item_set_int (kb, name, value) : -1;
613}

References check_kb_inconsistency_log(), and name.

Referenced by check_host_still_alive(), open_sock_tcp(), and overwrite_openvas_prefs_with_prefs_from_client().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kb_item_set_str_with_main_kb_check()

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.

Parameters
kbKb where to store the item into.
namekey for the given value.
valueto store under key within kb.
Returns
0 on success, -1 on inconsistency.

Definition at line 558 of file plugutils.c.

560{
561 int result = check_kb_inconsistency_log ();
562 return result == 0 ? kb_item_set_str (kb, name, value, len) : -1;
563}

References check_kb_inconsistency_log(), len, and name.

Referenced by attack_start(), overwrite_openvas_prefs_with_prefs_from_client(), and set_scan_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_add_host_fqdn()

int plug_add_host_fqdn ( struct script_infos * args,
const char * hostname,
const char * source )

Definition at line 257 of file plugutils.c.

259{
260 gvm_vhost_t *vhost;
261 char **excluded;
262
263 if (!prefs_get_bool ("expand_vhosts") || !hostname || !source)
264 return -1;
265
267 return -1;
268
269 /* Check for excluded vhost value. */
270 if (prefs_get ("exclude_hosts"))
271 {
272 char **tmp = excluded = g_strsplit (prefs_get ("exclude_hosts"), ",", 0);
273
274 while (*tmp)
275 {
276 if (!strcmp (g_strstrip (*tmp), hostname))
277 {
278 g_strfreev (excluded);
279 return -1;
280 }
281 tmp++;
282 }
283 g_strfreev (excluded);
284 }
285 vhost = gvm_vhost_new (g_strdup (hostname), g_strdup (source));
286 args->vhosts = g_slist_prepend (args->vhosts, vhost);
287 return 0;
288}
const char * hostname
static int check_duplicated_vhost(struct script_infos *args, const char *hostname)
Check for duplicated vhosts before inserting a new one.
Definition plugutils.c:213
GSList * vhosts
Definition scanneraux.h:38

References check_duplicated_vhost(), hostname, and script_infos::vhosts.

Referenced by add_hostname().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_create_from_nvti_and_prefs()

struct script_infos * plug_create_from_nvti_and_prefs ( const nvti_t * )

◆ plug_current_vhost()

const char * plug_current_vhost ( void )

Definition at line 93 of file plugutils.c.

94{
95 if (current_vhost != NULL)
96 return current_vhost->value;
97
98 return NULL;
99}
gvm_vhost_t * current_vhost
Definition plugutils.c:89

References current_vhost.

Referenced by nasl_end_denial(), and open_sock_tcp().

Here is the caller graph for this function:

◆ plug_get_host_fqdn()

char * plug_get_host_fqdn ( struct script_infos * args)

Definition at line 291 of file plugutils.c.

292{
293 GSList *vhosts = args->vhosts;
294
295 if (!args->vhosts)
296 return addr6_as_str (args->ip);
297
298 /* Workaround for rapid growth of forked processes ie. http_get() calls
299 * within foreach() loops. */
300 if (current_vhost)
301 return g_strdup (current_vhost->value);
302 while (vhosts)
303 {
304 int ret = plug_fork_child (args->key);
305
306 if (ret == 0)
307 {
308 current_vhost = vhosts->data;
309 return g_strdup (current_vhost->value);
310 }
311 else if (ret == -1)
312 return NULL;
313 vhosts = vhosts->next;
314 }
315
316 // Allow to return to the main process if parent process is openvas-nasl.
317 // So, the main process can do e.g. a kb clean up
318 if (args->standalone)
319 return NULL;
320
321 _exit (0);
322}
static int plug_fork_child(kb_t)
Spawns a new child process. Setups everything that is needed for a new process. Child must be handled...
Definition plugutils.c:1186
struct in6_addr * ip
Definition scanneraux.h:37

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_get_host_fqdn_list()

GSList * plug_get_host_fqdn_list ( struct script_infos * args)

Definition at line 325 of file plugutils.c.

326{
327 GSList *results = NULL, *vhosts = args->vhosts;
328
329 if (!args->vhosts)
330 results = g_slist_prepend (results, addr6_as_str (args->ip));
331
332 while (vhosts)
333 {
334 gvm_vhost_t *vhost = vhosts->data;
335
336 results = g_slist_prepend (results, g_strdup (vhost->value));
337 vhosts = vhosts->next;
338 }
339 return results;
340}

References script_infos::ip, and script_infos::vhosts.

Referenced by get_hostnames().

Here is the caller graph for this function:

◆ plug_get_host_ip()

◆ plug_get_host_ip_str()

char * plug_get_host_ip_str ( struct script_infos * desc)

Definition at line 377 of file plugutils.c.

378{
379 return addr6_as_str (plug_get_host_ip (desc));
380}
struct in6_addr * plug_get_host_ip(struct script_infos *args)
Definition plugutils.c:371

References plug_get_host_ip().

Referenced by host_reverse_lookup(), nasl_snmpv1v2c_get(), nasl_snmpv3_get_action(), open_sock_tcp(), and socket_negotiate_ssl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_get_host_open_port()

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 1323 of file plugutils.c.

1324{
1325 kb_t kb = plug_get_kb (desc);
1326 struct kb_item *res, *k;
1327 int open21 = 0, open80 = 0;
1328#define MAX_CANDIDATES 16
1329 u_short candidates[MAX_CANDIDATES];
1330 int num_candidates = 0;
1331
1332 k = res = kb_item_get_pattern (kb, "Ports/tcp/*");
1333 if (res == NULL)
1334 return 0;
1335 else
1336 {
1337 int ret;
1338 char *s;
1339
1340 for (;;)
1341 {
1342 s = res->name + sizeof ("Ports/tcp/") - 1;
1343 ret = atoi (s);
1344 if (ret == 21)
1345 open21 = 1;
1346 else if (ret == 80)
1347 open80 = 1;
1348 else
1349 {
1350 candidates[num_candidates++] = ret;
1351 if (num_candidates >= MAX_CANDIDATES)
1352 break;
1353 }
1354 res = res->next;
1355 if (res == NULL)
1356 break;
1357 }
1358
1359 kb_item_free (k);
1360 if (num_candidates != 0)
1361 return candidates[lrand48 () % num_candidates];
1362 else if (open21)
1363 return 21;
1364 else if (open80)
1365 return 80;
1366 }
1367
1368 /* Not reachable */
1369 return 0;
1370}
#define MAX_CANDIDATES
kb_t plug_get_kb(struct script_infos *args)
Definition plugutils.c:1152

References MAX_CANDIDATES, and plug_get_kb().

Referenced by get_host_open_port(), nasl_start_denial(), nasl_tcp_ping(), and nasl_tcp_v6_ping().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_get_host_source()

char * plug_get_host_source ( struct script_infos * args,
const char * hostname )

Definition at line 343 of file plugutils.c.

344{
345 if (!args->vhosts)
346 return g_strdup ("IP-address");
347
348 if (hostname)
349 {
350 GSList *vhosts = args->vhosts;
351
352 /* Search for source of specified hostname/vhost. */
353 while (vhosts)
354 {
355 gvm_vhost_t *vhost = vhosts->data;
356
357 if (!strcmp (vhost->value, hostname))
358 return g_strdup (vhost->source);
359 vhosts = vhosts->next;
360 }
361 return NULL;
362 }
363 /* Call plug_get_host_fqdn() to set current_vhost (and fork, in case of
364 * multiple vhosts.) */
365 if (!current_vhost)
366 g_free (plug_get_host_fqdn (args));
367 return g_strdup (current_vhost->source);
368}
char * plug_get_host_fqdn(struct script_infos *args)
Definition plugutils.c:291

References current_vhost, hostname, plug_get_host_fqdn(), and script_infos::vhosts.

Referenced by get_hostname_source().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_get_kb()

◆ plug_get_key()

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.

Parameters
[in]argsThe script infos where to get the kb from.
[in]nameKey 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]lenDesired string length to be returned.
[in]singleIn case of a list, fetch only the last element
Returns
Null if no result, or a void pointer to the result in success.

Definition at line 1226 of file plugutils.c.

1228{
1229 kb_t kb = args->key;
1230 struct kb_item *res = NULL, *res_list;
1231
1232 if (type != NULL && *type != KB_TYPE_INT)
1233 *type = -1;
1234
1235 if (kb == NULL)
1236 return NULL;
1237
1238 if (single && type != NULL && *type != KB_TYPE_INT)
1239 res = kb_item_get_single (kb, name, KB_TYPE_UNSPEC);
1240 else if (type != NULL && *type == KB_TYPE_INT)
1241 res = kb_item_get_single (kb, name, KB_TYPE_INT);
1242 else
1243 res = kb_item_get_all (kb, name);
1244
1245 if (res == NULL)
1246 return NULL;
1247
1248 if (!res->next) /* No fork - good */
1249 {
1250 void *ret;
1251 if (res->type == KB_TYPE_INT)
1252 {
1253 if (type != NULL)
1254 *type = KB_TYPE_INT;
1255 ret = g_memdup2 (&res->v_int, sizeof (res->v_int));
1256 }
1257 else
1258 {
1259 if (type != NULL)
1260 *type = KB_TYPE_STR;
1261 if (len)
1262 *len = res->len;
1263
1264 ret = g_malloc0 (res->len + 1);
1265 memcpy (ret, res->v_str, res->len + 1);
1266 }
1267 kb_item_free (res);
1268 return ret;
1269 }
1270
1271 /* More than one value - we will fork() then */
1272 sig_n (SIGCHLD, plug_get_key_sigchld);
1273 res_list = res;
1274 while (res)
1275 {
1276 int pret = plug_fork_child (kb);
1277
1278 if (pret == 0)
1279 {
1280 /* Forked child. */
1281 void *ret;
1282
1283 if (res->type == KB_TYPE_INT)
1284 {
1285 if (type != NULL)
1286 *type = KB_TYPE_INT;
1287 ret = g_memdup2 (&res->v_int, sizeof (res->v_int));
1288 }
1289 else
1290 {
1291 if (type != NULL)
1292 *type = KB_TYPE_STR;
1293 if (len)
1294 *len = res->len;
1295
1296 ret = g_malloc0 (res->len + 1);
1297 memcpy (ret, res->v_str, res->len + 1);
1298 }
1299 kb_item_free (res_list);
1300 return ret;
1301 }
1302 else if (pret == -1)
1303 return NULL;
1304 res = res->next;
1305 }
1306 kb_item_free (res_list);
1307
1308 // Allow to return to the main process if parent process is openvas-nasl.
1309 // So, the main process can do e.g. a kb clean up
1310 if (args->standalone)
1311 return NULL;
1312
1313 _exit (0);
1314}
static void sig_n(int signo, void(*fnc)(int))
Definition plugutils.c:1167
static void plug_get_key_sigchld(int s)
Definition plugutils.c:1158

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_get_port_transport()

int plug_get_port_transport ( struct script_infos * args,
int port )

Definition at line 1391 of file plugutils.c.

1392{
1393 char s[256];
1394 int trp;
1395
1396 snprintf (s, sizeof (s), "Transports/TCP/%d", port);
1397 trp = kb_item_get_int (plug_get_kb (args), s);
1398 if (trp >= 0)
1399 return trp;
1400 else
1401 return OPENVAS_ENCAPS_IP; /* Change this to 0 for ultra smart SSL
1402 negotiation, at the expense of possibly
1403 breaking stuff */
1404}
@ OPENVAS_ENCAPS_IP
Definition network.h:31

References OPENVAS_ENCAPS_IP, and plug_get_kb().

Referenced by get_port_transport(), and open_stream_auto_encaps_ext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_replace_key()

void plug_replace_key ( struct script_infos * args,
char * name,
int type,
void * value )

◆ plug_replace_key_len()

void plug_replace_key_len ( struct script_infos * args,
char * name,
int type,
void * value,
size_t len )

Definition at line 1113 of file plugutils.c.

1115{
1116 kb_t kb = plug_get_kb (args);
1117
1118 if (name == NULL || value == NULL)
1119 return;
1120
1121 if (type == ARG_STRING)
1122 {
1123 if (add_kb_usage (args, len) == -1)
1124 return;
1125 kb_item_set_str (kb, name, value, len);
1126 }
1127 else if (type == ARG_INT)
1128 kb_item_set_int (kb, name, GPOINTER_TO_SIZE (value));
1129 if (global_nasl_debug == 1)
1130 {
1131 if (type == ARG_STRING)
1132 g_message ("replace key %s -> %s", name, (char *) value);
1133 else if (type == ARG_INT)
1134 g_message ("replace key %s -> %d", name,
1135 (int) GPOINTER_TO_SIZE (value));
1136 }
1137}
int global_nasl_debug
Definition plugutils.c:39
static int add_kb_usage(struct script_infos *args, size_t size)
Definition plugutils.c:69
#define ARG_STRING
Definition plugutils.h:19
#define ARG_INT
Definition plugutils.h:20

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_dep()

void plug_set_dep ( struct script_infos * args,
const char * depname )

Definition at line 104 of file plugutils.c.

105{
106 nvti_t *n = args->nvti;
107 gchar *old = nvti_dependencies (n);
108 gchar *new;
109
110 if (!depname)
111 return;
112
113 if (old)
114 {
115 new = g_strdup_printf ("%s, %s", old, depname);
116 nvti_set_dependencies (n, new);
117 g_free (new);
118 }
119 else
120 nvti_set_dependencies (n, depname);
121}
nvti_t * nvti
Definition scanneraux.h:33

References script_infos::nvti.

Referenced by script_dependencies().

Here is the caller graph for this function:

◆ plug_set_key()

void plug_set_key ( struct script_infos * args,
char * name,
int type,
const void * value )

Definition at line 1055 of file plugutils.c.

1057{
1058 plug_set_key_len (args, name, type, value, 0);
1059}
void plug_set_key_len(struct script_infos *args, char *name, int type, const void *value, size_t len)
Definition plugutils.c:1028

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_key_len()

void plug_set_key_len ( struct script_infos * args,
char * name,
int type,
const void * value,
size_t len )

Definition at line 1028 of file plugutils.c.

1030{
1031 kb_t kb = plug_get_kb (args);
1032 int pos = 0; // Append the item on the right position of the list
1033
1034 if (name == NULL || value == NULL)
1035 return;
1036
1037 if (type == ARG_STRING)
1038 {
1039 if (add_kb_usage (args, len) == -1)
1040 return;
1041 kb_item_add_str_unique (kb, name, value, len, pos);
1042 }
1043 else if (type == ARG_INT)
1044 kb_item_add_int_unique (kb, name, GPOINTER_TO_SIZE (value));
1045 if (global_nasl_debug == 1)
1046 {
1047 if (type == ARG_STRING)
1048 g_message ("set key %s -> %s", name, (char *) value);
1049 else if (type == ARG_INT)
1050 g_message ("set key %s -> %d", name, (int) GPOINTER_TO_SIZE (value));
1051 }
1052}

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_key_len_volatile()

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.

Parameters
argsScript infos.
nameKey name.
typeKey type.
valueKey value.
expireKey expire in seconds.
lenLen of value.

Definition at line 1072 of file plugutils.c.

1074{
1075 kb_t kb = plug_get_kb (args);
1076 int pos = 0; // Append the item on the right position of the list
1077
1078 if (name == NULL || value == NULL || expire == -1)
1079 return;
1080
1081 if (type == ARG_STRING)
1082 kb_add_str_unique_volatile (kb, name, value, expire, len, pos);
1083 else if (type == ARG_INT)
1084 kb_add_int_unique_volatile (kb, name, GPOINTER_TO_SIZE (value),
1085 GPOINTER_TO_SIZE (expire));
1086 if (global_nasl_debug == 1)
1087 {
1088 if (type == ARG_STRING)
1089 g_message ("set volatile key %s -> %s", name, (char *) value);
1090 else if (type == ARG_INT)
1091 g_message ("set volatile key %s -> %d", name,
1092 (int) GPOINTER_TO_SIZE (value));
1093 }
1094}

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_key_volatile()

void plug_set_key_volatile ( struct script_infos * args,
char * name,
int type,
const void * value,
int expire )

Set volatile key with expire.

Parameters
argsScript infos.
nameKey name.
typeKey type.
valueKey value.
expireKey expire in seconds.

Definition at line 1106 of file plugutils.c.

1108{
1109 plug_set_key_len_volatile (args, name, type, value, expire, 0);
1110}
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.
Definition plugutils.c:1072

References name, and plug_set_key_len_volatile().

Referenced by set_kb_item_volatile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_port_transport()

void plug_set_port_transport ( struct script_infos * args,
int port,
int tr )
Todo
Those brain damaged functions should probably be in another file They are use to remember who speaks SSL or not

Definition at line 1378 of file plugutils.c.

1379{
1380 char s[256];
1381
1382 snprintf (s, sizeof (s), "Transports/TCP/%d", port);
1383 plug_set_key (args, s, ARG_INT, GSIZE_TO_POINTER (tr));
1384}
void plug_set_key(struct script_infos *args, char *name, int type, const void *value)
Definition plugutils.c:1055

References ARG_INT, and plug_set_key().

Referenced by open_stream_auto_encaps_ext(), and plugin_do_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_ssl_CA_file()

void plug_set_ssl_CA_file ( struct script_infos * args,
char * key )
Todo
Also, all plug_set_ssl*-functions set values that are only accessed in network.c:open_stream_connection under specific conditions. Check whether these conditions can actually occur. Document the functions on the way.

Definition at line 1437 of file plugutils.c.

1438{
1439 plug_set_ssl_item (args, "CA", key);
1440}
static void plug_set_ssl_item(struct script_infos *args, char *item, char *itemfname)
Definition plugutils.c:1407

References plug_set_ssl_item().

Referenced by plugin_run_find_service().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_ssl_cert()

void plug_set_ssl_cert ( struct script_infos * args,
char * cert )

Definition at line 1415 of file plugutils.c.

1416{
1417 plug_set_ssl_item (args, "cert", cert);
1418}

References plug_set_ssl_item().

Referenced by plugin_run_find_service().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_ssl_key()

void plug_set_ssl_key ( struct script_infos * args,
char * key )

Definition at line 1421 of file plugutils.c.

1422{
1423 plug_set_ssl_item (args, "key", key);
1424}

References plug_set_ssl_item().

Referenced by plugin_run_find_service().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plug_set_ssl_pem_password()

void plug_set_ssl_pem_password ( struct script_infos * args,
char * key )

Definition at line 1427 of file plugutils.c.

1428{
1429 plug_set_ssl_item (args, "password", key);
1430}

References plug_set_ssl_item().

Referenced by plugin_run_find_service().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ post_alarm()

void post_alarm ( const char * oid,
struct script_infos * desc,
int port,
const char * action,
const char * uri )

Definition at line 769 of file plugutils.c.

771{
772 proto_post_alarm (oid, desc, port, "tcp", action, uri);
773}
void proto_post_alarm(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *uri)
Definition plugutils.c:762

References oid, and proto_post_alarm().

Referenced by mark_fssniffer(), mark_netbus_server(), mark_sub7_server(), mark_wild_shell(), and security_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ post_alarm_udp()

void post_alarm_udp ( struct script_infos * ,
int ,
const char * ,
const char *  )

◆ post_error()

void post_error ( const char * oid,
struct script_infos * desc,
int port,
const char * action,
const char * uri )

Definition at line 813 of file plugutils.c.

815{
816 proto_post_error (oid, desc, port, "tcp", action, uri);
817}
void proto_post_error(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *uri)
Definition plugutils.c:806

References oid, and proto_post_error().

Referenced by error_message2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ post_log()

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 789 of file plugutils.c.

791{
792 proto_post_log (oid, desc, port, "tcp", action, NULL);
793}
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 plugutils.c:779

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().

Here is the call graph for this function:

◆ post_log_with_uri()

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 799 of file plugutils.c.

801{
802 proto_post_log (oid, desc, port, "tcp", action, uri);
803}

References oid, and proto_post_log().

Referenced by log_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proto_post_alarm()

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 762 of file plugutils.c.

764{
765 proto_post_wrapped (oid, desc, port, proto, action, ALARM, uri);
766}
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 ...).
Definition plugutils.c:704

References ALARM, oid, and proto_post_wrapped().

Referenced by post_alarm(), and security_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proto_post_error()

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 806 of file plugutils.c.

808{
809 proto_post_wrapped (oid, desc, port, proto, action, ERRMSG, uri);
810}

References ERRMSG, oid, and proto_post_wrapped().

Referenced by error_message2(), and post_error().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ proto_post_log()

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 779 of file plugutils.c.

781{
782 proto_post_wrapped (oid, desc, port, proto, action, LOG, uri);
783}

References LOG, oid, and proto_post_wrapped().

Referenced by log_message(), post_log(), and post_log_with_uri().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scanner_add_port()

void scanner_add_port ( struct script_infos * args,
int port,
char * proto )

Definition at line 1146 of file plugutils.c.

1147{
1148 host_add_port_proto (args, port, proto);
1149}
static void host_add_port_proto(struct script_infos *args, int portnum, char *proto)
Definition plugutils.c:124

References host_add_port_proto().

Referenced by banner_grab(), nasl_scanner_add_port(), sendpacket(), and v6_sendpacket().

Here is the call graph for this function:
Here is the caller graph for this function: