OpenVAS Libraries  8.0.3
omp.h
Go to the documentation of this file.
1 /* openvase-libraries/omp
2  * $Id$
3  * Description: Header for OMP client interface.
4  *
5  * Authors:
6  * Matthew Mundell <matt@mundell.ukfsn.org>
7  *
8  * Copyright:
9  * Copyright (C) 2009 Greenbone Networks GmbH
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #ifndef _OPENVAS_LIBRARIES_OMP_H
27 #define _OPENVAS_LIBRARIES_OMP_H
28 
29 #include "../base/array.h"
30 #include "xml.h"
31 
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #if 0
36 }
37 #endif
38 #endif
39 
43 typedef struct
44 {
45  const char *username;
46  const char *password;
47  char **role;
48  char **severity;
49  char **timezone;
50  char **pw_warning;
52 
56 typedef struct
57 {
58  const char* sort_field;
59  const char* sort_order;
60  const char* format_id;
61  const char* levels;
62  const char* report_id;
67  int autofp;
68  char *type;
69  char *host;
70  char *pos;
71  char *timezone;
72  char *alert_id;
74  char *delta_states;
75  char *host_levels;
76  char *search_phrase;
78  char *min_cvss_base;
79  char *min_qod;
80  /* Boolean flags: */
81  int notes;
83  int overrides;
89 
93 static const omp_get_report_opts_t omp_get_report_opts_defaults =
94  {
95  "ROWID", "ascending", "a994b278-1f62-11e1-96ac-406186ea4fc5", "hmlgd",
96  NULL, 1, -1
97  };
98 
102 typedef struct
103 {
104  const char* filter;
105  const char* actions;
106  /* Boolean flags: */
107  int details;
108  int rcfile;
110 
114 static const omp_get_tasks_opts_t omp_get_tasks_opts_defaults =
115  { "" };
116 
120 typedef struct
121 {
122  const char* actions;
123  const char* task_id;
124  /* Boolean flags: */
125  int details;
126  int rcfile;
128 
132 static const omp_get_task_opts_t omp_get_task_opts_defaults =
133  { };
134 
138 typedef struct
139 {
141  const char* config_id;
142  const char* scanner_id;
143  const char* schedule_id;
144  const char* slave_id;
145  const char* target_id;
146  const char* name;
147  const char* comment;
148  const char* hosts_ordering;
149  const char* observers;
152  /* Preferences */
153  const char* in_assets;
154  const char* max_hosts;
155  const char* max_checks;
156  const char* source_iface;
157  /* Boolean flags: */
158  int alterable;
160 
164 static const omp_create_task_opts_t omp_create_task_opts_defaults =
165  { };
166 
170 typedef struct
171 {
173  const char* ssh_credential_id;
174  const char* smb_credential_id;
175  const char* esxi_credential_id;
176  const char* port_range;
177  const char* name;
178  const char* comment;
179  const char* hosts;
180  const char* exclude_hosts;
181  const char* alive_tests;
182  /* Boolean flags: */
186 
190 static const omp_create_target_opts_t omp_create_target_opts_defaults =
191  { 0 };
192 
196 typedef struct
197 {
198  const char* name;
199  const char* duration;
200  const char* slave_id;
201  int brief;
203 
207 static const omp_get_system_reports_opts_t omp_get_system_reports_opts_defaults =
208  { };
209 
213 typedef struct
214 {
215  const char *name;
216  const char *login;
217  const char *passphrase;
218  const char *private_key;
219  const char *comment;
221 
225 static const omp_create_lsc_credential_opts_t omp_create_lsc_credential_opts_defaults =
226  { };
227 
231 typedef struct
232 {
233  int ultimate;
235 
239 static const omp_delete_opts_t omp_delete_opts_defaults =
240  { 0 };
241 
245 static const omp_delete_opts_t omp_delete_opts_ultimate_defaults =
246  { 1 };
247 
248 int check_response (gnutls_session_t *);
249 
250 int omp_read_create_response (gnutls_session_t*, gchar **);
251 
252 const char *omp_task_status (entity_t status_response);
253 
254 int omp_ping (gnutls_session_t *, int);
255 
256 int omp_authenticate (gnutls_session_t * session, const char *username,
257  const char *password);
258 
260 
261 int omp_create_task (gnutls_session_t *, const char *, const char *,
262  const char *, const char *, gchar **);
263 
264 int omp_create_task_ext (gnutls_session_t *, omp_create_task_opts_t, gchar **);
265 
266 int omp_start_task_report (gnutls_session_t *, const char *, char **);
267 
268 int omp_stop_task (gnutls_session_t *, const char *);
269 
270 int omp_resume_task_report (gnutls_session_t*, const char*, char**);
271 
272 int omp_get_tasks (gnutls_session_t *, const char *, int, int, entity_t *);
273 
274 int omp_get_tasks_ext (gnutls_session_t *, omp_get_tasks_opts_t, entity_t *);
275 
276 int omp_get_task_ext (gnutls_session_t *, omp_get_task_opts_t, entity_t *);
277 
278 int omp_get_targets (gnutls_session_t *, const char *, int, int, entity_t *);
279 
280 int omp_get_report_ext (gnutls_session_t *, omp_get_report_opts_t, entity_t *);
281 
282 int omp_delete_port_list_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
283 
284 int omp_delete_task (gnutls_session_t *, const char *);
285 
286 int omp_delete_task_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
287 
288 int omp_modify_task_file (gnutls_session_t *, const char *, const char *,
289  const void *, gsize);
290 
291 int omp_delete_report (gnutls_session_t*, const char*);
292 
293 int omp_create_target_ext (gnutls_session_t *, omp_create_target_opts_t,
294  gchar**);
295 
296 int omp_delete_target_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
297 
298 int omp_delete_config_ext (gnutls_session_t *, const char *, omp_delete_opts_t);
299 
301  gchar**);
302 
303 int omp_create_lsc_credential (gnutls_session_t *, const char *, const char *,
304  const char *, const char *, gchar **);
305 
306 int omp_create_lsc_credential_key (gnutls_session_t *, const char *,
307  const char *, const char *, const char *,
308  const char *, gchar **);
309 
310 int omp_delete_lsc_credential_ext (gnutls_session_t *, const char *,
312 
313 int omp_get_system_reports (gnutls_session_t *, const char *, int, entity_t *);
314 
315 int omp_get_system_reports_ext (gnutls_session_t *,
317  entity_t *);
318 
319 #if 0
320 {
321 #endif
322 #ifdef __cplusplus
323 }
324 #endif
325 
326 #endif /* not _OPENVAS_LIBRARIES_OMP_H */
int omp_delete_lsc_credential_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a LSC credential.
Definition: omp.c:1684
Struct holding options for omp get_report command.
Definition: omp.h:56
int reverse_lookup_only
Scanner pref reverse_lookup_only.
Definition: omp.h:183
int omp_create_target_ext(gnutls_session_t *, omp_create_target_opts_t, gchar **)
Create a target.
Definition: omp.c:1298
int brief
Brief flag.
Definition: omp.h:201
int rcfile
Ignored. Removed since OMP 6.0.
Definition: omp.h:108
int omp_read_create_response(gnutls_session_t *, gchar **)
Read response status and resource UUID.
Definition: omp.c:674
const char * login
Login.
Definition: omp.h:216
int ultimate
Definition: omp.h:233
const char * sort_order
Definition: omp.h:59
int override_details
If overrides, whether to include details.
Definition: omp.h:84
const char * duration
Duration.
Definition: omp.h:199
const char * task_id
ID of single task to get.
Definition: omp.h:123
const char * name
Name of report.
Definition: omp.h:198
const char * target_id
ID of target.
Definition: omp.h:145
int schedule_periods
Number of periods the schedule must run for.
Definition: omp.h:151
const char * omp_task_status(entity_t status_response)
Get the task status from an OMP GET_TASKS response.
Definition: omp.c:119
int omp_create_task_ext(gnutls_session_t *, omp_create_task_opts_t, gchar **)
Create a task.
Definition: omp.c:336
Struct holding options for omp get_tasks command.
Definition: omp.h:120
const char * hosts_ordering
Order for scanning target hosts.
Definition: omp.h:148
int omp_delete_port_list_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a port list.
Definition: omp.c:1254
char * timezone
Timezone.
Definition: omp.h:71
char * host
Host for asset report.
Definition: omp.h:69
int omp_get_tasks_ext(gnutls_session_t *, omp_get_tasks_opts_t, entity_t *)
Get all tasks (generic version).
Definition: omp.c:957
char * delta_states
Delta states (Changed Gone New Same) to include.
Definition: omp.h:74
char * alert_id
ID of alert.
Definition: omp.h:72
const char * comment
Comment on LSC credential.
Definition: omp.h:219
int overrides
Whether to include overrides in the report.
Definition: omp.h:83
int alterable
Whether the task is alterable.
Definition: omp.h:158
int omp_get_task_ext(gnutls_session_t *, omp_get_task_opts_t, entity_t *)
Get a task (generic version).
Definition: omp.c:894
int omp_create_lsc_credential_ext(gnutls_session_t *, omp_create_lsc_credential_opts_t, gchar **)
Create an LSC credential.
Definition: omp.c:1608
const char * slave_id
ID of the slave to get report from.
Definition: omp.h:200
const char * ssh_credential_id
ID of SSH credential.
Definition: omp.h:173
Struct holding options for omp get_system_reports command.
Definition: omp.h:196
const char * comment
Comment on task.
Definition: omp.h:147
int host_first_result
Skip over results before this result number.
Definition: omp.h:65
Struct holding options for omp get_tasks command.
Definition: omp.h:102
int omp_get_report_ext(gnutls_session_t *, omp_get_report_opts_t, entity_t *)
Get a report (generic version).
Definition: omp.c:1155
array_t * alert_ids
Array of alert IDs.
Definition: omp.h:140
int omp_delete_target_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a target.
Definition: omp.c:1419
array_t * observer_groups
IDs of observer groups.
Definition: omp.h:150
const char * passphrase
Passphrase.
Definition: omp.h:217
XML element.
Definition: xml.h:46
const char * alive_tests
Alive tests.
Definition: omp.h:181
char * type
Type of report.
Definition: omp.h:68
const char * slave_id
ID of task schedule.
Definition: omp.h:144
const char * sort_field
Definition: omp.h:58
const char * esxi_credential_id
ID of ESXi credential.
Definition: omp.h:175
const char * max_hosts
Max hosts preference.
Definition: omp.h:154
char * host_levels
Letter encoded threat level filter, for hosts.
Definition: omp.h:75
int omp_resume_task_report(gnutls_session_t *, const char *, char **)
Resume a task and read the manager response.
Definition: omp.c:750
char * delta_report_id
ID of report to compare single report to.
Definition: omp.h:73
const char * source_iface
Source iface preference.
Definition: omp.h:156
int omp_ping(gnutls_session_t *, int)
"Ping" the manager.
Definition: omp.c:141
const char * hosts
Name of target.
Definition: omp.h:179
GPtrArray array_t
Definition: array.h:31
Struct holding options for authentication.
Definition: omp.h:43
int check_response(gnutls_session_t *)
Read response and convert status of response to a return value.
Definition: omp.c:629
int omp_modify_task_file(gnutls_session_t *, const char *, const char *, const void *, gsize)
Modify a file on a task.
Definition: omp.c:1017
int omp_create_task(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create a task given a config and target.
Definition: omp.c:531
int ignore_pagination
Whether to ignore pagination filters.
Definition: omp.h:87
int details
Whether to include overrides in the tasks.
Definition: omp.h:125
int omp_get_system_reports(gnutls_session_t *, const char *, int, entity_t *)
Get system reports.
Definition: omp.c:1710
Struct holding options for omp create_lsc_credential command.
Definition: omp.h:213
char ** severity
[out] Severity class setting.
Definition: omp.h:48
const char * port_range
Port range.
Definition: omp.h:176
const char * actions
Actions argument.
Definition: omp.h:105
char * search_phrase
Search phrase result filter.
Definition: omp.h:76
const char * levels
Result levels to include.
Definition: omp.h:61
const char * actions
Actions argument.
Definition: omp.h:122
int first_result
First result to get.
Definition: omp.h:63
const char * exclude_hosts
Hosts to exclude.
Definition: omp.h:180
int host_max_results
Maximum number of results to return.
Definition: omp.h:66
const char * comment
Comment on target.
Definition: omp.h:178
const char * username
Password.
Definition: omp.h:45
int omp_stop_task(gnutls_session_t *, const char *)
Stop a task and read the manager response.
Definition: omp.c:729
const char * password
Username.
Definition: omp.h:46
int apply_overrides
Whether overrides are applied.
Definition: omp.h:85
int omp_start_task_report(gnutls_session_t *, const char *, char **)
Start a task and read the manager response.
Definition: omp.c:572
char * pos
Position of report from end.
Definition: omp.h:70
Struct holding options for omp create_task command.
Definition: omp.h:138
int details
Whether to include overrides in the tasks.
Definition: omp.h:107
Struct holding options for omp create_target command.
Definition: omp.h:170
int omp_get_targets(gnutls_session_t *, const char *, int, int, entity_t *)
Get a target.
Definition: omp.c:1091
const char * smb_credential_id
ID of SMB credential.
Definition: omp.h:174
const char * scanner_id
ID of task scanner.
Definition: omp.h:142
int ssh_credential_port
Port for SSH access.
Definition: omp.h:172
int omp_delete_task(gnutls_session_t *, const char *)
Delete a task and read the manager response.
Definition: omp.c:1070
const char * in_assets
In assets preference.
Definition: omp.h:153
const char * schedule_id
ID of task schedule.
Definition: omp.h:143
int omp_get_system_reports_ext(gnutls_session_t *, omp_get_system_reports_opts_t, entity_t *)
Get system reports.
Definition: omp.c:1767
const char * name
Name of target.
Definition: omp.h:177
char * min_cvss_base
Minimum CVSS base filter.
Definition: omp.h:78
int autofp
Whether to trust vendor security updates. 0 No, 1 full match, 2 partial.
Definition: omp.h:67
int omp_delete_config_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a config.
Definition: omp.c:1442
int omp_delete_task_ext(gnutls_session_t *, const char *, omp_delete_opts_t)
Delete a task and read the manager response.
Definition: omp.c:808
Struct holding options for various omp delete_[...] commands.
Definition: omp.h:231
char ** timezone
[out] Timezone if any, else NULL.
Definition: omp.h:49
int rcfile
Ignored. Removed since OMP 6.0.
Definition: omp.h:126
char ** pw_warning
[out] Password warning, NULL if password is okay.
Definition: omp.h:50
int notes_details
Whether to include details of above.
Definition: omp.h:82
int omp_authenticate_info_ext(gnutls_session_t *, omp_authenticate_info_opts_t)
Authenticate with the manager.
Definition: omp.c:255
const char * max_checks
Max checks preference.
Definition: omp.h:155
char * min_qod
Minimum QoD filter.
Definition: omp.h:79
const char * filter
Filter argument.
Definition: omp.h:104
const char * name
Name of LSC credential.
Definition: omp.h:215
char ** role
[out] Role.
Definition: omp.h:47
int omp_delete_report(gnutls_session_t *, const char *)
Remove a report.
Definition: omp.c:1276
const char * name
Name of task.
Definition: omp.h:146
int max_results
Maximum number of results to return.
Definition: omp.h:64
const char * config_id
ID of config.
Definition: omp.h:141
char * host_search_phrase
Search phrase result filter.
Definition: omp.h:77
int notes
Whether to include associated notes.
Definition: omp.h:81
int reverse_lookup_unify
Scanner pref reverse_lookup_unify.
Definition: omp.h:184
int result_hosts_only
Whether to include only hosts that have results.
Definition: omp.h:86
int omp_get_tasks(gnutls_session_t *, const char *, int, int, entity_t *)
Get the status of a task.
Definition: omp.c:833
const char * report_id
ID of single report to get.
Definition: omp.h:62
int omp_create_lsc_credential(gnutls_session_t *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential.
Definition: omp.c:1468
const char * private_key
Private key.
Definition: omp.h:218
const char * format_id
ID of required report format.
Definition: omp.h:60
int omp_create_lsc_credential_key(gnutls_session_t *, const char *, const char *, const char *, const char *, const char *, gchar **)
Create an LSC Credential with a key.
Definition: omp.c:1547
int omp_authenticate(gnutls_session_t *session, const char *username, const char *password)
Authenticate with the manager.
Definition: omp.c:197
const char * observers
Comma-separated string of observer users.
Definition: omp.h:149