|
OpenVAS Scanner 23.32.3
|
#include "nasl_packet_forgery.h"#include "../misc/bpf_share.h"#include "../misc/pcap_openvas.h"#include "../misc/plugutils.h"#include "capture_packet.h"#include "exec.h"#include "nasl_debug.h"#include "nasl_func.h"#include "nasl_global_ctxt.h"#include "nasl_lex_ctxt.h"#include "nasl_packet_forgery_v6.h"#include "nasl_raw.h"#include "nasl_socket.h"#include "nasl_tree.h"#include "nasl_var.h"#include <arpa/inet.h>#include <ctype.h>#include <errno.h>#include <pcap.h>#include <stdlib.h>#include <string.h>#include <sys/time.h>#include <unistd.h>
Go to the source code of this file.
Data Structures | |
| struct | pseudohdr |
| struct | tcp_opt_mss |
| struct | tcp_opt_wscale |
| struct | tcp_opt_sack_perm |
| struct | tcp_opt_tstamp |
| struct | tcp_options |
| struct | pseudo_udp_hdr |
| struct | igmp |
Macros | |
| #define | FIX(n) |
| #define | UNFIX(n) |
| #define | rnd_tcp_port() |
Functions | |
| static int | np_in_cksum (u_short *p, int n) |
| tree_cell * | forge_ip_packet (lex_ctxt *lexic) |
| Forge an IP datagram. | |
| tree_cell * | get_ip_element (lex_ctxt *lexic) |
| Extracts a field from an IP datagram. | |
| tree_cell * | set_ip_elements (lex_ctxt *lexic) |
| Modify the fields of a datagram. | |
| tree_cell * | insert_ip_options (lex_ctxt *lexic) |
| Add option datagram. | |
| tree_cell * | dump_ip_packet (lex_ctxt *lexic) |
| Dump IP datagrams. | |
| struct pseudohdr | __attribute__ ((packed)) |
| 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 IP datagram. Its arguments are: | |
| tree_cell * | get_tcp_element (lex_ctxt *lexic) |
| Extracts TCP field from an IP datagram. | |
| static void | get_tcp_options (char *options, struct tcp_options *tcp_all_options) |
| Extract all TCP option from an IP datagram. | |
| tree_cell * | get_tcp_option (lex_ctxt *lexic) |
| Get a TCP option from an IP datagram if present. Possible options are: TCPOPT_MAXSEG (2), values between 536 and 65535 TCPOPT_WINDOW (3), with values between 0 and 14 TCPOPT_SACK_PERMITTED (4), no value required. TCPOPT_TIMESTAMP (8), 8 bytes value for timestamp and echo timestamp, 4 bytes each one. | |
| tree_cell * | set_tcp_elements (lex_ctxt *lexic) |
| Modify the TCP fields of a 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 65535 TCPOPT_WINDOW (3), with values between 0 and 14 TCPOPT_SACK_PERMITTED (4), no value required. TCPOPT_TIMESTAMP (8), 8 bytes value for timestamp and echo timestamp, 4 bytes each one. | |
| tree_cell * | dump_tcp_packet (lex_ctxt *lexic) |
| Dump the TCP part of 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 IP datagram. Its arguments are: | |
| tree_cell * | get_udp_element (lex_ctxt *lexic) |
| Get an UDP element from a IP datagram. | |
| tree_cell * | set_udp_elements (lex_ctxt *lexic) |
| Modify UDP fields of an IP datagram. | |
| tree_cell * | dump_udp_packet (lex_ctxt *lexic) |
| Dump the UDP part of a IP Datagram. | |
| tree_cell * | forge_icmp_packet (lex_ctxt *lexic) |
| Fill an IP datagram with ICMP data. | |
| tree_cell * | get_icmp_element (lex_ctxt *lexic) |
| Get an ICMP element from a IP datagram. | |
| tree_cell * | dump_icmp_packet (lex_ctxt *lexic) |
| Dump the ICMP part of a IP Datagram. | |
| tree_cell * | forge_igmp_packet (lex_ctxt *lexic) |
| Fills an IP datagram with IGMP data. | |
| tree_cell * | nasl_tcp_ping (lex_ctxt *lexic) |
| Launches a âTCP pingâ against the target host. | |
| 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 made of all the sniffed âanswersâ. | |
| tree_cell * | nasl_pcap_next (lex_ctxt *lexic) |
| Listen to one packet and return it. | |
| tree_cell * | nasl_send_capture (lex_ctxt *lexic) |
| Send a capture. | |
Variables | |
| struct in_addr | saddr |
| struct in_addr | daddr |
| u_char | zero |
| u_char | protocol |
| u_short | length |
| struct tcphdr | tcpheader |
| uint8_t | kind |
| uint8_t | len |
| uint16_t | mss |
| uint8_t | wscale |
| uint32_t | tstamp |
| uint32_t | e_tstamp |
| struct tcp_opt_sack_perm | sack_perm |
| struct pseudo_udp_hdr | __attribute__ |
| #define FIX | ( | n | ) |
Definition at line 39 of file nasl_packet_forgery.c.
Referenced by forge_icmp_packet(), forge_igmp_packet(), forge_ip_packet(), forge_tcp_packet(), forge_udp_packet(), insert_ip_options(), insert_tcp_options(), nasl_tcp_ping(), set_ip_elements(), and set_udp_elements().
| #define rnd_tcp_port | ( | ) |
Referenced by nasl_tcp_ping(), and nasl_tcp_v6_ping().
| #define UNFIX | ( | n | ) |
Definition at line 40 of file nasl_packet_forgery.c.
Referenced by __attribute__(), dump_icmp_v6_packet(), dump_ip_v6_packet(), dump_tcp_packet(), dump_tcp_v6_packet(), forge_icmp_packet(), forge_icmp_v6_packet(), forge_igmp_packet(), forge_igmp_v6_packet(), forge_tcp_packet(), forge_udp_packet(), forge_udp_v6_packet(), get_ip_element(), get_tcp_element(), get_tcp_option(), get_tcp_v6_element(), get_tcp_v6_option(), insert_ip_options(), insert_tcp_options(), insert_tcp_v6_options(), nasl_pcap_next(), nasl_send_capture(), set_ip_elements(), set_tcp_elements(), and set_tcp_v6_elements().
| struct pseudohdr __attribute__ | ( | (packed) | ) |
Dump the ICMP part of a IP Datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ... | IP datagrams to dump the ICMP part from. |
Definition at line 1928 of file nasl_packet_forgery.c.
References get_str_var_by_num().

Dump IP datagrams.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ... | IP datagrams to dump. |
Definition at line 434 of file nasl_packet_forgery.c.
Dump the TCP part of a IP Datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ... | IP datagrams to dump the TCP part from. |
Definition at line 1304 of file nasl_packet_forgery.c.
References tcp_opt_tstamp::e_tstamp, get_str_var_by_num(), get_tcp_options(), get_var_size_by_num(), tcp_opt_sack_perm::kind, tcp_opt_mss::mss, tcp_options::mss, tcp_options::sack_perm, tcp_opt_tstamp::tstamp, tcp_options::tstamp, UNFIX, tcp_opt_wscale::wscale, and tcp_options::wscale.

Dump the UDP part of a IP Datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ... | IP datagrams to dump the UDP part from. |
Definition at line 1732 of file nasl_packet_forgery.c.
References get_str_var_by_num(), and get_var_size_by_num().

Fill an IP datagram with ICMP data.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ip | IP datagram that is updated. |
| [in] | data | Payload. |
| [in] | icmp_cksum | Checksum, computed by default. |
| [in] | icmp_code | ICMP code. 0 by default. |
| [in] | icmp_id | ICMP ID. 0 by default. |
| [in] | icmp_seq | ICMP sequence number. |
| [in] | icmp_type | ICMP type. 0 by default. |
| [in] | update_ip_len | Flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram. |
Definition at line 1778 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), len, nasl_perror(), np_in_cksum(), TC::size, TC::str_val, UNFIX, and TC::x.

Fills an IP datagram with IGMP data.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ip | IP datagram that is updated. |
| [in] | code | 0 by default. |
| [in] | data | |
| [in] | group | |
| [in] | type | 0 by default. |
| [in] | update_ip_len | Flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram. |
Definition at line 1974 of file nasl_packet_forgery.c.
References alloc_typed_cell(), igmp::cksum, igmp::code, CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), igmp::group, len, nasl_perror(), np_in_cksum(), TC::size, TC::str_val, igmp::type, UNFIX, and TC::x.

Forge an IP datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | data | Payload. |
| [in] | ip_hl | IP header length in 32 bits words. 5 by default. |
| [in] | ip_id | Datagram ID. Random by default. |
| [in] | ip_len | Length of the datagram. 20 plus the length of the data field by default. |
| [in] | ip_off | Fragment offset in 64 bits words. 0 by default. |
| [in] | ip_p | IP protocol. 0 by default. |
| [in] | ip_src | Source address in ASCII. NASL will convert it into an integer in network order. |
| [in] | ip_dst | Destination address in ASCII. NASL will convert it into an integer in network order. Uses the target ip of the current plugin by default. |
| [in] | ip_sum | Packet header checksum. It will be computed by default. |
| [in] | ip_tos | Type of service field. 0 by default |
| [in] | ip_ttl | Time To Live field. 64 by default. |
| [in] | ip_v | IP version. 4 by default. |
Definition at line 104 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), nasl_perror(), np_in_cksum(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.

Fills an IP datagram with TCP data. Note that the ip_p field is not updated. It returns the modified IP datagram. Its arguments are:
| [in] | ip | IP datagram to be filled. |
| [in] | data | TCP data payload. |
| [in] | th_ack | Acknowledge number. NASL will convert it into network order if necessary. 0 by default. |
| [in] | th_dport | Destination port. NASL will convert it into network order if necessary. 0 by default. |
| [in] | th_flags | TCP flags. 0 by default. |
| [in] | th_off | Size of the TCP header in 32 bits words. By default, 5. |
| [in] | th_seq | TCP sequence number. NASL will convert it into network order if necessary. Random by default. |
| [in] | th_sport | Source port. NASL will convert it into network order if necessary. 0 by default. |
| [in] | th_sum | TCP checksum. Right value is computed by default. |
| [in] | th_urp | Urgent pointer. 0 by default. |
| [in] | th_win | TCP window size. NASL will convert it into network order if necessary. 0 by default. |
| [in] | th_x2 | Is a reserved field and should probably be left unchanged. 0 by default. |
| [in] | update_ip_len | Flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram. |
Definition at line 555 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, pseudohdr::daddr, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), len, pseudohdr::length, nasl_perror(), np_in_cksum(), pseudohdr::protocol, pseudohdr::saddr, TC::size, TC::str_val, pseudohdr::tcpheader, UNFIX, and TC::x.

Fills an IP datagram with UDP data. Note that the ip_p field is not updated. It returns the modified IP datagram. Its arguments are:
| [in] | ip | IP datagram to be filled. |
| [in] | data | Payload. |
| [in] | uh_dport | Destination port. NASL will convert it into network order if necessary. 0 by default. |
| [in] | uh_sport | Source port. NASL will convert it into network order if necessary. 0 by default. |
| [in] | uh_sum | UDP checksum. Although it is not compulsory, the right value is computed by default. |
| [in] | uh_ulen | Data length. By default it is set to the length of the data argument plus the size of the UDP header. |
| [in] | update_ip_len | Flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram. |
Definition at line 1451 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, pseudohdr::daddr, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), nasl_perror(), np_in_cksum(), pseudohdr::saddr, TC::size, TC::str_val, UNFIX, and TC::x.

Get an ICMP element from a IP datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | icmp | Full IP datagram (IP + ICMP). |
| [in] | element | Name of the TCP field (see forge_tcp_packet()). |
Definition at line 1854 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), get_var_size_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, and TC::x.

Extracts a field from an IP datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | element | Name of the field, e.g. "ip_len" or "ip_src". |
| [in] | ip | IP datagram or fragment. |
Definition at line 183 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, UNFIX, and TC::x.

Extracts TCP field from an IP datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | element | Name of the the TCP field. See forge_tcp_packet(). |
| [in] | tcp | The full IP datagram (IP + TCP). |
Definition at line 652 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), get_var_size_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, UNFIX, and TC::x.

Get a TCP option from an IP datagram if present. Possible options are: TCPOPT_MAXSEG (2), values between 536 and 65535 TCPOPT_WINDOW (3), with values between 0 and 14 TCPOPT_SACK_PERMITTED (4), no value required. TCPOPT_TIMESTAMP (8), 8 bytes value for timestamp and echo timestamp, 4 bytes each one.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | tcp | The full IP datagram (IP + TCP). |
| [in] | option | Option to get. |
Definition at line 802 of file nasl_packet_forgery.c.
References add_var_to_array(), alloc_typed_cell(), CONST_INT, DYN_ARRAY, tcp_opt_tstamp::e_tstamp, get_int_var_by_name(), get_str_var_by_name(), get_tcp_options(), get_var_size_by_name(), TC::i_val, tcp_opt_sack_perm::kind, tcp_opt_mss::mss, tcp_options::mss, nasl_perror(), TC::ref_val, tcp_options::sack_perm, tcp_opt_tstamp::tstamp, tcp_options::tstamp, UNFIX, st_a_nasl_var::v, st_a_nasl_var::v_int, VAR2_INT, st_a_nasl_var::var_type, tcp_opt_wscale::wscale, tcp_options::wscale, and TC::x.

|
static |
Extract all TCP option from an IP datagram.
| [in] | options | All options present in the TCP segment. |
| [out] | tcp_all_options | Container for the options to return. |
Definition at line 733 of file nasl_packet_forgery.c.
References tcp_opt_tstamp::e_tstamp, tcp_opt_mss::kind, tcp_opt_sack_perm::kind, tcp_opt_tstamp::kind, tcp_opt_wscale::kind, tcp_opt_mss::len, tcp_opt_sack_perm::len, tcp_opt_tstamp::len, tcp_opt_wscale::len, tcp_opt_mss::mss, tcp_options::mss, tcp_options::sack_perm, tcp_opt_tstamp::tstamp, tcp_options::tstamp, tcp_opt_wscale::wscale, and tcp_options::wscale.
Referenced by dump_tcp_packet(), and get_tcp_option().

Get an UDP element from a IP datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | udp | The full IP datagram (IP + UDP). |
| [in] | element | Name of the UDP field (see forge_udp_packet()). |
Definition at line 1544 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), get_var_size_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, and TC::x.

Add option datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ip | IP datagram to add the option to. |
| [in] | code | Number of the option. |
| [in] | length | Length of the option data. |
| [in] | value | Option data. |
Definition at line 357 of file nasl_packet_forgery.c.
References alloc_typed_cell(), code, CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), len, nasl_perror(), np_in_cksum(), TC::size, TC::str_val, UNFIX, TC::x, and zero.

Add options to a TCP segment header. Possible options are: TCPOPT_MAXSEG (2), values between 536 and 65535 TCPOPT_WINDOW (3), with values between 0 and 14 TCPOPT_SACK_PERMITTED (4), no value required. TCPOPT_TIMESTAMP (8), 8 bytes value for timestamp and echo timestamp, 4 bytes each one.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | tcp | IP datagram. |
| [in] | data | (optional) TCP data payload. |
| [in] | unnamed | option. |
| [in] | Value | for unnamed option if required. |
Definition at line 1042 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, pseudohdr::daddr, tcp_opt_tstamp::e_tstamp, FIX, get_int_var_by_num(), get_str_var_by_name(), get_var_size_by_name(), tcp_opt_mss::kind, tcp_opt_sack_perm::kind, tcp_opt_tstamp::kind, tcp_opt_wscale::kind, tcp_opt_mss::len, tcp_opt_sack_perm::len, tcp_opt_tstamp::len, tcp_opt_wscale::len, pseudohdr::length, tcp_opt_mss::mss, nasl_perror(), np_in_cksum(), pseudohdr::protocol, pseudohdr::saddr, TC::size, TC::str_val, pseudohdr::tcpheader, tcp_opt_tstamp::tstamp, UNFIX, tcp_opt_wscale::wscale, and TC::x.

Listen to one packet and return it.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | interface | Network interface name. By default, NASL will try to find the best one. |
| [in] | pcap_filter | BPF filter. By default, it listens to everything. |
| [in] | timeout | 5 seconds by default. |
Definition at line 2338 of file nasl_packet_forgery.c.
References alloc_typed_cell(), bpf_close(), bpf_datalink(), bpf_next(), bpf_open_live(), CONST_DATA, get_datalink_size(), get_int_var_by_name(), get_str_var_by_name(), len, name, nasl_perror(), plug_get_host_ip(), routethrough(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, timeval(), UNFIX, v6_routethrough(), and TC::x.

Send a capture.
| [in] | interface | string |
| [in] | pcap | filter string |
| [in] | timeout | integer |
Definition at line 2488 of file nasl_packet_forgery.c.
References alloc_typed_cell(), bpf_close(), bpf_datalink(), bpf_next(), bpf_open_live(), CONST_DATA, get_datalink_size(), get_int_var_by_name(), get_str_var_by_name(), len, name, nasl_perror(), nasl_send(), plug_get_host_ip(), routethrough(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, timeval(), UNFIX, v6_routethrough(), and TC::x.

Send a list of packets (passed as unnamed arguments) and listens to the answers. It returns a block made of all the sniffed âanswersâ.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ... | Packets to send. |
| [in] | length | Length of each packet by default. |
| [in] | pcap_active | TRUE by default. Otherwise, NASL does not listen for the answers. |
| [in] | pcap_filter | BPF filter. |
| [in] | pcap_timeout | Capture timeout. 5 by default. |
| [in] | allow_broadcast | Default 0. |
Definition at line 2202 of file nasl_packet_forgery.c.
References alloc_typed_cell(), bpf_close(), capture_next_packet(), CONST_DATA, FAKE_CELL, get_int_var_by_name(), get_str_var_by_name(), get_str_var_by_num(), get_var_size_by_num(), init_capture_device(), islocalhost(), len, nasl_perror(), np_in_cksum(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.

Launches a âTCP pingâ against the target host.
Tries to open a TCP connection and sees if anything comes back (SYN/ACK or RST).
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | port | Port to ping. Internal list of common ports is used as default. |
Definition at line 2048 of file nasl_packet_forgery.c.
References alloc_typed_cell(), bpf_close(), bpf_next_tv(), CONST_INT, pseudohdr::daddr, FIX, get_int_var_by_name(), TC::i_val, init_capture_device(), islocalhost(), len, pseudohdr::length, nasl_tcp_v6_ping(), np_in_cksum(), plug_get_host_ip(), plug_get_host_open_port(), pseudohdr::protocol, rnd_tcp_port, routethrough(), pseudohdr::saddr, struct_lex_ctxt::script_infos, pseudohdr::tcpheader, timeval(), and TC::x.
Referenced by nasl_end_denial(), and nasl_start_denial().


|
static |
Definition at line 50 of file nasl_packet_forgery.c.
Referenced by forge_icmp_packet(), forge_igmp_packet(), forge_ip_packet(), forge_tcp_packet(), forge_udp_packet(), insert_ip_options(), insert_tcp_options(), nasl_send_packet(), nasl_tcp_ping(), set_ip_elements(), set_tcp_elements(), and set_udp_elements().

Modify the fields of a datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | ip | IP datagram to set fields on. |
| [in] | ip_hl | IP header length in 32 bits words. 5 by default. |
| [in] | ip_id | Datagram ID. Random by default. |
| [in] | ip_len | Length of the datagram. 20 plus the length of the data field by default. |
| [in] | ip_off | Fragment offset in 64 bits words. 0 by default. |
| [in] | ip_p | IP protocol. 0 by default. |
| [in] | ip_src | Source address in ASCII. NASL will convert it into an integer in network order. |
| [in] | ip_sum | Packet header checksum. It will be computed by default. |
| [in] | ip_tos | Type of service field. 0 by default |
| [in] | ip_ttl | Time To Live field. 64 by default. |
| [in] | ip_v | IP version. 4 by default. |
Definition at line 302 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), nasl_perror(), np_in_cksum(), TC::size, TC::str_val, UNFIX, and TC::x.

Modify the TCP fields of a datagram.
| [in] | lexic | Lexical context of NASL interpreter. |
| [in] | tcp | IP datagram. |
| [in] | data | TCP data payload. |
| [in] | th_ack | Acknowledge number. NASL will convert it into network order if necessary. |
| [in] | th_dport | Destination port. NASL will convert it into network order if necessary. |
| [in] | th_flags | TCP flags. |
| [in] | th_off | Size of the TCP header in 32 bits words. |
| [in] | th_seq | TCP sequence number. NASL will convert it into network order if necessary. |
| [in] | th_sport | Source port. NASL will convert it into network order if necessary. |
| [in] | th_sum | TCP checksum. |
| [in] | th_urp | Urgent pointer. |
| [in] | th_win | TCP window size. NASL will convert it into network order if necessary. |
| [in] | th_x2 | Is a reserved field and should probably be left unchanged. |
| [in] | update_ip_len | Flag (TRUE by default). If set, NASL will recompute the size field of the IP datagram. |
Definition at line 929 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, pseudohdr::daddr, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), pseudohdr::length, nasl_perror(), np_in_cksum(), pseudohdr::protocol, pseudohdr::saddr, TC::size, TC::str_val, pseudohdr::tcpheader, UNFIX, and TC::x.

Modify UDP fields of an IP datagram.
| [in] | udp | IP datagram to modify. |
| [in] | data | Payload. |
| [in] | uh_dport | Destination port. NASL will convert it into network order if necessary. |
| [in] | uh_sport | Source port. NASL will convert it into network order if necessary. |
| [in] | uh_sum | UDP checksum. |
| [in] | uh_ulen | Data length. |
Definition at line 1620 of file nasl_packet_forgery.c.
References alloc_typed_cell(), CONST_DATA, pseudohdr::daddr, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), len, nasl_perror(), np_in_cksum(), pseudohdr::saddr, TC::size, TC::str_val, and TC::x.

| struct tcp_options __attribute__ |
Referenced by __attribute__(), and __wrap_setsockopt().
| struct in_addr daddr |
Definition at line 1 of file nasl_packet_forgery.c.
Referenced by nasl_open_privileged_socket(), and nasl_send_arp_request().
| uint32_t e_tstamp |
Definition at line 3 of file nasl_packet_forgery.c.
| uint8_t kind |
Definition at line 0 of file nasl_packet_forgery.c.
| uint8_t len |
Definition at line 1 of file nasl_packet_forgery.c.
Referenced by __attribute__(), add_udp_data(), banner_grab(), capture_next_frame(), capture_next_packet(), capture_next_v6_packet(), crypt_data(), Ensure(), extractack(), extractsport(), extracttcp(), file_checksum(), forge_icmp_packet(), forge_icmp_v6_packet(), forge_igmp_packet(), forge_igmp_v6_packet(), forge_tcp_packet(), forge_tcp_v6_packet(), generate_random_buffer_ntlmssp(), get_available_memory(), get_kb_item(), get_status_of_table_driven_lsc_from_json(), get_udp_data(), getinterfaces(), getipv6routes(), getpts(), host_set_time(), insert_ip_options(), ipc_data_from_json(), ipc_get_lsc_os_release_from_data(), ipc_pipe_send(), ipc_send(), isalldigit(), issynack(), kb_item_add_str_unique_with_main_kb_check(), kb_item_set_str_with_main_kb_check(), MD5Update(), mpi_from_string(), mylex(), nasl_chomp(), nasl_crap(), nasl_file_write(), nasl_hash(), nasl_hexstr(), nasl_keyexchg(), nasl_ntlm2_response(), nasl_ntlm_response(), nasl_ntlmv2_response(), nasl_pcap_next(), nasl_recv(), nasl_recv_line(), nasl_send_capture(), nasl_send_packet(), nasl_send_v6packet(), nasl_split(), nasl_ssh_request_exec(), nasl_ssh_shell_write(), nasl_strlen(), nasl_tcp_ping(), nasl_tcp_v6_ping(), open_socket(), os_recv(), os_send(), plug_get_key(), plug_replace_key_len(), plug_set_key_len(), plug_set_key_len_volatile(), plugin_do_run(), process_notus_response(), read_ipc(), read_stream_connection(), replace_kb_item(), SamOEMhash(), script_get_preference_file_location(), security_something(), sendpacket(), set_kb_item(), set_kb_item_volatile(), set_udp_elements(), set_udp_v6_elements(), smb_arc4_crypt_ntlmssp(), strlen_w_ntlmssp(), and v6_sendpacket().
| u_short length |
Definition at line 4 of file nasl_packet_forgery.c.
Referenced by nasl_send(), nasl_win_cmd_exec(), nrecv(), nsend(), ntlmssp_genauth_keyexchg(), and proto_post_wrapped().
| struct tcp_opt_mss mss |
Definition at line 2 of file nasl_packet_forgery.c.
| u_char protocol |
Definition at line 3 of file nasl_packet_forgery.c.
Referenced by __attribute__(), open_sock_opt_hn(), open_sock_option(), and open_socket().
| struct tcp_opt_sack_perm sack_perm |
Definition at line 2 of file nasl_packet_forgery.c.
| struct in_addr saddr |
Definition at line 0 of file nasl_packet_forgery.c.
Referenced by v6_getinterfaces().
| struct tcphdr tcpheader |
Definition at line 5 of file nasl_packet_forgery.c.
| struct tcp_opt_tstamp tstamp |
Definition at line 2 of file nasl_packet_forgery.c.
| struct tcp_opt_wscale wscale |
Definition at line 2 of file nasl_packet_forgery.c.
| u_char zero |
Definition at line 2 of file nasl_packet_forgery.c.
Referenced by __attribute__(), and insert_ip_options().