OpenVAS Scanner
6.0.1
|
Plugin-specific stuff. More...
#include "plugutils.h"
#include "network.h"
#include <ctype.h>
#include <errno.h>
#include <glib.h>
#include <gvm/base/hosts.h>
#include <gvm/base/logging.h>
#include <gvm/base/networking.h>
#include <gvm/base/prefs.h>
#include <gvm/util/kb.h>
#include <gvm/util/nvticache.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
Macros | |
#define | G_LOG_DOMAIN "lib misc" |
GLib logging domain. More... | |
#define | MAX_CANDIDATES 16 |
Functions | |
const char * | plug_current_vhost (void) |
static int | plug_fork_child (kb_t) |
void | plug_set_xref (struct script_infos *args, char *name, char *value) |
void | plug_set_tag (struct script_infos *args, char *name, char *value) |
void | plug_set_dep (struct script_infos *args, const char *depname) |
void | host_add_port_proto (struct script_infos *args, int portnum, char *proto) |
static int | unscanned_ports_as_closed (port_protocol_t ptype) |
Report state of preferences "unscanned_closed". More... | |
int | kb_get_port_state_proto (kb_t kb, int portnum, char *proto) |
int | host_get_port_state_proto (struct script_infos *args, int portnum, char *proto) |
int | host_get_port_state (struct script_infos *plugdata, int portnum) |
int | host_get_port_state_udp (struct script_infos *plugdata, int portnum) |
int | plug_add_host_fqdn (struct script_infos *args, const char *hostname, const char *source) |
char * | plug_get_host_fqdn (struct script_infos *args) |
GSList * | plug_get_host_fqdn_list (struct script_infos *args) |
char * | plug_get_host_source (struct script_infos *args, const char *hostname) |
struct in6_addr * | plug_get_host_ip (struct script_infos *args) |
char * | plug_get_host_ip_str (struct script_infos *desc) |
void | proto_post_wrapped (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action, const char *what) |
Post a security message (e.g. LOG, NOTE, WARNING ...). More... | |
void | proto_post_alarm (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action) |
void | post_alarm (const char *oid, struct script_infos *desc, int port, const char *action) |
void | proto_post_log (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action) |
Post a log message. More... | |
void | post_log (const char *oid, struct script_infos *desc, int port, const char *action) |
Post a log message about a tcp port. More... | |
void | proto_post_error (const char *oid, struct script_infos *desc, int port, const char *proto, const char *action) |
void | post_error (const char *oid, struct script_infos *desc, int port, const char *action) |
void | add_plugin_preference (struct script_infos *desc, const char *name, const char *type, const char *defaul) |
char * | get_plugin_preference (const char *oid, const char *name) |
const char * | get_plugin_preference_fname (struct script_infos *desc, const char *filename) |
Get the file name of a plugins preference that is of type "file". More... | |
char * | get_plugin_preference_file_content (struct script_infos *desc, const char *identifier) |
Get the file contents of a plugins preference that is of type "file". More... | |
long | get_plugin_preference_file_size (struct script_infos *desc, const char *identifier) |
Get the file size of a plugins preference that is of type "file". More... | |
void | plug_set_key_len (struct script_infos *args, char *name, int type, const void *value, size_t len) |
void | plug_set_key (struct script_infos *args, char *name, int type, const void *value) |
void | plug_replace_key_len (struct script_infos *args, char *name, int type, void *value, size_t len) |
void | plug_replace_key (struct script_infos *args, char *name, int type, void *value) |
void | scanner_add_port (struct script_infos *args, int port, char *proto) |
kb_t | plug_get_kb (struct script_infos *args) |
static void | plug_get_key_sigchld () |
static void | sig_n (int signo, void(*fnc)(int)) |
static void | sig_term (void(*fcn)()) |
static void | sig_chld (void(*fcn)()) |
void * | plug_get_key (struct script_infos *args, char *name, int *type, size_t *len, int single) |
unsigned int | plug_get_host_open_port (struct script_infos *desc) |
void | plug_set_port_transport (struct script_infos *args, int port, int tr) |
int | plug_get_port_transport (struct script_infos *args, int port) |
static void | plug_set_ssl_item (struct script_infos *args, char *item, char *itemfname) |
void | plug_set_ssl_cert (struct script_infos *args, char *cert) |
void | plug_set_ssl_key (struct script_infos *args, char *key) |
void | plug_set_ssl_pem_password (struct script_infos *args, char *key) |
void | plug_set_ssl_CA_file (struct script_infos *args, char *key) |
Variables | |
int | global_nasl_debug = 0 |
gvm_vhost_t * | current_vhost = NULL |
Plugin-specific stuff.
#define G_LOG_DOMAIN "lib misc" |
GLib logging domain.
#define MAX_CANDIDATES 16 |
void add_plugin_preference | ( | struct script_infos * | desc, |
const char * | name, | ||
const char * | type, | ||
const char * | defaul | ||
) |
char* get_plugin_preference | ( | const char * | oid, |
const char * | name | ||
) |
char* get_plugin_preference_file_content | ( | struct script_infos * | 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.
identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier
, NULL if not found or setup broken. long get_plugin_preference_file_size | ( | struct script_infos * | 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.
identifier | Identifier that was supplied by the client when the file was uploaded. |
identifier
, -1 if not found or setup broken. const char* get_plugin_preference_fname | ( | struct script_infos * | 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.
filename
, NULL if not found or setup broken. void host_add_port_proto | ( | struct script_infos * | args, |
int | portnum, | ||
char * | proto | ||
) |
int host_get_port_state | ( | struct script_infos * | plugdata, |
int | portnum | ||
) |
int host_get_port_state_proto | ( | struct script_infos * | args, |
int | portnum, | ||
char * | proto | ||
) |
int host_get_port_state_udp | ( | struct script_infos * | plugdata, |
int | portnum | ||
) |
int kb_get_port_state_proto | ( | kb_t | kb, |
int | portnum, | ||
char * | proto | ||
) |
proto | Protocol (udp/tcp). If NULL, "tcp" will be used. |
int plug_add_host_fqdn | ( | struct script_infos * | args, |
const char * | hostname, | ||
const char * | source | ||
) |
const char* plug_current_vhost | ( | void | ) |
|
static |
char* plug_get_host_fqdn | ( | struct script_infos * | args | ) |
GSList* plug_get_host_fqdn_list | ( | struct script_infos * | args | ) |
struct in6_addr* plug_get_host_ip | ( | struct script_infos * | args | ) |
char* plug_get_host_ip_str | ( | struct script_infos * | desc | ) |
unsigned int plug_get_host_open_port | ( | struct script_infos * | 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...
char* plug_get_host_source | ( | struct script_infos * | args, |
const char * | hostname | ||
) |
kb_t plug_get_kb | ( | struct script_infos * | args | ) |
void* plug_get_key | ( | struct script_infos * | args, |
char * | name, | ||
int * | type, | ||
size_t * | len, | ||
int | single | ||
) |
|
static |
int plug_get_port_transport | ( | struct script_infos * | args, |
int | port | ||
) |
void plug_replace_key | ( | struct script_infos * | args, |
char * | name, | ||
int | type, | ||
void * | value | ||
) |
void plug_replace_key_len | ( | struct script_infos * | args, |
char * | name, | ||
int | type, | ||
void * | value, | ||
size_t | len | ||
) |
void plug_set_dep | ( | struct script_infos * | args, |
const char * | depname | ||
) |
void plug_set_key | ( | struct script_infos * | args, |
char * | name, | ||
int | type, | ||
const void * | value | ||
) |
void plug_set_key_len | ( | struct script_infos * | args, |
char * | name, | ||
int | type, | ||
const void * | value, | ||
size_t | len | ||
) |
void plug_set_port_transport | ( | struct script_infos * | args, |
int | port, | ||
int | tr | ||
) |
void plug_set_ssl_CA_file | ( | struct script_infos * | args, |
char * | key | ||
) |
void plug_set_ssl_cert | ( | struct script_infos * | args, |
char * | cert | ||
) |
|
static |
void plug_set_ssl_key | ( | struct script_infos * | args, |
char * | key | ||
) |
void plug_set_ssl_pem_password | ( | struct script_infos * | args, |
char * | key | ||
) |
void plug_set_tag | ( | struct script_infos * | args, |
char * | name, | ||
char * | value | ||
) |
void plug_set_xref | ( | struct script_infos * | args, |
char * | name, | ||
char * | value | ||
) |
void post_alarm | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | action | ||
) |
void post_error | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | action | ||
) |
void post_log | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | action | ||
) |
Post a log message about a tcp port.
void proto_post_alarm | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | proto, | ||
const char * | action | ||
) |
void proto_post_error | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | proto, | ||
const char * | action | ||
) |
void proto_post_log | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | proto, | ||
const char * | action | ||
) |
Post a log message.
void proto_post_wrapped | ( | const char * | oid, |
struct script_infos * | desc, | ||
int | port, | ||
const char * | proto, | ||
const char * | action, | ||
const char * | what | ||
) |
Post a security message (e.g. LOG, NOTE, WARNING ...).
oid | The oid of the NVT |
desc | The script infos where to get the nvtichache from and some other settings and it is used to send the messages |
port | Port number related to the issue. |
proto | Protocol related to the issue (tcp or udp). |
action | The actual result text |
what | The type, like "LOG". |
void scanner_add_port | ( | struct script_infos * | args, |
int | port, | ||
char * | proto | ||
) |
|
static |
|
static |
|
static |
|
static |
Report state of preferences "unscanned_closed".
gvm_vhost_t* current_vhost = NULL |
int global_nasl_debug = 0 |