|
OpenVAS Scanner 23.23.1
|
Functions to forge and manipulate datalink layer frames. More...
#include "nasl_frame_forgery.h"#include "../misc/bpf_share.h"#include "../misc/pcap_openvas.h"#include "../misc/plugutils.h"#include "capture_packet.h"#include "nasl_debug.h"#include <errno.h>#include <gvm/base/networking.h>#include <linux/if_packet.h>#include <net/ethernet.h>#include <net/if.h>#include <net/if_arp.h>#include <netinet/ether.h>#include <netinet/if_ether.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <sys/ioctl.h>#include <unistd.h>Data Structures | |
| struct | pseudo_eth_arp |
| struct | pseudo_frame |
Macros | |
| #define | G_LOG_DOMAIN "lib misc" |
| GLib logging domain. | |
Functions | |
| struct pseudo_eth_arp | __attribute__ ((packed)) |
| static void | dump_frame (const u_char *frame, int frame_sz) |
| Dump a datalink layer frame. | |
| static void | prepare_sockaddr_ll (struct sockaddr_ll *soc_addr_ll, int ifindex, const u_char *ether_dst_addr) |
| Prepare message header to be sent with sendmsg(). | |
| static void | prepare_message (u_char *msg, struct sockaddr_ll *soc_addr_ll, u_char *payload, int payload_sz) |
| Prepare message header to be sent with sendmsg(). | |
| static int | send_frame (const u_char *frame, int frame_sz, int use_pcap, int timeout, char *filter, struct in6_addr *ipaddr, u_char **answer) |
| Send a frame and listen to the answer. | |
| static int | forge_frame (const u_char *ether_src_addr, const u_char *ether_dst_addr, int ether_proto, u_char *payload, int payload_sz, struct pseudo_frame **frame) |
| Forge a datalink layer frame. | |
| tree_cell * | nasl_forge_frame (lex_ctxt *lexic) |
| Forge a datalink layer frame. | |
| tree_cell * | nasl_send_frame (lex_ctxt *lexic) |
| Send a frame and listen to the answer. | |
| tree_cell * | nasl_dump_frame (lex_ctxt *lexic) |
| Dump a datalink layer frame. | |
| static int | get_local_mac_address_from_ip (char *ip_address, u_char *mac) |
| Get the MAC address of host. | |
| tree_cell * | nasl_get_local_mac_address_from_ip (lex_ctxt *lexic) |
| Get the MAC address of host. | |
| tree_cell * | nasl_send_arp_request (lex_ctxt *lexic) |
| Send an arp request to an IP host. | |
Variables | |
| struct arphdr | arp_header |
| u_char | __ar_sha [ETH_ALEN] |
| u_char | __ar_sip [4] |
| u_char | __ar_tha [ETH_ALEN] |
| u_char | __ar_tip [4] |
| u_char | __zero_padding [18] |
| struct ethhdr | framehdr |
| u_char * | payload |
Functions to forge and manipulate datalink layer frames.
| #define G_LOG_DOMAIN "lib misc" |
GLib logging domain.
| struct pseudo_eth_arp __attribute__ | ( | (packed) | ) |
|
static |
Dump a datalink layer frame.
| frame | The frame to be dumped. |
| frame_sz | The frame's size. |
|
static |
Forge a datalink layer frame.
| [in] | src_haddr | Source MAC address to use. |
| [in] | dst_haddr | Destination MAC address to use. |
| [in] | ether_proto | Ethernet type integer in hex format. Default 0x0800 (ETHER_P_IP) |
| [in] | payload | Payload to be attached to the frame. E.g a forged tcp datagram, or arp header |
| [out] | frame | the forge frame |
|
static |
Get the MAC address of host.
| [in] | ip_address | Local IP address |
| [out] | mac | The MAC address |
Dump a datalink layer frame.
@naslparam
| lexic | Lexical context of NASL interpreter. |
Forge a datalink layer frame.
@naslparams
| lexic | Lexical context of NASL interpreter. |
Get the MAC address of host.
@naslparam
ip_address Local IP address
@naslreturn The MAC address of the host. NULL otherwise
| [in] | lexic | Lexical context of NASL interpreter. |
Send an arp request to an IP host.
| [in] | lexic | Lexical context of NASL interpreter. |
Send a frame and listen to the answer.
@naslparams
| lexic | Lexical context of NASL interpreter. |
|
static |
Prepare message header to be sent with sendmsg().
| [out] | msg | The packaged messages to be sent |
| [in] | soc_addr_ll | The sockaddr_ll structure for capturing |
| [in] | payload | The payload, a datalink layer frame with payload |
| [in] | payload_sz | The payload size. |
|
static |
Prepare message header to be sent with sendmsg().
| [out] | soc_addr_ll | The sockaddr_ll structure to be prepared |
| [in] | ifindex | The interface index to be use for capturing. |
| [in] | ether_dst_addr | The dst MAC address. |
|
static |
Send a frame and listen to the answer.
| [in] |
The frame to be sent.
| [in] |
The frame's size.
| [in] |
TRUE by default. Otherwise, NASL does not listen for the answers.
| [in] |
BPF filter.
| [in] |
Capture timeout. 5 by default.
| [in] |
Destination address, used for calculating the ethernet index
| [out] |
Sniffed answer.
| u_char __ar_sha[ETH_ALEN] |
| u_char __ar_sip[4] |
| u_char __ar_tha[ETH_ALEN] |
| u_char __ar_tip[4] |
| u_char __zero_padding[18] |
| struct arphdr arp_header |
| struct ethhdr framehdr |
| u_char* payload |