Go to the source code of this file.
Get info pertaining to a socket.
- NASL Function: get_sock_info
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:
- dport Return the destination port. This is an integer. NOTE: Not yet implemented.
- sport Return the source port. This is an integer. NOTE: Not yet implemented.
- encaps Return the encapsulation of the socket. Example output: "TLScustom".
- tls-proto Return a string with the actual TLS protocol in use. n/a" is returned if no SSL/TLS session is active. Example
output: "TLSv1".
- tls-kx Return a string describing the key exchange algorithm. Example output: "RSA".
- tls-certtype Return the type of the certificate in use by the session. Example output: "X.509"
- tls-cipher Return the cipher algorithm in use by the session; Example output: "AES-256-CBC".
- tls-mac Return the message authentication algorithms used by the session. Example output: "SHA1".
- tls-comp Return the compression algorithms in use by the session. Example output: "DEFLATE".
- tls-auth Return the peer's authentication type. Example output: "CERT".
- tls-cert Return the peer's certificates for an SSL or TLS connection. This is an array of binary strings or NULL if no certificate is known.
- NASL Unnamed Parameters:
- A NASL socket
- A string keyword; see above.
- NASL Named Parameters:
- asstring If true return a human readable string instead of an integer. Used only with these keywords: encaps.
- NASL Returns:
- An integer or a string or NULL on error.
- Parameters
-
[in] | lexic | Lexical context of the NASL interpreter. |
- Returns
- A tree cell.
Open a TCP socket to the target host.
- NASL Function: open_sock_tcp
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.
- NASL Unnamed Parameters:
- A non-negative integer with the TCP port number.
- NASL Named Parameters:
- bufsz An integer with the the size buffer size. Note that by default, no buffering is used.
- timeout An integer with the timeout value in seconds. The default timeout is controlled by a global value.
- transport One of the ENCAPS_* constants to force a specific encapsulation mode or force trying of all modes (ENCAPS_AUTO). This is for example useful to select a specific TLS or SSL version or use specific TLS connection setup priorities. See get_port_transport for a description of the ENCAPS constants.
- priority A string value with priorities for an TLS encapsulation. For the syntax of the priority string see the GNUTLS manual. This argument is only used in ENCAPS_TLScustom encapsulation.
- NASL Returns:
- A positive integer as a NASL socket, 0 on connection error or NULL on other errors.
- Parameters
-
[in] | lexic | Lexical context of the NASL interpreter. |
- Returns
- A tree cell.