OpenVAS Scanner  22.7.9
nasl_host.c File Reference

Remote host helper functions. More...

#include "nasl_host.h"
#include "../misc/ipc_openvas.h"
#include "../misc/network.h"
#include "../misc/pcap_openvas.h"
#include "../misc/plugutils.h"
#include "nasl_debug.h"
#include "nasl_func.h"
#include "nasl_global_ctxt.h"
#include "nasl_lex_ctxt.h"
#include "nasl_tree.h"
#include "nasl_var.h"
#include <arpa/inet.h>
#include <gvm/base/networking.h>
#include <gvm/util/kb.h>
#include <net/if.h>
#include <net/if_arp.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
Include dependency graph for nasl_host.c:

Go to the source code of this file.

Macros

#define G_LOG_DOMAIN   "sd nasl"
 GLib log domain. More...
 

Functions

tree_cellget_hostnames (lex_ctxt *lexic)
 
tree_cellget_hostname (lex_ctxt *lexic)
 
tree_cellget_hostname_source (lex_ctxt *lexic)
 
tree_celladd_hostname (lex_ctxt *lexic)
 
tree_cellresolve_hostname_to_multiple_ips (lex_ctxt *lexic)
 Resolve a hostname and return all ip addresses as nasl array. More...
 
tree_cellresolve_hostname (lex_ctxt *lexic)
 
tree_cellget_host_ip (lex_ctxt *lexic)
 
tree_cellget_host_open_port (lex_ctxt *lexic)
 
tree_cellget_port_state (lex_ctxt *lexic)
 
tree_cellget_udp_port_state (lex_ctxt *lexic)
 
tree_cellnasl_islocalhost (lex_ctxt *lexic)
 
tree_cellnasl_islocalnet (lex_ctxt *lexic)
 
tree_cellnasl_this_host (lex_ctxt *lexic)
 
tree_cellnasl_this_host_name (lex_ctxt *lexic)
 
tree_cellget_port_transport (lex_ctxt *lexic)
 Return the encapsulation mode of a port. More...
 
tree_cellnasl_same_host (lex_ctxt *lexic)
 
tree_cellnasl_target_is_ipv6 (lex_ctxt *lexic)
 

Detailed Description

Remote host helper functions.

This file contains all the functions which deal with the remote host: which ports are open, what is its IP, what is our IP, what transport is on the remote port, and so on...

Definition in file nasl_host.c.

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "sd nasl"

GLib log domain.

Definition at line 45 of file nasl_host.c.

Function Documentation

◆ add_hostname()

tree_cell* add_hostname ( lex_ctxt lexic)

Definition at line 111 of file nasl_host.c.

112 {
113  struct ipc_data *hn = NULL;
114  char *lower;
115  const char *json = NULL;
116  char *value = get_str_var_by_name (lexic, "hostname");
117  char *source = get_str_var_by_name (lexic, "source");
118 
119  if (!value)
120  {
121  nasl_perror (lexic, "%s: Empty hostname\n", __func__);
122  return NULL;
123  }
124  if (!source || !*source)
125  source = "NASL";
126  /* Add to current process' vhosts list. */
127  lower = g_ascii_strdown (value, -1);
128  hn = ipc_data_type_from_hostname (source, strlen (source), lower,
129  strlen (lower));
130  json = ipc_data_to_json (hn);
131  ipc_data_destroy (&hn);
132  if (plug_add_host_fqdn (lexic->script_infos, lower, source))
133  goto end_add_hostname;
134 
135  // send it to host process to extend vhosts list there
136  if (ipc_send (lexic->script_infos->ipc_context, IPC_MAIN, json, strlen (json))
137  < 0)
138  g_warning ("Unable to send %s to host process", lower);
139 
140 end_add_hostname:
141  g_free (lower);
142  g_free ((void *) json);
143  return NULL;
144 }

References get_str_var_by_name(), script_infos::ipc_context, ipc_data_destroy(), ipc_data_to_json(), ipc_data_type_from_hostname(), IPC_MAIN, ipc_send(), nasl_perror(), plug_add_host_fqdn(), and struct_lex_ctxt::script_infos.

Here is the call graph for this function:

◆ get_host_ip()

tree_cell* get_host_ip ( lex_ctxt lexic)

Definition at line 206 of file nasl_host.c.

207 {
208  struct script_infos *script_infos = lexic->script_infos;
209  struct in6_addr *ip = plug_get_host_ip (script_infos);
210  tree_cell *retc;
211 
212  if (ip == NULL) /* WTF ? */
213  {
214  return FAKE_CELL;
215  }
216 
217  retc = alloc_typed_cell (CONST_STR);
218  retc->x.str_val = addr6_as_str (ip);
219  retc->size = strlen (retc->x.str_val);
220 
221  return retc;
222 }

References alloc_typed_cell(), CONST_STR, FAKE_CELL, plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.

Here is the call graph for this function:

◆ get_host_open_port()

tree_cell* get_host_open_port ( lex_ctxt lexic)

Definition at line 225 of file nasl_host.c.

226 {
227  struct script_infos *script_infos = lexic->script_infos;
228  unsigned int port = plug_get_host_open_port (script_infos);
229  tree_cell *retc;
230 
231  retc = alloc_typed_cell (CONST_INT);
232  retc->x.i_val = port;
233 
234  return retc;
235 }

References alloc_typed_cell(), CONST_INT, TC::i_val, plug_get_host_open_port(), struct_lex_ctxt::script_infos, and TC::x.

Here is the call graph for this function:

◆ get_hostname()

tree_cell* get_hostname ( lex_ctxt lexic)

Definition at line 77 of file nasl_host.c.

78 {
79  struct script_infos *script_infos = lexic->script_infos;
81  tree_cell *retc;
82 
83  if (hostname == NULL)
84  return NULL;
85 
86  retc = alloc_typed_cell (CONST_STR);
87  retc->size = strlen (hostname);
88  retc->x.str_val = hostname;
89  return retc;
90 }

References alloc_typed_cell(), CONST_STR, hostname, plug_get_host_fqdn(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.

Here is the call graph for this function:

◆ get_hostname_source()

tree_cell* get_hostname_source ( lex_ctxt lexic)

Definition at line 93 of file nasl_host.c.

94 {
95  struct script_infos *script_infos = lexic->script_infos;
96  char *source;
97  tree_cell *retc;
98 
100  get_str_var_by_name (lexic, "hostname"));
101  if (!source)
102  return NULL;
103 
104  retc = alloc_typed_cell (CONST_STR);
105  retc->size = strlen (source);
106  retc->x.str_val = source;
107  return retc;
108 }

References alloc_typed_cell(), CONST_STR, get_str_var_by_name(), plug_get_host_source(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.

Here is the call graph for this function:

◆ get_hostnames()

tree_cell* get_hostnames ( lex_ctxt lexic)

Definition at line 47 of file nasl_host.c.

48 {
49  struct script_infos *script_infos = lexic->script_infos;
50  tree_cell *retc;
51  int i = 0;
52  nasl_array *arr;
53  GSList *tmp, *hostnames;
54 
55  hostnames = tmp = plug_get_host_fqdn_list (script_infos);
56  if (!hostnames)
57  return NULL;
58 
59  retc = alloc_typed_cell (DYN_ARRAY);
60  retc->x.ref_val = arr = g_malloc0 (sizeof (nasl_array));
61  while (tmp)
62  {
63  anon_nasl_var v;
64 
65  v.var_type = VAR2_DATA;
66  v.v.v_str.s_siz = strlen (tmp->data);
67  v.v.v_str.s_val = tmp->data;
68  add_var_to_list (arr, i++, &v);
69  tmp = tmp->next;
70  }
71 
72  g_slist_free_full (hostnames, g_free);
73  return retc;
74 }

References add_var_to_list(), alloc_typed_cell(), DYN_ARRAY, plug_get_host_fqdn_list(), TC::ref_val, st_nasl_string::s_siz, st_nasl_string::s_val, struct_lex_ctxt::script_infos, st_a_nasl_var::v, st_a_nasl_var::v_str, VAR2_DATA, st_a_nasl_var::var_type, and TC::x.

Here is the call graph for this function:

◆ get_port_state()

tree_cell* get_port_state ( lex_ctxt lexic)

Definition at line 238 of file nasl_host.c.

239 {
240  int open;
241  struct script_infos *script_infos = lexic->script_infos;
242  tree_cell *retc;
243  int port;
244 
245  port = get_int_var_by_num (lexic, 0, -1);
246  if (port < 0)
247  return FAKE_CELL;
248 
249  retc = alloc_typed_cell (CONST_INT);
250  open = host_get_port_state (script_infos, port);
251  retc->x.i_val = open;
252  return retc;
253 }

References alloc_typed_cell(), CONST_INT, FAKE_CELL, get_int_var_by_num(), host_get_port_state(), TC::i_val, struct_lex_ctxt::script_infos, and TC::x.

Here is the call graph for this function:

◆ get_port_transport()

tree_cell* get_port_transport ( lex_ctxt lexic)

Return the encapsulation mode of a port.

NASL Function: get_port_transport\n

Takes a port number and returns its encapsulation mode (ENCAPS_*) The defined encapsulation modes are:

  • ENCAPS_AUTO Automatic encapsulation detection.
  • ENCAPS_IP No encapsulation
  • ENCAPS_SSLv23 Request compatibility options
  • ENCAPS_SSLv2 SSL version 2
  • ENCAPS_SSLv3 SSL version 3
  • ENCAPS_TLSv1 TLS version 1.0
  • ENCAPS_TLSv11 TLS version 1.1
  • ENCAPS_TLSv12 TLS version 1.2
  • ENCAPS_TLSv13 TLS version 1.3
  • ENCAPS_TLScustom SSL or TLS with custom priorities
NASL Unnamed Parameters:\n
  • An integer with the port number.
NASL Named Parameters:\n

-asstring If not 0 return a human readabale string instead of an integer.

NASL Returns:\n An integer or a string with the encapsulation mode or NULL
on error.
Parameters
[in]lexicLexical context of the NASL interpreter.
Returns
A tree cell.

Definition at line 401 of file nasl_host.c.

402 {
403  struct script_infos *script_infos = lexic->script_infos;
404  tree_cell *retc;
405  int port = get_int_var_by_num (lexic, 0, -1);
406 
407  if (port >= 0)
408  {
409  int trp = plug_get_port_transport (script_infos, port);
410 
411  retc = alloc_typed_cell (CONST_STR);
412  if (get_int_var_by_name (lexic, "asstring", 0))
413  {
414  const char *s = get_encaps_name (trp);
415  retc->x.str_val = g_strdup (s);
416  retc->size = strlen (s);
417  }
418  else
419  {
420  retc->type = CONST_INT;
421  retc->x.i_val = trp;
422  }
423  return retc;
424  }
425  return NULL;
426 }

References alloc_typed_cell(), CONST_INT, CONST_STR, get_encaps_name(), get_int_var_by_name(), get_int_var_by_num(), TC::i_val, plug_get_port_transport(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, TC::type, and TC::x.

Here is the call graph for this function:

◆ get_udp_port_state()

tree_cell* get_udp_port_state ( lex_ctxt lexic)

Definition at line 256 of file nasl_host.c.

257 {
258  int open;
259  struct script_infos *script_infos = lexic->script_infos;
260  tree_cell *retc;
261  int port;
262 
263  port = get_int_var_by_num (lexic, 0, -1);
264  if (port < 0)
265  return FAKE_CELL;
266 
267  retc = alloc_typed_cell (CONST_INT);
268  open = host_get_port_state_udp (script_infos, port);
269  retc->x.i_val = open;
270  return retc;
271 }

References alloc_typed_cell(), CONST_INT, FAKE_CELL, get_int_var_by_num(), host_get_port_state_udp(), TC::i_val, struct_lex_ctxt::script_infos, and TC::x.

Here is the call graph for this function:

◆ nasl_islocalhost()

tree_cell* nasl_islocalhost ( lex_ctxt lexic)

Definition at line 274 of file nasl_host.c.

275 {
276  struct script_infos *script_infos = lexic->script_infos;
277  struct in6_addr *dst = plug_get_host_ip (script_infos);
278  tree_cell *retc;
279 
280  retc = alloc_typed_cell (CONST_INT);
281  retc->x.i_val = v6_islocalhost (dst);
282  return retc;
283 }

References alloc_typed_cell(), CONST_INT, TC::i_val, plug_get_host_ip(), struct_lex_ctxt::script_infos, v6_islocalhost(), and TC::x.

Here is the call graph for this function:

◆ nasl_islocalnet()

tree_cell* nasl_islocalnet ( lex_ctxt lexic)

Definition at line 286 of file nasl_host.c.

287 {
288  struct script_infos *script_infos = lexic->script_infos;
289  struct in6_addr *ip = plug_get_host_ip (script_infos);
290  tree_cell *retc;
291 
292  retc = alloc_typed_cell (CONST_INT);
293  retc->x.i_val = v6_is_local_ip (ip);
294  return retc;
295 }

References alloc_typed_cell(), CONST_INT, TC::i_val, plug_get_host_ip(), struct_lex_ctxt::script_infos, v6_is_local_ip(), and TC::x.

Here is the call graph for this function:

◆ nasl_same_host()

tree_cell* nasl_same_host ( lex_ctxt lexic)

Definition at line 429 of file nasl_host.c.

430 {
431  tree_cell *retc;
432  struct hostent *h;
433  char *hn[2], **names[2];
434  struct in_addr ia, *a[2];
435  int i, j, n[2], names_nb[2], flag;
436  int cmp_hostname = get_int_var_by_name (lexic, "cmp_hostname", 0);
437 
438  memset (names_nb, '\0', sizeof (names_nb));
439  memset (names, '\0', sizeof (names));
440  memset (a, '\0', sizeof (a));
441  for (i = 0; i < 2; i++)
442  {
443  hn[i] = get_str_var_by_num (lexic, i);
444  if (hn[i] == NULL)
445  {
446  nasl_perror (lexic, "same_host needs two parameters!\n");
447  return NULL;
448  }
449  if (strlen (hn[i]) >= 256)
450  {
451  nasl_perror (lexic, "same_host(): Too long hostname !\n");
452  return NULL;
453  }
454  }
455  for (i = 0; i < 2; i++)
456  {
457  if (!inet_aton (hn[i], &ia)) /* Not an IP address */
458  {
459  h = gethostbyname (hn[i]);
460  if (h == NULL)
461  {
462  nasl_perror (lexic, "same_host: %s does not resolve\n", hn[i]);
463  n[i] = 0;
464  if (cmp_hostname)
465  {
466  names_nb[i] = 1;
467  names[i] = g_malloc0 (sizeof (char *));
468  names[i][0] = g_strdup (hn[i]);
469  }
470  }
471  else
472  {
473  for (names_nb[i] = 0; h->h_aliases[names_nb[i]] != NULL;
474  names_nb[i]++)
475  ;
476  names_nb[i]++;
477  names[i] = g_malloc0 (sizeof (char *) * names_nb[i]);
478  names[i][0] = g_strdup (h->h_name);
479  for (j = 1; j < names_nb[i]; j++)
480  names[i][j] = g_strdup (h->h_aliases[j - 1]);
481 
482  /* Here, we should check that h_addrtype == AF_INET */
483  for (n[i] = 0; ((struct in_addr **) h->h_addr_list)[n[i]] != NULL;
484  n[i]++)
485  ;
486  a[i] = g_malloc0 ((gsize) h->h_length * n[i]);
487  for (j = 0; j < n[i]; j++)
488  a[i][j] = *((struct in_addr **) h->h_addr_list)[j];
489  }
490  }
491  else
492  {
493  if (cmp_hostname)
494  h = gethostbyaddr ((const char *) &ia, sizeof (ia), AF_INET);
495  else
496  h = NULL;
497  if (h == NULL)
498  {
499  a[i] = g_malloc0 (sizeof (struct in_addr));
500  memcpy (a[i], &ia, sizeof (struct in_addr));
501  n[i] = 1;
502  }
503  else
504  {
505  for (names_nb[i] = 0; h->h_aliases[names_nb[i]] != NULL;
506  names_nb[i]++)
507  ;
508  names_nb[i]++;
509  names[i] = g_malloc0 (sizeof (char *) * names_nb[i]);
510  names[i][0] = g_strdup (h->h_name);
511  for (j = 1; j < names_nb[i]; j++)
512  names[i][j] = g_strdup (h->h_aliases[j - 1]);
513 
514  /* Here, we should check that h_addrtype == AF_INET */
515  for (n[i] = 0; ((struct in_addr **) h->h_addr_list)[n[i]] != NULL;
516  n[i]++)
517  ;
518  a[i] = g_malloc0 ((gsize) h->h_length * n[i]);
519  for (j = 0; j < n[i]; j++)
520  a[i][j] = *((struct in_addr **) h->h_addr_list)[j];
521  }
522  }
523  }
524  flag = 0;
525  for (i = 0; i < n[0] && !flag; i++)
526  for (j = 0; j < n[1] && !flag; j++)
527  if (a[0][i].s_addr == a[1][j].s_addr)
528  {
529  flag = 1;
530  }
531 
532  if (cmp_hostname)
533  for (i = 0; i < names_nb[0] && !flag; i++)
534  for (j = 0; j < names_nb[1] && !flag; j++)
535  if (strcmp (names[0][i], names[1][j]) == 0)
536  {
537  flag = 1;
538  }
539 
540  retc = alloc_typed_cell (CONST_INT);
541  retc->x.i_val = flag;
542 
543  for (i = 0; i < 2; i++)
544  g_free (a[i]);
545 
546  for (i = 0; i < 2; i++)
547  {
548  for (j = 0; j < names_nb[i]; j++)
549  g_free (names[i][j]);
550  g_free (names[i]);
551  }
552 
553  return retc;
554 }

References alloc_typed_cell(), CONST_INT, get_int_var_by_name(), get_str_var_by_num(), TC::i_val, nasl_perror(), and TC::x.

Here is the call graph for this function:

◆ nasl_target_is_ipv6()

tree_cell* nasl_target_is_ipv6 ( lex_ctxt lexic)

Definition at line 557 of file nasl_host.c.

558 {
559  tree_cell *retc;
560  struct script_infos *script_infos = lexic->script_infos;
561  struct in6_addr *addr;
562 
564  retc = alloc_typed_cell (CONST_INT);
565 
566  if (addr == NULL)
567  {
568  nasl_perror (lexic, "address is NULL!\n");
569  return NULL;
570  }
571  if (IN6_IS_ADDR_V4MAPPED (addr) == 1)
572  retc->x.i_val = 0;
573  else
574  retc->x.i_val = 1;
575 
576  return retc;
577 }

References alloc_typed_cell(), CONST_INT, TC::i_val, nasl_perror(), plug_get_host_ip(), struct_lex_ctxt::script_infos, and TC::x.

Here is the call graph for this function:

◆ nasl_this_host()

tree_cell* nasl_this_host ( lex_ctxt lexic)

Definition at line 298 of file nasl_host.c.

299 {
300  struct script_infos *script_infos = lexic->script_infos;
301  tree_cell *retc;
302  char hostname[255];
303  struct in6_addr *ia = plug_get_host_ip (script_infos);
304  struct in6_addr in6addr;
305  struct in6_addr src6;
306 
307  retc = alloc_typed_cell (CONST_DATA);
308 
309  if (gvm_source_iface_is_set ())
310  {
311  struct in6_addr addr;
312 
313  /* Use source_iface's IP address when available. */
314  if (IN6_IS_ADDR_V4MAPPED (ia))
315  gvm_source_addr_as_addr6 (&addr);
316  else
317  gvm_source_addr6 (&addr);
318  retc->x.str_val = addr6_as_str (&addr);
319  retc->size = strlen (retc->x.str_val);
320  return retc;
321  }
322  else
323  {
324  /* Manually find the source IP that will be used. */
325  int err = 1;
326  if (v6_islocalhost (ia))
327  memcpy (&src6, ia, sizeof (struct in6_addr));
328  else
329  err = v6_getsourceip (&src6, ia);
330 
331  if (err && !IN6_ARE_ADDR_EQUAL (&src6, &in6addr_any))
332  {
333  retc->x.str_val = addr6_as_str (&src6);
334  retc->size = strlen (retc->x.str_val);
335 
336  return retc;
337  }
338 
339  hostname[sizeof (hostname) - 1] = '\0';
340  gethostname (hostname, sizeof (hostname) - 1);
341  if (gvm_resolve_as_addr6 (hostname, &in6addr))
342  {
343  retc->x.str_val = addr6_as_str (&in6addr);
344  retc->size = strlen (retc->x.str_val);
345  }
346  }
347  return retc;
348 }

References alloc_typed_cell(), CONST_DATA, hostname, plug_get_host_ip(), struct_lex_ctxt::script_infos, v6_getsourceip(), and v6_islocalhost().

Here is the call graph for this function:

◆ nasl_this_host_name()

tree_cell* nasl_this_host_name ( lex_ctxt lexic)

Definition at line 351 of file nasl_host.c.

352 {
353  char *hostname;
354  tree_cell *retc;
355 
356  (void) lexic;
357  retc = alloc_typed_cell (CONST_DATA);
358 
359  hostname = g_malloc0 (256);
360  gethostname (hostname, 255);
361 
362  retc->x.str_val = hostname;
363  retc->size = strlen (hostname);
364  return retc;
365 }

References alloc_typed_cell(), CONST_DATA, hostname, TC::size, TC::str_val, and TC::x.

Here is the call graph for this function:

◆ resolve_hostname()

tree_cell* resolve_hostname ( lex_ctxt lexic)

Definition at line 184 of file nasl_host.c.

185 {
186  struct in6_addr in6addr;
187  char *value = get_str_var_by_name (lexic, "hostname");
188 
189  if (!value)
190  {
191  nasl_perror (lexic, "%s: Empty hostname\n", __func__);
192  return NULL;
193  }
194 
195  if (!gvm_resolve_as_addr6 (value, &in6addr))
196  {
198  retc->x.str_val = addr6_as_str (&in6addr);
199  retc->size = strlen (retc->x.str_val);
200  return retc;
201  }
202  return NULL;
203 }

References alloc_typed_cell(), CONST_STR, get_str_var_by_name(), nasl_perror(), TC::size, TC::str_val, and TC::x.

Here is the call graph for this function:

◆ resolve_hostname_to_multiple_ips()

tree_cell* resolve_hostname_to_multiple_ips ( lex_ctxt lexic)

Resolve a hostname and return all ip addresses as nasl array.

Definition at line 151 of file nasl_host.c.

152 {
153  GSList *list = NULL;
154  char *value = get_str_var_by_name (lexic, "hostname");
155  tree_cell *retc;
156  nasl_array *arr;
157  int i = 0;
158 
159  if (!value)
160  {
161  nasl_perror (lexic, "%s: Empty hostname\n", __func__);
162  return NULL;
163  }
164 
165  list = gvm_resolve_list (value);
166 
167  retc = alloc_typed_cell (DYN_ARRAY);
168  retc->x.ref_val = arr = g_malloc0 (sizeof (nasl_array));
169  while (list)
170  {
171  anon_nasl_var var_aux;
172 
173  var_aux.var_type = VAR2_DATA;
174  var_aux.v.v_str.s_siz = strlen (addr6_as_str (list->data));
175  var_aux.v.v_str.s_val = (unsigned char *) addr6_as_str (list->data);
176  add_var_to_list (arr, i++, &var_aux);
177  list = list->next;
178  }
179  g_slist_free_full (list, g_free);
180  return retc;
181 }

References add_var_to_list(), alloc_typed_cell(), DYN_ARRAY, get_str_var_by_name(), nasl_perror(), list::next, TC::ref_val, st_nasl_string::s_siz, st_nasl_string::s_val, st_a_nasl_var::v, st_a_nasl_var::v_str, VAR2_DATA, st_a_nasl_var::var_type, and TC::x.

Here is the call graph for this function:
st_a_nasl_var
Definition: nasl_var.h:40
script_infos
Definition: scanneraux.h:29
plug_get_host_source
char * plug_get_host_source(struct script_infos *args, const char *hostname)
Definition: plugutils.c:288
host_get_port_state
int host_get_port_state(struct script_infos *plugdata, int portnum)
Definition: plugutils.c:144
plug_get_port_transport
int plug_get_port_transport(struct script_infos *args, int port)
Definition: plugutils.c:1288
CONST_DATA
@ CONST_DATA
Definition: nasl_tree.h:82
plug_get_host_ip
struct in6_addr * plug_get_host_ip(struct script_infos *args)
Definition: plugutils.c:316
TC::str_val
char * str_val
Definition: nasl_tree.h:103
script_infos::ipc_context
struct ipc_context * ipc_context
Definition: scanneraux.h:31
plug_get_host_fqdn
char * plug_get_host_fqdn(struct script_infos *args)
Definition: plugutils.c:242
CONST_STR
@ CONST_STR
Definition: nasl_tree.h:80
ipc_data_destroy
void ipc_data_destroy(ipc_data_t **data)
destroys ipc_data.
Definition: ipc_openvas.c:224
TC::x
union TC::@5 x
DYN_ARRAY
@ DYN_ARRAY
Definition: nasl_tree.h:90
get_encaps_name
const char * get_encaps_name(openvas_encaps_t code)
Definition: network.c:1733
FAKE_CELL
#define FAKE_CELL
Definition: nasl_tree.h:110
st_a_nasl_var::v
union st_a_nasl_var::@7 v
get_str_var_by_name
char * get_str_var_by_name(lex_ctxt *, const char *)
Definition: nasl_var.c:1118
st_a_nasl_var::v_str
nasl_string_t v_str
Definition: nasl_var.h:47
st_nasl_string::s_siz
int s_siz
Definition: nasl_var.h:27
v6_is_local_ip
int v6_is_local_ip(struct in6_addr *addr)
Definition: pcap.c:108
VAR2_DATA
@ VAR2_DATA
Definition: nasl_var.h:18
st_nasl_array
Definition: nasl_var.h:33
plug_add_host_fqdn
int plug_add_host_fqdn(struct script_infos *args, const char *hostname, const char *source)
Definition: plugutils.c:208
plug_get_host_open_port
unsigned int plug_get_host_open_port(struct script_infos *desc)
Definition: plugutils.c:1220
ipc_send
int ipc_send(struct ipc_context *context, enum ipc_relation to, const char *msg, size_t len)
sends given msg to the target based on the given context
Definition: ipc.c:46
nasl_perror
void nasl_perror(lex_ctxt *lexic, char *msg,...)
Definition: nasl_debug.c:111
v6_getsourceip
int v6_getsourceip(struct in6_addr *src, struct in6_addr *dst)
Definition: pcap.c:477
TC::size
int size
Definition: nasl_tree.h:99
host_get_port_state_udp
int host_get_port_state_udp(struct script_infos *plugdata, int portnum)
Definition: plugutils.c:150
get_int_var_by_name
long int get_int_var_by_name(lex_ctxt *, const char *, int)
Definition: nasl_var.c:1104
ipc_data_to_json
const char * ipc_data_to_json(struct ipc_data *data)
transforms ipc_data to a json string
Definition: ipc_openvas.c:251
IPC_MAIN
@ IPC_MAIN
Definition: ipc.h:18
TC::ref_val
void * ref_val
Definition: nasl_tree.h:105
get_int_var_by_num
long int get_int_var_by_num(lex_ctxt *, int, int)
Definition: nasl_var.c:1097
get_str_var_by_num
char * get_str_var_by_num(lex_ctxt *, int)
Definition: nasl_var.c:1111
st_a_nasl_var::var_type
int var_type
Definition: nasl_var.h:41
struct_lex_ctxt::script_infos
struct script_infos * script_infos
Definition: nasl_lex_ctxt.h:30
TC
Definition: nasl_tree.h:94
TC::type
short type
Definition: nasl_tree.h:95
CONST_INT
@ CONST_INT
Definition: nasl_tree.h:79
hostname
const char * hostname
Definition: pluginlaunch.c:68
v6_islocalhost
int v6_islocalhost(struct in6_addr *addr)
Tests whether a packet sent to IP is LIKELY to route through the kernel localhost interface.
Definition: pcap.c:224
add_var_to_list
int add_var_to_list(nasl_array *a, int i, const anon_nasl_var *v)
Definition: nasl_var.c:1245
ipc_data
Definition: ipc_openvas.c:39
list::next
struct list * next
Definition: nasl_builtin_synscan.c:254
alloc_typed_cell
tree_cell * alloc_typed_cell(int typ)
Definition: nasl_tree.c:28
ipc_data_type_from_hostname
struct ipc_data * ipc_data_type_from_hostname(const char *source, size_t source_len, const char *hostname, size_t hostname_len)
initializes ipc_data for a hostname data.
Definition: ipc_openvas.c:124
plug_get_host_fqdn_list
GSList * plug_get_host_fqdn_list(struct script_infos *args)
Definition: plugutils.c:270
list
Definition: nasl_builtin_synscan.c:249
st_nasl_string::s_val
unsigned char * s_val
Definition: nasl_var.h:26
TC::i_val
long int i_val
Definition: nasl_tree.h:104