36#ifdef BSD_BYTE_ORDERING
40#define FIX(n) htons (n)
41#define UNFIX(n) ntohs (n)
56 register u_short answer;
57 register long sum = 0;
69 *(u_char *) (&odd_byte) = *(u_char *) p;
73 sum = (sum >> 16) + (sum & 0xffff);
111 struct in6_addr *dst_addr;
117 if (dst_addr == NULL || (IN6_IS_ADDR_V4MAPPED (dst_addr) != 1))
119 nasl_perror (lexic,
"forge_ip_packet: No valid dst_addr could be "
120 "determined via call to plug_get_host_ip().\n");
128 retc->
size =
sizeof (
struct ip) + data_len;
130 pkt = (
struct ip *) g_malloc0 (
sizeof (
struct ip) + data_len);
138 pkt->ip_len =
FIX (20 + data_len);
142 pkt->ip_off =
FIX (pkt->ip_off);
149 inet_aton (s, &pkt->ip_src);
156 inet_aton (s, &pkt->ip_dst);
158 pkt->ip_dst.s_addr = dst_addr->s6_addr32[3];
162 bcopy (data, retc->
x.
str_val + sizeof (
struct ip), data_len);
168 pkt->ip_sum =
np_in_cksum ((u_short *) pkt,
sizeof (
struct ip));
195 nasl_perror (lexic,
"get_ip_element: no valid 'ip' argument\n");
201 nasl_perror (lexic,
"get_ip_element: no valid 'element' argument\n");
205 if (!strcmp (element,
"ip_v"))
210 else if (!strcmp (element,
"ip_id"))
212 ret_int =
UNFIX (ip->ip_id);
215 else if (!strcmp (element,
"ip_hl"))
220 else if (!strcmp (element,
"ip_tos"))
222 ret_int = ip->ip_tos;
225 else if (!strcmp (element,
"ip_len"))
227 ret_int =
UNFIX (ip->ip_len);
230 else if (!strcmp (element,
"ip_off"))
232 ret_int =
UNFIX (ip->ip_off);
235 else if (!strcmp (element,
"ip_ttl"))
237 ret_int = ip->ip_ttl;
240 else if (!strcmp (element,
"ip_p"))
245 else if (!strcmp (element,
"ip_sum"))
247 ret_int =
UNFIX (ip->ip_sum);
258 if (!strcmp (element,
"ip_src"))
260 snprintf (ret_ascii,
sizeof (ret_ascii),
"%s", inet_ntoa (ip->ip_src));
263 else if (!strcmp (element,
"ip_dst"))
265 snprintf (ret_ascii,
sizeof (ret_ascii),
"%s", inet_ntoa (ip->ip_dst));
271 nasl_perror (lexic,
"%s: unknown element '%s'\n", __func__, element);
276 retc->
size = strlen (ret_ascii);
277 retc->
x.
str_val = g_strdup (ret_ascii);
313 nasl_perror (lexic,
"set_ip_elements: missing <ip> field\n");
317 pkt = (
struct ip *) g_malloc0 (size);
318 bcopy (o_pkt, pkt, size);
333 inet_aton (s, &pkt->ip_src);
336 if (pkt->ip_sum == 0)
337 pkt->ip_sum =
np_in_cksum ((u_short *) pkt,
sizeof (
struct ip));
366 struct ip *new_packet;
369 u_char uc_code, uc_len;
377 nasl_perror (lexic,
"Usage : insert_ip_options(ip:<ip>, code:<code>, "
378 "length:<len>, value:<value>\n");
382 pad_len = 4 - ((
sizeof (uc_code) +
sizeof (uc_len) + value_size) % 4);
386 hl = ip->ip_hl * 4 <
UNFIX (ip->ip_len) ? ip->ip_hl * 4 :
UNFIX (ip->ip_len);
387 new_packet = g_malloc0 (size + 4 + value_size + pad_len);
388 bcopy (ip, new_packet, hl);
390 uc_code = (u_char)
code;
391 uc_len = (u_char)
len;
393 p = (
char *) new_packet;
394 bcopy (&uc_code, p + hl,
sizeof (uc_code));
395 bcopy (&uc_len, p + hl +
sizeof (uc_code),
sizeof (uc_len));
396 bcopy (value, p + hl +
sizeof (uc_code) +
sizeof (uc_len), value_size);
399 for (i = 0; i < pad_len; i++)
402 p + hl +
sizeof (uc_code) +
sizeof (uc_len) + value_size + i, 1);
408 + (
sizeof (uc_code) +
sizeof (uc_len) + value_size + pad_len) + hl,
412 (hl + (
sizeof (uc_code) +
sizeof (uc_len) + value_size + pad_len)) / 4;
414 FIX (size +
sizeof (uc_code) +
sizeof (uc_len) + value_size + pad_len);
415 new_packet->ip_sum = 0;
417 (u_short *) new_packet, new_packet->ip_hl * 4 >
UNFIX (new_packet->ip_len)
418 ?
UNFIX (new_packet->ip_len)
419 : new_packet->ip_hl * 4);
422 retc->
size = size + value_size +
sizeof (uc_code) +
sizeof (uc_len) + pad_len;
423 retc->
x.
str_val = (
char *) new_packet;
447 printf (
"\tip_hl : %d\n", ip->ip_hl);
448 printf (
"\tip_v : %d\n", ip->ip_v);
449 printf (
"\tip_tos : %d\n", ip->ip_tos);
450 printf (
"\tip_len : %d\n",
UNFIX (ip->ip_len));
451 printf (
"\tip_id : %d\n", ntohs (ip->ip_id));
452 printf (
"\tip_off : %d\n",
UNFIX (ip->ip_off));
453 printf (
"\tip_ttl : %d\n", ip->ip_ttl);
457 printf (
"\tip_p : IPPROTO_TCP (%d)\n", ip->ip_p);
460 printf (
"\tip_p : IPPROTO_UDP (%d)\n", ip->ip_p);
463 printf (
"\tip_p : IPPROTO_ICMP (%d)\n", ip->ip_p);
466 printf (
"\tip_p : %d\n", ip->ip_p);
469 printf (
"\tip_sum : 0x%x\n", ntohs (ip->ip_sum));
470 printf (
"\tip_src : %s\n", inet_ntoa (ip->ip_src));
471 printf (
"\tip_dst : %s\n", inet_ntoa (ip->ip_dst));
483 struct in_addr
saddr;
484 struct in_addr
daddr;
561 struct ip *ip, *tcp_packet;
569 "forge_tcp_packet: You must supply the 'ip' argument\n");
574 if (ipsz > ip->ip_hl * 4)
575 ipsz = ip->ip_hl * 4;
581 tcp_packet = (
struct ip *) g_malloc0 (ipsz +
sizeof (
struct tcphdr) +
len);
582 retc->
x.
str_val = (
char *) tcp_packet;
584 bcopy (ip, tcp_packet, ipsz);
586 if (
UNFIX (tcp_packet->ip_len) <= tcp_packet->ip_hl * 4)
591 FIX (tcp_packet->ip_hl * 4 + sizeof (
struct tcphdr) +
len);
592 tcp_packet->ip_sum = 0;
594 np_in_cksum ((u_short *) tcp_packet,
sizeof (
struct ip));
597 tcp = (
struct tcphdr *) ((
char *) tcp_packet + tcp_packet->ip_hl * 4);
611 bcopy (data, (
char *) tcp +
sizeof (
struct tcphdr),
len);
616 char *tcpsumdata = g_malloc0 (
sizeof (
struct pseudohdr) +
len + 1);
617 struct in_addr source, dest;
619 source.s_addr = ip->ip_src.s_addr;
620 dest.s_addr = ip->ip_dst.s_addr;
622 bzero (&pseudoheader, 12 +
sizeof (
struct tcphdr));
623 pseudoheader.
saddr.s_addr = source.s_addr;
624 pseudoheader.
daddr.s_addr = dest.s_addr;
626 pseudoheader.
protocol = IPPROTO_TCP;
627 pseudoheader.
length = htons (
sizeof (
struct tcphdr) +
len);
628 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
629 sizeof (
struct tcphdr));
631 bcopy ((
char *) &pseudoheader, tcpsumdata,
sizeof (
struct pseudohdr));
633 bcopy ((
char *) data, tcpsumdata +
sizeof (
struct pseudohdr),
len);
634 tcp->th_sum =
np_in_cksum ((
unsigned short *) tcpsumdata,
635 12 +
sizeof (
struct tcphdr) +
len);
639 retc->
size = ipsz +
sizeof (
struct tcphdr) +
len;
667 nasl_perror (lexic,
"get_tcp_element: No valid 'tcp' argument\n");
671 ip = (
struct ip *) packet;
673 if (ip->ip_hl * 4 > ipsz)
676 if (
UNFIX (ip->ip_len) > ipsz)
679 tcp = (
struct tcphdr *) (packet + ip->ip_hl * 4);
684 nasl_perror (lexic,
"get_tcp_element: No valid 'element' argument\n");
688 if (!strcmp (element,
"th_sport"))
689 ret = ntohs (tcp->th_sport);
690 else if (!strcmp (element,
"th_dsport"))
691 ret = ntohs (tcp->th_dport);
692 else if (!strcmp (element,
"th_seq"))
693 ret = ntohl (tcp->th_seq);
694 else if (!strcmp (element,
"th_ack"))
695 ret = ntohl (tcp->th_ack);
696 else if (!strcmp (element,
"th_x2"))
698 else if (!strcmp (element,
"th_off"))
700 else if (!strcmp (element,
"th_flags"))
702 else if (!strcmp (element,
"th_win"))
703 ret = ntohs (tcp->th_win);
704 else if (!strcmp (element,
"th_sum"))
706 else if (!strcmp (element,
"th_urp"))
708 else if (!strcmp (element,
"data"))
711 retc->
size =
UNFIX (ip->ip_len) - (tcp->th_off + ip->ip_hl) * 4;
713 bcopy ((
char *) tcp + tcp->th_off * 4, retc->
x.
str_val, retc->
size);
718 nasl_perror (lexic,
"get_tcp_element: Unknown tcp field %s\n", element);
740 opt_kind = (uint8_t *) options;
742 while (*opt_kind != 0)
747 tcp_all_options->
mss.
kind = *opt_kind;
748 tcp_all_options->
mss.
len = *(opt_kind + 1);
749 tcp_all_options->
mss.
mss = *((uint16_t *) (opt_kind + 2));
750 opt_kind = opt_kind + *(opt_kind + 1);
754 tcp_all_options->
wscale.
len = *(opt_kind + 1);
755 tcp_all_options->
wscale.
wscale = (uint8_t) * (opt_kind + 2);
756 opt_kind = opt_kind + *(opt_kind + 1);
758 case TCPOPT_SACK_PERMITTED:
761 opt_kind = opt_kind + *(opt_kind + 1);
763 case TCPOPT_TIMESTAMP:
765 tcp_all_options->
tstamp.
len = *(opt_kind + 1);
766 tcp_all_options->
tstamp.
tstamp = *((uint32_t *) (opt_kind + 2));
767 tcp_all_options->
tstamp.
e_tstamp = *((uint32_t *) (opt_kind + 6));
768 opt_kind = opt_kind + *(opt_kind + 1);
775 opt_kind = opt_kind + *(opt_kind + 1);
778 g_debug (
"%s: Unsupported %u TCP option. "
779 "Not all options are returned.",
780 __func__, *opt_kind);
819 nasl_perror (lexic,
"%s: No valid 'tcp' argument passed.\n", __func__);
828 "Usage: %s(tcp:<tcp>, option:<TCPOPT>)",
833 ip = (
struct ip *) packet;
836 if (ip->ip_hl * 4 > ipsz)
839 if (
UNFIX (ip->ip_len) > ipsz)
842 tcp = (
struct tcphdr *) (packet + ip->ip_hl * 4);
844 if (tcp->th_off <= 5)
848 options = (
char *) g_malloc0 (
sizeof (uint8_t) * 4 * (tcp->th_off - 5));
849 memcpy (options, (
char *) tcp + 20, (tcp->th_off - 5) * 4);
851 tcp_all_options = g_malloc0 (
sizeof (
struct tcp_options));
853 if (tcp_all_options == NULL)
855 nasl_perror (lexic,
"%s: No TCP options found in passed TCP packet.\n",
868 retc->
x.
i_val = ntohs ((uint16_t) tcp_all_options->
mss.
mss);
874 case TCPOPT_SACK_PERMITTED:
878 case TCPOPT_TIMESTAMP:
882 memset (&v, 0,
sizeof (v));
887 memset (&v, 0,
sizeof (v));
893 nasl_perror (lexic,
"%s: Invalid TCP option passed.\n", __func__);
897 g_free (tcp_all_options);
933 struct ip *ip = (
struct ip *) pkt;
944 "set_tcp_elements: Invalid value for the argument 'tcp'\n");
948 if (ip->ip_hl * 4 > pktsz)
950 (
struct tcphdr *) (pkt
953 tcp = (
struct tcphdr *) (pkt + ip->ip_hl * 4);
955 if (pktsz <
UNFIX (ip->ip_len))
960 data_len =
UNFIX (ip->ip_len) - (ip->ip_hl * 4) - (tcp->th_off * 4);
961 data = (
char *) ((
char *) tcp + tcp->th_off * 4);
964 npkt = g_malloc0 (ip->ip_hl * 4 + tcp->th_off * 4 + data_len);
965 bcopy (pkt, npkt,
UNFIX (ip->ip_len));
967 ip = (
struct ip *) (npkt);
968 tcp = (
struct tcphdr *) (npkt + ip->ip_hl * 4);
985 bcopy (data, (
char *) tcp + tcp->th_off * 4, data_len);
989 ip->ip_len = ip->ip_hl * 4 + tcp->th_off * 4 + data_len;
991 ip->ip_sum =
np_in_cksum ((u_short *) pkt, ip->ip_hl * 4);
994 if (tcp->th_sum == 0)
997 char *tcpsumdata = g_malloc0 (
sizeof (
struct pseudohdr) + data_len + 1);
998 struct in_addr source, dest;
1000 source.s_addr = ip->ip_src.s_addr;
1001 dest.s_addr = ip->ip_dst.s_addr;
1003 bzero (&pseudoheader,
sizeof (pseudoheader));
1004 pseudoheader.
saddr.s_addr = source.s_addr;
1005 pseudoheader.
daddr.s_addr = dest.s_addr;
1007 pseudoheader.
protocol = IPPROTO_TCP;
1008 pseudoheader.
length = htons (
sizeof (
struct tcphdr) + data_len);
1009 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
1010 sizeof (
struct tcphdr));
1012 bcopy ((
char *) &pseudoheader, tcpsumdata,
sizeof (
struct pseudohdr));
1013 bcopy ((
char *) data, tcpsumdata +
sizeof (
struct pseudohdr), data_len);
1014 tcp->th_sum =
np_in_cksum ((
unsigned short *) tcpsumdata,
1015 sizeof (pseudoheader) + data_len);
1016 g_free (tcpsumdata);
1020 retc->
size = (ip->ip_hl * 4) + (tcp->th_off * 4) + data_len;
1046 struct ip *ip = (
struct ip *) pkt;
1053 int tcp_opt, tcp_opt_val, tcp_opt_val2;
1054 int current_opt_len, total_opt_len, opt_size_allocated;
1055 char *opts, *ptr_opts_pos;
1066 nasl_perror (lexic,
"%s: Invalid value for the argument 'tcp'\n",
1071 opts = g_malloc0 (
sizeof (
char) * 4);
1072 ptr_opts_pos = opts;
1073 opt_size_allocated = 4;
1078 current_opt_len = total_opt_len;
1088 if (tcp_opt_val < (
int) TCP_MSS_DEFAULT || tcp_opt_val > 65535)
1090 nasl_perror (lexic,
"%s: Invalid value for TCP option MSS\n",
1094 opt_mss = g_malloc0 (
sizeof (
struct tcp_opt_mss));
1095 total_opt_len += TCPOLEN_MAXSEG;
1096 opt_mss->
kind = TCPOPT_MAXSEG;
1097 opt_mss->
len = TCPOLEN_MAXSEG;
1098 opt_mss->
mss =
FIX (tcp_opt_val);
1101 if (total_opt_len > opt_size_allocated)
1103 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1104 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1105 ptr_opts_pos = opts + current_opt_len;
1108 memcpy (ptr_opts_pos, (u_char *) opt_mss,
1110 ptr_opts_pos = ptr_opts_pos +
sizeof (
struct tcp_opt_mss);
1116 if (tcp_opt_val < 0 || tcp_opt_val > 14)
1118 nasl_perror (lexic,
"%s: Invalid value for TCP option WScale\n",
1123 total_opt_len += TCPOLEN_WINDOW;
1124 opt_wscale->
kind = TCPOPT_WINDOW;
1125 opt_wscale->
len = TCPOLEN_WINDOW;
1126 opt_wscale->
wscale = tcp_opt_val;
1129 if (total_opt_len > opt_size_allocated)
1131 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1132 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1133 ptr_opts_pos = opts + current_opt_len;
1136 memcpy (ptr_opts_pos, (u_char *) opt_wscale,
1139 g_free (opt_wscale);
1141 case TCPOPT_SACK_PERMITTED:
1143 total_opt_len += TCPOLEN_SACK_PERMITTED;
1144 opt_sack_perm->
kind = TCPOPT_SACK_PERMITTED;
1145 opt_sack_perm->
len = TCPOLEN_SACK_PERMITTED;
1148 if (total_opt_len > opt_size_allocated)
1150 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1151 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1152 ptr_opts_pos = opts + current_opt_len;
1155 memcpy (ptr_opts_pos, (u_char *) opt_sack_perm,
1158 g_free (opt_sack_perm);
1160 case TCPOPT_TIMESTAMP:
1164 if (tcp_opt_val < 0)
1165 nasl_perror (lexic,
"%s: Invalid value for TCP option Timestamp\n",
1168 total_opt_len += TCPOLEN_TIMESTAMP;
1169 opt_tstamp->
kind = TCPOPT_TIMESTAMP;
1170 opt_tstamp->
len = TCPOLEN_TIMESTAMP;
1171 opt_tstamp->
tstamp = htonl (tcp_opt_val);
1172 opt_tstamp->
e_tstamp = htonl (tcp_opt_val2);
1175 if (total_opt_len > opt_size_allocated)
1177 opt_size_allocated = ((total_opt_len / 4) + 1) * 4;
1178 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1179 ptr_opts_pos = opts + current_opt_len;
1182 memcpy (ptr_opts_pos, (u_char *) opt_tstamp,
1185 g_free (opt_tstamp);
1191 nasl_perror (lexic,
"%s: TCP option %d not supported\n", __func__,
1198 current_opt_len = total_opt_len;
1201 if (total_opt_len % 4 == 0)
1203 opt_size_allocated = opt_size_allocated + 4;
1204 opts = g_realloc (opts,
sizeof (
char) * opt_size_allocated);
1205 ptr_opts_pos = opts + total_opt_len;
1207 if (current_opt_len < opt_size_allocated - 1)
1210 for (i = current_opt_len; i < opt_size_allocated - 1; i++)
1212 memcpy (ptr_opts_pos, &nop, 1);
1218 memcpy (ptr_opts_pos, &eol, 1);
1220 if (ip->ip_hl * 4 > pktsz)
1222 tcp = (
struct tcphdr *) (pkt + 20);
1224 tcp = (
struct tcphdr *) (pkt + ip->ip_hl * 4);
1226 if (pktsz <
UNFIX (ip->ip_len))
1234 data_len =
UNFIX (ip->ip_len) - (ip->ip_hl * 4) - (tcp->th_off * 4);
1235 data = (
char *) ((
char *) tcp + tcp->th_off * 4);
1240 g_malloc0 (ip->ip_hl * 4 + tcp->th_off * 4 + opt_size_allocated + data_len);
1241 memcpy (npkt, pkt,
UNFIX (ip->ip_len));
1242 ip = (
struct ip *) (npkt);
1243 tcp = (
struct tcphdr *) (npkt + ip->ip_hl * 4);
1246 memcpy ((
char *) tcp + tcp->th_off * 4, opts, opt_size_allocated);
1248 tcp->th_off = tcp->th_off + (opt_size_allocated / 4);
1249 memcpy ((
char *) tcp + tcp->th_off * 4, data, data_len);
1252 ip->ip_len =
FIX (ip->ip_hl * 4 + tcp->th_off * 4 + data_len);
1254 ip->ip_sum =
np_in_cksum ((u_short *) npkt, ip->ip_hl * 4);
1259 g_malloc0 (
sizeof (
struct pseudohdr) + opt_size_allocated + data_len + 1);
1260 struct in_addr source, dest;
1262 source.s_addr = ip->ip_src.s_addr;
1263 dest.s_addr = ip->ip_dst.s_addr;
1265 memset (&pseudoheader, 0,
sizeof (
struct pseudohdr));
1266 pseudoheader.
saddr.s_addr = source.s_addr;
1267 pseudoheader.
daddr.s_addr = dest.s_addr;
1269 pseudoheader.
protocol = IPPROTO_TCP;
1272 htons (
sizeof (
struct tcphdr) + opt_size_allocated + data_len);
1277 memcpy ((
char *) &pseudoheader.
tcpheader, (
char *) tcp,
1278 sizeof (
struct tcphdr));
1281 memcpy (tcpsumdata, (
char *) &pseudoheader,
sizeof (
struct pseudohdr));
1282 memcpy (tcpsumdata +
sizeof (
struct pseudohdr), (
char *) opts,
1283 opt_size_allocated);
1284 memcpy (tcpsumdata +
sizeof (
struct pseudohdr) + opt_size_allocated,
1285 (
char *) data, data_len);
1288 sizeof (
struct pseudohdr) + opt_size_allocated + data_len);
1290 g_free (tcpsumdata);
1293 retc->
size = (ip->ip_hl * 4) + (tcp->th_off * 4) + data_len;
1312 struct ip *ip = (
struct ip *) pkt;
1313 struct tcphdr *tcp = (
struct tcphdr *) (pkt + ip->ip_hl * 4);
1318 printf (
"------\n");
1319 printf (
"\tth_sport : %d\n", ntohs (tcp->th_sport));
1320 printf (
"\tth_dport : %d\n", ntohs (tcp->th_dport));
1321 printf (
"\tth_seq : %u\n", (
unsigned int) ntohl (tcp->th_seq));
1322 printf (
"\tth_ack : %u\n", (
unsigned int) ntohl (tcp->th_ack));
1323 printf (
"\tth_x2 : %d\n", tcp->th_x2);
1324 printf (
"\tth_off : %d\n", tcp->th_off);
1325 printf (
"\tth_flags : ");
1326 if (tcp->th_flags & TH_FIN)
1331 if (tcp->th_flags & TH_SYN)
1338 if (tcp->th_flags & TH_RST)
1345 if (tcp->th_flags & TH_PUSH)
1352 if (tcp->th_flags & TH_ACK)
1359 if (tcp->th_flags & TH_URG)
1369 printf (
" (%d)", tcp->th_flags);
1371 printf (
"\tth_win : %d\n", ntohs (tcp->th_win));
1372 printf (
"\tth_sum : 0x%x\n", ntohs (tcp->th_sum));
1373 printf (
"\tth_urp : %d\n", ntohs (tcp->th_urp));
1375 if (tcp->th_off > 5)
1381 (
char *) g_malloc0 (
sizeof (uint8_t) * 4 * (tcp->th_off - 5));
1382 memcpy (options, (
char *) tcp + 20, (tcp->th_off - 5) * 4);
1384 tcp_all_options = g_malloc0 (
sizeof (
struct tcp_options));
1386 if (tcp_all_options != NULL)
1388 printf (
"\tTCP Options:\n");
1389 printf (
"\t\tTCPOPT_MAXSEG: %u\n",
1390 ntohs ((uint16_t) tcp_all_options->
mss.
mss));
1391 printf (
"\t\tTCPOPT_WINDOW: %u\n",
1393 printf (
"\t\tTCPOPT_SACK_PERMITTED: %u\n",
1395 printf (
"\t\tTCPOPT_TIMESTAMP TSval: %u\n",
1397 printf (
"\t\tTCPOPT_TIMESTAMP TSecr: %u\n",
1401 g_free (tcp_all_options);
1404 printf (
"\n\tData : ");
1405 c = (
char *) ((
char *) tcp +
sizeof (
struct tcphdr)
1406 +
sizeof (uint8_t) * 4 * (tcp->th_off - 5));
1407 if (
UNFIX (ip->ip_len) > (sizeof (
struct ip) +
sizeof (
struct tcphdr)))
1408 for (j = 0; j <
UNFIX (ip->ip_len) -
sizeof (
struct ip)
1409 - sizeof (struct tcphdr)
1410 - sizeof (uint8_t) * 4 * (tcp->th_off - 5)
1413 printf (
"%c", isprint (c[j]) ? c[j] :
'.');
1462 struct ip *udp_packet;
1465 pkt = g_malloc0 (
sizeof (
struct udphdr) + ip->ip_hl * 4
1466 + sizeof (
struct udphdr) + data_len);
1468 udp_packet = (
struct ip *) pkt;
1469 udp = (
struct udphdr *) (pkt + ip->ip_hl * 4);
1474 lexic,
"uh_ulen", data_len +
sizeof (
struct udphdr)));
1477 if (data_len != 0 && data != NULL)
1478 bcopy (data, (pkt + ip->ip_hl * 4 + sizeof (
struct udphdr)), data_len);
1481 bcopy ((
char *) ip, pkt, ip->ip_hl * 4);
1482 if (udp->uh_sum == 0)
1485 struct in_addr source, dest;
1489 source.s_addr = ip->ip_src.s_addr;
1490 dest.s_addr = ip->ip_dst.s_addr;
1497 pseudohdr.len = htons (
sizeof (
struct udphdr) + data_len);
1498 bcopy ((
char *) udp, (
char *) &
pseudohdr.udpheader,
1499 sizeof (
struct udphdr));
1503 bcopy ((
char *) data, udpsumdata +
sizeof (
pseudohdr), data_len);
1505 udp->uh_sum =
np_in_cksum ((
unsigned short *) udpsumdata,
1506 12 +
sizeof (
struct udphdr) + data_len);
1507 g_free (udpsumdata);
1510 if (
UNFIX (udp_packet->ip_len) <= udp_packet->ip_hl * 4)
1515 udp_packet->ip_len =
1516 FIX (ntohs (udp->uh_ulen) + (udp_packet->ip_hl * 4));
1517 udp_packet->ip_sum = 0;
1518 udp_packet->ip_sum =
1519 np_in_cksum ((u_short *) udp_packet, udp_packet->ip_hl * 4);
1525 retc->
size = 8 + ip->ip_hl * 4 + data_len;
1530 "forge_udp_packet: Invalid value for the argument 'ip'\n");
1552 struct udphdr *udphdr;
1559 if (udp == NULL || element == NULL)
1561 nasl_perror (lexic,
"get_udp_element: usage :\nelement = "
1562 "get_udp_element(udp:<udp>,element:<element>\n");
1565 ip = (
struct ip *) udp;
1567 if (ip->ip_hl * 4 + sizeof (
struct udphdr) > ipsz)
1570 udphdr = (
struct udphdr *) (udp + ip->ip_hl * 4);
1571 if (!strcmp (element,
"uh_sport"))
1572 ret = ntohs (udphdr->uh_sport);
1573 else if (!strcmp (element,
"uh_dport"))
1574 ret = ntohs (udphdr->uh_dport);
1575 else if (!strcmp (element,
"uh_ulen"))
1576 ret = ntohs (udphdr->uh_ulen);
1577 else if (!strcmp (element,
"uh_sum"))
1578 ret = ntohs (udphdr->uh_sum);
1579 else if (!strcmp (element,
"data"))
1583 sz = ntohs (udphdr->uh_ulen) -
sizeof (
struct udphdr);
1585 if (ntohs (udphdr->uh_ulen) - ip->ip_hl * 4 - sizeof (
struct udphdr)
1587 sz = ipsz - ip->ip_hl * 4 - sizeof (
struct udphdr);
1591 bcopy (udp + ip->ip_hl * 4 + sizeof (
struct udphdr), retc->
x.
str_val, sz);
1596 nasl_perror (lexic,
"%s: '%s' is not a value of a udp packet\n", __func__,
1635 if (ip->ip_hl * 4 + sizeof (
struct udphdr) > sz)
1640 sz = ip->ip_hl * 4 +
sizeof (
struct udphdr) + data_len;
1641 pkt = g_malloc0 (sz);
1642 bcopy (ip, pkt, ip->ip_hl * 4 + sizeof (
struct udphdr));
1646 pkt = g_malloc0 (sz);
1647 bcopy (ip, pkt, sz);
1650 ip = (
struct ip *) pkt;
1653 ip->ip_len =
FIX (sz);
1655 ip->ip_sum =
np_in_cksum ((u_short *) ip, ip->ip_hl * 4);
1657 udp = (
struct udphdr *) (pkt + ip->ip_hl * 4);
1663 old_len = ntohs (udp->uh_ulen);
1670 bcopy (data, pkt + ip->ip_hl * 4 + sizeof (
struct udphdr), data_len);
1671 udp->uh_ulen = htons (
sizeof (
struct udphdr) + data_len);
1674 if (udp->uh_sum == 0)
1677 struct in_addr source, dest;
1678 int len = old_len -
sizeof (
struct udphdr);
1689 ptr = (
char *) udp +
sizeof (
struct udphdr);
1694 source.s_addr = ip->ip_src.s_addr;
1695 dest.s_addr = ip->ip_dst.s_addr;
1703 bcopy ((
char *) udp, (
char *) &
pseudohdr.udpheader,
1704 sizeof (
struct udphdr));
1708 bcopy ((
char *) ptr, udpsumdata +
sizeof (
pseudohdr),
len);
1710 udp->uh_sum =
np_in_cksum ((
unsigned short *) udpsumdata,
1711 12 +
sizeof (
struct udphdr) +
len);
1712 g_free (udpsumdata);
1721 "set_udp_elements: Invalid value for the argument 'udp'.");
1739 struct udphdr *udp = (
struct udphdr *) (pkt +
sizeof (
struct ip));
1743 printf (
"------\n");
1744 printf (
"\tuh_sport : %d\n", ntohs (udp->uh_sport));
1745 printf (
"\tuh_dport : %d\n", ntohs (udp->uh_dport));
1746 printf (
"\tuh_sum : 0x%x\n", udp->uh_sum);
1747 printf (
"\tuh_ulen : %d\n", ntohs (udp->uh_ulen));
1748 printf (
"\tdata : ");
1750 if (udp->uh_ulen > sizeof (
struct udphdr))
1751 for (j =
sizeof (
struct udphdr);
1752 j < (ntohs (udp->uh_ulen)) && j < limit; j++)
1753 printf (
"%c", isprint (c[j]) ? c[j] :
'.');
1799 if (t == 13 || t == 14)
1800 len += 3 *
sizeof (time_t);
1802 if (ip->ip_hl * 4 > ip_sz)
1805 pkt = g_malloc0 (
sizeof (
struct icmp) + ip_sz +
len);
1806 ip_icmp = (
struct ip *) pkt;
1808 bcopy (ip, ip_icmp, ip_sz);
1809 if (
UNFIX (ip_icmp->ip_len) <= (ip_icmp->ip_hl * 4))
1813 ip_icmp->ip_len =
FIX (ip->ip_hl * 4 + 8 +
len);
1814 ip_icmp->ip_sum = 0;
1819 p = (
char *) (pkt + (ip->ip_hl * 4));
1820 icmp = (
struct icmp *) p;
1823 icmp->icmp_type = t;
1828 bcopy (data, &(p[8]),
len);
1840 nasl_perror (lexic,
"forge_icmp_packet: missing 'ip' parameter\n");
1864 struct ip *ip = (
struct ip *) p;
1867 icmp = (
struct icmp *) (p + ip->ip_hl * 4);
1872 "get_icmp_element: missing 'element' parameter\n");
1876 if (!strcmp (elem,
"icmp_id"))
1877 value = ntohs (icmp->icmp_id);
1878 else if (!strcmp (elem,
"icmp_code"))
1879 value = icmp->icmp_code;
1880 else if (!strcmp (elem,
"icmp_type"))
1881 value = icmp->icmp_type;
1882 else if (!strcmp (elem,
"icmp_seq"))
1883 value = ntohs (icmp->icmp_seq);
1884 else if (!strcmp (elem,
"icmp_cksum"))
1885 value = ntohs (icmp->icmp_cksum);
1886 else if (!strcmp (elem,
"data"))
1894 memcpy (retc->
x.
str_val, &(p[ip->ip_hl * 4 + 8]), retc->
size + 1);
1907 "get_icmp_element: Element '%s' is not a valid element to get.\n",
1917 nasl_perror (lexic,
"get_icmp_element: missing 'icmp' parameter\n");
1935 struct ip *ip = (
struct ip *) pkt;
1937 icmp = (
struct icmp *) (pkt + ip->ip_hl * 4);
1938 printf (
"------\n");
1939 printf (
"\ticmp_id : %d\n", ntohs (icmp->icmp_id));
1940 printf (
"\ticmp_code : %d\n", icmp->icmp_code);
1941 printf (
"\ticmp_type : %u\n", icmp->icmp_type);
1942 printf (
"\ticmp_seq : %u\n", ntohs (icmp->icmp_seq));
1943 printf (
"\ticmp_cksum : %d\n", ntohs (icmp->icmp_cksum));
1944 printf (
"\tData : %s\n", icmp->icmp_data);
1983 u_char *pkt = g_malloc0 (
sizeof (
struct igmp) + ip->ip_hl * 4 +
len);
1984 struct ip *ip_igmp = (
struct ip *) pkt;
1991 bcopy (ip, ip_igmp, ipsz);
1993 if (
UNFIX (ip_igmp->ip_len) <= ip_igmp->ip_hl * 4)
1999 FIX (ip->ip_hl * 4 + sizeof (
struct igmp) +
len);
2000 ip_igmp->ip_sum = 0;
2005 p = (
char *) (pkt + ip_igmp->ip_hl * 4);
2020 char *ptmp = (
char *) (pkt + ip->ip_hl * 4 + sizeof (
struct igmp));
2021 bcopy (ptmp, data,
len);
2025 retc->
size = ip->ip_hl * 4 +
sizeof (
struct igmp) +
len;
2029 nasl_perror (lexic,
"forge_igmp_packet: missing 'ip' parameter\n");
2053 if (IN6_IS_ADDR_V4MAPPED (dst) != 1)
2059 u_char packet[
sizeof (
struct ip) + sizeof (struct tcphdr)];
2061 struct ip *ip = (
struct ip *) packet;
2062 struct tcphdr *tcp = (
struct tcphdr *) (packet +
sizeof (
struct ip));
2064 struct sockaddr_in soca;
2073#define rnd_tcp_port() (rand () % 65535 + 1024)
2074 int sports[] = {0, 0, 0, 0, 0, 1023, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2075 0, 0, 0, 0, 0, 53, 0, 0, 20, 0, 25, 0, 0, 0};
2076 int ports[] = {139, 135, 445, 80, 22, 515, 23, 21, 6000, 1025,
2077 25, 111, 1028, 9100, 1029, 79, 497, 548, 5000, 1917,
2078 53, 161, 9001, 65535, 443, 113, 993, 8080};
2079 struct in_addr inaddr;
2081 if (dst == NULL || (IN6_IS_ADDR_V4MAPPED (dst) != 1))
2083 inaddr.s_addr = dst->s6_addr32[3];
2084 for (i = 0; i <
sizeof (sports) /
sizeof (int); i++)
2090 soc = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
2093 if (setsockopt (soc, IPPROTO_IP, IP_HDRINCL, (
char *) &opt,
sizeof (opt)) < 0)
2094 perror (
"setsockopt ");
2101 src.s_addr = dst->s6_addr32[3];
2104 bzero (&src,
sizeof (src));
2108 snprintf (filter,
sizeof (filter),
"ip and src host %s", inet_ntoa (inaddr));
2115 for (i = 0; i <
sizeof (sports) /
sizeof (int) && !flag; i++)
2117 bzero (packet,
sizeof (packet));
2120 ip->ip_off =
FIX (0);
2122 ip->ip_len =
FIX (40);
2124 ip->ip_p = IPPROTO_TCP;
2125 ip->ip_id = rand ();
2128 ip->ip_dst = inaddr;
2133 tcp->th_sport = port ? htons (
rnd_tcp_port ()) : htons (sports[i]);
2134 tcp->th_flags = TH_SYN;
2135 tcp->th_dport = port ? htons (port) : htons (ports[i]);
2136 tcp->th_seq = rand ();
2146 struct in_addr source, dest;
2148 source.s_addr = ip->ip_src.s_addr;
2149 dest.s_addr = ip->ip_dst.s_addr;
2151 bzero (&pseudoheader, 12 +
sizeof (
struct tcphdr));
2152 pseudoheader.
saddr.s_addr = source.s_addr;
2153 pseudoheader.
daddr.s_addr = dest.s_addr;
2156 pseudoheader.
length = htons (
sizeof (
struct tcphdr));
2157 bcopy ((
char *) tcp, (
char *) &pseudoheader.
tcpheader,
2158 sizeof (
struct tcphdr));
2159 tcp->th_sum =
np_in_cksum ((
unsigned short *) &pseudoheader,
2160 12 +
sizeof (
struct tcphdr));
2163 bzero (&soca,
sizeof (soca));
2164 soca.sin_family = AF_INET;
2165 soca.sin_addr = ip->ip_dst;
2166 if (sendto (soc, (
const void *) ip, 40, 0, (
struct sockaddr *) &soca,
2169 g_warning (
"sendto: %s", strerror (errno));
2171 tv.tv_usec = 100000;
2209 struct sockaddr_in sockaddr;
2211 struct ip *sip = NULL;
2223 struct in_addr inaddr;
2224 int allow_broadcast = 0;
2226 if (dstip == NULL || (IN6_IS_ADDR_V4MAPPED (dstip) != 1))
2228 inaddr.s_addr = dstip->s6_addr32[3];
2229 soc = socket (AF_INET, SOCK_RAW, IPPROTO_RAW);
2232 if (setsockopt (soc, IPPROTO_IP, IP_HDRINCL, (
char *) &opt_on,
2235 perror (
"setsockopt ");
2243 if ((
unsigned int) sz <
sizeof (
struct ip))
2245 nasl_perror (lexic,
"send_packet: packet is too short\n");
2249 sip = (
struct ip *) ip;
2250 if (use_pcap != 0 && bpf < 0)
2253 bzero (&sockaddr,
sizeof (
struct sockaddr_in));
2254 sockaddr.sin_family = AF_INET;
2255 sockaddr.sin_addr = sip->ip_dst;
2257 if (allow_broadcast)
2259 if (setsockopt (soc, SOL_SOCKET, SO_BROADCAST, &opt_on,
2262 perror (
"setsockopt ");
2263 if (sockaddr.sin_addr.s_addr != INADDR_BROADCAST)
2264 allow_broadcast = 0;
2267 if (sockaddr.sin_addr.s_addr != inaddr.s_addr && !allow_broadcast)
2269 char txt1[64], txt2[64];
2270 strncpy (txt1, inet_ntoa (sockaddr.sin_addr), sizeof (txt1));
2271 txt1[
sizeof (txt1) - 1] =
'\0';
2272 strncpy (txt2, inet_ntoa (inaddr),
sizeof (txt2));
2273 txt2[
sizeof (txt2) - 1] =
'\0';
2275 "send_packet: malicious or buggy script is trying to "
2276 "send packet to %s instead of designated target %s\n",
2284 sip->ip_dst = inaddr;
2285 sip->ip_sum =
np_in_cksum ((u_short *) sip,
sizeof (
struct ip));
2289 if (dfl_len > 0 && dfl_len < sz)
2294 b = sendto (soc, (u_char *) ip,
len, 0, (
struct sockaddr *) &sockaddr,
2297 if (b >= 0 && use_pcap != 0 && bpf >= 0)
2302 while (answer != NULL
2303 && (!memcmp (answer, (
char *) ip,
sizeof (
struct ip))))
2316 retc->
size = answer_sz;
2345 static char errbuf[PCAP_ERRBUF_SIZE];
2347 struct ip *ret = NULL;
2348 struct ip6_hdr *ret6 = NULL;
2350 pcap_if_t *alldevsp = NULL;
2355 struct in_addr inaddr;
2361 int v4_addr = IN6_IS_ADDR_V4MAPPED (dst);
2362 if (interface == NULL)
2367 bzero (&src,
sizeof (src));
2368 inaddr.s_addr = dst->s6_addr32[3];
2373 struct in6_addr src;
2374 bzero (&src,
sizeof (src));
2377 if (interface == NULL)
2379 if (pcap_findalldevs (&alldevsp, errbuf) < 0)
2380 g_message (
"Error for pcap_findalldevs(): %s", errbuf);
2381 if (alldevsp != NULL)
2382 interface = alldevsp->
name;
2386 if (interface != NULL)
2393 nasl_perror (lexic,
"pcap_next: Could not get a bpf\n");
2403 gettimeofday (&then, NULL);
2413 gettimeofday (&now, NULL);
2414 if (now.tv_sec - then.tv_sec >= timeout)
2426 ip = (
struct ip *) (packet + dl_len);
2427 sz =
UNFIX (ip->ip_len);
2428 ret = g_malloc0 (sz);
2430 is_ip = (ip->ip_v == 4);
2434 bcopy (ip, ret, sz);
2439 bcopy (ip, ret, sz);
2445 ip = (
struct ip6_hdr *) (packet + dl_len);
2446 sz =
UNFIX (ip->ip6_plen);
2447 ret6 = g_malloc0 (sz);
2449 is_ip = ((ip->ip6_flow & 0x3ffff) == 96);
2452 bcopy (ip, ret6, sz);
2457 bcopy (ip, ret6, sz);
2475 if (alldevsp != NULL)
2476 pcap_freealldevs (alldevsp);
2495 static char errbuf[PCAP_ERRBUF_SIZE];
2497 struct ip *ret = NULL;
2498 struct ip6_hdr *ret6 = NULL;
2500 pcap_if_t *alldevsp = NULL;
2505 struct in_addr inaddr;
2510 int v4_addr = IN6_IS_ADDR_V4MAPPED (dst);
2511 if (interface == NULL)
2516 bzero (&src,
sizeof (src));
2517 inaddr.s_addr = dst->s6_addr32[3];
2522 struct in6_addr src;
2523 bzero (&src,
sizeof (src));
2526 if (interface == NULL)
2528 if (pcap_findalldevs (&alldevsp, errbuf) < 0)
2529 g_message (
"Error for pcap_findalldevs(): %s", errbuf);
2530 if (alldevsp != NULL)
2531 interface = alldevsp->
name;
2535 if (interface != NULL)
2540 nasl_perror (lexic,
"pcap_next: Could not get a bpf\n");
2541 if (alldevsp != NULL)
2542 pcap_freealldevs (alldevsp);
2555 gettimeofday (&then, NULL);
2565 gettimeofday (&now, NULL);
2566 if (now.tv_sec - then.tv_sec >= timeout)
2576 ip = (
struct ip *) (packet + dl_len);
2577 sz =
UNFIX (ip->ip_len);
2578 ret = g_malloc0 (sz);
2580 is_ip = (ip->ip_v == 4);
2583 bcopy (ip, ret, sz);
2588 bcopy (ip, ret, sz);
2594 ip = (
struct ip6_hdr *) (packet + dl_len);
2595 sz =
UNFIX (ip->ip6_plen);
2596 ret6 = g_malloc0 (sz);
2597 is_ip = ((ip->ip6_flow & 0x3ffff) == 96);
2600 bcopy (ip, ret6, sz);
2605 bcopy (ip, ret6, sz);
2611 if (alldevsp != NULL)
2612 pcap_freealldevs (alldevsp);
2625 if (alldevsp != NULL)
2626 pcap_freealldevs (alldevsp);
int bpf_open_live(char *iface, char *filter)
int bpf_datalink(int bpf)
u_char * bpf_next_tv(int bpf, int *caplen, struct timeval *tv)
u_char * bpf_next(int bpf, int *caplen)
Header file for module bpf_share.
int init_capture_device(struct in_addr src, struct in_addr dest, char *filter)
Set up the pcap filter, and select the correct interface.
struct ip * capture_next_packet(int bpf, int timeout, int *sz)
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 * insert_ip_options(lex_ctxt *lexic)
Add option datagram.
tree_cell * nasl_tcp_ping(lex_ctxt *lexic)
Launches a âTCP pingâ against the target host.
tree_cell * set_udp_elements(lex_ctxt *lexic)
Modify UDP fields of an IP datagram.
tree_cell * get_tcp_element(lex_ctxt *lexic)
Extracts TCP field from an IP datagram.
static int np_in_cksum(u_short *p, int n)
tree_cell * get_tcp_option(lex_ctxt *lexic)
Get a TCP option from an IP datagram if present. Possible options are: TCPOPT_MAXSEG (2),...
tree_cell * forge_ip_packet(lex_ctxt *lexic)
Forge an IP datagram.
tree_cell * dump_icmp_packet(lex_ctxt *lexic)
Dump the ICMP part of a IP Datagram.
tree_cell * set_ip_elements(lex_ctxt *lexic)
Modify the fields of a datagram.
tree_cell * dump_ip_packet(lex_ctxt *lexic)
Dump IP datagrams.
static void get_tcp_options(char *options, struct tcp_options *tcp_all_options)
Extract all TCP option from an IP datagram.
tree_cell * insert_tcp_options(lex_ctxt *lexic)
Add options to a TCP segment header. Possible options are: TCPOPT_MAXSEG (2), values between 536 and ...
tree_cell * nasl_pcap_next(lex_ctxt *lexic)
Listen to one packet and return it.
tree_cell * set_tcp_elements(lex_ctxt *lexic)
Modify the TCP fields of a datagram.
tree_cell * dump_tcp_packet(lex_ctxt *lexic)
Dump the TCP part of a IP Datagram.
tree_cell * forge_tcp_packet(lex_ctxt *lexic)
Fills an IP datagram with TCP data. Note that the ip_p field is not updated. It returns the modified ...
tree_cell * dump_udp_packet(lex_ctxt *lexic)
Dump the UDP part of a IP Datagram.
tree_cell * get_icmp_element(lex_ctxt *lexic)
Get an ICMP element from a IP datagram.
tree_cell * nasl_send_packet(lex_ctxt *lexic)
Send a list of packets (passed as unnamed arguments) and listens to the answers. It returns a block m...
tree_cell * nasl_send_capture(lex_ctxt *lexic)
Send a capture.
tree_cell * forge_icmp_packet(lex_ctxt *lexic)
Fill an IP datagram with ICMP data.
tree_cell * get_udp_element(lex_ctxt *lexic)
Get an UDP element from a IP datagram.
tree_cell * forge_udp_packet(lex_ctxt *lexic)
Fills an IP datagram with UDP data. Note that the ip_p field is not updated. It returns the modified ...
tree_cell * get_ip_element(lex_ctxt *lexic)
Extracts a field from an IP datagram.
struct pseudo_udp_hdr __attribute__
tree_cell * forge_igmp_packet(lex_ctxt *lexic)
Fills an IP datagram with IGMP data.
tree_cell * nasl_tcp_v6_ping(lex_ctxt *lexic)
Performs TCP Connect to test if host is alive.
tree_cell * nasl_send(lex_ctxt *lexic)
tree_cell * alloc_typed_cell(int typ)
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 islocalhost(struct in_addr *addr)
Tests whether a packet sent to IP is LIKELY to route through the kernel localhost interface.
char * routethrough(struct in_addr *dest, struct in_addr *source)
An awesome function to determine what interface a packet to a given destination should be routed thro...
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...
int get_datalink_size(int datalink)
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