37#include <netinet/in.h>
55#include <netinet/icmp6.h>
59#ifdef BSD_BYTE_ORDERING
63#define FIX(n) htons (n)
64#define UNFIX(n) ntohs (n)
78 register u_short answer = 0;
79 register long sum = 0;
91 *(u_char *) (&odd_byte) = *(u_char *) p;
95 sum = (sum >> 16) + (sum & 0xffff);
125 struct in6_addr *dst_addr;
134 if (dst_addr == NULL || (IN6_IS_ADDR_V4MAPPED (dst_addr) == 1))
141 retc->
size =
sizeof (
struct ip6_hdr) + data_len;
143 pkt = (
struct ip6_hdr *) g_malloc0 (
sizeof (
struct ip6_hdr) + data_len);
150 pkt->ip6_flow = htonl (version << 28 | tc << 20 | fl);
152 pkt->ip6_plen =
FIX (data_len);
159 inet_pton (AF_INET6, s, &pkt->ip6_src);
164 inet_pton (AF_INET6, s, &pkt->ip6_dst);
166 pkt->ip6_dst = *dst_addr;
170 bcopy (data, retc->
x.
str_val + sizeof (
struct ip6_hdr), data_len);
195 char ret_ascii[INET6_ADDRSTRLEN];
210 nasl_perror (lexic,
"%s: no valid 'ip6' argument\n", __func__);
217 nasl_perror (lexic,
"%s: no valid 'element' argument\n", __func__);
221 if (!strcmp (element,
"ip6_v"))
223 ret_int = ntohl (ip6->ip6_flow) >> 28;
226 else if (!strcmp (element,
"ip6_tc"))
228 ret_int = (ntohl (ip6->ip6_flow) >> 20) & 0xff;
231 else if (!strcmp (element,
"ip6_fl"))
233 ret_int = ntohl (ip6->ip6_flow) & 0x3ffff;
236 else if (!strcmp (element,
"ip6_plen"))
238 ret_int =
UNFIX (ip6->ip6_plen);
241 else if (!strcmp (element,
"ip6_nxt"))
243 ret_int = (ip6->ip6_nxt);
246 else if (!strcmp (element,
"ip6_hlim"))
248 ret_int = (ip6->ip6_hlim);
259 if (!strcmp (element,
"ip6_src"))
261 inet_ntop (AF_INET6, &ip6->ip6_src, ret_ascii, sizeof (ret_ascii));
264 else if (!strcmp (element,
"ip6_dst"))
266 inet_ntop (AF_INET6, &ip6->ip6_dst, ret_ascii, sizeof (ret_ascii));
272 nasl_perror (lexic,
"%s : unknown element '%s'\n", __func__, element);
277 retc->
size = strlen (ret_ascii);
278 retc->
x.
str_val = g_strdup (ret_ascii);
306 nasl_perror (lexic,
"%s: missing <ip6> field\n", __func__);
310 pkt = (
struct ip6_hdr *) g_malloc0 (size);
311 bcopy (o_pkt, pkt, size);
319 inet_pton (AF_INET6, s, &pkt->ip6_src);
340 char addr[INET6_ADDRSTRLEN];
351 printf (
"\tip6_v : %d\n", ntohl (ip6->ip6_flow) >> 28);
352 printf (
"\tip6_tc : %d\n", (ntohl (ip6->ip6_flow) >> 20) & 0xff);
353 printf (
"\tip6_fl : %d\n", ntohl (ip6->ip6_flow) & 0x3ffff);
354 printf (
"\tip6_plen : %d\n",
UNFIX (ip6->ip6_plen));
355 printf (
"\tip6_hlim : %d\n", ip6->ip6_hlim);
356 switch (ip6->ip6_nxt)
359 printf (
"\tip6_nxt : IPPROTO_TCP (%d)\n", ip6->ip6_nxt);
362 printf (
"\tip6_nxt : IPPROTO_UDP (%d)\n", ip6->ip6_nxt);
365 printf (
"\tip6_nxt : IPPROTO_ICMPV6 (%d)\n", ip6->ip6_nxt);
368 printf (
"\tip6_nxt : %d\n", ip6->ip6_nxt);
371 printf (
"\tip6_src : %s\n",
372 inet_ntop (AF_INET6, &ip6->ip6_src, addr, sizeof (addr)));
373 printf (
"\tip6_dst : %s\n",
374 inet_ntop (AF_INET6, &ip6->ip6_dst, addr, sizeof (addr)));
403 struct ip6_hdr *new_packet;
406 u_char uc_code, uc_len;
415 "Usage : %s(ip6:<ip6>, code:<code>, "
416 "length:<len>, value:<value>\n",
421 pad_len = 4 - ((
sizeof (uc_code) +
sizeof (uc_len) + value_size) % 4);
425 pl = 40 <
UNFIX (ip6->ip6_plen) ? 40 :
UNFIX (ip6->ip6_plen);
426 new_packet = g_malloc0 (size + 4 + value_size + pad_len);
427 bcopy (ip6, new_packet, pl);
429 uc_code = (u_char)
code;
430 uc_len = (u_char)
len;
432 p = (
char *) new_packet;
433 bcopy (&uc_code, p + pl,
sizeof (uc_code));
434 bcopy (&uc_len, p + pl +
sizeof (uc_code),
sizeof (uc_len));
435 bcopy (value, p + pl +
sizeof (uc_code) +
sizeof (uc_len), value_size);
438 for (i = 0; i < pad_len; i++)
441 p + pl +
sizeof (uc_code) +
sizeof (uc_len) + value_size + i, 1);
447 + (
sizeof (uc_code) +
sizeof (uc_len) + value_size + pad_len) + pl,
450 new_packet->ip6_plen =
451 FIX (size +
sizeof (uc_code) +
sizeof (uc_len) + value_size + pad_len);
454 retc->
size = size + value_size +
sizeof (uc_code) +
sizeof (uc_len) + pad_len;
455 retc->
x.
str_val = (
char *) new_packet;
505 struct tcp_opt_mss
mss;
506 struct tcp_opt_wscale
wscale;
508 struct tcp_opt_tstamp
tstamp;
536 struct ip6_hdr *ip6, *tcp_packet;
544 "forge_tcp_v6_packet: You must supply the 'ip6' argument\n");
559 (
struct ip6_hdr *) g_malloc0 (ipsz +
sizeof (
struct tcphdr) +
len);
560 retc->
x.
str_val = (
char *) tcp_packet;
562 bcopy (ip6, tcp_packet, ipsz);
564 tcp_packet->ip6_ctlun.ip6_un1.ip6_un1_plen =
565 FIX (
sizeof (
struct tcphdr) +
len);
566 tcp = (
struct tcphdr *) ((
char *) tcp_packet + 40);
580 bcopy (data, (
char *) tcp +
sizeof (
struct tcphdr),
len);
585 char *tcpsumdata = g_malloc0 (
sizeof (
struct v6pseudohdr) +
len + 1);
587 bzero (&pseudoheader, 38 +
sizeof (
struct tcphdr));
588 memcpy (&pseudoheader.
s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
589 memcpy (&pseudoheader.
d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
591 pseudoheader.
protocol = IPPROTO_TCP;
592 pseudoheader.
length = htons (
sizeof (
struct tcphdr) +
len);
593 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
594 sizeof (
struct tcphdr));
596 bcopy ((
char *) &pseudoheader, tcpsumdata,
sizeof (
struct v6pseudohdr));
598 bcopy ((
char *) data, tcpsumdata +
sizeof (
struct v6pseudohdr),
len);
599 tcp->th_sum =
np_in_cksum ((
unsigned short *) tcpsumdata,
600 38 +
sizeof (
struct tcphdr) +
len);
604 retc->
size = ipsz +
sizeof (
struct tcphdr) +
len;
633 nasl_perror (lexic,
"get_tcp_v6_element: No valid 'tcp' argument\n");
637 ip6 = (
struct ip6_hdr *) packet;
640 if (
UNFIX (ip6->ip6_plen) > ipsz)
643 tcp = (
struct tcphdr *) (packet + 40);
648 nasl_perror (lexic,
"get_tcp_v6_element: No valid 'element' argument\n");
652 if (!strcmp (element,
"th_sport"))
653 ret = ntohs (tcp->th_sport);
654 else if (!strcmp (element,
"th_dsport"))
655 ret = ntohs (tcp->th_dport);
656 else if (!strcmp (element,
"th_seq"))
657 ret = ntohl (tcp->th_seq);
658 else if (!strcmp (element,
"th_ack"))
659 ret = ntohl (tcp->th_ack);
660 else if (!strcmp (element,
"th_x2"))
662 else if (!strcmp (element,
"th_off"))
664 else if (!strcmp (element,
"th_flags"))
666 else if (!strcmp (element,
"th_win"))
667 ret = ntohs (tcp->th_win);
668 else if (!strcmp (element,
"th_sum"))
670 else if (!strcmp (element,
"th_urp"))
672 else if (!strcmp (element,
"data"))
675 retc->
size =
UNFIX (ip6->ip6_plen) - tcp->th_off * 4;
676 if (retc->
size < 0 || retc->
size > ipsz - 40 - tcp->th_off * 4)
679 "get_tcp_v6_element: Erroneous tcp header offset %d\n",
685 bcopy ((
char *) tcp + tcp->th_off * 4, retc->
x.
str_val, retc->
size);
690 nasl_perror (lexic,
"get_tcp_v6_element: Unknown tcp field %s\n",
713 opt_kind = (uint8_t *) options;
715 while (*opt_kind != 0)
720 tcp_all_options->
mss.
kind = *opt_kind;
721 tcp_all_options->
mss.
len = *(opt_kind + 1);
722 tcp_all_options->
mss.
mss = *((uint16_t *) (opt_kind + 2));
723 opt_kind = opt_kind + *(opt_kind + 1);
727 tcp_all_options->
wscale.
len = *(opt_kind + 1);
728 tcp_all_options->
wscale.
wscale = (uint8_t) * (opt_kind + 2);
729 opt_kind = opt_kind + *(opt_kind + 1);
731 case TCPOPT_SACK_PERMITTED:
734 opt_kind = opt_kind + *(opt_kind + 1);
736 case TCPOPT_TIMESTAMP:
738 tcp_all_options->
tstamp.
len = *(opt_kind + 1);
739 tcp_all_options->
tstamp.
tstamp = *((uint32_t *) (opt_kind + 2));
740 tcp_all_options->
tstamp.
e_tstamp = *((uint32_t *) (opt_kind + 6));
741 opt_kind = opt_kind + *(opt_kind + 1);
748 opt_kind = opt_kind + *(opt_kind + 1);
751 g_debug (
"%s: Unsupported %u TCP option. "
752 "Not all options are returned.",
753 __func__, *opt_kind);
792 nasl_perror (lexic,
"%s: No valid 'tcp' argument passed.\n", __func__);
800 "%s: No 'option' argument passed but required.\n."
801 "Usage: %s(tcp:<tcp>, option:<TCPOPT>)",
806 ip6 = (
struct ip6_hdr *) packet;
810 if (
UNFIX (ip6->ip6_plen) > ipsz)
813 tcp = (
struct tcphdr *) (packet + 40);
815 if (tcp->th_off <= 5)
819 options = (
char *) g_malloc0 (
sizeof (uint8_t) * 4 * (tcp->th_off - 5));
820 memcpy (options, (
char *) tcp + 20, (tcp->th_off - 5) * 4);
822 tcp_all_options = g_malloc0 (
sizeof (
struct tcp_options));
824 if (tcp_all_options == NULL)
826 nasl_perror (lexic,
"%s: No TCP options found in passed TCP packet.\n",
839 retc->
x.
i_val = ntohs ((uint16_t) tcp_all_options->
mss.
mss);
845 case TCPOPT_SACK_PERMITTED:
849 case TCPOPT_TIMESTAMP:
853 memset (&v, 0,
sizeof (v));
858 memset (&v, 0,
sizeof (v));
864 nasl_perror (lexic,
"%s: Invalid TCP option passed.\n", __func__);
868 g_free (tcp_all_options);
898 struct ip6_hdr *ip6 = (
struct ip6_hdr *) pkt;
909 lexic,
"set_tcp_v6_elements: Invalid value for the argument 'tcp'\n");
913 tcp = (
struct tcphdr *) (pkt + 40);
915 if (pktsz <
UNFIX (ip6->ip6_plen))
920 data_len =
UNFIX (ip6->ip6_plen) - (tcp->th_off * 4);
921 data = (
char *) ((
char *) tcp + tcp->th_off * 4);
924 npkt = g_malloc0 (40 + tcp->th_off * 4 + data_len);
925 bcopy (pkt, npkt,
UNFIX (ip6->ip6_plen) + 40);
927 ip6 = (
struct ip6_hdr *) (npkt);
928 tcp = (
struct tcphdr *) (npkt + 40);
946 bcopy (data, (
char *) tcp + tcp->th_off * 4, data_len);
950 ip6->ip6_plen =
FIX (tcp->th_off * 4 + data_len);
953 if (tcp->th_sum == 0)
956 char *tcpsumdata = g_malloc0 (
sizeof (
struct v6pseudohdr) + data_len + 1);
958 bzero (&pseudoheader, 38 +
sizeof (
struct tcphdr));
959 memcpy (&pseudoheader.
s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
960 memcpy (&pseudoheader.
d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
962 pseudoheader.
protocol = IPPROTO_TCP;
963 pseudoheader.
length = htons (
sizeof (
struct tcphdr) + data_len);
964 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
965 sizeof (
struct tcphdr));
967 bcopy ((
char *) &pseudoheader, tcpsumdata,
sizeof (
struct v6pseudohdr));
969 bcopy ((
char *) data, tcpsumdata +
sizeof (
struct v6pseudohdr),
971 tcp->th_sum =
np_in_cksum ((
unsigned short *) tcpsumdata,
972 38 +
sizeof (
struct tcphdr) + data_len);
977 retc->
size = 40 + (tcp->th_off * 4) + data_len;
1003 struct ip6_hdr *ip6 = (
struct ip6_hdr *) pkt;
1010 int tcp_opt, tcp_opt_val, tcp_opt_val2;
1011 int current_opt_len, total_opt_len, opt_size_allocated;
1012 char *opts, *ptr_opts_pos;
1024 lexic,
"set_tcp_v6_elements: Invalid value for the argument 'tcp'\n");
1027 opts = g_malloc0 (
sizeof (
char) * 4);
1028 ptr_opts_pos = opts;
1029 opt_size_allocated = 4;
1034 current_opt_len = total_opt_len;
1044 if (tcp_opt_val < (
int) TCP_MSS_DESIRED || tcp_opt_val > 65535)
1046 nasl_perror (lexic,
"%s: Invalid value for TCP option MSS\n",
1050 opt_mss = g_malloc0 (
sizeof (
struct tcp_opt_mss));
1051 total_opt_len += TCPOLEN_MAXSEG;
1052 opt_mss->
kind = TCPOPT_MAXSEG;
1053 opt_mss->
len = TCPOLEN_MAXSEG;
1054 opt_mss->
mss =
FIX (tcp_opt_val);
1057 if (total_opt_len > opt_size_allocated)
1059 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1060 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1061 ptr_opts_pos = opts + current_opt_len;
1064 memcpy (ptr_opts_pos, (u_char *) opt_mss,
1066 ptr_opts_pos = ptr_opts_pos +
sizeof (
struct tcp_opt_mss);
1072 if (tcp_opt_val < 0 || tcp_opt_val > 14)
1074 nasl_perror (lexic,
"%s: Invalid value for TCP option WScale\n",
1079 total_opt_len += TCPOLEN_WINDOW;
1080 opt_wscale->
kind = TCPOPT_WINDOW;
1081 opt_wscale->
len = TCPOLEN_WINDOW;
1082 opt_wscale->
wscale = tcp_opt_val;
1085 if (total_opt_len > opt_size_allocated)
1087 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1088 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1089 ptr_opts_pos = opts + current_opt_len;
1092 memcpy (ptr_opts_pos, (u_char *) opt_wscale,
1095 g_free (opt_wscale);
1097 case TCPOPT_SACK_PERMITTED:
1099 total_opt_len += TCPOLEN_SACK_PERMITTED;
1100 opt_sack_perm->
kind = TCPOPT_SACK_PERMITTED;
1101 opt_sack_perm->
len = TCPOLEN_SACK_PERMITTED;
1104 if (total_opt_len > opt_size_allocated)
1106 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1107 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1108 ptr_opts_pos = opts + current_opt_len;
1111 memcpy (ptr_opts_pos, (u_char *) opt_sack_perm,
1114 g_free (opt_sack_perm);
1116 case TCPOPT_TIMESTAMP:
1120 if (tcp_opt_val < 0)
1121 nasl_perror (lexic,
"%s: Invalid value for TCP option Timestamp\n",
1124 total_opt_len += TCPOLEN_TIMESTAMP;
1125 opt_tstamp->
kind = TCPOPT_TIMESTAMP;
1126 opt_tstamp->
len = TCPOLEN_TIMESTAMP;
1127 opt_tstamp->
tstamp = htonl (tcp_opt_val);
1128 opt_tstamp->
e_tstamp = htonl (tcp_opt_val2);
1131 if (total_opt_len > opt_size_allocated)
1133 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1134 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1135 ptr_opts_pos = opts + current_opt_len;
1138 memcpy (ptr_opts_pos, (u_char *) opt_tstamp,
1141 g_free (opt_tstamp);
1147 nasl_perror (lexic,
"%s: TCP option %d not supported\n", __func__,
1154 current_opt_len = total_opt_len;
1157 if (total_opt_len % 4 == 0)
1159 opt_size_allocated = opt_size_allocated + 4;
1160 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1161 ptr_opts_pos = opts + total_opt_len;
1163 if (current_opt_len < opt_size_allocated - 1)
1166 for (i = current_opt_len; i < opt_size_allocated - 1; i++)
1168 memcpy (ptr_opts_pos, &nop, 1);
1174 memcpy (ptr_opts_pos, &eol, 1);
1176 tcp = (
struct tcphdr *) (pkt + 40);
1178 if (pktsz <
UNFIX (ip6->ip6_plen))
1186 data_len =
UNFIX (ip6->ip6_plen) - (tcp->th_off * 4);
1187 data = (
char *) ((
char *) tcp + tcp->th_off * 4);
1191 npkt = g_malloc0 (40 + tcp->th_off * 4 + opt_size_allocated + data_len);
1192 memcpy (npkt, pkt,
UNFIX (ip6->ip6_plen) + 40);
1193 ip6 = (
struct ip6_hdr *) (npkt);
1194 tcp = (
struct tcphdr *) (npkt + 40);
1197 memcpy ((
char *) tcp + tcp->th_off * 4, opts, opt_size_allocated);
1198 tcp->th_off = tcp->th_off + (opt_size_allocated / 4);
1200 memcpy ((
char *) tcp + tcp->th_off * 4, data, data_len);
1202 ip6->ip6_plen =
FIX (tcp->th_off * 4 + data_len);
1206 g_malloc0 (
sizeof (
struct v6pseudohdr) + opt_size_allocated + data_len + 1);
1208 memset (&pseudoheader, 0, 38 +
sizeof (
struct tcphdr));
1209 memcpy (&pseudoheader.
s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
1210 memcpy (&pseudoheader.
d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
1212 pseudoheader.
protocol = IPPROTO_TCP;
1214 htons (
sizeof (
struct tcphdr) + opt_size_allocated + data_len);
1219 memcpy ((
char *) &pseudoheader.
tcpheader, (
char *) tcp,
1220 sizeof (
struct tcphdr));
1223 memcpy (tcpsumdata, (
char *) &pseudoheader,
sizeof (
struct v6pseudohdr));
1224 memcpy (tcpsumdata +
sizeof (
struct v6pseudohdr), (
char *) opts,
1225 opt_size_allocated);
1227 memcpy (tcpsumdata +
sizeof (
struct v6pseudohdr) + opt_size_allocated,
1228 (
char *) data, data_len);
1231 38 +
sizeof (
struct tcphdr) + opt_size_allocated + data_len);
1233 g_free (tcpsumdata);
1236 retc->
size = 40 + (tcp->th_off * 4) + data_len;
1254 int options_len = 0;
1259 struct ip6_hdr *ip6 = (
struct ip6_hdr *) pkt;
1260 struct tcphdr *tcp = (
struct tcphdr *) (pkt + 40);
1267 printf (
"------\n");
1268 printf (
"\tth_sport : %d\n", ntohs (tcp->th_sport));
1269 printf (
"\tth_dport : %d\n", ntohs (tcp->th_dport));
1270 printf (
"\tth_seq : %u\n", (
unsigned int) ntohl (tcp->th_seq));
1271 printf (
"\tth_ack : %u\n", (
unsigned int) ntohl (tcp->th_ack));
1272 printf (
"\tth_x2 : %d\n", tcp->th_x2);
1273 printf (
"\tth_off : %d\n", tcp->th_off);
1274 printf (
"\tth_flags : ");
1275 if (tcp->th_flags & TH_FIN)
1280 if (tcp->th_flags & TH_SYN)
1287 if (tcp->th_flags & TH_RST)
1294 if (tcp->th_flags & TH_PUSH)
1301 if (tcp->th_flags & TH_ACK)
1308 if (tcp->th_flags & TH_URG)
1318 printf (
" (%d)", tcp->th_flags);
1320 printf (
"\tth_win : %d\n", ntohs (tcp->th_win));
1321 printf (
"\tth_sum : 0x%x\n", tcp->th_sum);
1322 printf (
"\tth_urp : %d\n", tcp->th_urp);
1324 options_len =
sizeof (uint8_t) * 4 * (tcp->th_off - 5);
1326 if (options_len > 5)
1331 options = (
char *) g_malloc0 (options_len);
1332 memcpy (options, (
char *) tcp + 20, options_len);
1334 tcp_all_options = g_malloc0 (
sizeof (
struct tcp_options));
1336 if (tcp_all_options != NULL)
1338 printf (
"\tTCP Options:\n");
1339 printf (
"\t\tTCPOPT_MAXSEG: %u\n",
1340 ntohs ((uint16_t) tcp_all_options->
mss.
mss));
1341 printf (
"\t\tTCPOPT_WINDOW: %u\n",
1343 printf (
"\t\tTCPOPT_SACK_PERMITTED: %u\n",
1345 printf (
"\t\tTCPOPT_TIMESTAMP TSval: %u\n",
1347 printf (
"\t\tTCPOPT_TIMESTAMP TSecr: %u\n",
1351 g_free (tcp_all_options);
1353 printf (
"\n\tData : ");
1354 c = (
char *) ((
char *) tcp +
sizeof (
struct tcphdr) + options_len);
1355 if (
UNFIX (ip6->ip6_plen) > (sizeof (
struct tcphdr) + options_len))
1357 j <
UNFIX (ip6->ip6_plen) -
sizeof (
struct tcphdr) - options_len
1360 printf (
"%c", isprint (c[j]) ? c[j] :
'.');
1406 struct ip6_hdr *udp_packet;
1409 pkt = g_malloc0 (
sizeof (
struct udphdr) + 40 + data_len);
1410 udp_packet = (
struct ip6_hdr *) pkt;
1411 udp = (
struct udphdr *) (pkt + 40);
1414 bcopy ((
char *) ip6, pkt, 40);
1419 lexic,
"uh_ulen", data_len +
sizeof (
struct udphdr)));
1421 if (data_len != 0 && data != NULL)
1422 bcopy (data, (pkt + 40 +
sizeof (
struct udphdr)), data_len);
1431 memcpy (&
pseudohdr.s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
1432 memcpy (&
pseudohdr.d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
1435 pseudohdr.len = htons (
sizeof (
struct udphdr) + data_len);
1436 bcopy ((
char *) udp, (
char *) &
pseudohdr.udpheader,
1437 sizeof (
struct udphdr));
1441 bcopy ((
char *) data, udpsumdata +
sizeof (
pseudohdr), data_len);
1443 udp->uh_sum =
np_in_cksum ((
unsigned short *) udpsumdata,
1444 38 +
sizeof (
struct udphdr) + data_len);
1445 g_free (udpsumdata);
1448 if (
UNFIX (udp_packet->ip6_ctlun.ip6_un1.ip6_un1_plen) <= 40)
1453 udp_packet->ip6_ctlun.ip6_un1.ip6_un1_plen =
1454 FIX (ntohs (udp->uh_ulen));
1460 retc->
size = 8 + 40 + data_len;
1465 nasl_perror (lexic,
"forge_udp_v6_packet:'ip6' argument missing. \n");
1486 struct udphdr *udphdr;
1493 if (udp == NULL || element == NULL)
1496 lexic,
"get_udp_v6_element() usage :\n"
1497 "element = get_udp_v6_element(udp:<udp>,element:<element>\n");
1501 if (40 +
sizeof (
struct udphdr) > ipsz)
1504 udphdr = (
struct udphdr *) (udp + 40);
1505 if (!strcmp (element,
"uh_sport"))
1506 ret = ntohs (udphdr->uh_sport);
1507 else if (!strcmp (element,
"uh_dport"))
1508 ret = ntohs (udphdr->uh_dport);
1509 else if (!strcmp (element,
"uh_ulen"))
1510 ret = ntohs (udphdr->uh_ulen);
1511 else if (!strcmp (element,
"uh_sum"))
1512 ret = ntohs (udphdr->uh_sum);
1513 else if (!strcmp (element,
"data"))
1517 sz = ntohs (udphdr->uh_ulen) -
sizeof (
struct udphdr);
1519 if (ntohs (udphdr->uh_ulen) - 40 - sizeof (
struct udphdr) > ipsz)
1520 sz = ipsz - 40 -
sizeof (
struct udphdr);
1524 bcopy (udp + 40 +
sizeof (
struct udphdr), retc->
x.
str_val, sz);
1529 nasl_perror (lexic,
"%s is not a value of a udp packet\n", element);
1566 if (40 +
sizeof (
struct udphdr) > sz)
1572 sz = 40 +
sizeof (
struct udphdr) + data_len;
1573 pkt = g_malloc0 (sz);
1574 bcopy (ip6, pkt, 40 +
sizeof (
struct udphdr));
1578 pkt = g_malloc0 (sz);
1579 bcopy (ip6, pkt, sz);
1582 ip6 = (
struct ip6_hdr *) pkt;
1585 ip6->ip6_ctlun.ip6_un1.ip6_un1_plen =
FIX (sz - 40);
1587 udp = (
struct udphdr *) (pkt + 40);
1594 old_len = ntohs (udp->uh_ulen);
1601 bcopy (data, pkt + 40 +
sizeof (
struct udphdr), data_len);
1602 udp->uh_ulen = htons (
sizeof (
struct udphdr) + data_len);
1608 int len = old_len -
sizeof (
struct udphdr);
1619 ptr = (
char *) udp +
sizeof (
struct udphdr);
1626 pseudohdr.len = htons (
sizeof (
struct udphdr) + data_len);
1627 bcopy ((
char *) udp, (
char *) &
pseudohdr.udpheader,
1628 sizeof (
struct udphdr));
1629 memcpy (&
pseudohdr.s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
1630 memcpy (&
pseudohdr.d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
1634 bcopy ((
char *) ptr, udpsumdata +
sizeof (
pseudohdr), data_len);
1636 udp->uh_sum =
np_in_cksum ((
unsigned short *) udpsumdata,
1637 38 +
sizeof (
struct udphdr)
1639 g_free (udpsumdata);
1648 "set_udp_v6_elements: You must supply the 'udp' argument !\n");
1668 struct udphdr *udp = (
struct udphdr *) (pkt +
sizeof (
struct ip6_hdr));
1672 printf (
"------\n");
1673 printf (
"\tuh_sport : %d\n", ntohs (udp->uh_sport));
1674 printf (
"\tuh_dport : %d\n", ntohs (udp->uh_dport));
1675 printf (
"\tuh_sum : 0x%x\n", udp->uh_sum);
1676 printf (
"\tuh_ulen : %d\n", ntohs (udp->uh_ulen));
1677 printf (
"\tdata : ");
1679 if (udp->uh_ulen > sizeof (
struct udphdr))
1680 for (j =
sizeof (
struct udphdr); j < ntohs (udp->uh_ulen) && j < limit;
1682 printf (
"%c", isprint (c[j]) ? c[j] :
'.');
1729 struct ip6_hdr *ip6;
1730 struct ip6_hdr *ip6_icmp;
1731 size_t ip6_sz, size = 0, sz = 0;
1732 struct icmp6_hdr *icmp;
1733 struct nd_router_solicit *routersolicit = NULL;
1734 struct nd_router_advert *routeradvert = NULL;
1735 struct nd_neighbor_solicit *neighborsolicit = NULL;
1736 struct nd_neighbor_advert *neighboradvert = NULL;
1755 pkt = g_malloc0 (ip6_sz + 8 +
len);
1756 ip6_icmp = (
struct ip6_hdr *) pkt;
1758 bcopy (ip6, ip6_icmp, ip6_sz);
1759 p = (
char *) (pkt + ip6_sz);
1760 icmp = (
struct icmp6_hdr *) p;
1763 icmp->icmp6_type = t;
1767 case ICMP6_ECHO_REQUEST:
1770 bcopy (data, &(p[8]),
len);
1773 size = ip6_sz + 8 +
len;
1777 case ND_ROUTER_SOLICIT:
1780 g_realloc (pkt, ip6_sz +
sizeof (
struct nd_router_solicit) +
len);
1781 p = (
char *) (pkt + ip6_sz);
1783 ip6_icmp = (
struct ip6_hdr *) pkt;
1784 routersolicit = (
struct nd_router_solicit *) p;
1785 ((
struct icmp6_hdr *) routersolicit)->icmp6_type = icmp->icmp6_type;
1786 ((
struct icmp6_hdr *) routersolicit)->icmp6_code = icmp->icmp6_code;
1787 ((
struct icmp6_hdr *) routersolicit)->icmp6_cksum =
1789 size = ip6_sz +
sizeof (
struct nd_router_solicit) +
len;
1793 case ND_ROUTER_ADVERT:
1796 g_realloc (pkt, ip6_sz +
sizeof (
struct nd_router_advert) +
len);
1797 p = (
char *) (pkt + ip6_sz);
1799 ip6_icmp = (
struct ip6_hdr *) pkt;
1801 routeradvert = (
struct nd_router_advert *) p;
1803 ((
struct icmp6_hdr *) routeradvert)->icmp6_type = icmp->icmp6_type;
1804 ((
struct icmp6_hdr *) routeradvert)->icmp6_code = icmp->icmp6_code;
1805 ((
struct icmp6_hdr *) routeradvert)->icmp6_cksum =
1807 routeradvert->nd_ra_reachable =
1809 routeradvert->nd_ra_retransmit =
1811 routeradvert->nd_ra_curhoplimit = ip6_icmp->ip6_hlim;
1812 routeradvert->nd_ra_flags_reserved =
1814 size = ip6_sz +
sizeof (
struct nd_router_advert) +
len;
1819 case ND_NEIGHBOR_SOLICIT:
1822 pkt = g_realloc (pkt, ip6_sz +
sizeof (
struct nd_neighbor_solicit)
1825 p = (
char *) (pkt + ip6_sz);
1827 ip6_icmp = (
struct ip6_hdr *) pkt;
1830 memmove (&(p[8 + 16]), data,
len);
1832 neighborsolicit = (
struct nd_neighbor_solicit *) p;
1834 ((
struct icmp6_hdr *) neighborsolicit)->icmp6_type =
1836 ((
struct icmp6_hdr *) neighborsolicit)->icmp6_code =
1838 ((
struct icmp6_hdr *) neighborsolicit)->icmp6_cksum =
1841 memcpy (&neighborsolicit->nd_ns_target, &ip6_icmp->ip6_dst,
1842 sizeof (
struct in6_addr));
1843 size = ip6_sz +
sizeof (
struct nd_neighbor_solicit) +
len;
1847 case ND_NEIGHBOR_ADVERT:
1849 pkt = g_realloc (pkt,
1850 ip6_sz +
sizeof (
struct nd_neighbor_advert) +
len);
1852 ip6_icmp = (
struct ip6_hdr *) pkt;
1853 p = (
char *) (pkt + 40);
1854 neighboradvert = (
struct nd_neighbor_advert *) p;
1856 ((
struct icmp6_hdr *) neighboradvert)->icmp6_type =
1858 ((
struct icmp6_hdr *) neighboradvert)->icmp6_code =
1860 ((
struct icmp6_hdr *) neighboradvert)->icmp6_cksum =
1862 neighboradvert->nd_na_flags_reserved =
1864 if (neighboradvert->nd_na_flags_reserved & 0x00000020)
1866 &neighboradvert->nd_na_target, &ip6_icmp->ip6_src,
1867 sizeof (
struct in6_addr));
1872 &neighboradvert->nd_na_target);
1876 "forge_icmp_v6_packet: missing 'target' "
1877 "parameter required for constructing response "
1878 "to a Neighbor Solicitation\n");
1883 size = ip6_sz +
sizeof (
struct nd_neighbor_advert) +
len;
1889 if (t < 0 || t > 255)
1891 nasl_perror (lexic,
"forge_icmp_v6_packet: illegal type %d\n",
1897 bcopy (data, &(p[8]),
len);
1900 size = ip6_sz + 8 +
len;
1906 if (
UNFIX (ip6_icmp->ip6_ctlun.ip6_un1.ip6_un1_plen) <= 40)
1910 ip6_icmp->ip6_ctlun.ip6_un1.ip6_un1_plen =
FIX (size - ip6_sz);
1920 memcpy (&
pseudohdr.s6addr, &ip6->ip6_src, sizeof (
struct in6_addr));
1921 memcpy (&
pseudohdr.d6addr, &ip6->ip6_dst, sizeof (
struct in6_addr));
1925 bcopy ((
char *) icmp, (
char *) &
pseudohdr.icmpheader, sz);
1928 bcopy ((
char *) data, icmpsumdata +
sizeof (
pseudohdr),
len);
1930 np_in_cksum ((
unsigned short *) icmpsumdata, size);
1931 g_free (icmpsumdata);
1938 case ICMP6_ECHO_REQUEST:
1940 case ND_ROUTER_SOLICIT:
1942 routersolicit->nd_rs_hdr.icmp6_cksum = icmp->icmp6_cksum;
1945 case ND_ROUTER_ADVERT:
1947 routeradvert->nd_ra_hdr.icmp6_cksum = icmp->icmp6_cksum;
1950 case ND_NEIGHBOR_SOLICIT:
1952 neighborsolicit->nd_ns_hdr.icmp6_cksum = icmp->icmp6_cksum;
1955 case ND_NEIGHBOR_ADVERT:
1957 neighboradvert->nd_na_hdr.icmp6_cksum = icmp->icmp6_cksum;
1969 nasl_perror (lexic,
"forge_icmp_v6_packet: missing 'ip6' parameter\n");
1987 struct icmp6_hdr *icmp;
1996 icmp = (
struct icmp6_hdr *) (p + 40);
2000 nasl_perror (lexic,
"%s: Missing 'element' argument\n", __func__);
2004 else if (!strcmp (elem,
"icmp_code"))
2005 value = icmp->icmp6_code;
2006 else if (!strcmp (elem,
"icmp_type"))
2007 value = icmp->icmp6_type;
2008 else if (!strcmp (elem,
"icmp_cksum"))
2009 value = ntohs (icmp->icmp6_cksum);
2010 else if (!strcmp (elem,
"icmp_id"))
2011 value = ntohs (icmp->icmp6_id);
2012 else if (!strcmp (elem,
"icmp_seq"))
2013 value = ntohs (icmp->icmp6_seq);
2014 else if (!strcmp (elem,
"data"))
2021 memcpy (retc->
x.
str_val, &(p[40 + 8]), retc->
size + 1);
2032 nasl_perror (lexic,
"%s: '%s' not a valid 'element' argument\n",
2042 nasl_perror (lexic,
"%s: missing 'icmp' parameter\n", __func__);
2063 struct ip6_hdr *ip6 = (
struct ip6_hdr *) pkt;
2064 struct icmp6_hdr *icmp;
2065 icmp = (
struct icmp6_hdr *) (pkt + 40);
2067 printf (
"------\n");
2068 printf (
"\ticmp6_id : %d\n", ntohs (icmp->icmp6_id));
2069 printf (
"\ticmp6_code : %d\n", icmp->icmp6_code);
2070 printf (
"\ticmp6_type : %u\n", icmp->icmp6_type);
2071 printf (
"\ticmp6_seq : %u\n", ntohs (icmp->icmp6_seq));
2072 printf (
"\ticmp6_cksum : %d\n", ntohs (icmp->icmp6_cksum));
2073 printf (
"\tData : ");
2074 c = (
char *) ((
char *) icmp +
sizeof (
struct icmp6_hdr));
2075 if (
UNFIX (ip6->ip6_plen) > (sizeof (
struct icmp6_hdr)))
2077 j <
UNFIX (ip6->ip6_plen) -
sizeof (
struct icmp6_hdr) && j < limit;
2079 printf (
"%c", isprint (c[j]) ? c[j] :
'.');
2119 u_char *pkt = g_malloc0 (
sizeof (
struct igmp6_hdr) + 40 +
len);
2120 struct ip6_hdr *ip6_igmp = (
struct ip6_hdr *) pkt;
2127 bcopy (ip6, ip6_igmp, ipsz);
2129 if (
UNFIX (ip6_igmp->ip6_ctlun.ip6_un1.ip6_un1_plen) <= 40)
2134 ip6_igmp->ip6_ctlun.ip6_un1.ip6_un1_plen =
2138 p = (
char *) (pkt + 40);
2147 inet_pton (AF_INET6, grp, &
igmp->
group);
2153 char *ptmp = (
char *) (pkt + 40 +
sizeof (
struct igmp6_hdr));
2154 bcopy (ptmp, data,
len);
2162 nasl_perror (lexic,
"forge_igmp_v6_packet: missing 'ip6' parameter\n");
2181 u_char packet[
sizeof (
struct ip6_hdr) + sizeof (struct tcphdr)];
2183 struct ip6_hdr *ip = (
struct ip6_hdr *) packet;
2184 struct tcphdr *tcp = (
struct tcphdr *) (packet +
sizeof (
struct ip6_hdr));
2187 struct in6_addr source;
2188 struct sockaddr_in6 soca;
2198#define rnd_tcp_port() (rand () % 65535 + 1024)
2199 int sports[] = {0, 0, 0, 0, 0, 1023, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2200 0, 0, 0, 0, 0, 53, 0, 0, 20, 0, 25, 0, 0, 0};
2201 int ports[] = {139, 135, 445, 80, 22, 515, 23, 21, 6000, 1025,
2202 25, 111, 1028, 9100, 1029, 79, 497, 548, 5000, 1917,
2203 53, 161, 9001, 65535, 443, 113, 993, 8080, 0};
2204 char addr[INET6_ADDRSTRLEN];
2206 if (!destination || (IN6_IS_ADDR_V4MAPPED (destination) == 1))
2209 for (i = 0; i <
sizeof (sports) /
sizeof (int); i++)
2215 soc = socket (AF_INET6, SOCK_RAW, IPPROTO_RAW);
2219 if (setsockopt (soc, IPPROTO_IPV6, IP_HDRINCL, (
char *) &opt,
sizeof (opt))
2221 perror (
"setsockopt");
2227 source = *destination;
2230 bzero (&source,
sizeof (source));
2234 snprintf (filter,
sizeof (filter),
"ip6 and src host %s",
2235 inet_ntop (AF_INET6, destination, addr,
sizeof (addr)));
2242 unsigned int num_ports =
sizeof (sports) /
sizeof (
int);
2243 for (i = 0; i < num_ports && !flag; i++)
2245 bzero (packet,
sizeof (packet));
2247 int version = 0x60, tc = 0, fl = 0;
2248 ip->ip6_ctlun.ip6_un1.ip6_un1_flow = version | tc | fl;
2249 ip->ip6_nxt = 0x06, ip->ip6_hlim = 0x40, ip->ip6_src = source;
2250 ip->ip6_dst = *destination;
2251 ip->ip6_ctlun.ip6_un1.ip6_un1_plen =
FIX (
sizeof (
struct tcphdr));
2254 tcp->th_sport = port ? htons (
rnd_tcp_port ()) : htons (sports[i]);
2255 tcp->th_flags = TH_SYN;
2256 tcp->th_dport = port ? htons (port) : htons (ports[i]);
2257 tcp->th_seq = rand ();
2261 tcp->th_win = htons (512);
2269 bzero (&pseudoheader, 38 +
sizeof (
struct tcphdr));
2270 memcpy (&pseudoheader.
s6addr, &ip->ip6_src,
2271 sizeof (
struct in6_addr));
2272 memcpy (&pseudoheader.
d6addr, &ip->ip6_dst,
2273 sizeof (
struct in6_addr));
2275 pseudoheader.
protocol = IPPROTO_TCP;
2276 pseudoheader.
length = htons (
sizeof (
struct tcphdr));
2277 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
2278 sizeof (
struct tcphdr));
2279 tcp->th_sum =
np_in_cksum ((
unsigned short *) &pseudoheader,
2280 38 +
sizeof (
struct tcphdr));
2283 bzero (&soca,
sizeof (soca));
2284 soca.sin6_family = AF_INET6;
2285 soca.sin6_addr = ip->ip6_dst;
2286 if (sendto (soc, (
const void *) ip,
2287 sizeof (
struct tcphdr) +
sizeof (
struct ip6_hdr), 0,
2288 (
struct sockaddr *) &soca,
sizeof (
struct sockaddr_in6))
2295 tv.tv_usec = 100000;
2330 struct sockaddr_in6 sockaddr;
2332 struct ip6_hdr *sip = NULL;
2344 char name[INET6_ADDRSTRLEN];
2345 int allow_multicast = 0;
2347 if (dstip == NULL || (IN6_IS_ADDR_V4MAPPED (dstip) == 1))
2349 soc = socket (AF_INET6, SOCK_RAW, IPPROTO_RAW);
2353 if (setsockopt (soc, IPPROTO_IPV6, IP_HDRINCL, (
char *) &opt_on,
2356 perror (
"setsockopt");
2363 if (sz <
sizeof (
struct ip6_hdr))
2365 nasl_perror (lexic,
"send_v6packet: packet is too short\n");
2369 sip = (
struct ip6_hdr *) ip;
2370 if (use_pcap != 0 && bpf < 0)
2373 bzero (&sockaddr,
sizeof (
struct sockaddr_in6));
2374 sockaddr.sin6_family = AF_INET6;
2375 sockaddr.sin6_addr = sip->ip6_dst;
2377 if (allow_multicast)
2379 struct sockaddr_in6 multicast;
2381 if (setsockopt (soc, SOL_SOCKET, SO_BROADCAST, &opt_on,
2384 perror (
"setsockopt ");
2386 bzero (&multicast,
sizeof (
struct sockaddr_in6));
2387 sockaddr.sin6_family = AF_INET6;
2388 inet_pton (AF_INET6,
"ff02::1", &(multicast.sin6_addr));
2390 if (!IN6_ARE_ADDR_EQUAL (&sockaddr.sin6_addr, &multicast.sin6_addr))
2391 allow_multicast = 0;
2394 if (dstip != NULL && !IN6_ARE_ADDR_EQUAL (&sockaddr.sin6_addr, dstip)
2395 && !allow_multicast)
2397 char txt1[64], txt2[64];
2400 inet_ntop (AF_INET6, &sockaddr.sin6_addr,
name, INET6_ADDRSTRLEN),
2402 txt1[
sizeof (txt1) - 1] =
'\0';
2403 strncpy (txt2, inet_ntop (AF_INET6, dstip,
name, INET6_ADDRSTRLEN),
2405 txt2[
sizeof (txt2) - 1] =
'\0';
2407 "send_v6packet: malicious or buggy script is trying to "
2408 "send packet to %s instead of designated target %s\n",
2416 if (dfl_len > 0 && dfl_len < sz)
2421 b = sendto (soc, (u_char *) ip,
len, 0, (
struct sockaddr *) &sockaddr,
2422 sizeof (
struct sockaddr_in6));
2424 if (b >= 0 && use_pcap != 0 && bpf >= 0)
2431 && (!memcmp (answer, (
char *) ip,
sizeof (
struct ip6_hdr))))
2446 retc->
size = answer_sz;
u_char * bpf_next_tv(int bpf, int *caplen, struct timeval *tv)
Header file for module bpf_share.
struct ip6_hdr * capture_next_v6_packet(int bpf, int timeout, int *sz)
int init_v6_capture_device(struct in6_addr src, struct in6_addr dest, char *filter)
static struct timeval timeval(unsigned long val)
void nasl_perror(lex_ctxt *lexic, char *msg,...)
long int get_var_size_by_num(lex_ctxt *, int)
struct struct_lex_ctxt lex_ctxt
char * get_str_var_by_name(lex_ctxt *, const char *)
char * get_str_var_by_num(lex_ctxt *, int)
long int get_int_var_by_num(lex_ctxt *, int, int)
long int get_int_var_by_name(lex_ctxt *, const char *, int)
long int get_var_size_by_name(lex_ctxt *, const char *)
tree_cell * get_ip_v6_element(lex_ctxt *lexic)
Obtain IPv6 header element.
tree_cell * dump_ip_v6_packet(lex_ctxt *lexic)
Print IPv6 Header.
tree_cell * set_ip_v6_elements(lex_ctxt *lexic)
Set IPv6 header element.
tree_cell * dump_icmp_v6_packet(lex_ctxt *lexic)
Dump the ICMP part of a IP Datagram.
tree_cell * get_tcp_v6_element(lex_ctxt *lexic)
Get TCP Header element.
tree_cell * forge_ip_v6_packet(lex_ctxt *lexic)
Forge an IPv6 packet.
tree_cell * forge_igmp_v6_packet(lex_ctxt *lexic)
struct v6pseudo_udp_hdr __attribute__
static int np_in_cksum(u_short *p, int n)
tree_cell * set_udp_v6_elements(lex_ctxt *lexic)
tree_cell * dump_tcp_v6_packet(lex_ctxt *lexic)
Dump TCP part of an IPv6 Datagram.
tree_cell * set_tcp_v6_elements(lex_ctxt *lexic)
Set TCP Header element.
tree_cell * get_tcp_v6_option(lex_ctxt *lexic)
Get a TCP option from an IP datagram if present. Possible options are: TCPOPT_MAXSEG (2),...
tree_cell * insert_ip_v6_options(lex_ctxt *lexic)
Adds an IPv6 option to the datagram.
tree_cell * forge_tcp_v6_packet(lex_ctxt *lexic)
Forge TCP packet.
static void get_tcp_options(char *options, struct tcp_options *tcp_all_options)
Extract all TCP option from an IP datagram.
tree_cell * forge_udp_v6_packet(lex_ctxt *lexic)
tree_cell * get_icmp_v6_element(lex_ctxt *lexic)
tree_cell * insert_tcp_v6_options(lex_ctxt *lexic)
Add options to a TCP segment header. Possible options are: TCPOPT_MAXSEG (2), values between 536 and ...
tree_cell * nasl_tcp_v6_ping(lex_ctxt *lexic)
Performs TCP Connect to test if host is alive.
tree_cell * nasl_send_v6packet(lex_ctxt *lexic)
Send forged IPv6 Packets.
tree_cell * get_udp_v6_element(lex_ctxt *lexic)
tree_cell * dump_udp_v6_packet(lex_ctxt *lexic)
tree_cell * forge_icmp_v6_packet(lex_ctxt *lexic)
tree_cell * alloc_typed_cell(int typ)
void deref_cell(tree_cell *c)
int add_var_to_array(nasl_array *a, char *name, const anon_nasl_var *v)
struct st_a_nasl_var anon_nasl_var
struct st_nasl_array nasl_array
int v6_islocalhost(struct in6_addr *addr)
Tests whether a packet sent to IP is LIKELY to route through the kernel localhost interface.
char * v6_routethrough(struct in6_addr *dest, struct in6_addr *source)
An awesome function to determine what interface a packet to a given destination should be routed thro...
Header file for module pcap.
unsigned int plug_get_host_open_port(struct script_infos *desc)
struct in6_addr * plug_get_host_ip(struct script_infos *args)
Header file for module plugutils.
union TC::@332262321161220155002104006201360276211317150140 x
union st_a_nasl_var::@154137074032032170165360023270032033276061363156 v
struct script_infos * script_infos
struct tcp_opt_wscale wscale
struct tcp_opt_tstamp tstamp
struct tcp_opt_sack_perm sack_perm
struct icmp6_hdr icmpheader