OpenVAS Libraries
8.0.3
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <sys/types.h>
#include <ifaddrs.h>
#include <netdb.h>
#include <glib.h>
#include <errno.h>
#include <ctype.h>
#include <assert.h>
#include "array.h"
Go to the source code of this file.
Data Structures | |
struct | range |
A port range. More... | |
Typedefs | |
typedef struct range | range_t |
Enumerations | |
enum | port_protocol_t { PORT_PROTOCOL_TCP = 0, PORT_PROTOCOL_UDP = 1, PORT_PROTOCOL_OTHER = 2 } |
Possible port types. More... | |
Functions | |
int | openvas_source_iface_init (const char *) |
Initializes the source network interface name and related information. More... | |
int | openvas_source_iface_is_set (void) |
int | openvas_source_set_socket (int, int, int) |
Binds a socket to use the global source address. More... | |
void | openvas_source_addr (void *) |
Gives the source IPv4 address. More... | |
void | openvas_source_addr6 (void *) |
Gives the source IPv6 address. More... | |
void | openvas_source_addr_as_addr6 (struct in6_addr *) |
Gives the source IPv4 mapped as an IPv6 address. eg. 192.168.20.10 would map to ::ffff:192.168.20.10. More... | |
char * | openvas_source_addr_str (void) |
Gives the source IPv4 address in string format. More... | |
char * | openvas_source_addr6_str (void) |
Gives the source IPv6 address in string format. More... | |
void | ipv4_as_ipv6 (const struct in_addr *, struct in6_addr *) |
Maps an IPv4 address as an IPv6 address. eg. 192.168.10.20 would map to ::ffff:192.168.10.20. More... | |
char * | addr6_as_str (const struct in6_addr *) |
int | openvas_resolve (const char *, void *, int) |
Resolves a hostname to an IPv4 or IPv6 address. More... | |
int | openvas_resolve_as_addr6 (const char *, struct in6_addr *) |
Resolves a hostname to an IPv4-mapped IPv6 or IPv6 address. More... | |
int | validate_port_range (const char *) |
Validate a port range string. More... | |
array_t * | port_range_ranges (const char *) |
Create a range array from a port_range string. More... | |
int | port_in_port_ranges (int, port_protocol_t, array_t *) |
Checks if a port num is in port ranges array. More... | |
char * | openvas_ssh_public_from_private (const char *, const char *) |
Exports a base64 encoded public key from a private key and its passphrase. More... | |
char * | openvas_ssh_pkcs8_decrypt (const char *, const char *) |
Decrypts a base64 encrypted ssh private key. More... | |
enum port_protocol_t |
char* addr6_as_str | ( | const struct in6_addr * | ) |
void ipv4_as_ipv6 | ( | const struct in_addr * | ip4, |
struct in6_addr * | ip6 | ||
) |
Maps an IPv4 address as an IPv6 address. eg. 192.168.10.20 would map to ::ffff:192.168.10.20.
[in] | ip4 | IPv4 address to map. |
[out] | ip6 | Buffer to store the IPv6 address. |
int openvas_resolve | ( | const char * | name, |
void * | dst, | ||
int | family | ||
) |
Resolves a hostname to an IPv4 or IPv6 address.
[in] | name | Hostname to resolve. |
[out] | dst | Buffer to store resolved address. Size must be at least 4 bytes for AF_INET and 16 bytes for AF_INET6. |
[in] | family | Either AF_INET or AF_INET6. |
int openvas_resolve_as_addr6 | ( | const char * | name, |
struct in6_addr * | ip6 | ||
) |
Resolves a hostname to an IPv4-mapped IPv6 or IPv6 address.
[in] | name | Hostname to resolve. |
[out] | ip6 | Buffer to store resolved address. |
void openvas_source_addr | ( | void * | addr | ) |
Gives the source IPv4 address.
[out] | addr | Buffer of at least 4 bytes. |
void openvas_source_addr6 | ( | void * | addr6 | ) |
Gives the source IPv6 address.
[out] | addr6 | Buffer of at least 16 bytes. |
char* openvas_source_addr6_str | ( | void | ) |
Gives the source IPv6 address in string format.
void openvas_source_addr_as_addr6 | ( | struct in6_addr * | addr6 | ) |
Gives the source IPv4 mapped as an IPv6 address. eg. 192.168.20.10 would map to ::ffff:192.168.20.10.
[out] | addr6 | Buffer of at least 16 bytes. |
char* openvas_source_addr_str | ( | void | ) |
Gives the source IPv4 address in string format.
int openvas_source_iface_init | ( | const char * | iface | ) |
Initializes the source network interface name and related information.
[in] | iface | Name of network interface to use as source interface. |
int openvas_source_iface_is_set | ( | void | ) |
int openvas_source_set_socket | ( | int | socket, |
int | port, | ||
int | family | ||
) |
Binds a socket to use the global source address.
[in] | socket | Socket to set source address for. |
[in] | port | Network port for socket. |
[in] | family | Family of socket. AF_INET or AF_INET6. |
char* openvas_ssh_pkcs8_decrypt | ( | const char * | pkcs8_key, |
const char * | passphrase | ||
) |
Decrypts a base64 encrypted ssh private key.
[in] | pkcs8_key | PKCS#8 encrypted private key. |
[in] | passphrase | Passphrase for the private key. |
char* openvas_ssh_public_from_private | ( | const char * | private_key, |
const char * | passphrase | ||
) |
Exports a base64 encoded public key from a private key and its passphrase.
[in] | private_key | Private key to export. |
[in] | passphrase | Passphrase for the private key. |
int port_in_port_ranges | ( | int | pnum, |
port_protocol_t | ptype, | ||
array_t * | pranges | ||
) |
Checks if a port num is in port ranges array.
[in] | pnum | Port number. |
[in] | ptype | Port type. |
[in] | pranges | Array of port ranges. |
array_t* port_range_ranges | ( | const char * | port_range | ) |
Create a range array from a port_range string.
[in] | port_range | Valid port_range string. |
int validate_port_range | ( | const char * | port_range | ) |
Validate a port range string.
Accepts ranges in form of "103,U:200-1024,3000-4000,T:3-4,U:7".
[in] | port_range | A port range. |