|
OpenVAS Scanner 23.40.3
|
Port scanner Synscan. More...
#include "../misc/bpf_share.h"#include "../misc/network.h"#include "../misc/pcap_openvas.h"#include "../misc/plugutils.h"#include "nasl_builtin_plugins.h"#include "nasl_lex_ctxt.h"#include <arpa/inet.h>#include <gvm/base/logging.h>#include <gvm/base/prefs.h>#include <netinet/ip.h>#include <netinet/tcp.h>#include <stdlib.h>#include <string.h>#include <unistd.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 |
| #define | G_LOG_DOMAIN "lib nasl" |
| GLib logging domain. | |
Functions | |
| static int | in_cksum (u_short *p, int n) |
| static unsigned long | maketime (void) |
| static struct timeval | timeval (unsigned long val) |
| static unsigned long | compute_rtt (unsigned long then) |
| static int | packetdead (unsigned long then) |
| static int | rawsocket (int family) |
| Opens and returns a raw socket. | |
| static int | openbpf (struct in_addr dst, struct in_addr *src, int magic) |
Opens a packet filter, grabs packets from dst to port magic. | |
| static int | v6_openbpf (struct in6_addr *dst, struct in6_addr *src, int magic) |
| static struct list * | get_packet (struct list *l, unsigned short dport) |
| static 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. | |
| static struct list * | rm_packet (struct list *l, unsigned short dport) |
| static struct list * | rm_dead_packets (struct list *l, int *retry) |
| static struct tcphdr * | extracttcp (char *pkt, unsigned int len) |
| static struct tcphdr * | v6_extracttcp (char *pkt) |
| static unsigned long | extractack (char *pkt, int len, int family) |
| static unsigned short | extractsport (char *pkt, int len, int family) |
| static int | issynack (char *pkt, int len, int family) |
| static char * | mktcp (struct in_addr src, int sport, struct in_addr dst, int dport, unsigned long th_ack, unsigned char flag) |
| static char * | mktcpv6 (int sport, int dport, unsigned long th_ack, unsigned char flag) |
| static 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 script_infos *env) |
| static struct list * | v6_sendpacket (int soc, int bpf, int skip, struct in6_addr *dst, int dport, int magic, struct list *packets, unsigned long *rtt, int sniff, struct script_infos *env) |
| static int | scan (struct script_infos *env, char *portrange, struct in6_addr *dst6, unsigned long rtt) |
| tree_cell * | plugin_run_synscan (lex_ctxt *lexic) |
Port scanner Synscan.
Definition in file nasl_builtin_synscan.c.
| #define _BSD_SOURCE 1 |
Definition at line 13 of file nasl_builtin_synscan.c.
| #define _DEFAULT_SOURCE 1 |
Definition at line 15 of file nasl_builtin_synscan.c.
| #define G_LOG_DOMAIN "lib nasl" |
GLib logging domain.
Definition at line 43 of file nasl_builtin_synscan.c.
| #define NUM_RETRIES 2 |
Definition at line 37 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 279 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().


|
static |
Definition at line 121 of file nasl_builtin_synscan.c.
References maketime().
Referenced by sendpacket().


|
static |
Definition at line 397 of file nasl_builtin_synscan.c.
References extracttcp(), len, and v6_extracttcp().
Referenced by sendpacket().


|
static |
Definition at line 414 of file nasl_builtin_synscan.c.
References extracttcp(), len, and v6_extracttcp().
Referenced by sendpacket(), and v6_sendpacket().


|
static |
Definition at line 375 of file nasl_builtin_synscan.c.
References len.
Referenced by extractack(), extractsport(), and issynack().

dport , NULL if no such list item could be found. Definition at line 262 of file nasl_builtin_synscan.c.
References list::dport, and list::next.
Referenced by add_packet(), and rm_packet().

|
static |
Definition at line 56 of file nasl_builtin_synscan.c.
Referenced by mktcp().

|
static |
Definition at line 430 of file nasl_builtin_synscan.c.
References extracttcp(), len, and v6_extracttcp().
Referenced by sendpacket(), and v6_sendpacket().


|
static |
Definition at line 81 of file nasl_builtin_synscan.c.
References timeval().
Referenced by compute_rtt(), packetdead(), sendpacket(), and v6_sendpacket().


|
static |
Definition at line 446 of file nasl_builtin_synscan.c.
References pseudohdr::daddr, in_cksum(), pseudohdr::length, pseudohdr::protocol, pseudohdr::saddr, and pseudohdr::tcpheader.
Referenced by sendpacket().


|
static |
Definition at line 495 of file nasl_builtin_synscan.c.
Referenced by v6_sendpacket().

|
static |
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. |
dst to port magic. Definition at line 216 of file nasl_builtin_synscan.c.
References bpf_open_live(), and routethrough().
Referenced by scan().


|
static |
Definition at line 142 of file nasl_builtin_synscan.c.
References maketime().
Referenced by rm_dead_packets().


Definition at line 778 of file nasl_builtin_synscan.c.
References ARG_INT, islocalhost(), plug_get_host_ip(), plug_set_key(), scan(), and struct_lex_ctxt::script_infos.

|
static |
Opens and returns a raw socket.
Definition at line 161 of file nasl_builtin_synscan.c.
Referenced by scan().

Definition at line 327 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 307 of file nasl_builtin_synscan.c.
References list::dport, get_packet(), list::next, and list::prev.
Referenced by sendpacket(), and v6_sendpacket().


|
static |
This will send packets to ports not in ports list, will it?
Definition at line 676 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().


|
static |
| sniff | If != 0, "sniff" (listen to incoming packages), else just add packet. |
Definition at line 520 of file nasl_builtin_synscan.c.
References add_packet(), bpf_close(), bpf_next_tv(), compute_rtt(), list::dport, extractack(), extractsport(), issynack(), len, maketime(), mktcp(), rm_packet(), scanner_add_port(), and timeval().
Referenced by scan().


|
static |
Definition at line 94 of file nasl_builtin_synscan.c.
References timeval(), and val.
Referenced by attack_network(), attack_start(), banner_grab(), bpf_next(), bpf_next_tv(), calculate_eta(), capture_next_frame(), capture_next_packet(), capture_next_v6_packet(), do_reseed_ntlmssp(), GetTimeOfDay_ntlmssp(), maketime(), nasl_gettimeofday(), nasl_open_privileged_socket(), nasl_pcap_next(), nasl_recv(), nasl_send_capture(), nasl_tcp_ping(), nasl_tcp_v6_ping(), nsend(), open_socket(), open_SSL_connection(), plugin_do_run(), plugins_reload_from_dir(), read_stream_connection_unbuffered(), sendpacket(), socket_ssl_do_handshake(), timeval(), update_running_processes(), v6_sendpacket(), wait_before_next_probe(), and write_stream_connection4().


|
static |
Definition at line 389 of file nasl_builtin_synscan.c.
Referenced by extractack(), extractsport(), and issynack().

|
static |
Definition at line 230 of file nasl_builtin_synscan.c.
References bpf_open_live(), hostname, and v6_routethrough().
Referenced by scan().


|
static |
Definition at line 602 of file nasl_builtin_synscan.c.
References add_packet(), bpf_close(), bpf_next(), list::dport, extractsport(), issynack(), len, maketime(), mktcpv6(), rm_packet(), scanner_add_port(), and timeval().
Referenced by scan().

