OpenVAS Scanner 23.32.3
nasl_wmi.c
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Greenbone AG
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
17
18#include "nasl_wmi.h"
19
20#include "../misc/plugutils.h"
22
23#include <arpa/inet.h>
24#include <ctype.h>
25#include <gvm/base/logging.h>
26#include <gvm/base/networking.h>
27#include <inttypes.h>
28#include <netinet/in.h>
29#include <stdio.h>
30#include <string.h>
31#include <sys/socket.h>
32
33#define IMPORT(var) char *var = get_str_var_by_name (lexic, #var)
34#define max 5
35
36#undef G_LOG_DOMAIN
40#define G_LOG_DOMAIN "lib nasl"
41
45static int
47{
48 int i, val_len;
49 val_len = strlen (val);
50
51 if ((strcmp (val, "-1")) != 0)
52 {
53 for (i = 0; i < val_len; i++)
54 if (!isdigit (val[i]))
55 return 0;
56 }
57 else
58 return 0;
59
60 return 1;
61}
62
66static uint32_t
68{
69 uint32_t v;
70 sscanf (s, "%" PRIu32, &v);
71 return v;
72}
73
77static uint64_t
79{
80 uint64_t v;
81 sscanf (s, "%" PRIu64, &v);
82 return v;
83}
84
95{
96 char *version = wmi_versioninfo ();
97 tree_cell *retc;
98 (void) lexic;
99
100 if (!version)
101 return NULL;
102
104 retc->x.str_val = strdup (version);
105 retc->size = strlen (version);
106 return retc;
107}
108
109/*
110################################################################################
111 WMI_FUNCTIONS
112################################################################################
113*/
114
127tree_cell *
129{
130 struct script_infos *script_infos = lexic->script_infos;
131 struct in6_addr *host = plug_get_host_ip (script_infos);
132 char *ip;
133 char *argv[max];
134 WMI_HANDLE handle;
135 int argc = 5;
136 IMPORT (username);
137 IMPORT (password);
138 IMPORT (ns);
139 IMPORT (options);
140
141 if (ns == NULL)
142 ns = "root\\cimv2";
143
144 if ((host == NULL) || (username == NULL) || (password == NULL))
145 {
146 g_message ("nasl_wmi_connect: Invalid input arguments");
147 return NULL;
148 }
149
150 ip = addr6_as_str (host);
151 if ((strlen (password) == 0) || (strlen (username) == 0) || strlen (ip) == 0)
152 {
153 g_message ("nasl_wmi_connect: Invalid input arguments");
154 g_free (ip);
155 return NULL;
156 }
157
158 // Construct the WMI query
159 argv[0] = g_strdup ("wmic");
160 argv[1] = g_strdup ("-U");
161 argv[2] = g_strdup_printf ("%s%%%s", username, password);
162 argv[3] = g_strdup_printf ("//%s%s", ip, options ? options : "[sign]");
163 argv[4] = g_strdup (ns);
164 g_free (ip);
165
167 handle = wmi_connect (argc, argv);
168 if (!handle)
169 {
170 g_message ("nasl_wmi_connect: WMI Connect failed or missing WMI support "
171 "for the scanner");
172 return NULL;
173 }
174
175 retc->x.ref_val = handle;
176 return retc;
177}
178
190tree_cell *
192{
193 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
194 if (!handle)
195 return NULL;
196
198
199 if (wmi_close (handle) == 0)
200 {
201 retc->x.i_val = 1;
202 return retc;
203 }
204 return NULL;
205}
206
219tree_cell *
221{
222 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
223 char *query = get_str_var_by_name (lexic, "query");
224 char *res = NULL;
225 int value;
226
227 if (!handle)
228 return NULL;
229
231 retc->x.str_val = NULL;
232 retc->size = 0;
233
234 value = wmi_query (handle, query, &res);
235 if ((value == -1) && (res != NULL))
236 {
237 g_message ("wmi_query: WMI query failed '%s' with error: '%s'", query,
238 res);
239 g_free (res);
240 return NULL;
241 }
242 else if ((value == -1) && (res == NULL))
243 {
244 g_debug ("wmi_query: WMI query failed '%s'", query);
245 return NULL;
246 }
247 else if (res == NULL)
248 return NULL;
249
250 retc->x.str_val = strdup (res);
251 retc->size = strlen (res);
252
253 return retc;
254}
255
256/*
257################################################################################
258 WMI_RSOP_FUNCTIONS
259################################################################################
260*/
261
274tree_cell *
276{
277 struct script_infos *script_infos = lexic->script_infos;
278 struct in6_addr *host = plug_get_host_ip (script_infos);
279 char *ip;
280 IMPORT (username);
281 IMPORT (password);
282 IMPORT (options);
283
284 char *argv[4];
285 WMI_HANDLE handle;
286 int argc = 4;
287
288 if ((host == NULL) || (username == NULL) || (password == NULL))
289 {
290 g_message ("nasl_wmi_connect_rsop: Invalid input arguments");
291 return NULL;
292 }
293
294 ip = addr6_as_str (host);
295 if ((strlen (password) == 0) || (strlen (username) == 0) || strlen (ip) == 0)
296 {
297 g_message ("nasl_wmi_connect_rsop: Invalid input arguments");
298 g_free (ip);
299 return NULL;
300 }
301
302 // Construct the WMI query
303 argv[0] = g_strdup ("wmic");
304 argv[1] = g_strdup ("-U");
305 argv[2] = g_strdup_printf ("%s%%%s", username, password);
306 argv[3] = g_strdup_printf ("//%s%s", ip, options ? options : "[sign]");
307 g_free (ip);
308
310 handle = wmi_connect_rsop (argc, argv);
311 if (!handle)
312 {
313 g_message ("nasl_wmi_connect_rsop: WMI Connect failed or missing WMI "
314 "support for the scanner");
315 return NULL;
316 }
317
318 retc->x.ref_val = handle;
319 return retc;
320}
321
333tree_cell *
335{
336 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
337 if (!handle)
338 return NULL;
339
340 char *query = get_str_var_by_name (lexic, "query"); // WQL query
341 char *res = NULL;
342 int value;
344 retc->x.str_val = NULL;
345 retc->size = 0;
346
347 value = wmi_query_rsop (handle, query, &res);
348 if ((value == -1) && (res != NULL))
349 {
350 g_message ("wmi_query_rsop: WMI query failed '%s' with error: '%s'",
351 query, res);
352 g_free (res);
353 return NULL;
354 }
355 else if ((value == -1) && (res == NULL))
356 {
357 g_debug ("wmi_query_rsop: WMI query failed");
358 return NULL;
359 }
360 else if (res == NULL)
361 return NULL;
362
363 retc->x.str_val = strdup (res);
364 retc->size = strlen (res);
365
366 return retc;
367}
368
369/*
370################################################################################
371 WMI_REGISTRY_FUNCTIONS
372################################################################################
373*/
374
387tree_cell *
389{
390 struct script_infos *script_infos = lexic->script_infos;
391 struct in6_addr *host = plug_get_host_ip (script_infos);
392 char *ip;
393 IMPORT (username);
394 IMPORT (password);
395 IMPORT (options);
396
397 char *argv[4];
398 WMI_HANDLE handle;
399 int argc = 4;
400
401 if ((host == NULL) || (username == NULL) || (password == NULL))
402 {
403 g_message ("nasl_wmi_connect_reg: Invalid input arguments");
404 return NULL;
405 }
406
407 ip = addr6_as_str (host);
408 if ((strlen (password) == 0) || (strlen (username) == 0) || strlen (ip) == 0)
409 {
410 g_message ("nasl_wmi_connect_reg: Invalid input arguments");
411 g_free (ip);
412 return NULL;
413 }
414
415 // Construct the WMI query
416 argv[0] = g_strdup ("wmic");
417 argv[1] = g_strdup ("-U");
418 argv[2] = g_strdup_printf ("%s%%%s", username, password);
419 argv[3] = g_strdup_printf ("//%s%s", ip, options ? options : "[sign]");
420 g_free (ip);
421
423 handle = wmi_connect_reg (argc, argv);
424 if (!handle)
425 {
426 g_message ("nasl_wmi_connect_reg: WMI Connect failed or missing WMI "
427 "support for the scanner");
428 return NULL;
429 }
430
431 retc->x.ref_val = handle;
432 return retc;
433}
434
447tree_cell *
449{
450 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
451
452 if (!handle)
453 return NULL;
454
455 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
456 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
457 char *key_name =
458 get_str_var_by_name (lexic, "key_name"); // REGISTRY value name
459
460 char *res = NULL;
461 int value;
463 retc->x.str_val = NULL;
464 retc->size = 0;
465
466 value = wmi_reg_get_sz (handle, hive, key, key_name, &res);
467
468 if ((value == -1) || (res == NULL))
469 {
470 g_message ("nasl_wmi_reg_get_sz: WMI Registry get failed");
471 return NULL;
472 }
473
474 retc->x.str_val = strdup (res);
475 retc->size = strlen (res);
476
477 return retc;
478}
479
492tree_cell *
494{
495 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
496
497 if (!handle)
498 return NULL;
499
500 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
501 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
502
503 char *res = NULL;
504 int value;
506 retc->x.str_val = NULL;
507 retc->size = 0;
508
509 value = wmi_reg_enum_value (handle, hive, key, &res);
510
511 if ((value == -1) || (res == NULL))
512 {
513 g_message ("nasl_wmi_reg_enum_value: WMI query failed");
514 return NULL;
515 }
516
517 retc->x.str_val = strdup (res);
518 retc->size = strlen (res);
519
520 return retc;
521}
522
535tree_cell *
537{
538 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
539
540 if (!handle)
541 return NULL;
542
543 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
544 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
545
546 char *res = NULL;
547 int value;
549 retc->x.str_val = NULL;
550 retc->size = 0;
551
552 value = wmi_reg_enum_key (handle, hive, key, &res);
553
554 if ((value == -1) || (res == NULL))
555 {
556 g_message ("nasl_wmi_reg_enum_key: WMI query failed");
557 return NULL;
558 }
559
560 retc->x.str_val = strdup (res);
561 retc->size = strlen (res);
562
563 return retc;
564}
565
578tree_cell *
580{
581 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
582
583 if (!handle)
584 return NULL;
585
586 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
587 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
588 char *val_name =
589 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
590
591 char *res = NULL;
592 int value;
593
595 retc->x.str_val = NULL;
596 retc->size = 0;
597
598 value = wmi_reg_get_bin_val (handle, hive, key, val_name, &res);
599
600 if ((value == -1) || (res == NULL))
601 {
602 g_message ("nasl_wmi_reg_get_bin_val: WMI query failed");
603 return NULL;
604 }
605
606 retc->x.str_val = strdup (res);
607 retc->size = strlen (res);
608 return retc;
609}
610
623tree_cell *
625{
626 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
627
628 if (!handle)
629 return NULL;
630
631 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
632 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
633 char *val_name =
634 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
635
636 char *res = NULL;
637 int value;
638
640 retc->x.str_val = NULL;
641 retc->size = 0;
642
643 value = wmi_reg_get_dword_val (handle, hive, key, val_name, &res);
644
645 if ((value == 0) && (res == 0))
646 res = "0";
647
648 if ((value == -1) || (res == NULL))
649 {
650 g_message ("nasl_wmi_reg_get_dword_val: WMI query failed");
651 return NULL;
652 }
653
654 retc->x.str_val = strdup (res);
655 retc->size = strlen (res);
656 return retc;
657}
658
671tree_cell *
673{
674 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
675
676 if (!handle)
677 return NULL;
678
679 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
680 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
681 char *val_name =
682 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
683
684 char *res = NULL;
685 int value;
686
688 retc->x.str_val = NULL;
689 retc->size = 0;
690
691 value = wmi_reg_get_ex_string_val (handle, hive, key, val_name, &res);
692
693 if ((value == -1) || (res == NULL))
694 {
695 g_message ("nasl_wmi_reg_get_ex_string_val: WMI query failed");
696 return NULL;
697 }
698
699 retc->x.str_val = strdup (res);
700 retc->size = strlen (res);
701 return retc;
702}
703
716tree_cell *
718{
719 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
720
721 if (!handle)
722 return NULL;
723
724 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
725 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
726 char *val_name =
727 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
728
729 char *res = NULL;
730 int value;
731
733 retc->x.str_val = NULL;
734 retc->size = 0;
735
736 value = wmi_reg_get_mul_string_val (handle, hive, key, val_name, &res);
737
738 if ((value == -1) || (res == NULL))
739 {
740 g_message ("nasl_wmi_reg_get_mul_string_val: WMI query failed");
741 return NULL;
742 }
743
744 retc->x.str_val = strdup (res);
745 retc->size = strlen (res);
746 return retc;
747}
748
761tree_cell *
763{
764 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
765
766 if (!handle)
767 return NULL;
768
769 unsigned int hive = get_int_var_by_name (lexic, "hive", 0); // REGISTRY Hive
770 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
771 char *val_name =
772 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
773
774 char *res = NULL;
775 int value;
776
778 retc->x.str_val = NULL;
779 retc->size = 0;
780
781 value = wmi_reg_get_qword_val (handle, hive, key, val_name, &res);
782
783 if ((value == -1) || (res == NULL))
784 {
785 g_message ("nasl_wmi_reg_get_qword_val: WMI query failed");
786 return NULL;
787 }
788
789 retc->x.str_val = strdup (res);
790 retc->size = strlen (res);
791 return retc;
792}
793
807tree_cell *
809{
810 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
811
812 if (!handle)
813 return NULL;
814
815 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
816 char *val_name =
817 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
818 char *val = get_str_var_by_name (lexic, "val"); // REGISTRY VALUE TO SET
819
820 uint32_t val1;
821 int value;
822
823 // Return NULL if any alphabet is present
824 if (check_alpha (val) == 0)
825 return NULL;
826
827 // Convert string to proper 64 bit integer
828 val1 = stoi_uint32_t (val);
829
831 retc->x.i_val = 1;
832
833 value = wmi_reg_set_dword_val (handle, key, val_name, val1);
834
835 if (value == -1)
836 {
837 g_message ("nasl_wmi_reg_set_dword_val: WMI registry set"
838 " operation failed");
839 return NULL;
840 }
841 return retc;
842}
843
857tree_cell *
859{
860 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
861
862 if (!handle)
863 return NULL;
864
865 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
866 char *val_name =
867 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
868 char *val = get_str_var_by_name (lexic, "val"); // REGISTRY VALUE TO SET
869
870 uint64_t val1;
871 int value;
872
873 // Return if alphabets present
874 if (check_alpha (val) == 0)
875 return NULL;
876
877 // Convert string to proper integer
878 val1 = stoi_uint64_t (val);
879
881 retc->x.i_val = 1;
882
883 value = wmi_reg_set_qword_val (handle, key, val_name, val1);
884
885 if (value == -1)
886 {
887 g_message ("nasl_wmi_reg_set_qword_val: WMI register"
888 " set operation failed");
889 return NULL;
890 }
891 return retc;
892}
893
907tree_cell *
909{
910 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
911
912 if (!handle)
913 return NULL;
914
915 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
916 char *val_name =
917 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
918 char *val = get_str_var_by_name (lexic, "val"); // REGISTRY VALUE TO SET
919
920 int value;
921
923 retc->x.i_val = 1;
924
925 value = wmi_reg_set_ex_string_val (handle, key, val_name, val);
926
927 if (value == -1)
928 {
929 g_message (
930 "nasl_wmi_reg_set_ex_string_val: WMI registry set operation failed");
931 return NULL;
932 }
933 return retc;
934}
935
949tree_cell *
951{
952 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
953
954 if (!handle)
955 return NULL;
956
957 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
958 char *val_name =
959 get_str_var_by_name (lexic, "val_name"); // REGISTRY VALUE NAME
960 char *val = get_str_var_by_name (lexic, "val"); // REGISTRY VALUE TO SET
961
962 int value;
963
965 retc->x.i_val = 1;
966
967 value = wmi_reg_set_string_val (handle, key, val_name, val);
968
969 if (value == -1)
970 {
971 g_message ("nasl_wmi_reg_set_string_val: WMI registry"
972 " set operation failed");
973 return NULL;
974 }
975 return retc;
976}
977
989tree_cell *
991{
992 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
993
994 if (!handle)
995 return NULL;
996
997 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
998
999 int value;
1000
1002 retc->x.i_val = 1;
1003
1004 value = wmi_reg_create_key (handle, key);
1005
1006 if (value == -1)
1007 {
1008 g_message ("nasl_wmi_reg_create_key: WMI registry key create"
1009 " operation failed");
1010 return NULL;
1011 }
1012 return retc;
1013}
1014
1028tree_cell *
1030{
1031 WMI_HANDLE handle = (WMI_HANDLE) get_int_var_by_name (lexic, "wmi_handle", 0);
1032
1033 if (!handle)
1034 return NULL;
1035
1036 char *key = get_str_var_by_name (lexic, "key"); // REGISTRY KEY
1037
1038 int value;
1039
1041 retc->x.i_val = 1;
1042
1043 value = wmi_reg_delete_key (handle, key);
1044
1045 if (value == -1)
1046 {
1047 g_message ("nasl_wmi_reg_delete_key: WMI registry key"
1048 " delete operation failed");
1049 return NULL;
1050 }
1051 return retc;
1052}
const char * val
Definition nasl_init.c:440
struct struct_lex_ctxt lex_ctxt
char * get_str_var_by_name(lex_ctxt *, const char *)
Definition nasl_var.c:1118
long int get_int_var_by_name(lex_ctxt *, const char *, int)
Definition nasl_var.c:1101
tree_cell * alloc_typed_cell(int typ)
Definition nasl_tree.c:25
@ CONST_DATA
Definition nasl_tree.h:82
@ CONST_INT
Definition nasl_tree.h:79
struct TC tree_cell
tree_cell * nasl_wmi_close(lex_ctxt *lexic)
Close WMI service handle.
Definition nasl_wmi.c:191
static int check_alpha(char *val)
Definition nasl_wmi.c:46
tree_cell * nasl_wmi_reg_get_dword_val(lex_ctxt *lexic)
Get registry DWORD value.
Definition nasl_wmi.c:624
#define max
Definition nasl_wmi.c:34
tree_cell * nasl_wmi_reg_get_bin_val(lex_ctxt *lexic)
Get registry binary value.
Definition nasl_wmi.c:579
tree_cell * nasl_wmi_reg_enum_key(lex_ctxt *lexic)
Enumerate registry keys.
Definition nasl_wmi.c:536
tree_cell * nasl_wmi_connect_reg(lex_ctxt *lexic)
Connect to a WMI Registry service and return a handle for it.
Definition nasl_wmi.c:388
static uint32_t stoi_uint32_t(char *s)
Definition nasl_wmi.c:67
tree_cell * nasl_wmi_reg_set_string_val(lex_ctxt *lexic)
Set Registry string value.
Definition nasl_wmi.c:950
tree_cell * nasl_wmi_reg_set_dword_val(lex_ctxt *lexic)
Set Registry DWORD value.
Definition nasl_wmi.c:808
tree_cell * nasl_wmi_query(lex_ctxt *lexic)
Perform WQL query.
Definition nasl_wmi.c:220
tree_cell * nasl_wmi_reg_get_mul_string_val(lex_ctxt *lexic)
Get registry multi valued strings.
Definition nasl_wmi.c:717
static uint64_t stoi_uint64_t(char *s)
Definition nasl_wmi.c:78
#define IMPORT(var)
Definition nasl_wmi.c:33
tree_cell * nasl_wmi_reg_set_ex_string_val(lex_ctxt *lexic)
Set Registry Expanded string value.
Definition nasl_wmi.c:908
tree_cell * nasl_wmi_reg_create_key(lex_ctxt *lexic)
Create Registry key.
Definition nasl_wmi.c:990
tree_cell * nasl_wmi_connect_rsop(lex_ctxt *lexic)
Connect to a WMI RSOP service and return a handle for it.
Definition nasl_wmi.c:275
tree_cell * nasl_wmi_reg_delete_key(lex_ctxt *lexic)
Delete Registry key.
Definition nasl_wmi.c:1029
tree_cell * nasl_wmi_reg_set_qword_val(lex_ctxt *lexic)
Set Registry QWORD value.
Definition nasl_wmi.c:858
tree_cell * nasl_wmi_connect(lex_ctxt *lexic)
Connect to a WMI service and return a handle for it.
Definition nasl_wmi.c:128
tree_cell * nasl_wmi_reg_enum_value(lex_ctxt *lexic)
Enumerate registry values.
Definition nasl_wmi.c:493
tree_cell * nasl_wmi_reg_get_ex_string_val(lex_ctxt *lexic)
Get registry expanded string value.
Definition nasl_wmi.c:672
tree_cell * nasl_wmi_reg_get_sz(lex_ctxt *lexic)
Get string value from Registry.
Definition nasl_wmi.c:448
tree_cell * nasl_wmi_query_rsop(lex_ctxt *lexic)
WMI RSOP query.
Definition nasl_wmi.c:334
tree_cell * nasl_wmi_reg_get_qword_val(lex_ctxt *lexic)
Get registry QWORD value.
Definition nasl_wmi.c:762
tree_cell * nasl_wmi_versioninfo(lex_ctxt *lexic)
Get a version string of the WMI implementation.
Definition nasl_wmi.c:94
Protos for NASL WMI API.
API protos describing the interface of a wmi interface implementation.
int wmi_reg_get_dword_val(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry DWORD value.
int wmi_reg_get_ex_string_val(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry Expanded string value.
int wmi_close(WMI_HANDLE)
Close the connection handle for a WMI service.
WMI_HANDLE wmi_connect_rsop(int argc, char **argv)
Establish connection to a WMI RSOP service.
int wmi_reg_get_mul_string_val(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry multi-valued strings.
int wmi_reg_set_string_val(WMI_HANDLE, const char *, const char *, const char *)
Set Registry string value.
int wmi_reg_delete_key(WMI_HANDLE, const char *)
Delete Registry Key.
WMI_HANDLE wmi_connect(int argc, char **argv)
Establish connection to a WMI service.
int wmi_reg_set_ex_string_val(WMI_HANDLE, const char *, const char *, const char *)
Set Registry Expanded string value.
char * wmi_versioninfo(void)
Return version info for WMI implementation.
int wmi_reg_set_qword_val(WMI_HANDLE, const char *, const char *, uint64_t)
Set Registry QWORD value.
int wmi_query_rsop(WMI_HANDLE, const char *, char **)
WMI RSOP query.
int wmi_reg_enum_value(WMI_HANDLE, unsigned int, const char *, char **)
Enumerate Registry values.
int wmi_reg_get_sz(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry string value.
int wmi_query(WMI_HANDLE, const char *, char **)
Query WMI service using a WQL query.
int wmi_reg_create_key(WMI_HANDLE, const char *)
Create Registry Key.
void * WMI_HANDLE
int wmi_reg_set_dword_val(WMI_HANDLE, const char *, const char *, uint32_t)
Set Registry DWORD value.
int wmi_reg_get_bin_val(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry binary value.
int wmi_reg_enum_key(WMI_HANDLE, unsigned int, const char *, char **)
Enumerate Registry keys.
WMI_HANDLE wmi_connect_reg(int argc, char **argv)
Establish connection to a WMI Registry service.
int wmi_reg_get_qword_val(WMI_HANDLE, unsigned int, const char *, const char *, char **)
Get Registry QWORD value.
struct in6_addr * plug_get_host_ip(struct script_infos *args)
Definition plugutils.c:371
Header file for module plugutils.
int size
Definition nasl_tree.h:99
long int i_val
Definition nasl_tree.h:104
union TC::@332262321161220155002104006201360276211317150140 x
char * str_val
Definition nasl_tree.h:103
void * ref_val
Definition nasl_tree.h:105
Host information, implemented as doubly linked list.
Definition hosts.c:37
struct script_infos * script_infos