OpenVAS Scanner
7.0.1~git
|
Header file for module network. More...
#include "scanneraux.h"
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <netinet/in.h>
#include <sys/select.h>
Go to the source code of this file.
Macros | |
#define | IS_ENCAPS_SSL(x) ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom) |
Typedefs | |
typedef enum openvas_encaps | openvas_encaps_t |
Functions | |
int | open_sock_tcp (struct script_infos *, unsigned int, int) |
int | open_sock_option (struct script_infos *, unsigned int, int, int, int) |
int | recv_line (int, char *, size_t) |
Reads a text from the socket stream into the argument buffer, always. More... | |
int | nrecv (int, void *, int, int) |
int | socket_close (int) |
int | get_sock_infos (int sock, int *r_transport, void **r_tls_session) |
unsigned short * | getpts (char *, int *) |
Converts a string like "-100,200-1024,3000-4000,60000-" into an array. More... | |
int | open_stream_connection (struct script_infos *, unsigned int, int, int) |
int | open_stream_connection_ext (struct script_infos *, unsigned int, int, int, const char *) |
int | open_stream_auto_encaps_ext (struct script_infos *, unsigned int port, int timeout, int force) |
int | write_stream_connection (int, void *buf, int n) |
int | read_stream_connection (int, void *, int) |
int | read_stream_connection_min (int, void *, int, int) |
int | nsend (int, void *, int, int) |
void | add_close_stream_connection_hook (int(*)(int)) |
int | close_stream_connection (int) |
const char * | get_encaps_name (openvas_encaps_t) |
const char * | get_encaps_through (openvas_encaps_t) |
int | open_sock_opt_hn (const char *, unsigned int, int, int, int) |
int | openvas_SSL_init (void) |
Initializes SSL support. More... | |
int | stream_set_buffer (int, int) |
int | stream_get_buffer_sz (int) |
int | stream_get_err (int) |
int | openvas_register_connection (int s, void *ssl, gnutls_certificate_credentials_t certcred, openvas_encaps_t encaps) |
int | openvas_deregister_connection (int) |
int | openvas_get_socket_from_connection (int) |
gnutls_session_t | ovas_get_tlssession_from_connection (int) |
int | stream_zero (fd_set *) |
int | stream_set (int, fd_set *) |
int | os_send (int, void *, int, int) |
int | os_recv (int, void *, int, int) |
int | fd_is_stream (int) |
int | stream_set_timeout (int, int) |
int | socket_negotiate_ssl (int, openvas_encaps_t, struct script_infos *) |
void | socket_get_cert (int, void **, int *) |
int | socket_get_ssl_version (int) |
void | socket_get_ssl_session_id (int, void **, size_t *) |
int | socket_get_ssl_compression (int) |
int | socket_get_ssl_ciphersuite (int) |
Header file for module network.
Definition in file network.h.
#define IS_ENCAPS_SSL | ( | x | ) | ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom) |
typedef enum openvas_encaps openvas_encaps_t |
enum openvas_encaps |
void add_close_stream_connection_hook | ( | int(*)(int) | ) |
int close_stream_connection | ( | int | ) |
Definition at line 1518 of file network.c.
References OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, openvas_connection::port, release_connection_fd(), run_csc_hooks(), and socket_close().
Referenced by nasl_close_socket(), nasl_end_denial(), nasl_start_denial(), and plugin_do_run().
int fd_is_stream | ( | int | ) |
Definition at line 1959 of file network.c.
References OPENVAS_STREAM.
Referenced by nasl_close_socket(), nasl_get_source_port(), nasl_recv(), nasl_recv_line(), nasl_send(), nasl_socket_get_error(), socket_get_cert(), socket_get_ssl_ciphersuite(), socket_get_ssl_session_id(), socket_get_ssl_version(), and socket_negotiate_ssl().
const char* get_encaps_name | ( | openvas_encaps_t | ) |
Definition at line 1546 of file network.c.
References code, OPENVAS_ENCAPS_AUTO, OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, and OPENVAS_ENCAPS_TLSv12.
Referenced by get_port_transport(), nasl_get_sock_info(), and plugin_do_run().
const char* get_encaps_through | ( | openvas_encaps_t | ) |
Definition at line 1577 of file network.c.
References code, OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, and OPENVAS_ENCAPS_TLSv12.
Referenced by mark_acap_server(), mark_adsgone(), mark_avotus_mm_server(), mark_BitTorrent_server(), mark_citrix_server(), mark_dameware_server(), mark_dictd_server(), mark_direct_connect_hub(), mark_eggdrop_server(), mark_ens_server(), mark_exchg_routing_server(), mark_finger_server(), mark_fssniffer(), mark_ftp_server(), mark_fw1(), mark_giop_server(), mark_gnocatan_server(), mark_gnome14_server(), mark_http_proxy(), mark_http_server(), mark_imap_server(), mark_interscan_viruswall(), mark_ircxpro_admin_server(), mark_jabber_server(), mark_LISa_server(), mark_listserv_server(), mark_locked_adsubtract_server(), mark_lpd_server(), mark_lyskom_server(), mark_mon_server(), mark_nagiosd_server(), mark_nntp_server(), mark_ofa_express_server(), mark_pblocald_server(), mark_pbmaster_server(), mark_ph_server(), mark_pnsclient(), mark_pop3pw_server(), mark_ppp_daemon(), mark_psybnc(), mark_quicktime_streaming_server(), mark_remote_nc_server(), mark_rmserver(), mark_shoutcast_server(), mark_smppd_server(), mark_smtp_server(), mark_smux_server(), mark_snpp_server(), mark_spamd_server(), mark_stonegate_auth_server(), mark_sub7_server(), mark_tcpmux_server(), mark_teamspeak2_server(), mark_telnet_server(), mark_time_server(), mark_unknown_svc(), mark_upsmon_server(), mark_uucp_server(), mark_veritas_backup(), mark_vmware_auth(), mark_vtun_server(), mark_websm_server(), mark_whois_plus2_server(), and mark_zebra_server().
int get_sock_infos | ( | int | sock, |
int * | r_transport, | ||
void ** | r_tls_session | ||
) |
Definition at line 2063 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, openvas_connection::tls_session, and openvas_connection::transport.
Referenced by nasl_get_sock_info(), and nasl_socket_cert_verify().
unsigned short* getpts | ( | char * | origexpr, |
int * | len | ||
) |
Converts a string like "-100,200-1024,3000-4000,60000-" into an array.
of port numbers
This function is (c) Fyodor fyodo and was taken from his excellent and outstanding scanner Nmap See r@dh p.comhttp://www.insecure.org/nmap/ for details about Nmap
Definition at line 2103 of file network.c.
References qsort_compar().
Referenced by nasl_scanner_get_port(), and scan().
int nrecv | ( | int | , |
void * | , | ||
int | , | ||
int | |||
) |
Definition at line 1441 of file network.c.
References block_socket(), connections, OPENVAS_FD_OFF, OPENVAS_STREAM, and read_stream_connection().
int nsend | ( | int | , |
void * | , | ||
int | , | ||
int | |||
) |
Definition at line 1402 of file network.c.
References block_socket(), connections, OPENVAS_FD_OFF, OPENVAS_STREAM, os_send(), timeval(), and write_stream_connection4().
Referenced by nasl_end_denial(), and nasl_send().
int open_sock_opt_hn | ( | const char * | , |
unsigned int | , | ||
int | , | ||
int | , | ||
int | |||
) |
Definition at line 1700 of file network.c.
References hostname, and open_socket().
Referenced by nasl_open_sock_kdc().
int open_sock_option | ( | struct script_infos * | , |
unsigned int | , | ||
int | , | ||
int | , | ||
int | |||
) |
Definition at line 1802 of file network.c.
References open_socket(), and plug_get_host_ip().
Referenced by open_sock_tcp().
int open_sock_tcp | ( | struct script_infos * | , |
unsigned int | , | ||
int | |||
) |
Definition at line 1729 of file network.c.
References host_get_port_state(), script_infos::ip, script_infos::key, open_sock_option(), plug_current_vhost(), plug_get_host_ip_str(), and plug_get_kb().
Referenced by open_stream_connection_ext().
int open_stream_auto_encaps_ext | ( | struct script_infos * | , |
unsigned int | port, | ||
int | timeout, | ||
int | force | ||
) |
Definition at line 1002 of file network.c.
References open_stream_connection(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_TLScustom, plug_get_port_transport(), and plug_set_port_transport().
Referenced by nasl_open_sock_tcp_bufsz().
int open_stream_connection | ( | struct script_infos * | , |
unsigned int | , | ||
int | , | ||
int | |||
) |
Definition at line 992 of file network.c.
References open_stream_connection_ext().
Referenced by nasl_end_denial(), nasl_start_denial(), open_stream_auto_encaps_ext(), and plugin_do_run().
int open_stream_connection_ext | ( | struct script_infos * | , |
unsigned int | , | ||
int | , | ||
int | , | ||
const char * | |||
) |
Definition at line 886 of file network.c.
References openvas_connection::fd, get_connection_fd(), hostname, openvas_connection::last_err, script_infos::name, open_sock_tcp(), open_SSL_connection(), OPENVAS_ENCAPS_IP, OPENVAS_ENCAPS_SSLv2, OPENVAS_ENCAPS_SSLv23, OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLScustom, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, OVAS_CONNECTION_FROM_FD, plug_get_host_fqdn(), plug_get_kb(), openvas_connection::port, openvas_connection::priority, release_connection_fd(), TIMEOUT, openvas_connection::timeout, and openvas_connection::transport.
Referenced by nasl_open_sock_tcp_bufsz(), and open_stream_connection().
int openvas_deregister_connection | ( | int | ) |
Definition at line 269 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, openvas_connection::priority, and openvas_connection::transport.
int openvas_get_socket_from_connection | ( | int | ) |
Definition at line 367 of file network.c.
References connections, openvas_connection::fd, OPENVAS_FD_OFF, OPENVAS_STREAM, and openvas_connection::transport.
Referenced by nasl_get_source_port(), nasl_ssh_connect(), and plugin_do_run().
int openvas_register_connection | ( | int | soc, |
void * | ssl, | ||
gnutls_certificate_credentials_t | certcred, | ||
openvas_encaps_t | encaps | ||
) |
soc | Socket to use. |
Definition at line 244 of file network.c.
References openvas_connection::fd, get_connection_fd(), openvas_connection::last_err, OVAS_CONNECTION_FROM_FD, openvas_connection::port, openvas_connection::priority, TIMEOUT, openvas_connection::timeout, openvas_connection::tls_cred, openvas_connection::tls_session, and openvas_connection::transport.
Referenced by nasl_open_privileged_socket().
int openvas_SSL_init | ( | void | ) |
Initializes SSL support.
Definition at line 351 of file network.c.
References log_message_gnutls(), and tlserror().
Referenced by main(), openvas(), and start_single_task_scan().
int os_recv | ( | int | , |
void * | , | ||
int | , | ||
int | |||
) |
int os_send | ( | int | , |
void * | , | ||
int | , | ||
int | |||
) |
gnutls_session_t ovas_get_tlssession_from_connection | ( | int | ) |
Definition at line 387 of file network.c.
References connections, OPENVAS_FD_OFF, OPENVAS_STREAM, and openvas_connection::tls_session.
Referenced by socket_get_cert(), socket_get_ssl_ciphersuite(), socket_get_ssl_session_id(), and socket_get_ssl_version().
int read_stream_connection | ( | int | , |
void * | , | ||
int | |||
) |
Definition at line 1272 of file network.c.
References read_stream_connection_min().
Referenced by nasl_telnet_init(), nrecv(), and plugin_do_run().
int read_stream_connection_min | ( | int | , |
void * | , | ||
int | , | ||
int | |||
) |
Definition at line 1212 of file network.c.
References openvas_connection::buf, openvas_connection::bufcnt, openvas_connection::bufptr, openvas_connection::bufsz, OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, and read_stream_connection_unbuffered().
Referenced by nasl_recv(), nasl_recv_line(), nasl_telnet_init(), plugin_do_run(), read_stream_connection(), and recv_line().
int recv_line | ( | int | soc, |
char * | buf, | ||
size_t | bufsiz | ||
) |
Reads a text from the socket stream into the argument buffer, always.
appending a '\0' byte.
buf | Buffer to read into. |
Definition at line 1846 of file network.c.
References OPENVAS_STREAM, and read_stream_connection_min().
Referenced by ftp_get_pasv_address(), and ftp_log_in().
int socket_close | ( | int | ) |
Definition at line 1949 of file network.c.
Referenced by close_stream_connection(), open_socket(), and release_connection_fd().
void socket_get_cert | ( | int | , |
void ** | , | ||
int * | |||
) |
Definition at line 730 of file network.c.
References fd_is_stream(), and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_cert().
int socket_get_ssl_ciphersuite | ( | int | ) |
Definition at line 847 of file network.c.
References fd_is_stream(), and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_ssl_ciphersuite().
int socket_get_ssl_compression | ( | int | ) |
void socket_get_ssl_session_id | ( | int | , |
void ** | , | ||
size_t * | |||
) |
Definition at line 807 of file network.c.
References fd_is_stream(), ovas_get_tlssession_from_connection(), and tlserror().
Referenced by nasl_socket_get_ssl_session_id().
int socket_get_ssl_version | ( | int | ) |
Definition at line 766 of file network.c.
References fd_is_stream(), OPENVAS_ENCAPS_SSLv3, OPENVAS_ENCAPS_TLSv1, OPENVAS_ENCAPS_TLSv11, OPENVAS_ENCAPS_TLSv12, and ovas_get_tlssession_from_connection().
Referenced by nasl_socket_get_ssl_version().
int socket_negotiate_ssl | ( | int | , |
openvas_encaps_t | , | ||
struct script_infos * | |||
) |
Definition at line 683 of file network.c.
References fd_is_stream(), hostname, nasl_get_plugin_filename(), open_SSL_connection(), OVAS_CONNECTION_FROM_FD, plug_get_host_fqdn(), plug_get_kb(), openvas_connection::port, openvas_connection::priority, release_connection_fd(), and openvas_connection::transport.
Referenced by nasl_socket_negotiate_ssl().
int stream_get_buffer_sz | ( | int | ) |
Definition at line 1965 of file network.c.
References openvas_connection::bufsz, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_recv_line().
int stream_get_err | ( | int | ) |
Definition at line 145 of file network.c.
References openvas_connection::last_err, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_socket_get_error().
int stream_set | ( | int | , |
fd_set * | |||
) |
int stream_set_buffer | ( | int | , |
int | |||
) |
Definition at line 1975 of file network.c.
References openvas_connection::buf, openvas_connection::bufcnt, openvas_connection::bufptr, openvas_connection::bufsz, OPENVAS_STREAM, and OVAS_CONNECTION_FROM_FD.
Referenced by nasl_open_sock_tcp_bufsz(), and nasl_recv_line().
int stream_set_timeout | ( | int | , |
int | |||
) |
Definition at line 1033 of file network.c.
References OPENVAS_STREAM, OVAS_CONNECTION_FROM_FD, and openvas_connection::timeout.
Referenced by nasl_recv(), and plugin_do_run().
int stream_zero | ( | fd_set * | ) |
int write_stream_connection | ( | int | , |
void * | buf, | ||
int | n | ||
) |
Definition at line 1396 of file network.c.
References write_stream_connection4().
Referenced by ftp_get_pasv_address(), ftp_log_in(), nasl_telnet_init(), and plugin_do_run().