1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
/* SPDX-FileCopyrightText: 2023 Greenbone AG
* SPDX-FileCopyrightText: 1998-2007 Tenable Network Security, Inc.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/**
* @file plugutils.h
* @brief Header file for module plugutils.
*/
#ifndef MISC_PLUGUTILS_H
#define MISC_PLUGUTILS_H
#include "scanneraux.h" /* for struct script_infos */
#include <gvm/base/nvti.h> /* for nvti_t */
#define ARG_STRING 1
#define ARG_INT 2
void
init_kb_usage (void);
void
scanner_add_port (struct script_infos *, int, char *);
/*
* Arglist management at plugin-level
*/
void
plug_set_dep (struct script_infos *, const char *);
void
plug_set_ssl_cert (struct script_infos *, char *);
void
plug_set_ssl_key (struct script_infos *, char *);
void
plug_set_ssl_pem_password (struct script_infos *, char *);
void
plug_set_ssl_CA_file (struct script_infos *, char *);
const char *
plug_current_vhost (void);
char *
plug_get_host_fqdn (struct script_infos *);
int
plug_add_host_fqdn (struct script_infos *, const char *, const char *);
GSList *
plug_get_host_fqdn_list (struct script_infos *);
char *
plug_get_host_source (struct script_infos *, const char *);
unsigned int
plug_get_host_open_port (struct script_infos *desc);
void
plug_set_port_transport (struct script_infos *, int, int);
int
plug_get_port_transport (struct script_infos *, int);
struct script_infos *
plug_create_from_nvti_and_prefs (const nvti_t *);
/*
* Reporting functions
*/
typedef enum
{
ERRMSG,
HOST_START,
HOST_END,
LOG,
HOST_DETAIL,
ALARM,
DEADHOST,
HOSTS_COUNT
} msg_t;
void
proto_post_alarm (const char *, struct script_infos *, int, const char *,
const char *, const char *);
void
post_alarm (const char *, struct script_infos *, int, const char *,
const char *);
void
post_alarm_udp (struct script_infos *, int, const char *, const char *);
#define post_alarm_tcp post_alarm
void
proto_post_error (const char *, struct script_infos *, int, const char *,
const char *, const char *);
void
post_error (const char *, struct script_infos *, int, const char *,
const char *);
#define post_error_tcp post_error
void
proto_post_log (const char *, struct script_infos *, int, const char *,
const char *, const char *);
void
post_log (const char *, struct script_infos *, int, const char *);
void
post_log_with_uri (const char *, struct script_infos *, int, const char *,
const char *);
#define post_log_tcp post_log
/*
* Management of the portlists
*/
int
host_get_port_state (struct script_infos *, int);
int
host_get_port_state_udp (struct script_infos *, int);
/*
* Inter Plugins Communication functions
*/
int check_kb_inconsistency (kb_t);
int
kb_item_push_str_with_main_kb_check (kb_t, const char *, const char *);
int
kb_item_set_str_with_main_kb_check (kb_t, const char *, const char *, size_t);
int
kb_item_add_str_unique_with_main_kb_check (kb_t, const char *, const char *,
size_t, int);
int
kb_item_set_int_with_main_kb_check (kb_t, const char *, int);
int
kb_item_add_int_with_main_kb_check (kb_t, const char *, int);
int
kb_item_add_int_unique_with_main_kb_check (kb_t, const char *, int);
void
plug_set_key (struct script_infos *, char *, int, const void *);
void
plug_set_key_len (struct script_infos *, char *, int, const void *, size_t);
void
plug_set_key_volatile (struct script_infos *, char *, int, const void *, int);
void
plug_set_key_len_volatile (struct script_infos *, char *, int, const void *,
int, size_t);
void
plug_replace_key (struct script_infos *, char *, int, void *);
void
plug_replace_key_len (struct script_infos *, char *, int, void *, size_t);
kb_t
plug_get_kb (struct script_infos *);
void *
plug_get_key (struct script_infos *, char *, int *, size_t *, int);
struct in6_addr *
plug_get_host_ip (struct script_infos *);
char *
plug_get_host_ip_str (struct script_infos *);
char *
get_plugin_preference (const char *, const char *, int);
const char *
get_plugin_preference_fname (struct script_infos *, const char *);
char *
get_plugin_preference_file_content (struct script_infos *, const char *);
long
get_plugin_preference_file_size (struct script_infos *, const char *);
int
kb_get_port_state_proto (kb_t kb, int portnum, char *proto);
#endif
|