|
OpenVAS Libraries
8.0.8
|
#include <stdarg.h>#include <string.h>#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <arpa/inet.h>#include "arglists.h"#include "bpf_share.h"#include "ids_send.h"#include "network.h"#include "pcap_openvas.h"#include "plugutils.h"#include "openvas_logging.h"#include "support.h"Data Structures | |
| struct | ip_packet |
| struct | tcp_packet |
| struct | ipv6_header |
| struct | pseudohdr |
| union | sockaddr_u |
Macros | |
| #define | FIX(n) htons(n) |
| #define | UNFIX(n) ntohs(n) |
| #define | TCP_FLAG_RST 0x0004 |
| #define | TCP_FLAG_ACK 0x0010 |
| #define | TCP_FLAG_PUSH 0x0008 |
Functions | |
| if (method &OPENVAS_CNX_IDS_EVASION_SHORT_TTL) | |
| while (n > 1) | |
| if (n==1) | |
| return (answer) | |
| bzero & | pseudoheader (struct tcp_packet) |
| bcopy ((char *) tcp,(char *)&pseudoheader.tcpheader, sizeof(struct tcp_packet)) | |
| bcopy ((char *)&pseudoheader, tcpsumdata, sizeof(struct pseudohdr)) | |
| bcopy ((char *) data, tcpsumdata+sizeof(struct pseudohdr), len) | |
| g_free (tcpsumdata) | |
| if () | |
| g_free (packet) | |
| close (soc) | |
| memcpy (ip6, old_ip6, sizeof(struct ipv6_header)) | |
| memcpy & | ip6 (struct in6_addr) |
| memcpy (tcp, old_tcp, sizeof(struct tcp_packet)) | |
| if ((flags &TCP_FLAG_RST)&&(method &OPENVAS_CNX_IDS_EVASION_FAKE_RST)) | |
| if (sa->sa_family==AF_INET) | |
| memcpy & | dst6 (struct in6_addr) |
| bzero & | src6 (src6) |
| snprintf (filter, sizeof(filter),"tcp and (src host %s and dst host %s and src port %d)", dst_host, src_host, port) | |
| g_free (src_host) | |
| g_free (dst_host) | |
| if (bpf >=0) | |
| else return | send (fd, buf, n, 0) |
| if (!dst6) | |
| else return | open_sock_tcp (args, port, timeout) |
Variables | |
| else | |
| return | ttl |
| int | n |
| register long | sum = 0 |
| u_short | odd_byte = 0 |
| answer = (int) ~sum | |
| int | len |
| char * | tcpsumdata |
| struct in_addr source | dest |
| struct ip_packet * | ip = (struct ip_packet *) packet |
| struct tcp_packet * | tcp = (struct tcp_packet *) (packet + ip->ip_hl * 4) |
| char * | data = (char *) (packet + ip->ip_hl * 4 + tcp->th_off * 4) |
| source | s_addr = ip->ip_src.s_addr |
| pseudoheader | protocol = IPPROTO_TCP |
| pseudoheader | length = htons (sizeof (struct tcp_packet) + len) |
| tcp | th_sum |
| return | |
| int | packet_len |
| int | flags |
| int | data_len |
| struct ip_packet * | old_ip |
| struct tcp_packet * | old_tcp |
| int | tot_len |
| int | i |
| int | one = 1 |
| struct sockaddr_in | sockaddr |
| struct ipv6_header * | ip6 = (struct ipv6_header *) packet |
| struct ipv6_header * | old_ip6 |
| struct sockaddr_in6 | sockaddr6 |
| ip6 ip6_ctlun ip6_un1 | ip6_un1_flow = old_ip6->ip6_ctlun.ip6_un1.ip6_un1_flow |
| ip6 ip6_ctlun ip6_un1 | ip6_un1_plen = data_len |
| ip6 ip6_ctlun ip6_un1 | ip6_un1_nxt = old_ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt |
| ip6 ip6_ctlun ip6_un1 | ip6_un1_hlim |
| tcp | th_flags = flags |
| int int | fd |
| void * | buf0 |
| struct in6_addr dst6 | src6 |
| struct sockaddr_in * | saddr |
| struct sockaddr * | sa = &(su->sockaddr) |
| union sockaddr_u * | su = NULL |
| char * | iface = v6_routethrough (&dst6, &src6) |
| char | filter [255] |
| char * | src_host |
| char * | dst_host |
| int | port = ntohs (sockaddr6.sin6_port) |
| int | ret = 0 |
| char * | buf = (char *) buf0 |
| unsigned int | sz = sizeof (sockaddr6) |
| int | e |
| int | bpf = bpf_open_live (iface, filter) |
| char | hostname [INET6_ADDRSTRLEN] |
| int | family = AF_INET6 |
| int struct arglist * | args |
| int | timeout |
| struct in_addr dst | src |
| struct in6_addr * | dst6 = NULL |
| #define TCP_FLAG_ACK 0x0010 |
| #define TCP_FLAG_PUSH 0x0008 |
| #define TCP_FLAG_RST 0x0004 |
| bcopy | ( | (char *) | tcp, |
| (char *)&pseudoheader. | tcpheader, | ||
| sizeof(struct tcp_packet) | |||
| ) |
| bcopy | ( | (char *)& | pseudoheader, |
| tcpsumdata | , | ||
| sizeof(struct pseudohdr) | |||
| ) |
| bcopy | ( | (char *) | data, |
| tcpsumdata+ | sizeofstruct pseudohdr, | ||
| len | |||
| ) |
| close | ( | soc | ) |
| memcpy& dst6 | ( | struct in6_addr | ) |
| g_free | ( | tcpsumdata | ) |
| g_free | ( | packet | ) |
| g_free | ( | src_host | ) |
| g_free | ( | dst_host | ) |
| if | ( | method & | OPENVAS_CNX_IDS_EVASION_SHORT_TTL | ) |
| if | ( | n | = = 1 | ) |
| if | ( | ) |
| if | ( | (flags &TCP_FLAG_RST)&&(method &OPENVAS_CNX_IDS_EVASION_FAKE_RST) | ) |
| if | ( | sa-> | sa_family = = AF_INET | ) |
| if | ( | bpf >= | 0 | ) |
| if | ( | ! | dst6 | ) |
| memcpy& ip6 | ( | struct in6_addr | ) |
| memcpy | ( | ip6 | , |
| old_ip6 | , | ||
| sizeof(struct ipv6_header) | |||
| ) |
| memcpy | ( | tcp | , |
| old_tcp | , | ||
| sizeof(struct tcp_packet) | |||
| ) |
| bzero& pseudoheader | ( | struct tcp_packet | ) |
| return | ( | answer | ) |
| snprintf | ( | filter | , |
| sizeof(filter) | , | ||
| "tcp and (src host %s and dst host %s and src port %d)" | , | ||
| dst_host | , | ||
| src_host | , | ||
| port | |||
| ) |
| bzero& src6 | ( | src6 | ) |
| while | ( | n | , |
| 1 | |||
| ) |
| answer = (int) ~sum |
| int struct arglist* args |
| bpf = bpf_open_live (iface, filter) |
| char* buf = (char *) buf0 |
| void* buf0 |
| int data_len |
| struct in_addr source dest |
| dst6 = NULL |
| char * dst_host |
| int e |
| int family = AF_INET6 |
| int int fd |
| char filter |
| int flags |
| char hostname |
| int i |
| char * iface = v6_routethrough (&dst6, &src6) |
| memcpy & ip6 = (struct ipv6_header *) packet |
| ip6 ip6_ctlun ip6_un1 ip6_un1_hlim |
| int len |
| pseudoheader length = htons (sizeof (struct tcp_packet) + len) |
| int n |
| u_short odd_byte = 0 |
| struct ip_packet * old_ip |
| struct ipv6_header * old_ip6 |
| struct tcp_packet * old_tcp |
| int one = 1 |
| int packet_len |
| int port = ntohs (sockaddr6.sin6_port) |
| pseudoheader protocol = IPPROTO_TCP |
| int ret = 0 |
| return |
| struct sockaddr_in* saddr |
| struct sockaddr_in sockaddr |
| struct sockaddr_in6 sockaddr6 |
| struct in6_addr src6 |
| char * src_host |
| union sockaddr_u* su = NULL |
| sum = 0 |
| unsigned int sz = sizeof (sockaddr6) |
| struct tcp_packet * tcp = (struct tcp_packet *) (packet + ip->ip_hl * 4) |
| char* tcpsumdata |
| tcp th_sum |
| int timeout |
| int tot_len |
| return ttl |
1.8.5