OpenVAS Scanner
7.0.1~git
|
NASL IPv6 Packet Forgery functions. More...
#include <arpa/inet.h>
#include <ctype.h>
#include <pcap.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/time.h>
#include <unistd.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 <netinet/icmp6.h>
Go to the source code of this file.
Data Structures | |
struct | v6pseudohdr |
struct | v6pseudo_udp_hdr |
struct | v6pseudo_icmp_hdr |
struct | igmp6_hdr |
Macros | |
#define | FIX(n) htons (n) |
#define | UNFIX(n) ntohs (n) |
#define | rnd_tcp_port() (rand () % 65535 + 1024) |
NASL IPv6 Packet Forgery functions.
Provides IPv6 Packet Forgery functionalities The API set offers forgery for,
Definition in file nasl_packet_forgery_v6.c.
#define FIX | ( | n | ) | htons (n) |
Definition at line 74 of file nasl_packet_forgery_v6.c.
#define rnd_tcp_port | ( | ) | (rand () % 65535 + 1024) |
#define UNFIX | ( | n | ) | ntohs (n) |
Definition at line 75 of file nasl_packet_forgery_v6.c.
Print IPv6 Header.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 319 of file nasl_packet_forgery_v6.c.
References FAKE_CELL, get_str_var_by_num(), and UNFIX.
Print TCP/IPv6 packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 719 of file nasl_packet_forgery_v6.c.
References get_str_var_by_num(), get_var_size_by_num(), and UNFIX.
Definition at line 1082 of file nasl_packet_forgery_v6.c.
References get_str_var_by_num(), and get_var_size_by_num().
Definition at line 1131 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), v6pseudo_icmp_hdr::len, nasl_perror(), np_in_cksum(), TC::size, TC::str_val, UNFIX, and TC::x.
Definition at line 1441 of file nasl_packet_forgery_v6.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, np_in_cksum(), TC::size, TC::str_val, igmp::type, UNFIX, and TC::x.
Forge IPv6 packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 119 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, and TC::x.
Forge TCP packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 451 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, v6pseudohdr::d6addr, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), v6pseudohdr::length, nasl_perror(), np_in_cksum(), v6pseudohdr::protocol, v6pseudohdr::s6addr, TC::size, TC::str_val, v6pseudohdr::tcpheader, and TC::x.
Definition at line 827 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), np_in_cksum(), TC::size, TC::str_val, UNFIX, and TC::x.
Definition at line 1370 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), get_var_size_by_name(), TC::i_val, TC::size, TC::str_val, and TC::x.
Obtain IPv6 header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 188 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, and TC::x.
Get TCP Header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 536 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, deref_cell(), get_str_var_by_name(), get_var_size_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, UNFIX, and TC::x.
Definition at line 909 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, CONST_INT, get_str_var_by_name(), get_var_size_by_name(), TC::i_val, TC::size, TC::str_val, and TC::x.
Definition at line 366 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), code, CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), nasl_perror(), TC::size, TC::str_val, UNFIX, and TC::x.
Send forged IPv6 Packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 1643 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), bpf_close(), capture_next_v6_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_v6_capture_device(), name, nasl_perror(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, v6_islocalhost(), and TC::x.
Performs TCP Connect to test if host is alive.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 1504 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), bpf_close(), bpf_next_tv(), CONST_INT, v6pseudohdr::d6addr, FIX, get_int_var_by_name(), TC::i_val, init_v6_capture_device(), v6pseudohdr::length, np_in_cksum(), plug_get_host_ip(), plug_get_host_open_port(), v6pseudohdr::protocol, rnd_tcp_port, v6pseudohdr::s6addr, struct_lex_ctxt::script_infos, v6pseudohdr::tcpheader, timeval(), v6_islocalhost(), v6_routethrough(), and TC::x.
Referenced by nasl_tcp_ping().
|
static |
Definition at line 84 of file nasl_packet_forgery_v6.c.
Referenced by forge_icmp_v6_packet(), forge_igmp_v6_packet(), forge_tcp_v6_packet(), forge_udp_v6_packet(), nasl_tcp_v6_ping(), set_tcp_v6_elements(), and set_udp_v6_elements().
Set IPv6 header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 279 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), nasl_perror(), TC::size, TC::str_val, and TC::x.
Set TCP Header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 624 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, v6pseudohdr::d6addr, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), v6pseudohdr::length, nasl_perror(), np_in_cksum(), v6pseudohdr::protocol, v6pseudohdr::s6addr, TC::size, TC::str_val, v6pseudohdr::tcpheader, UNFIX, and TC::x.
Definition at line 974 of file nasl_packet_forgery_v6.c.
References alloc_typed_cell(), CONST_DATA, FIX, get_int_var_by_name(), get_str_var_by_name(), get_var_size_by_name(), v6pseudo_udp_hdr::len, np_in_cksum(), TC::size, TC::str_val, and TC::x.