OpenVAS Scanner 23.23.1
network.h File Reference

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)
#define NO_PRIORITY_FLAGS   0
#define INSECURE_DH_PRIME_BITS   (1 << 0)

Typedefs

typedef enum openvas_encaps openvas_encaps_t

Enumerations

enum  openvas_encaps {
  OPENVAS_ENCAPS_AUTO = 0 , OPENVAS_ENCAPS_IP , OPENVAS_ENCAPS_SSLv23 , OPENVAS_ENCAPS_SSLv2 ,
  OPENVAS_ENCAPS_SSLv3 , OPENVAS_ENCAPS_TLSv1 , OPENVAS_ENCAPS_TLSv11 , OPENVAS_ENCAPS_TLSv12 ,
  OPENVAS_ENCAPS_TLSv13 , OPENVAS_ENCAPS_TLScustom , OPENVAS_ENCAPS_MAX
}

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.
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.
void open_stream_tls_default_priorities (const char *p, const int pflag)
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)
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))
 Register a hook function for close_stream_connection.
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.
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_ssl_safe_renegotiation_status (int)
 Check if Secure Renegotiation is supported in the server side.
int socket_ssl_do_handshake (int)
 Do a re-handshake of the TLS/SSL protocol.
int socket_negotiate_ssl (int, openvas_encaps_t, struct script_infos *)
 Upgrade an ENCAPS_IP socket to an SSL/TLS encapsulated one.
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)

Detailed Description

Header file for module network.

Macro Definition Documentation

◆ INSECURE_DH_PRIME_BITS

#define INSECURE_DH_PRIME_BITS   (1 << 0)

◆ IS_ENCAPS_SSL

#define IS_ENCAPS_SSL ( x)
Value:
@ OPENVAS_ENCAPS_TLScustom
Definition network.h:39
@ OPENVAS_ENCAPS_SSLv23
Definition network.h:32

◆ NO_PRIORITY_FLAGS

#define NO_PRIORITY_FLAGS   0

Typedef Documentation

◆ openvas_encaps_t

Enumeration Type Documentation

◆ openvas_encaps

Enumerator
OPENVAS_ENCAPS_AUTO 
OPENVAS_ENCAPS_IP 
OPENVAS_ENCAPS_SSLv23 
OPENVAS_ENCAPS_SSLv2 
OPENVAS_ENCAPS_SSLv3 
OPENVAS_ENCAPS_TLSv1 
OPENVAS_ENCAPS_TLSv11 
OPENVAS_ENCAPS_TLSv12 
OPENVAS_ENCAPS_TLSv13 
OPENVAS_ENCAPS_TLScustom 
OPENVAS_ENCAPS_MAX 

Function Documentation

◆ add_close_stream_connection_hook()

void add_close_stream_connection_hook ( int(* fnc )(int fd))

Register a hook function for close_stream_connection.

The function adds the given hook function to the list of hooks to be run by close_stream_connection. These hooks are intended to test whether they need to close the stream them self. See argument to the hook function is the file descriptor of the stream. The hook shall return 0 if it has taken over control of that file descriptor. The same function is only aded once to the list of hooks.

Parameters
fncThe hook function. See above for details.

◆ close_stream_connection()

int close_stream_connection ( int fd)

◆ fd_is_stream()

int fd_is_stream ( int fd)

◆ get_encaps_name()

const char * get_encaps_name ( openvas_encaps_t code)

◆ get_encaps_through()

const char * get_encaps_through ( openvas_encaps_t code)

◆ get_sock_infos()

int get_sock_infos ( int sock,
int * r_transport,
void ** r_tls_session )

◆ getpts()

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.nosp@m.r@dh.nosp@m.p.com and was taken from his excellent and outstanding scanner Nmap See http://www.insecure.org/nmap/ for details about Nmap

◆ nrecv()

int nrecv ( int fd,
void * data,
int length,
int i_opt )

◆ nsend()

int nsend ( int fd,
void * data,
int length,
int i_opt )

◆ open_sock_opt_hn()

int open_sock_opt_hn ( const char * hostname,
unsigned int port,
int type,
int protocol,
int timeout )

◆ open_sock_option()

int open_sock_option ( struct script_infos * args,
unsigned int port,
int type,
int protocol,
int timeout )

◆ open_sock_tcp()

int open_sock_tcp ( struct script_infos * args,
unsigned int port,
int timeout )

◆ open_stream_auto_encaps_ext()

int open_stream_auto_encaps_ext ( struct script_infos * args,
unsigned int port,
int timeout,
int force )

◆ open_stream_connection()

int open_stream_connection ( struct script_infos * args,
unsigned int port,
int transport,
int timeout )

◆ open_stream_connection_ext()

int open_stream_connection_ext ( struct script_infos * args,
unsigned int port,
int transport,
int timeout,
const char * priority,
int flags )

◆ open_stream_tls_default_priorities()

void open_stream_tls_default_priorities ( const char * p,
const int pflag )

◆ openvas_deregister_connection()

int openvas_deregister_connection ( int fd)

◆ openvas_get_socket_from_connection()

int openvas_get_socket_from_connection ( int fd)

◆ openvas_register_connection()

int openvas_register_connection ( int soc,
void * ssl,
gnutls_certificate_credentials_t certcred,
openvas_encaps_t encaps )
Todo
TLS FIXME: migrate this to TLS
Todo
Fix the voidness of the ssl parameter (problematic in 64bit env.) here or on caller-side
Parameters
socSocket to use.

◆ openvas_SSL_init()

int openvas_SSL_init ( void )

Initializes SSL support.

◆ os_recv()

int os_recv ( int soc,
void * buf,
int len,
int opt )

◆ os_send()

int os_send ( int soc,
void * buf,
int len,
int opt )

◆ ovas_get_tlssession_from_connection()

gnutls_session_t ovas_get_tlssession_from_connection ( int fd)

◆ read_stream_connection()

int read_stream_connection ( int fd,
void * buf0,
int len )

◆ read_stream_connection_min()

int read_stream_connection_min ( int fd,
void * buf0,
int min_len,
int max_len )

◆ 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.

Parameters
bufBuffer to read into.
Returns
Number of bytes read, without the trailing '\0'.

◆ socket_close()

int socket_close ( int soc)

◆ socket_get_cert()

void socket_get_cert ( int fd,
void ** cert,
int * certlen )

◆ socket_get_ssl_ciphersuite()

int socket_get_ssl_ciphersuite ( int fd)

◆ socket_get_ssl_compression()

int socket_get_ssl_compression ( int )

◆ socket_get_ssl_session_id()

void socket_get_ssl_session_id ( int fd,
void ** sid,
size_t * ssize )

◆ socket_get_ssl_version()

int socket_get_ssl_version ( int fd)

◆ socket_negotiate_ssl()

int socket_negotiate_ssl ( int fd,
openvas_encaps_t transport,
struct script_infos * args )

Upgrade an ENCAPS_IP socket to an SSL/TLS encapsulated one.

Parameters
[in]fdSocket file descriptor.
[in]transportEncapsulation type.
[in]argScript args.
Returns
-1 if error, socket file descriptor value otherwise.

◆ socket_ssl_do_handshake()

int socket_ssl_do_handshake ( int fd)

Do a re-handshake of the TLS/SSL protocol.

Parameters
[in]fdSocket file descriptor.
Returns
1 on success, less than 0 on failure or error.

◆ socket_ssl_safe_renegotiation_status()

int socket_ssl_safe_renegotiation_status ( int fd)

Check if Secure Renegotiation is supported in the server side.

Parameters
[in]fdSocket file descriptor.
Returns
1 if supported, 0 if not supported and less than 0 on error.

◆ stream_get_buffer_sz()

int stream_get_buffer_sz ( int fd)

◆ stream_get_err()

int stream_get_err ( int fd)

◆ stream_set()

int stream_set ( int ,
fd_set *  )

◆ stream_set_buffer()

int stream_set_buffer ( int fd,
int sz )

◆ stream_set_timeout()

int stream_set_timeout ( int fd,
int timeout )

◆ stream_zero()

int stream_zero ( fd_set * )

◆ write_stream_connection()

int write_stream_connection ( int fd,
void * buf,
int n )