47 #include <netinet/in.h> 48 #include <sys/socket.h> 49 #include <arpa/inet.h> 53 #include "../misc/plugutils.h" 54 #include "../misc/openvas_logging.h" 56 #define IMPORT(var) char *var = get_str_local_var_by_name(lexic, #var) 79 retc->
size = strlen (version);
110 if ((host == NULL) || (username == NULL) || (password == NULL)
118 if ((strlen (password) == 0) || (strlen (username) == 0)
119 || (strlen (ip) == 0) || (strlen (share) == 0))
128 value =
smb_connect (ip, share, username, password, &handle);
137 retc->
x.
i_val = (int) handle;
213 retc->
size = strlen (buffer);
258 retc->
size = strlen (buffer);
303 retc->
size = strlen (buffer);
349 retc->
size = strlen (buffer);
382 char *argv1 =
"winexe";
385 if ((host == NULL) || (username == NULL) || (password == NULL) || (cmd == NULL))
392 if ((strlen (password) == 0) || (strlen (username) == 0)
400 argv[0] = (
char *) g_malloc0 (strlen (argv1) + 1);
401 argv[1] = (
char *) g_malloc0 (strlen (argv2) + 1);
402 argv[2] = (
char *) g_malloc0 (strlen (username) + strlen (password) + 1 + 1);
403 argv[3] = (
char *) g_malloc0 (strlen (ip) + 2 + 1);
404 argv[4] = (
char *) g_malloc0 (strlen (cmd) + 1);
407 strcpy (argv[0], argv1);
408 strcpy (argv[1],
"-U");
409 strcpy (argv[2], username);
410 strcat (argv[2],
"%");
411 strcat (argv[2], password);
412 strcpy (argv[3],
"//");
413 strcat (argv[3], ip);
414 strcpy (argv[4], cmd);
421 value =
wincmd (argc, argv, &res);
430 retc->
size = strlen (res);
tree_cell * nasl_smb_file_trustee_rights(lex_ctxt *lexic)
Obtain File Trustee SID with Access Mask.
tree_cell * nasl_smb_close(lex_ctxt *lexic)
Close SMB service handle.
tree_cell * nasl_smb_file_SDDL(lex_ctxt *lexic)
Obtain Security Descriptor in SDDL format.
char * smb_versioninfo(void)
Return version info for SMB implementation.
tree_cell * nasl_smb_file_group_sid(lex_ctxt *lexic)
Obtain File Group SID.
void log_legacy_write(const char *format,...)
Legacy function to write a log message.
long int get_int_local_var_by_name(lex_ctxt *, const char *, int)
char * get_str_local_var_by_name(lex_ctxt *, const char *)
tree_cell * nasl_win_cmd_exec(lex_ctxt *lexic)
Execute the command in windows.
tree_cell * nasl_smb_versioninfo(lex_ctxt *lexic)
Get a version string of the SMB implementation.
char * addr6_as_str(const struct in6_addr *addr6)
API protos describing the interface of a smb interface implementation.
struct in6_addr * plug_get_host_ip(struct arglist *desc)
tree_cell * nasl_smb_connect(lex_ctxt *lexic)
Connect to SMB service and return a handle for it.
tree_cell * nasl_smb_file_owner_sid(lex_ctxt *lexic)
Obtain File Owner SID.
char * smb_file_OwnerSID(SMB_HANDLE, const char *)
Obtain the SID of the Owner for a given file/path.
int smb_close(SMB_HANDLE)
Close the connection handle for SMB service.
char * smb_file_SDDL(SMB_HANDLE, const char *)
Obtain Windows file rights in SDDL format.
tree_cell * alloc_tree_cell(int lnb, char *s)
struct arglist * script_infos
char * smb_file_TrusteeRights(SMB_HANDLE, const char *)
Obtain the Trustee SID and their rights for a given file/path.
int smb_connect(const char *, const char *, const char *, const char *, SMB_HANDLE *)
Establish connection to a SMB service.
char * smb_file_GroupSID(SMB_HANDLE, const char *)
Obtain the SID of the Group for a given file/path.
int wincmd(int argc, char *argv[], char **res)
Command Execution in Windows.