OpenVAS Scanner 23.40.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 837 of file plugutils.c.

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

982{
983 struct scan_globals *globals = desc->globals;
984 GHashTable *trans;
985
986 if (!globals)
987 return NULL;
988
989 trans = globals->files_translation;
990 if (!trans)
991 return NULL;
992
993 return g_hash_table_lookup (trans, identifier);
994}
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 1011 of file plugutils.c.

1013{
1014 struct scan_globals *globals = desc->globals;
1015 GHashTable *trans;
1016 gchar *filesize_str;
1017
1018 if (!globals)
1019 return -1;
1020
1021 trans = globals->files_size_translation;
1022 if (!trans)
1023 return -1;
1024
1025 filesize_str = g_hash_table_lookup (trans, identifier);
1026 if (filesize_str == NULL)
1027 return -1;
1028
1029 return atol (filesize_str);
1030}
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 925 of file plugutils.c.

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

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:1191
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 1328 of file plugutils.c.

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

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

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

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

1397{
1398 char s[256];
1399 int trp;
1400
1401 snprintf (s, sizeof (s), "Transports/TCP/%d", port);
1402 trp = kb_item_get_int (plug_get_kb (args), s);
1403 if (trp >= 0)
1404 return trp;
1405 else
1406 return OPENVAS_ENCAPS_IP; /* Change this to 0 for ultra smart SSL
1407 negotiation, at the expense of possibly
1408 breaking stuff */
1409}
@ 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 1118 of file plugutils.c.

1120{
1121 kb_t kb = plug_get_kb (args);
1122
1123 if (name == NULL || value == NULL)
1124 return;
1125
1126 if (type == ARG_STRING)
1127 {
1128 if (add_kb_usage (args, len) == -1)
1129 return;
1130 kb_item_set_str (kb, name, value, len);
1131 }
1132 else if (type == ARG_INT)
1133 kb_item_set_int (kb, name, GPOINTER_TO_SIZE (value));
1134 if (global_nasl_debug == 1)
1135 {
1136 if (type == ARG_STRING)
1137 g_message ("replace key %s -> %s", name, (char *) value);
1138 else if (type == ARG_INT)
1139 g_message ("replace key %s -> %d", name,
1140 (int) GPOINTER_TO_SIZE (value));
1141 }
1142}
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 1060 of file plugutils.c.

1062{
1063 plug_set_key_len (args, name, type, value, 0);
1064}
void plug_set_key_len(struct script_infos *args, char *name, int type, const void *value, size_t len)
Definition plugutils.c:1033

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

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

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

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

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

1113{
1114 plug_set_key_len_volatile (args, name, type, value, expire, 0);
1115}
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:1077

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

1384{
1385 char s[256];
1386
1387 snprintf (s, sizeof (s), "Transports/TCP/%d", port);
1388 plug_set_key (args, s, ARG_INT, GSIZE_TO_POINTER (tr));
1389}
void plug_set_key(struct script_infos *args, char *name, int type, const void *value)
Definition plugutils.c:1060

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

1443{
1444 plug_set_ssl_item (args, "CA", key);
1445}
static void plug_set_ssl_item(struct script_infos *args, char *item, char *itemfname)
Definition plugutils.c:1412

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

1421{
1422 plug_set_ssl_item (args, "cert", cert);
1423}

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

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

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

1433{
1434 plug_set_ssl_item (args, "password", key);
1435}

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

776{
777 proto_post_alarm (oid, desc, port, "tcp", action, uri);
778}
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:767

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

820{
821 proto_post_error (oid, desc, port, "tcp", action, uri);
822}
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:811

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

796{
797 proto_post_log (oid, desc, port, "tcp", action, NULL);
798}
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:784

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

806{
807 proto_post_log (oid, desc, port, "tcp", action, uri);
808}

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

769{
770 proto_post_wrapped (oid, desc, port, proto, action, ALARM, uri);
771}
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:709

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

813{
814 proto_post_wrapped (oid, desc, port, proto, action, ERRMSG, uri);
815}

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

786{
787 proto_post_wrapped (oid, desc, port, proto, action, LOG, uri);
788}

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

1152{
1153 host_add_port_proto (args, port, proto);
1154}
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: