OpenVAS Libraries
4.0+rc3.SVN
|
00001 /* OpenVAS 00002 * $Id$ 00003 * Description: Header file for module plugutils. 00004 * 00005 * Authors: 00006 * Renaud Deraison <deraison@nessus.org> (Original pre-fork development) 00007 * 00008 * Copyright: 00009 * Based on work Copyright (C) 1998 - 2007 Tenable Network Security, Inc. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Library General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Library General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU General Public License 00022 * along with this program; if not, write to the Free Software 00023 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 00024 */ 00025 00026 #ifndef OPENVAS_PLUGUTILS_H 00027 #define OPENVAS_PLUGUTILS_H 00028 00029 #include "../misc/arglists.h" 00030 00031 #include "../base/nvti.h" 00032 00033 #define LEGACY_OID "1.3.6.1.4.1.25623.1.0." 00034 00035 void scanner_add_port (struct arglist *, int, char *); 00036 00037 00038 /* 00039 * Arglist management at plugin-level 00040 */ 00041 void plug_set_nvti (struct arglist *, nvti_t *); 00042 nvti_t *plug_get_nvti (struct arglist *); 00043 00044 void plug_set_name (struct arglist *, const char *); 00045 char *plug_get_name (struct arglist *); 00046 00047 void plug_set_path (struct arglist *, const char *); 00048 char *plug_get_path (struct arglist *); 00049 00050 void plug_set_version (struct arglist *, const char *); 00051 char *plug_get_version (struct arglist *); 00052 00053 void plug_set_timeout (struct arglist *, int); 00054 int plug_get_timeout (struct arglist *); 00055 00056 void plug_set_launch (struct arglist *, int); 00057 int plug_get_launch (struct arglist *); 00058 00059 void plug_set_summary (struct arglist *, const char *); 00060 char *plug_get_summary (struct arglist *); 00061 00062 void plug_set_description (struct arglist *, const char *); 00063 char *plug_get_description (struct arglist *); 00064 00065 void plug_set_category (struct arglist *, int); 00066 int plug_get_category (struct arglist *); 00067 00068 void plug_set_copyright (struct arglist *, const char *); 00069 char *plug_get_copyright (struct arglist *); 00070 00071 void plug_set_family (struct arglist *, const char *); 00072 char *plug_get_family (struct arglist *); 00073 00074 void plug_set_dep (struct arglist *, const char *); 00075 struct arglist *plug_get_deps (struct arglist *); 00076 00077 00078 void plug_set_id (struct arglist *, int); 00079 int plug_get_id (struct arglist *); 00080 00081 void plug_set_oid (struct arglist *, char *); 00082 char *plug_get_oid (struct arglist *); 00083 00084 void plug_set_cve_id (struct arglist *, char *); 00085 char *plug_get_cve_id (struct arglist *); 00086 00087 void plug_set_bugtraq_id (struct arglist *, char *); 00088 char *plug_get_bugtraq_id (struct arglist *); 00089 00090 void plug_set_xref (struct arglist *, char *, char *); 00091 char *plug_get_xref (struct arglist *); 00092 00093 void plug_set_tag (struct arglist *, char *, char *); 00094 char *plug_get_tag (struct arglist *); 00095 00096 void plug_set_sign_key_ids (struct arglist *, char *); 00097 char *plug_get_sign_key_ids (struct arglist *); 00098 00099 void plug_set_ssl_cert (struct arglist *, char *); 00100 void plug_set_ssl_key (struct arglist *, char *); 00101 void plug_set_ssl_pem_password (struct arglist *, char *); 00102 void plug_set_ssl_CA_file (struct arglist *, char *); 00103 00104 00105 const char *plug_get_hostname (struct arglist *); 00106 const char *plug_get_host_fqdn (struct arglist *); 00107 void plug_add_host (struct arglist *, struct arglist *); 00108 unsigned int plug_get_host_open_port (struct arglist *desc); 00109 00110 void plug_set_port_transport (struct arglist *, int, int); 00111 00112 void plug_require_key (struct arglist *, const char *); 00113 struct arglist *plug_get_required_keys (struct arglist *); 00114 00115 void plug_mandatory_key (struct arglist *, const char *); 00116 struct arglist *plug_get_mandatory_keys (struct arglist *); 00117 00118 void plug_exclude_key (struct arglist *, const char *); 00119 struct arglist *plug_get_excluded_keys (struct arglist *); 00120 00121 void plug_require_port (struct arglist *, const char *); 00122 struct arglist *plug_get_required_ports (struct arglist *); 00123 00124 void plug_require_udp_port (struct arglist *, const char *); 00125 struct arglist *plug_get_required_udp_ports (struct arglist *); 00126 int plug_get_port_transport (struct arglist *, int); 00127 00128 00129 /* 00130 * Reporting functions 00131 */ 00132 void proto_post_hole (struct arglist *, int, const char *, const char *); 00133 void post_hole (struct arglist *, int, const char *); 00134 void post_hole_udp (struct arglist *, int, const char *); 00135 #define post_hole_tcp post_hole 00136 00137 void proto_post_info (struct arglist *, int, const char *, const char *); 00138 void post_info (struct arglist *, int, const char *); 00139 void post_info_udp (struct arglist *, int, const char *); 00140 #define post_info_tcp post_info 00141 00142 void proto_post_note (struct arglist *, int, const char *, const char *); 00143 void post_note (struct arglist *, int, const char *); 00144 void post_note_udp (struct arglist *, int, const char *); 00145 #define post_note_tcp post_note 00146 00147 void proto_post_debug (struct arglist *, int, const char *, const char *); 00148 void post_debug (struct arglist *, int, const char *); 00149 void post_debug_udp (struct arglist *, int, const char *); 00150 #define post_debug_tcp post_debug 00151 00152 void proto_post_log (struct arglist *, int, const char *, const char *); 00153 void post_log (struct arglist *, int, const char *); 00154 void post_log_udp (struct arglist *, int, const char *); 00155 #define post_log_tcp post_log 00156 00157 00158 /* 00159 * Management of the portlists 00160 */ 00161 void host_add_port (struct arglist *, int, int); 00162 void host_add_port_udp (struct arglist *, int, int); 00163 int host_get_port_state (struct arglist *, int); 00164 int host_get_port_state_udp (struct arglist *, int); 00165 00166 /* Not implemented 00167 char * host_get_port_banner(struct arglist *, int); 00168 */ 00169 00170 00171 /* 00172 * Inter Plugins Communication functions 00173 */ 00174 void plug_set_key (struct arglist *, char *, int, void *); 00175 void plug_replace_key (struct arglist *, char *, int, void *); 00176 void *plug_get_fresh_key (struct arglist *, char *, int *); 00177 struct kb_item **plug_get_kb (struct arglist *); 00178 void *plug_get_key (struct arglist *, char *, int *); 00179 00180 char *openvaslib_version (); 00181 void openvas_lib_version (int *, int *, int *); 00182 char *addslashes (char *); 00183 char *rmslashes (char *); 00184 00185 struct in6_addr *plug_get_host_ip (struct arglist *); 00186 char *get_preference (struct arglist *, const char *); 00187 void add_plugin_preference (struct arglist *, const char *, const char *, 00188 const char *); 00189 char *get_plugin_preference (struct arglist *, const char *); 00190 const char *get_plugin_preference_fname (struct arglist *, const char *); 00191 char *get_plugin_preference_file_content (struct arglist *, const char *); 00192 const long get_plugin_preference_file_size (struct arglist *, const char *); 00193 00194 char *find_in_path (char *, int); 00195 00196 int shared_socket_register (struct arglist *, int, char *); 00197 int shared_socket_acquire (struct arglist *, char *); 00198 int shared_socket_release (struct arglist *, char *); 00199 int shared_socket_destroy (struct arglist *, char *); 00200 00205 #define INTERNAL_COMM_MSG_TYPE_CTRL (1 << 16) 00206 #define INTERNAL_COMM_MSG_TYPE_KB (1 << 17) 00207 #define INTERNAL_COMM_MSG_TYPE_DATA (1 << 18) 00208 #define INTERNAL_COMM_MSG_SHARED_SOCKET (1 << 19) 00209 00210 #define INTERNAL_COMM_KB_REPLACE 1 00211 #define INTERNAL_COMM_KB_GET 2 00212 #define INTERNAL_COMM_KB_SENDING_INT 4 00213 #define INTERNAL_COMM_KB_SENDING_STR 8 00214 #define INTERNAL_COMM_KB_ERROR 16 00215 00216 00217 #define INTERNAL_COMM_CTRL_FINISHED 1 00218 #define INTERNAL_COMM_CTRL_ACK 2 00219 00220 #define INTERNAL_COMM_SHARED_SOCKET_REGISTER 1 00221 #define INTERNAL_COMM_SHARED_SOCKET_ACQUIRE 2 00222 #define INTERNAL_COMM_SHARED_SOCKET_RELEASE 4 00223 #define INTERNAL_COMM_SHARED_SOCKET_DESTROY 8 00224 00225 #define INTERNAL_COMM_SHARED_SOCKET_DORECVMSG 16 00226 #define INTERNAL_COMM_SHARED_SOCKET_BUSY 32 00227 #define INTERNAL_COMM_SHARED_SOCKET_ERROR 64 00228 00229 /* 00230 * Type of "transport layer", for encapsulated connections 00231 * Only SSL is supported at this time. 00232 * (Bad) examples of other layers could be SOCKS, httptunnel, icmptunnel, 00233 * RMI over HTTP, DCOM over HTTP, TCP over TCP, etc. 00234 */ 00235 #define OPENVAS_ENCAPS_IP 1 00236 #define OPENVAS_ENCAPS_SSLv23 2 /* Ask for compatibility options */ 00237 #define OPENVAS_ENCAPS_SSLv2 3 00238 #define OPENVAS_ENCAPS_SSLv3 4 00239 #define OPENVAS_ENCAPS_TLSv1 5 00240 00241 #define IS_ENCAPS_SSL(x) ((x) >= OPENVAS_ENCAPS_SSLv23 && (x) <= OPENVAS_ENCAPS_TLSv1) 00242 00243 #endif