OpenVAS Scanner  7.0.0~git
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
 

Functions

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 *)
 
void post_alarm (const char *, struct script_infos *, int, const char *)
 
void post_alarm_udp (struct script_infos *, int, const char *)
 
void proto_post_error (const char *, struct script_infos *, int, const char *, const char *)
 
void post_error (const char *, struct script_infos *, int, const char *)
 
void proto_post_log (const char *, struct script_infos *, int, const char *, const char *)
 Post a log message. More...
 
void post_log (const char *, struct script_infos *, int, const char *)
 Post a log message about a tcp port. More...
 
int host_get_port_state (struct script_infos *, int)
 
int host_get_port_state_udp (struct script_infos *, int)
 
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_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. More...
 
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 *)
 
const char * get_plugin_preference_fname (struct script_infos *, const char *)
 Get the file name of a plugins preference that is of type "file". More...
 
char * get_plugin_preference_file_content (struct script_infos *, const char *)
 Get the file contents of a plugins preference that is of type "file". More...
 
long get_plugin_preference_file_size (struct script_infos *, const char *)
 Get the file size of a plugins preference that is of type "file". More...
 

Detailed Description

Header file for module plugutils.

Definition in file plugutils.h.

Macro Definition Documentation

◆ ARG_INT

#define ARG_INT   2

Definition at line 34 of file plugutils.h.

◆ ARG_STRING

#define ARG_STRING   1

Definition at line 33 of file plugutils.h.

◆ post_alarm_tcp

#define post_alarm_tcp   post_alarm

Definition at line 99 of file plugutils.h.

◆ post_error_tcp

#define post_error_tcp   post_error

Definition at line 107 of file plugutils.h.

◆ post_log_tcp

#define post_log_tcp   post_log

Definition at line 115 of file plugutils.h.

Function Documentation

◆ get_plugin_preference()

char* get_plugin_preference ( const char *  ,
const char *   
)

Definition at line 396 of file plugutils.c.

397 {
398  GHashTable *prefs;
399  GHashTableIter iter;
400  char *cname, *retval = NULL;
401  void *itername, *itervalue;
402  char prefix[1024], suffix[1024];
403 
404  prefs = preferences_get ();
405  if (!prefs || !nvticache_initialized () || !oid || !name)
406  return NULL;
407 
408  cname = g_strdup (name);
409  g_strchomp (cname);
410  g_hash_table_iter_init (&iter, prefs);
411  snprintf (prefix, sizeof (prefix), "%s:", oid);
412  snprintf (suffix, sizeof (suffix), ":%s", cname);
413  /* NVT preferences receiveed in OID:PrefID:PrefType:PrefName form */
414  while (g_hash_table_iter_next (&iter, &itername, &itervalue))
415  {
416  if (g_str_has_prefix (itername, prefix)
417  && g_str_has_suffix (itername, suffix))
418  {
419  retval = g_strdup (itervalue);
420  break;
421  }
422  }
423  /* If no value set by the user, get the default one. */
424  if (!retval)
425  {
426  GSList *nprefs, *tmp;
427 
428  tmp = nprefs = nvticache_get_prefs (oid);
429  while (tmp)
430  {
431  if (!strcmp (cname, nvtpref_name (tmp->data)))
432  {
433  retval = g_strdup (nvtpref_default (tmp->data));
434  break;
435  }
436  tmp = tmp->next;
437  }
438  g_slist_free_full (nprefs, (void (*) (void *)) nvtpref_free);
439  }
440  g_free (cname);
441  return retval;
442 }

References name, oid, and prefix().

Referenced by _http_req(), add_scantype_arguments(), add_timing_arguments(), build_cmd_line(), nmap_create(), plugin_do_run(), plugin_run_find_service(), script_get_preference(), script_get_preference_file_content(), and script_get_preference_file_location().

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

512 {
513  struct scan_globals *globals = desc->globals;
514  GHashTable *trans;
515 
516  if (!globals)
517  return NULL;
518 
519  trans = globals->files_translation;
520  if (!trans)
521  return NULL;
522 
523  return g_hash_table_lookup (trans, identifier);
524 }

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

543 {
544  struct scan_globals *globals = desc->globals;
545  GHashTable *trans;
546  gchar *filesize_str;
547 
548  if (!globals)
549  return -1;
550 
551  trans = globals->files_size_translation;
552  if (!trans)
553  return -1;
554 
555  filesize_str = g_hash_table_lookup (trans, identifier);
556  if (filesize_str == NULL)
557  return -1;
558 
559  return atol (filesize_str);
560 }

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

456 {
457  const char *content;
458  long contentsize = 0;
459  gint tmpfile;
460  gchar *tmpfilename;
461  GError *error = NULL;
462 
463  content = get_plugin_preference_file_content (desc, filename);
464  if (content == NULL)
465  {
466  return NULL;
467  }
468  contentsize = get_plugin_preference_file_size (desc, filename);
469  if (contentsize <= 0)
470  return NULL;
471 
472  tmpfile =
473  g_file_open_tmp ("openvas-file-upload.XXXXXX", &tmpfilename, &error);
474  if (tmpfile == -1)
475  {
476  g_message ("get_plugin_preference_fname: Could not open temporary"
477  " file for %s: %s",
478  filename, error->message);
479  g_error_free (error);
480  return NULL;
481  }
482  close (tmpfile);
483 
484  if (!g_file_set_contents (tmpfilename, content, contentsize, &error))
485  {
486  g_message ("get_plugin_preference_fname: could set contents of"
487  " temporary file for %s: %s",
488  filename, error->message);
489  g_error_free (error);
490  return NULL;
491  }
492 
493  return tmpfilename;
494 }

References get_plugin_preference_file_content(), and get_plugin_preference_file_size().

Referenced by nmap_create(), 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 ,
int   
)

Definition at line 154 of file plugutils.c.

155 {
156  return (host_get_port_state_proto (plugdata, portnum, "tcp"));
157 }

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 ,
int   
)

Definition at line 160 of file plugutils.c.

161 {
162  return (host_get_port_state_proto (plugdata, portnum, "udp"));
163 }

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:

◆ plug_add_host_fqdn()

int plug_add_host_fqdn ( struct script_infos ,
const char *  ,
const char *   
)

Definition at line 166 of file plugutils.c.

168 {
169  gvm_vhost_t *vhost;
170  GSList *vhosts;
171  char **excluded;
172 
173  if (!prefs_get_bool ("expand_vhosts") || !hostname || !source)
174  return -1;
175 
176  /* Check for duplicate vhost value. */
177  vhosts = args->vhosts;
178  while (vhosts)
179  {
180  gvm_vhost_t *tmp = vhosts->data;
181 
182  if (!strcmp (tmp->value, hostname))
183  {
184  g_warning ("%s: Value '%s' exists already", __FUNCTION__, hostname);
185  return -1;
186  }
187  vhosts = vhosts->next;
188  }
189  /* Check for excluded vhost value. */
190  if (prefs_get ("exclude_hosts"))
191  {
192  char **tmp = excluded = g_strsplit (prefs_get ("exclude_hosts"), ",", 0);
193 
194  while (*tmp)
195  {
196  if (!strcmp (g_strstrip (*tmp), hostname))
197  {
198  g_strfreev (excluded);
199  return -1;
200  }
201  tmp++;
202  }
203  g_strfreev (excluded);
204  }
205  vhost = gvm_vhost_new (g_strdup (hostname), g_strdup (source));
206  args->vhosts = g_slist_prepend (args->vhosts, vhost);
207  return 0;
208 }

References hostname, and script_infos::vhosts.

Referenced by add_hostname().

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

58 {
59  return current_vhost->value;
60 }

References current_vhost.

Referenced by open_sock_tcp().

Here is the caller graph for this function:

◆ plug_get_host_fqdn()

char* plug_get_host_fqdn ( struct script_infos )

Definition at line 211 of file plugutils.c.

212 {
213  GSList *vhosts = args->vhosts;
214 
215  if (!args->vhosts)
216  return addr6_as_str (args->ip);
217 
218  /* Workaround for rapid growth of forked processes ie. http_get() calls
219  * within foreach() loops. */
220  if (current_vhost)
221  return g_strdup (current_vhost->value);
222  while (vhosts)
223  {
224  pid_t pid = plug_fork_child (args->key);
225 
226  if (pid == 0)
227  {
228  current_vhost = vhosts->data;
229  return g_strdup (current_vhost->value);
230  }
231  else if (pid == -1)
232  return NULL;
233  vhosts = vhosts->next;
234  }
235  exit (0);
236 }

References current_vhost, script_infos::ip, script_infos::key, pid, plug_fork_child(), and script_infos::vhosts.

Referenced by _http_req(), get_hostname(), open_stream_connection_ext(), plug_get_host_source(), plugin_do_run(), 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 )

Definition at line 239 of file plugutils.c.

240 {
241  GSList *results = NULL, *vhosts = args->vhosts;
242 
243  if (!args->vhosts)
244  results = g_slist_prepend (results, addr6_as_str (args->ip));
245 
246  while (vhosts)
247  {
248  gvm_vhost_t *vhost = vhosts->data;
249 
250  results = g_slist_prepend (results, g_strdup (vhost->value));
251  vhosts = vhosts->next;
252  }
253  return results;
254 }

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 )

Definition at line 291 of file plugutils.c.

292 {
293  return addr6_as_str (plug_get_host_ip (desc));
294 }

References plug_get_host_ip().

Referenced by open_sock_tcp().

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

787 {
788  kb_t kb = plug_get_kb (desc);
789  struct kb_item *res, *k;
790  int open21 = 0, open80 = 0;
791 #define MAX_CANDIDATES 16
792  u_short candidates[MAX_CANDIDATES];
793  int num_candidates = 0;
794 
795  k = res = kb_item_get_pattern (kb, "Ports/tcp/*");
796  if (res == NULL)
797  return 0;
798  else
799  {
800  int ret;
801  char *s;
802 
803  for (;;)
804  {
805  s = res->name + sizeof ("Ports/tcp/") - 1;
806  ret = atoi (s);
807  if (ret == 21)
808  open21 = 1;
809  else if (ret == 80)
810  open80 = 1;
811  else
812  {
813  candidates[num_candidates++] = ret;
814  if (num_candidates >= MAX_CANDIDATES)
815  break;
816  }
817  res = res->next;
818  if (res == NULL)
819  break;
820  }
821 
822  kb_item_free (k);
823  if (num_candidates != 0)
824  return candidates[lrand48 () % num_candidates];
825  else if (open21)
826  return 21;
827  else if (open80)
828  return 80;
829  }
830 
831  /* Not reachable */
832  return 0;
833 }

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 ,
const char *   
)

Definition at line 257 of file plugutils.c.

258 {
259  if (!args->vhosts)
260  return g_strdup ("IP-address");
261 
262  if (hostname)
263  {
264  GSList *vhosts = args->vhosts;
265 
266  /* Search for source of specified hostname/vhost. */
267  while (vhosts)
268  {
269  gvm_vhost_t *vhost = vhosts->data;
270 
271  if (!strcmp (vhost->value, hostname))
272  return g_strdup (vhost->source);
273  vhosts = vhosts->next;
274  }
275  return NULL;
276  }
277  /* Call plug_get_host_fqdn() to set current_vhost (and fork, in case of
278  * multiple vhosts.) */
279  if (!current_vhost)
280  g_free (plug_get_host_fqdn (args));
281  return g_strdup (current_vhost->source);
282 }

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

701 {
702  kb_t kb = args->key;
703  struct kb_item *res = NULL, *res_list;
704 
705  if (type != NULL && *type != KB_TYPE_INT)
706  *type = -1;
707 
708  if (kb == NULL)
709  return NULL;
710 
711  if (single && *type != KB_TYPE_INT)
712  res = kb_item_get_single (kb, name, KB_TYPE_UNSPEC);
713  else if (*type == KB_TYPE_INT)
714  res = kb_item_get_single (kb, name, KB_TYPE_INT);
715  else
716  res = kb_item_get_all (kb, name);
717 
718  if (res == NULL)
719  return NULL;
720 
721  if (!res->next) /* No fork - good */
722  {
723  void *ret;
724  if (res->type == KB_TYPE_INT)
725  {
726  if (type != NULL)
727  *type = KB_TYPE_INT;
728  ret = g_memdup (&res->v_int, sizeof (res->v_int));
729  }
730  else
731  {
732  if (type != NULL)
733  *type = KB_TYPE_STR;
734  if (len)
735  *len = res->len;
736  ret = g_memdup (res->v_str, res->len + 1);
737  }
738  kb_item_free (res);
739  return ret;
740  }
741 
742  /* More than one value - we will fork() then */
744  res_list = res;
745  while (res)
746  {
747  pid_t pid = plug_fork_child (kb);
748 
749  if (pid == 0)
750  {
751  /* Forked child. */
752  void *ret;
753 
754  if (res->type == KB_TYPE_INT)
755  {
756  if (type != NULL)
757  *type = KB_TYPE_INT;
758  ret = g_memdup (&res->v_int, sizeof (res->v_int));
759  }
760  else
761  {
762  if (type != NULL)
763  *type = KB_TYPE_STR;
764  if (len)
765  *len = res->len;
766  ret = g_memdup (res->v_str, res->len + 1);
767  }
768  kb_item_free (res_list);
769  return ret;
770  }
771  else if (pid == -1)
772  return NULL;
773  res = res->next;
774  }
775  kb_item_free (res_list);
776  exit (0);
777 }

References script_infos::key, name, pid, plug_fork_child(), plug_get_key_sigchld(), and sig_chld().

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 ,
int   
)

Definition at line 854 of file plugutils.c.

855 {
856  char s[256];
857  int trp;
858 
859  snprintf (s, sizeof (s), "Transports/TCP/%d", port);
860  trp = kb_item_get_int (plug_get_kb (args), s);
861  if (trp >= 0)
862  return trp;
863  else
864  return OPENVAS_ENCAPS_IP; /* Change this to 0 for ultra smart SSL
865  negotiation, at the expense of possibly
866  breaking stuff */
867 }

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

◆ plug_replace_key_len()

void plug_replace_key_len ( struct script_infos ,
char *  ,
int  ,
void *  ,
size_t   
)

Definition at line 592 of file plugutils.c.

594 {
595  kb_t kb = plug_get_kb (args);
596 
597  if (name == NULL || value == NULL)
598  return;
599 
600  if (type == ARG_STRING)
601  kb_item_set_str (kb, name, value, len);
602  else if (type == ARG_INT)
603  kb_item_set_int (kb, name, GPOINTER_TO_SIZE (value));
604  if (global_nasl_debug == 1)
605  {
606  if (type == ARG_STRING)
607  g_message ("replace key %s -> %s", name, (char *) value);
608  else if (type == ARG_INT)
609  g_message ("replace key %s -> %d", name,
610  (int) GPOINTER_TO_SIZE (value));
611  }
612 }

References ARG_INT, ARG_STRING, global_nasl_debug, 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 ,
const char *   
)

Definition at line 65 of file plugutils.c.

66 {
67  nvti_t *n = args->nvti;
68  gchar *old = nvti_dependencies (n);
69  gchar *new;
70 
71  if (!depname)
72  return;
73 
74  if (old)
75  {
76  new = g_strdup_printf ("%s, %s", old, depname);
77  nvti_set_dependencies (n, new);
78  g_free (new);
79  }
80  else
81  nvti_set_dependencies (n, depname);
82 }

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 ,
char *  ,
int  ,
const void *   
)

◆ plug_set_key_len()

void plug_set_key_len ( struct script_infos ,
char *  ,
int  ,
const void *  ,
size_t   
)

Definition at line 563 of file plugutils.c.

565 {
566  kb_t kb = plug_get_kb (args);
567 
568  if (name == NULL || value == NULL)
569  return;
570 
571  if (type == ARG_STRING)
572  kb_item_add_str_unique (kb, name, value, len);
573  else if (type == ARG_INT)
574  kb_item_add_int_unique (kb, name, GPOINTER_TO_SIZE (value));
575  if (global_nasl_debug == 1)
576  {
577  if (type == ARG_STRING)
578  g_message ("set key %s -> %s", name, (char *) value);
579  else if (type == ARG_INT)
580  g_message ("set key %s -> %d", name, (int) GPOINTER_TO_SIZE (value));
581  }
582 }

References ARG_INT, ARG_STRING, global_nasl_debug, 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_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 841 of file plugutils.c.

842 {
843  char s[256];
844 
845  snprintf (s, sizeof (s), "Transports/TCP/%d", port);
846  plug_set_key (args, s, ARG_INT, GSIZE_TO_POINTER (tr));
847 }

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

901 {
902  plug_set_ssl_item (args, "CA", key);
903 }

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 ,
char *   
)

Definition at line 878 of file plugutils.c.

879 {
880  plug_set_ssl_item (args, "cert", cert);
881 }

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 ,
char *   
)

Definition at line 884 of file plugutils.c.

885 {
886  plug_set_ssl_item (args, "key", key);
887 }

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 ,
char *   
)

Definition at line 890 of file plugutils.c.

891 {
892  plug_set_ssl_item (args, "password", key);
893 }

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 *  ,
struct script_infos ,
int  ,
const char *   
)

Definition at line 355 of file plugutils.c.

357 {
358  proto_post_alarm (oid, desc, port, "tcp", action);
359 }

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 *   
)

◆ post_error()

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

Definition at line 389 of file plugutils.c.

391 {
392  proto_post_error (oid, desc, port, "tcp", action);
393 }

References oid, and proto_post_error().

Referenced by error_message().

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

◆ post_log()

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

Post a log message about a tcp port.

Definition at line 375 of file plugutils.c.

377 {
378  proto_post_log (oid, desc, port, "tcp", action);
379 }

References oid, and proto_post_log().

Referenced by log_message(), 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_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:

◆ proto_post_alarm()

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

Definition at line 348 of file plugutils.c.

350 {
351  proto_post_wrapped (oid, desc, port, proto, action, "ALARM");
352 }

References 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 *  ,
struct script_infos ,
int  ,
const char *  ,
const char *   
)

Definition at line 382 of file plugutils.c.

384 {
385  proto_post_wrapped (oid, desc, port, proto, action, "ERRMSG");
386 }

References oid, and proto_post_wrapped().

Referenced by error_message(), 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 *  ,
struct script_infos ,
int  ,
const char *  ,
const char *   
)

Post a log message.

Definition at line 365 of file plugutils.c.

367 {
368  proto_post_wrapped (oid, desc, port, proto, action, "LOG");
369 }

References oid, and proto_post_wrapped().

Referenced by log_message(), and post_log().

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 ,
int  ,
char *   
)

Definition at line 621 of file plugutils.c.

622 {
623  host_add_port_proto (args, port, proto);
624 }

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:
host_add_port_proto
void host_add_port_proto(struct script_infos *args, int portnum, char *proto)
Definition: plugutils.c:85
OPENVAS_ENCAPS_IP
@ OPENVAS_ENCAPS_IP
Definition: network.h:45
plug_get_host_ip
struct in6_addr * plug_get_host_ip(struct script_infos *args)
Definition: plugutils.c:285
scan_globals::files_size_translation
GHashTable * files_size_translation
Definition: scanneraux.h:37
plug_get_kb
kb_t plug_get_kb(struct script_infos *args)
Definition: plugutils.c:627
script_infos::key
kb_t key
Definition: scanneraux.h:46
plug_get_host_fqdn
char * plug_get_host_fqdn(struct script_infos *args)
Definition: plugutils.c:211
pid
static pid_t pid
Definition: nasl_builtin_nmap.c:499
proto_post_error
void proto_post_error(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action)
Definition: plugutils.c:382
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".
Definition: plugutils.c:510
plug_replace_key_len
void plug_replace_key_len(struct script_infos *args, char *name, int type, void *value, size_t len)
Definition: plugutils.c:592
name
const char * name
Definition: nasl_init.c:377
host_get_port_state_proto
int host_get_port_state_proto(struct script_infos *args, int portnum, char *proto)
Definition: plugutils.c:148
plug_set_key_len
void plug_set_key_len(struct script_infos *args, char *name, int type, const void *value, size_t len)
Definition: plugutils.c:563
scan_globals::files_translation
GHashTable * files_translation
Definition: scanneraux.h:36
oid
const char * oid
Definition: nasl_builtin_find_service.c:57
plug_fork_child
static int plug_fork_child(kb_t)
Definition: plugutils.c:664
script_infos::globals
struct scan_globals * globals
Definition: scanneraux.h:45
current_vhost
gvm_vhost_t * current_vhost
Definition: plugutils.c:53
prefix
static void prefix(int n, int i)
Definition: nasl_tree.c:233
scan_globals
Definition: scanneraux.h:32
plug_get_key_sigchld
static void plug_get_key_sigchld()
Definition: plugutils.c:633
ARG_INT
#define ARG_INT
Definition: plugutils.h:34
proto_post_wrapped
void proto_post_wrapped(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *what)
Post a security message (e.g. LOG, NOTE, WARNING ...).
Definition: plugutils.c:307
hostname
const char * hostname
Definition: pluginlaunch.c:76
global_nasl_debug
int global_nasl_debug
Definition: plugutils.c:48
plug_set_key
void plug_set_key(struct script_infos *args, char *name, int type, const void *value)
Definition: plugutils.c:585
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".
Definition: plugutils.c:541
plug_set_ssl_item
static void plug_set_ssl_item(struct script_infos *args, char *item, char *itemfname)
Definition: plugutils.c:870
ARG_STRING
#define ARG_STRING
Definition: plugutils.h:33
sig_chld
static void sig_chld(void(*fcn)())
Definition: plugutils.c:658
proto_post_log
void proto_post_log(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action)
Post a log message.
Definition: plugutils.c:365
MAX_CANDIDATES
#define MAX_CANDIDATES
proto_post_alarm
void proto_post_alarm(const char *oid, struct script_infos *desc, int port, const char *proto, const char *action)
Definition: plugutils.c:348