OpenVAS Libraries
9.0.3
|
#include <unistd.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <string.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include "../misc/arglists.h"
#include "../misc/bpf_share.h"
#include "../misc/pcap_openvas.h"
#include "../misc/plugutils.h"
#include "../misc/openvas_logging.h"
#include "../misc/prefs.h"
#include "../misc/network.h"
#include "nasl_lex_ctxt.h"
Go to the source code of this file.
Data Structures | |
struct | pseudohdr |
struct | list |
Macros | |
#define | _BSD_SOURCE 1 |
#define | _DEFAULT_SOURCE 1 |
#define | NUM_RETRIES 2 |
Functions | |
unsigned long | maketime () |
struct timeval | timeval (unsigned long val) |
unsigned long | compute_rtt (unsigned long then) |
int | packetdead (unsigned long then, unsigned long rtt) |
int | rawsocket (int family) |
Opens and returns a raw socket. More... | |
int | openbpf (struct in_addr dst, struct in_addr *src, int magic) |
Opens a packet filter, grabs packets from dst to port magic. More... | |
int | v6_openbpf (struct in6_addr *dst, struct in6_addr *src, int magic) |
struct list * | get_packet (struct list *l, unsigned short dport) |
struct list * | add_packet (struct list *l, unsigned short dport, unsigned long ack) |
If no packet with dport is in list, prepends a "packet" to the. More... | |
struct list * | rm_packet (struct list *l, unsigned short dport) |
struct list * | rm_dead_packets (struct list *l, unsigned long rtt, int *retry) |
struct tcphdr * | extracttcp (char *pkt, int len) |
struct tcphdr * | v6_extracttcp (char *pkt, int len) |
unsigned long | extractack (char *pkt, int len, int family) |
unsigned short | extractsport (char *pkt, int len, int family) |
int | issynack (char *pkt, int len, int family) |
char * | mktcp (struct in_addr src, int sport, struct in_addr dst, int dport, unsigned long th_ack, unsigned char flag) |
char * | mktcpv6 (struct in6_addr *src, int sport, struct in6_addr *dst, int dport, unsigned long th_ack, unsigned char flag) |
struct list * | sendpacket (int soc, int bpf, int skip, struct in_addr dst, struct in_addr src, int dport, int magic, struct list *packets, unsigned long *rtt, int sniff, struct arglist *env) |
struct list * | v6_sendpacket (int soc, int bpf, int skip, struct in6_addr *dst, struct in6_addr *src, int dport, int magic, struct list *packets, unsigned long *rtt, int sniff, struct arglist *env) |
int | scan (struct arglist *env, char *hostname, char *portrange, struct in6_addr *dst6, unsigned long rtt) |
tree_cell * | plugin_run_synscan (lex_ctxt *lexic) |
#define _BSD_SOURCE 1 |
Definition at line 28 of file nasl_builtin_synscan.c.
#define _DEFAULT_SOURCE 1 |
Definition at line 30 of file nasl_builtin_synscan.c.
#define NUM_RETRIES 2 |
Definition at line 52 of file nasl_builtin_synscan.c.
Referenced by rm_dead_packets().
If no packet with dport is in list, prepends a "packet" to the.
list l.
Definition at line 298 of file nasl_builtin_synscan.c.
References list::dport, get_packet(), list::next, list::prev, list::retries, and list::when.
Referenced by sendpacket(), and v6_sendpacket().
unsigned long compute_rtt | ( | unsigned long | then | ) |
Definition at line 136 of file nasl_builtin_synscan.c.
References maketime().
Referenced by sendpacket().
unsigned long extractack | ( | char * | pkt, |
int | len, | ||
int | family | ||
) |
Definition at line 415 of file nasl_builtin_synscan.c.
References extracttcp(), and v6_extracttcp().
Referenced by sendpacket().
unsigned short extractsport | ( | char * | pkt, |
int | len, | ||
int | family | ||
) |
Definition at line 433 of file nasl_builtin_synscan.c.
References extracttcp(), and v6_extracttcp().
Referenced by sendpacket(), and v6_sendpacket().
struct tcphdr* extracttcp | ( | char * | pkt, |
int | len | ||
) |
Definition at line 392 of file nasl_builtin_synscan.c.
Referenced by extractack(), extractsport(), and issynack().
Definition at line 280 of file nasl_builtin_synscan.c.
References list::dport, and list::next.
Referenced by add_packet(), and rm_packet().
int issynack | ( | char * | pkt, |
int | len, | ||
int | family | ||
) |
Definition at line 448 of file nasl_builtin_synscan.c.
References extracttcp(), and v6_extracttcp().
Referenced by sendpacket(), and v6_sendpacket().
unsigned long maketime | ( | ) |
Definition at line 95 of file nasl_builtin_synscan.c.
References timeval().
Referenced by compute_rtt(), packetdead(), sendpacket(), and v6_sendpacket().
char* mktcp | ( | struct in_addr | src, |
int | sport, | ||
struct in_addr | dst, | ||
int | dport, | ||
unsigned long | th_ack, | ||
unsigned char | flag | ||
) |
Definition at line 464 of file nasl_builtin_synscan.c.
Referenced by sendpacket().
char* mktcpv6 | ( | struct in6_addr * | src, |
int | sport, | ||
struct in6_addr * | dst, | ||
int | dport, | ||
unsigned long | th_ack, | ||
unsigned char | flag | ||
) |
Definition at line 512 of file nasl_builtin_synscan.c.
Referenced by v6_sendpacket().
int openbpf | ( | struct in_addr | dst, |
struct in_addr * | src, | ||
int | magic | ||
) |
Opens a packet filter, grabs packets from dst to port magic.
[out] | src | in_addr of source. |
[in] | dst | Destination. |
[in] | magic | Destination port on src to listen to. |
Definition at line 227 of file nasl_builtin_synscan.c.
References bpf_open_live(), and routethrough().
Referenced by scan().
int packetdead | ( | unsigned long | then, |
unsigned long | rtt | ||
) |
Definition at line 158 of file nasl_builtin_synscan.c.
References maketime().
Referenced by rm_dead_packets().
Definition at line 788 of file nasl_builtin_synscan.c.
References arg_get_value(), ARG_INT, islocalhost(), host_info::name, plug_get_host_ip(), plug_set_key(), prefs_get(), scan(), struct_lex_ctxt::script_infos, and timeval().
int rawsocket | ( | int | family | ) |
Opens and returns a raw socket.
Definition at line 177 of file nasl_builtin_synscan.c.
Referenced by scan().
Definition at line 352 of file nasl_builtin_synscan.c.
References list::dport, list::next, NUM_RETRIES, packetdead(), list::prev, list::retries, and list::when.
Referenced by scan().
Definition at line 327 of file nasl_builtin_synscan.c.
References list::dport, get_packet(), log_legacy_write(), list::next, and list::prev.
Referenced by sendpacket(), and v6_sendpacket().
int scan | ( | struct arglist * | env, |
char * | hostname, | ||
char * | portrange, | ||
struct in6_addr * | dst6, | ||
unsigned long | rtt | ||
) |
This will send packets to ports not in ports list, will it?
Definition at line 672 of file nasl_builtin_synscan.c.
References ARG_INT, bpf_close(), bpf_datalink(), get_datalink_size(), getpts(), openbpf(), plug_set_key(), rawsocket(), rm_dead_packets(), sendpacket(), v6_openbpf(), and v6_sendpacket().
Referenced by plugin_run_synscan().
struct list* sendpacket | ( | int | soc, |
int | bpf, | ||
int | skip, | ||
struct in_addr | dst, | ||
struct in_addr | src, | ||
int | dport, | ||
int | magic, | ||
struct list * | packets, | ||
unsigned long * | rtt, | ||
int | sniff, | ||
struct arglist * | env | ||
) |
sniff | If != 0, "sniff" (listen to incoming packages), else just add packet. |
Definition at line 538 of file nasl_builtin_synscan.c.
References add_packet(), bpf_close(), bpf_next_tv(), compute_rtt(), list::dport, extractack(), extractsport(), issynack(), maketime(), mktcp(), rm_packet(), scanner_add_port(), and timeval().
Referenced by scan().
struct timeval timeval | ( | unsigned long | val | ) |
Definition at line 109 of file nasl_builtin_synscan.c.
References val.
Referenced by bpf_next(), bpf_next_tv(), capture_next_packet(), capture_next_v6_packet(), get_random_bytes(), maketime(), nasl_gettimeofday(), nasl_pcap_next(), nasl_recv(), nasl_send_capture(), nasl_tcp_ping(), nasl_tcp_v6_ping(), plugin_run_synscan(), sendpacket(), and v6_sendpacket().
struct tcphdr* v6_extracttcp | ( | char * | pkt, |
int | len | ||
) |
Definition at line 406 of file nasl_builtin_synscan.c.
Referenced by extractack(), extractsport(), and issynack().
int v6_openbpf | ( | struct in6_addr * | dst, |
struct in6_addr * | src, | ||
int | magic | ||
) |
Definition at line 247 of file nasl_builtin_synscan.c.
References bpf_open_live(), and v6_routethrough().
Referenced by scan().
struct list* v6_sendpacket | ( | int | soc, |
int | bpf, | ||
int | skip, | ||
struct in6_addr * | dst, | ||
struct in6_addr * | src, | ||
int | dport, | ||
int | magic, | ||
struct list * | packets, | ||
unsigned long * | rtt, | ||
int | sniff, | ||
struct arglist * | env | ||
) |
Definition at line 608 of file nasl_builtin_synscan.c.
References add_packet(), bpf_close(), bpf_next(), list::dport, extractsport(), issynack(), log_legacy_write(), maketime(), mktcpv6(), rm_packet(), scanner_add_port(), and timeval().
Referenced by scan().