OpenVAS Libraries  6.0+beta5
Macros | Functions
plugutils.h File Reference
#include "../misc/arglists.h"
#include "../base/nvti.h"

Go to the source code of this file.

Macros

#define LEGACY_OID   "1.3.6.1.4.1.25623.1.0."
 
#define post_hole_tcp   post_hole
 
#define post_info_tcp   post_info
 
#define post_note_tcp   post_note
 
#define post_error_tcp   post_error
 
#define post_log_tcp   post_log
 
#define OPENVAS_ENCAPS_AUTO   0 /* Request auto detection. */
 
#define OPENVAS_ENCAPS_IP   1
 
#define OPENVAS_ENCAPS_SSLv23   2 /* Ask for compatibility options */
 
#define OPENVAS_ENCAPS_SSLv2   3
 
#define OPENVAS_ENCAPS_SSLv3   4
 
#define OPENVAS_ENCAPS_TLSv1   5
 
#define OPENVAS_ENCAPS_TLScustom   6 /* SSL/TLS using custom priorities. */
 
#define IS_ENCAPS_SSL(x)   ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom)
 

Functions

void scanner_add_port (struct arglist *, int, char *)
 
void plug_set_launch (struct arglist *, int)
 
int plug_get_launch (struct arglist *)
 
void plug_set_dep (struct arglist *, const char *)
 
void plug_set_xref (struct arglist *, char *, char *)
 
void plug_set_tag (struct arglist *, char *, char *)
 
void plug_set_ssl_cert (struct arglist *, char *)
 
void plug_set_ssl_key (struct arglist *, char *)
 
void plug_set_ssl_pem_password (struct arglist *, char *)
 
void plug_set_ssl_CA_file (struct arglist *, char *)
 
const char * plug_get_hostname (struct arglist *)
 
const char * plug_get_host_fqdn (struct arglist *)
 
void plug_add_host (struct arglist *, struct arglist *)
 
unsigned int plug_get_host_open_port (struct arglist *desc)
 
void plug_set_port_transport (struct arglist *, int, int)
 
int plug_get_port_transport (struct arglist *, int)
 
struct arglistplug_create_from_nvti_and_prefs (nvti_t *, struct arglist *)
 Returns a (plugin) arglist assembled from the nvti. More...
 
void proto_post_hole (struct arglist *, int, const char *, const char *)
 
void post_hole (struct arglist *, int, const char *)
 
void post_hole_udp (struct arglist *, int, const char *)
 
void proto_post_info (struct arglist *, int, const char *, const char *)
 
void post_info (struct arglist *, int, const char *)
 
void post_info_udp (struct arglist *, int, const char *)
 
void proto_post_note (struct arglist *, int, const char *, const char *)
 
void post_note (struct arglist *, int, const char *)
 
void post_note_udp (struct arglist *, int, const char *)
 
void proto_post_error (struct arglist *, int, const char *, const char *)
 
void post_error (struct arglist *, int, const char *)
 
void post_error_udp (struct arglist *, int, const char *)
 Post a debug message about a udp port. More...
 
void proto_post_log (struct arglist *, int, const char *, const char *)
 Post a log message. More...
 
void post_log (struct arglist *, int, const char *)
 Post a log message about a tcp port. More...
 
void post_log_udp (struct arglist *, int, const char *)
 Post a log message about a udp port. More...
 
void host_add_port (struct arglist *, int, int)
 
void host_add_port_udp (struct arglist *, int, int)
 
int host_get_port_state (struct arglist *, int)
 
int host_get_port_state_udp (struct arglist *, int)
 
void plug_set_key (struct arglist *, char *, int, void *)
 
void plug_replace_key (struct arglist *, char *, int, void *)
 
void * plug_get_fresh_key (struct arglist *, char *, int *)
 
struct kb_item ** plug_get_kb (struct arglist *)
 
void * plug_get_key (struct arglist *, char *, int *)
 
char * openvaslib_version ()
 Returns a static version string. More...
 
void openvas_lib_version (int *, int *, int *)
 Sets major minor and to the respective values of the openvas-libraries version. More...
 
char * addslashes (char *)
 Escapes \n and \r and \ in <in> properly. The. More...
 
char * rmslashes (char *)
 Replaces escape codes (\n, \r) by the real value. More...
 
struct in6_addr * plug_get_host_ip (struct arglist *)
 
char * get_preference (struct arglist *, const char *)
 
void add_plugin_preference (struct arglist *, const char *, const char *, const char *)
 
char * get_plugin_preference (struct arglist *, const char *)
 
const char * get_plugin_preference_fname (struct arglist *, const char *)
 Get the file name of a plugins preference that is of type "file". More...
 
char * get_plugin_preference_file_content (struct arglist *, const char *)
 Get the file contents of a plugins preference that is of type "file". More...
 
const long get_plugin_preference_file_size (struct arglist *, const char *)
 Get the file size of a plugins preference that is of type "file". More...
 
char * find_in_path (char *, int)
 

Macro Definition Documentation

#define IS_ENCAPS_SSL (   x)    ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLScustom)
#define LEGACY_OID   "1.3.6.1.4.1.25623.1.0."
#define OPENVAS_ENCAPS_AUTO   0 /* Request auto detection. */
Todo:
Donate modules to these defines, eg. openvas_encaps.h Old comment: In fact, these defines might better be in a separate files. They are inserted here simply because plugutils uses them a lot.
#define OPENVAS_ENCAPS_IP   1
#define OPENVAS_ENCAPS_SSLv2   3
#define OPENVAS_ENCAPS_SSLv23   2 /* Ask for compatibility options */
#define OPENVAS_ENCAPS_SSLv3   4
#define OPENVAS_ENCAPS_TLScustom   6 /* SSL/TLS using custom priorities. */
#define OPENVAS_ENCAPS_TLSv1   5
#define post_error_tcp   post_error
#define post_hole_tcp   post_hole
#define post_info_tcp   post_info
#define post_log_tcp   post_log
#define post_note_tcp   post_note

Function Documentation

void add_plugin_preference ( struct arglist ,
const char *  ,
const char *  ,
const char *   
)
char* addslashes ( char *  in)

Escapes \n and \r and \ in <in> properly. The.

resulting string is copied and returned.

Parameters
inString in which to escape \n, \r and
Returns
Copy of in with \n, \r and \ escaped, NULL if in is NULL.
See Also
To undo, call rmslashes.
char* find_in_path ( char *  ,
int   
)
char* get_plugin_preference ( struct arglist ,
const char *   
)
char* get_plugin_preference_file_content ( struct arglist desc,
const char *  identifier 
)

Get the file contents of a plugins preference that is of type "file".

As files sent to the scanner (e.g. as plugin preference) are stored in a hash table with an identifier supplied by the client as the key, the contents have to be looked up here.

Parameters
identifierIdentifier that was supplied by the client when the file was uploaded.
Returns
Contents of the file identified by identifier, NULL if not found or setup broken.
const long get_plugin_preference_file_size ( struct arglist desc,
const char *  identifier 
)

Get the file size of a plugins preference that is of type "file".

Files sent to the scanner (e.g. as plugin preference) are stored in a hash table with an identifier supplied by the client as the key. The size of the file is stored in a separate hash table with the same identifier as key, which can be looked up here.

Parameters
identifierIdentifier that was supplied by the client when the file was uploaded.
Returns
Size of the file identified by identifier, -1 if not found or setup broken.
const char* get_plugin_preference_fname ( struct arglist desc,
const char *  filename 
)

Get the file name of a plugins preference that is of type "file".

As files sent to the server (e.g. as plugin preference) are stored at pseudo-random locations with different names, the "real" file name has to be looked up in a hashtable.

Returns
Filename on disc for filename, NULL if not found or setup broken.
char* get_preference ( struct arglist ,
const char *   
)
void host_add_port ( struct arglist ,
int  ,
int   
)
void host_add_port_udp ( struct arglist ,
int  ,
int   
)
int host_get_port_state ( struct arglist ,
int   
)
int host_get_port_state_udp ( struct arglist ,
int   
)
void openvas_lib_version ( int *  ,
int *  ,
int *   
)

Sets major minor and to the respective values of the openvas-libraries version.

char* openvaslib_version ( )

Returns a static version string.

Returns
Version of openvas-libraries, do not modify nor free.
void plug_add_host ( struct arglist ,
struct arglist  
)
struct arglist* plug_create_from_nvti_and_prefs ( nvti_t nvti,
struct arglist prefs 
)

Returns a (plugin) arglist assembled from the nvti.

Parameters
nvtiNVT Information to be used for the creation.
prefsPlugin preference arglist that is added to new arglist and where all preferences of the NVTI are copied to as single entries.
Returns
Pointer to plugin as arglist or NULL.
void* plug_get_fresh_key ( struct arglist ,
char *  ,
int *   
)
const char* plug_get_host_fqdn ( struct arglist )
struct in6_addr* plug_get_host_ip ( struct arglist )
unsigned int plug_get_host_open_port ( struct arglist desc)

Don't always return the first open port, otherwise we might get bitten by OSes doing active SYN flood countermeasures. Also, avoid returning 80 and 21 as open ports, as many transparent proxies are acting for these...

const char* plug_get_hostname ( struct arglist )
struct kb_item** plug_get_kb ( struct arglist )
void* plug_get_key ( struct arglist ,
char *  ,
int *   
)
int plug_get_launch ( struct arglist )
int plug_get_port_transport ( struct arglist ,
int   
)
void plug_replace_key ( struct arglist ,
char *  ,
int  ,
void *   
)
void plug_set_dep ( struct arglist ,
const char *   
)
void plug_set_key ( struct arglist ,
char *  ,
int  ,
void *   
)
void plug_set_launch ( struct arglist ,
int   
)
void plug_set_port_transport ( struct arglist args,
int  port,
int  tr 
)
Todo:
Those brain damaged functions should probably be in another file They are use to remember who speaks SSL or not
void plug_set_ssl_CA_file ( struct arglist args,
char *  key 
)
Todo:
Also, all plug_set_ssl*-functions set values that are only accessed in network.c:open_stream_connection under specific conditions. Check whether these conditions can actually occur. Document the functions on the way.
void plug_set_ssl_cert ( struct arglist ,
char *   
)
void plug_set_ssl_key ( struct arglist ,
char *   
)
void plug_set_ssl_pem_password ( struct arglist ,
char *   
)
void plug_set_tag ( struct arglist ,
char *  ,
char *   
)
void plug_set_xref ( struct arglist ,
char *  ,
char *   
)
void post_error ( struct arglist ,
int  ,
const char *   
)
void post_error_udp ( struct arglist ,
int  ,
const char *   
)

Post a debug message about a udp port.

void post_hole ( struct arglist ,
int  ,
const char *   
)
void post_hole_udp ( struct arglist ,
int  ,
const char *   
)
void post_info ( struct arglist ,
int  ,
const char *   
)
void post_info_udp ( struct arglist ,
int  ,
const char *   
)
void post_log ( struct arglist ,
int  ,
const char *   
)

Post a log message about a tcp port.

void post_log_udp ( struct arglist ,
int  ,
const char *   
)

Post a log message about a udp port.

void post_note ( struct arglist ,
int  ,
const char *   
)
void post_note_udp ( struct arglist ,
int  ,
const char *   
)
void proto_post_error ( struct arglist ,
int  ,
const char *  ,
const char *   
)
void proto_post_hole ( struct arglist ,
int  ,
const char *  ,
const char *   
)
void proto_post_info ( struct arglist ,
int  ,
const char *  ,
const char *   
)
void proto_post_log ( struct arglist ,
int  ,
const char *  ,
const char *   
)

Post a log message.

void proto_post_note ( struct arglist ,
int  ,
const char *  ,
const char *   
)
char* rmslashes ( char *  in)

Replaces escape codes (\n, \r) by the real value.

The resulting string is stored in another buffer.

See Also
(slashes could have been added with addslashes)
void scanner_add_port ( struct arglist ,
int  ,
char *   
)