OpenVAS Libraries
9.0.3
|
The NASL socket API. More...
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <gnutls/gnutls.h>
#include "../misc/network.h"
#include "../base/openvas_networking.h"
#include "../misc/plugutils.h"
#include "../misc/openvas_logging.h"
#include "../misc/prefs.h"
#include "nasl.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "exec.h"
#include "nasl_packet_forgery.h"
#include "nasl_debug.h"
Go to the source code of this file.
Data Structures | |
struct | udp_record |
struct | jmg |
Macros | |
#define | EADDRNOTAVAIL EADDRINUSE |
Variables | |
int | lowest_socket = 0 |
The NASL socket API.
This file contains all the functions related to the handling of the sockets within a NASL script - for example the implementation of the NASL built-ins open_sock_tcp, send, recv, recv_line, and close.
Definition in file nasl_socket.c.
#define EADDRNOTAVAIL EADDRINUSE |
Definition at line 70 of file nasl_socket.c.
Definition at line 947 of file nasl_socket.c.
References fd_is_stream(), and get_int_var_by_num().
Referenced by http_close_socket().
Get info pertaining to a socket.
This function is used to retrieve various information about an active socket. It requires the NASL socket number and a string to select the information to retrieve.
Supported keywords are:
[in] | lexic | Lexical context of the NASL interpreter. |
Definition at line 1240 of file nasl_socket.c.
References add_var_to_list(), alloc_tree_cell(), alloc_typed_cell(), CONST_INT, CONST_STR, DYN_ARRAY, err, FAKE_CELL, get_encaps_name(), get_int_local_var_by_name(), get_int_var_by_num(), get_sock_infos(), get_str_var_by_num(), get_var_type_by_num(), TC::i_val, nasl_perror(), TC::ref_val, st_nasl_string::s_siz, st_nasl_string::s_val, TC::size, TC::str_val, TC::type, st_a_nasl_var::v, st_a_nasl_var::v_str, VAR2_DATA, VAR2_STRING, st_a_nasl_var::var_type, and TC::x.
Definition at line 1094 of file nasl_socket.c.
References alloc_typed_cell(), CONST_INT, fd_is_stream(), get_int_var_by_num(), TC::i_val, nasl_perror(), openvas_get_socket_from_connection(), and TC::x.
Definition at line 993 of file nasl_socket.c.
References get_str_var_by_num(), and nasl_perror().
Definition at line 1061 of file nasl_socket.c.
References get_str_var_by_num(), and nasl_perror().
Definition at line 411 of file nasl_socket.c.
Definition at line 417 of file nasl_socket.c.
Open a TCP socket to the target host.
This function is used to create a TCP connection to the target host. It requires the port number as its argument and has various optional named arguments to control encapsulation, timeout and buffering.
[in] | lexic | Lexical context of the NASL interpreter. |
Definition at line 527 of file nasl_socket.c.
References nasl_open_sock_tcp_bufsz().
Definition at line 426 of file nasl_socket.c.
References get_int_local_var_by_name(), get_int_var_by_num(), get_local_var_type_by_name(), get_str_local_var_by_name(), OPENVAS_ENCAPS_TLScustom, struct_lex_ctxt::recv_timeout, struct_lex_ctxt::script_infos, arglist::type, VAR2_DATA, and VAR2_STRING.
Referenced by http_open_socket(), and nasl_open_sock_tcp().
Definition at line 539 of file nasl_socket.c.
References alloc_tree_cell(), CONST_INT, get_int_var_by_num(), TC::i_val, lowest_socket, openvas_source_set_socket(), plug_get_host_ip(), struct_lex_ctxt::script_infos, TC::type, and TC::x.
Definition at line 726 of file nasl_socket.c.
References fd_is_stream(), get_int_local_var_by_name(), struct_lex_ctxt::recv_timeout, and timeval().
Definition at line 828 of file nasl_socket.c.
References alloc_tree_cell(), CONST_DATA, fd_is_stream(), get_int_local_var_by_name(), nasl_perror(), read_stream_connection_min(), TC::size, TC::str_val, stream_get_buffer_sz(), stream_set_buffer(), TC::type, and TC::x.
Definition at line 899 of file nasl_socket.c.
References fd_is_stream(), get_int_local_var_by_name(), get_str_local_var_by_name(), get_var_size_by_name(), nasl_perror(), and option.
Referenced by nasl_send_capture().
Definition at line 623 of file nasl_socket.c.
References alloc_tree_cell(), CONST_DATA, get_int_local_var_by_name(), nasl_perror(), TC::size, socket_get_cert(), TC::str_val, TC::type, and TC::x.
Definition at line 1137 of file nasl_socket.c.
References alloc_typed_cell(), CONST_INT, err, fd_is_stream(), get_int_var_by_num(), TC::i_val, log_legacy_write(), NASL_ERR_ECONNRESET, NASL_ERR_ETIMEDOUT, NASL_ERR_EUNREACH, NASL_ERR_NOERR, stream_get_err(), and TC::x.
Definition at line 708 of file nasl_socket.c.
References alloc_tree_cell(), CONST_INT, get_int_local_var_by_name(), TC::i_val, socket_get_ssl_ciphersuite(), TC::type, and TC::x.
Definition at line 672 of file nasl_socket.c.
References alloc_tree_cell(), CONST_INT, get_int_local_var_by_name(), TC::i_val, nasl_perror(), socket_get_ssl_compression(), TC::type, and TC::x.
Definition at line 647 of file nasl_socket.c.
References alloc_tree_cell(), CONST_DATA, get_int_local_var_by_name(), nasl_perror(), TC::size, socket_get_ssl_session_id(), TC::str_val, TC::type, and TC::x.
Definition at line 691 of file nasl_socket.c.
References alloc_tree_cell(), CONST_INT, get_int_local_var_by_name(), TC::i_val, socket_get_ssl_version(), TC::type, and TC::x.
Definition at line 589 of file nasl_socket.c.
References alloc_tree_cell(), CONST_INT, get_int_local_var_by_name(), TC::i_val, IS_ENCAPS_SSL, nasl_perror(), OPENVAS_ENCAPS_TLScustom, struct_lex_ctxt::script_infos, socket_negotiate_ssl(), TC::type, and TC::x.
int lowest_socket = 0 |
Definition at line 223 of file nasl_socket.c.
Referenced by nasl_open_sock_udp().