OpenVAS Libraries
9.0.3
|
NASL IPv6 Packet Forgery functions. More...
#include <arpa/inet.h>
#include <ctype.h>
#include <pcap.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <netinet/icmp6.h>
#include "../misc/bpf_share.h"
#include "../misc/pcap_openvas.h"
#include "../misc/plugutils.h"
#include "nasl_raw.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "exec.h"
#include "nasl_socket.h"
#include "nasl_debug.h"
#include "capture_packet.h"
#include "nasl_packet_forgery_v6.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 72 of file nasl_packet_forgery_v6.c.
#define rnd_tcp_port | ( | ) | (rand() % 65535 + 1024) |
#define UNFIX | ( | n | ) | ntohs(n) |
Definition at line 73 of file nasl_packet_forgery_v6.c.
Print IPv6 Header.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 325 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 732 of file nasl_packet_forgery_v6.c.
References get_str_var_by_num(), get_var_size_by_num(), and UNFIX.
Definition at line 1112 of file nasl_packet_forgery_v6.c.
References get_str_var_by_num(), and get_var_size_by_num().
Definition at line 1164 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, FIX, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), get_var_size_by_name(), v6pseudo_icmp_hdr::len, nasl_perror(), TC::type, and UNFIX.
Definition at line 1472 of file nasl_packet_forgery_v6.c.
References igmp::cksum, igmp::code, FIX, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), igmp::group, igmp::type, and UNFIX.
Forge IPv6 packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 120 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, FIX, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::size, TC::str_val, TC::type, and TC::x.
Forge TCP packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 463 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, v6pseudohdr::d6addr, FIX, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), get_var_size_by_name(), v6pseudohdr::length, nasl_perror(), v6pseudohdr::protocol, v6pseudohdr::s6addr, TC::str_val, v6pseudohdr::tcpheader, TC::type, and TC::x.
Definition at line 841 of file nasl_packet_forgery_v6.c.
References get_int_local_var_by_name(), get_local_var_size_by_name(), and get_str_local_var_by_name().
Definition at line 1396 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, CONST_INT, get_str_local_var_by_name(), get_var_size_by_name(), TC::i_val, TC::size, TC::str_val, TC::type, and TC::x.
Obtain IPv6 header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 190 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, CONST_INT, get_str_local_var_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, TC::type, and TC::x.
Get TCP Header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 549 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, CONST_INT, get_local_var_size_by_name(), get_str_local_var_by_name(), TC::i_val, nasl_perror(), TC::size, TC::str_val, TC::type, UNFIX, and TC::x.
Definition at line 929 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, CONST_INT, get_local_var_size_by_name(), get_str_local_var_by_name(), TC::i_val, TC::size, TC::str_val, TC::type, and TC::x.
Definition at line 372 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), code, CONST_DATA, FIX, get_int_local_var_by_name(), get_str_local_var_by_name(), get_var_size_by_name(), nasl_perror(), TC::size, TC::str_val, TC::type, UNFIX, and TC::x.
Send forged IPv6 Packet.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 1679 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), bpf_close(), capture_next_v6_packet(), CONST_DATA, FAKE_CELL, get_int_local_var_by_name(), get_str_local_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, TC::type, v6_islocalhost(), and TC::x.
Performs TCP Connect to test if host is alive.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 1539 of file nasl_packet_forgery_v6.c.
References v6pseudohdr::d6addr, FIX, get_int_local_var_by_name(), init_v6_capture_device(), v6pseudohdr::length, 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(), and v6_routethrough().
Referenced by nasl_tcp_ping().
Set IPv6 header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 284 of file nasl_packet_forgery_v6.c.
References alloc_tree_cell(), CONST_DATA, get_int_local_var_by_name(), get_str_local_var_by_name(), get_var_size_by_name(), nasl_perror(), TC::size, TC::str_val, TC::type, and TC::x.
Set TCP Header element.
[in] | lexic | Lexical context of NASL interpreter. |
Definition at line 633 of file nasl_packet_forgery_v6.c.
References v6pseudohdr::d6addr, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), v6pseudohdr::length, nasl_perror(), v6pseudohdr::protocol, v6pseudohdr::s6addr, v6pseudohdr::tcpheader, and UNFIX.
Definition at line 997 of file nasl_packet_forgery_v6.c.
References FIX, get_int_local_var_by_name(), get_local_var_size_by_name(), get_str_local_var_by_name(), and v6pseudo_udp_hdr::len.