OpenVAS Libraries
8.0.3
|
NASL WMI functions. More...
#include <string.h>
#include <stdio.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <ctype.h>
#include <inttypes.h>
#include "plugutils.h"
#include "nasl_wmi.h"
#include "openvas_wmi_interface.h"
#include "../misc/openvas_logging.h"
Macros | |
#define | IMPORT(var) char *var = get_str_local_var_by_name(lexic, #var) |
#define | max 5 |
Functions | |
int | check_alpha (char *val) |
uint32_t | stoi_uint32_t (char *s) |
uint64_t | stoi_uint64_t (char *s) |
tree_cell * | nasl_wmi_versioninfo (lex_ctxt *lexic) |
Get a version string of the WMI implementation. More... | |
tree_cell * | nasl_wmi_connect (lex_ctxt *lexic) |
Connect to a WMI service and return a handle for it. More... | |
tree_cell * | nasl_wmi_close (lex_ctxt *lexic) |
Close WMI service handle. More... | |
tree_cell * | nasl_wmi_query (lex_ctxt *lexic) |
Perform WQL query. More... | |
tree_cell * | nasl_wmi_connect_rsop (lex_ctxt *lexic) |
Connect to a WMI RSOP service and return a handle for it. More... | |
tree_cell * | nasl_wmi_query_rsop (lex_ctxt *lexic) |
WMI RSOP query. More... | |
tree_cell * | nasl_wmi_connect_reg (lex_ctxt *lexic) |
Connect to a WMI Registry service and return a handle for it. More... | |
tree_cell * | nasl_wmi_reg_get_sz (lex_ctxt *lexic) |
Get string value from Registry. More... | |
tree_cell * | nasl_wmi_reg_enum_value (lex_ctxt *lexic) |
Enumerate registry values. More... | |
tree_cell * | nasl_wmi_reg_enum_key (lex_ctxt *lexic) |
Enumerate registry keys. More... | |
tree_cell * | nasl_wmi_reg_get_bin_val (lex_ctxt *lexic) |
Get registry binary value. More... | |
tree_cell * | nasl_wmi_reg_get_dword_val (lex_ctxt *lexic) |
Get registry DWORD value. More... | |
tree_cell * | nasl_wmi_reg_get_ex_string_val (lex_ctxt *lexic) |
Get registry expanded string value. More... | |
tree_cell * | nasl_wmi_reg_get_mul_string_val (lex_ctxt *lexic) |
Get registry multi valued strings. More... | |
tree_cell * | nasl_wmi_reg_get_qword_val (lex_ctxt *lexic) |
Get registry QWORD value. More... | |
tree_cell * | nasl_wmi_reg_set_dword_val (lex_ctxt *lexic) |
Set Registry DWORD value. More... | |
tree_cell * | nasl_wmi_reg_set_qword_val (lex_ctxt *lexic) |
Set Registry QWORD value. More... | |
tree_cell * | nasl_wmi_reg_set_ex_string_val (lex_ctxt *lexic) |
Set Registry Expanded string value. More... | |
tree_cell * | nasl_wmi_reg_set_string_val (lex_ctxt *lexic) |
Set Registry string value. More... | |
tree_cell * | nasl_wmi_reg_create_key (lex_ctxt *lexic) |
Create Registry key. More... | |
tree_cell * | nasl_wmi_reg_delete_key (lex_ctxt *lexic) |
Delete Registry key. More... | |
NASL WMI functions.
Provides WMI (Windows Management Instrumentation) functionalities via calling functions of a appropriate library. The API offers three groups of functions:
#define IMPORT | ( | var | ) | char *var = get_str_local_var_by_name(lexic, #var) |
#define max 5 |
int check_alpha | ( | char * | val | ) |
Returns 0 if any alphabets are present
Close WMI service handle.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variable "wmi_handle" from the lexical context and closes the respective handle.
Connect to a WMI service and return a handle for it.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "host", "username", "password" and "ns" from the lexical context, performs and connects to this given WMI service returning a handle for the service as integer.
Connect to a WMI Registry service and return a handle for it.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "host", "username", "password" from the lexical context, performs and connects to this given WMI service returning a handle for the service as integer.
Connect to a WMI RSOP service and return a handle for it.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "host", "username", "password" from the lexical context, performs and connects to this given WMI service returning a handle for the service as integer.
Perform WQL query.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle" and "query" from the lexical context, performs a WMI query on the given handle and returns the result as a string.
WMI RSOP query.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "query" from the lexical context, performs the RSOP query returning results in string format.
Create Registry key.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key" from the lexical context, performs the registry create operation for the key.
Delete Registry key.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key" from the lexical context, performs the registry delete operation for the key.
It will work only if the key exist
Enumerate registry keys.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key" from the lexical context, performs the registry query returning a string value.
Enumerate registry values.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key" from the lexical context, performs the registry query returning a string value.
Get registry binary value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "val_name" from the lexical context, performs the registry operation querying binary value.
Get registry DWORD value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "val_name" from the lexical context, performs the registry operation querying DWORD value.
Get registry expanded string value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "val_name" from the lexical context, performs the registry operation querying Expanded string value.
Get registry multi valued strings.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "val_name" from the lexical context, performs the registry operation querying Expanded string value.
Get registry QWORD value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "val_name" from the lexical context, performs the registry operation querying 64-bit unsigned integer.
Get string value from Registry.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "hive", "key", "key_name" from the lexical context, performs the registry query returning a string value.
Set Registry DWORD value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key", "val_name", "val" from the lexical context, performs the registry set/create operation for double word data type.
It will work only if the key exist
Set Registry Expanded string value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key", "val_name", "val" from the lexical context, performs the registry set/create operation for string value.
It will work only if the key exist
Set Registry QWORD value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key", "val_name", "val" from the lexical context, performs the registry set/create operation for 64-bit unsigned integer.
It will work only if the key exist
Set Registry string value.
[in] | lexic | Lexical context of NASL interpreter. |
Retrieves local variables "wmi_handle", "key", "val_name", "val" from the lexical context, performs the registry set/create operation for string value.
It will work only if the key exist
Get a version string of the WMI implementation.
[in] | lexic | Lexical context of NASL interpreter. |
uint32_t stoi_uint32_t | ( | char * | s | ) |
Convert string to unsign int 32 bit
uint64_t stoi_uint64_t | ( | char * | s | ) |
Convert string to unsign int 64 bit