-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: documentation for NASL SMB functions (#1278)
- Loading branch information
Showing
9 changed files
with
258 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SMB Functions | ||
|
||
## GENERAL | ||
|
||
Provides SMB API as built-in functions to NASL via calling corresponding functions of a appropriate library. The focus is on effective files rights which can't be retrieved via [WMI](../wmi-functions/index.md). | ||
|
||
## TOC |
29 changes: 29 additions & 0 deletions
29
doc/manual/nasl/built-in-functions/smb-functions/smb_close.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# smb_close | ||
|
||
## NAME | ||
|
||
**smb_close** - close SMB service handle | ||
|
||
## SYNOPSIS | ||
|
||
*bool* **smb_close**(smb_handle: *int*); | ||
|
||
**smb_close** takes 1 named argument. | ||
|
||
## DESCRIPTION | ||
|
||
Closes an opened SMB service handle. A service handle can be opened with **[smb_connect(3)](smb_connect.md)**. | ||
|
||
The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. | ||
|
||
## RETURN VALUE | ||
|
||
*TRUE* on success, *FALSE* on failure. | ||
|
||
## ERRORS | ||
|
||
The named argument *smb_handle* is either missing or invalid. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_connect(3)](smb_connect.md)** |
35 changes: 35 additions & 0 deletions
35
doc/manual/nasl/built-in-functions/smb-functions/smb_connect.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# smb_connect | ||
|
||
## NAME | ||
|
||
**smb_connect** - opens a connection to a SMB service | ||
|
||
## SYNOPSIS | ||
|
||
*int* **smb_connect**(username: *string*, password: *string*, share: *string*); | ||
|
||
**smb_connect** takes 3 named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function opens a connection to a SMB service. A opened handler must be closed by calling **[smb_close(3)](smb_close.md)**. | ||
|
||
The named argument *username* is a *string* containing the user to login onto the windows machine. | ||
|
||
The named argument *password* is a *string* containing the password for the user. | ||
|
||
The named argument *share* is a *string* containing the directory to run the smb commands in. | ||
|
||
## RETURN VALUE | ||
|
||
An *int* representing a SMB service handle or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments are missing. | ||
|
||
Unable to connect to SMB service. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_close(3)](smb_close.md)** |
35 changes: 35 additions & 0 deletions
35
doc/manual/nasl/built-in-functions/smb-functions/smb_file_SDDL.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# smb_file_SDDL | ||
|
||
## NAME | ||
|
||
**smb_file_SDDL** - obtain Security Descriptor in SDDL format | ||
|
||
## SYNOPSIS | ||
|
||
*string* **smb_file_SDDL**(smb_handle: *int*, filename: *string*); | ||
|
||
**smb_file_SDDL** takes two named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function checks the security descriptor of a file and obtains it in the SDDL format. SDDL is th Security Descriptor Definition Language and is used for e.g. the Access Control List (ACL) in the registry. | ||
|
||
For more information about SDDL see [https://learn.microsoft.com/en-us/windows/win32/secauthz/security-descriptor-string-format]. | ||
|
||
The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. | ||
|
||
The named argument *filename* is a *string* containing the filename. | ||
|
||
## RETURN VALUE | ||
|
||
The security descriptor in SDDL format of the given file as *string* or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments is either missing, empty or invalid. | ||
|
||
File does not exist. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_connect(3)](smb_connect.md)** |
33 changes: 33 additions & 0 deletions
33
doc/manual/nasl/built-in-functions/smb-functions/smb_file_group_sid.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# smb_file_group_sid | ||
|
||
## NAME | ||
|
||
**smb_file_group_sid** - get the group SID of a file | ||
|
||
## SYNOPSIS | ||
|
||
*string* **smb_file_group_sid**(smb_handle: *int*, filename: *string*); | ||
|
||
**smb_file_group_sid** takes two named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function checks the group SID of a specified file. | ||
|
||
The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. | ||
|
||
The named argument *filename* is a *string* containing the filename. | ||
|
||
## RETURN VALUE | ||
|
||
The group SID of the given file as *string* or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments is either missing, empty or invalid. | ||
|
||
File does not exist. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_connect(3)](smb_connect.md)** |
33 changes: 33 additions & 0 deletions
33
doc/manual/nasl/built-in-functions/smb-functions/smb_file_owner_sid.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# smb_file_owner_sid | ||
|
||
## NAME | ||
|
||
**smb_file_owner_sid** - get the owner SID of a file | ||
|
||
## SYNOPSIS | ||
|
||
*string* **smb_file_owner_sid**(smb_handle: *int*, filename: *string*); | ||
|
||
**smb_file_owner_sid** takes two named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function checks the owner of a file. A owner is specified by its SID. | ||
|
||
The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. | ||
|
||
The named argument *filename* is a *string* containing the filename. | ||
|
||
## RETURN VALUE | ||
|
||
The SID of a owner of the given file as *string* or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments is either missing, empty or invalid. | ||
|
||
File does not exist. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_connect(3)](smb_connect.md)** |
36 changes: 36 additions & 0 deletions
36
doc/manual/nasl/built-in-functions/smb-functions/smb_file_trustee_rights.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# smb_file_trustee_rights | ||
|
||
## NAME | ||
|
||
**smb_file_trustee_rights** - obtain file trustee SID with access mask | ||
|
||
## SYNOPSIS | ||
|
||
*string* **smb_file_trustee_rights**(smb_handle: *int*, filename: *string*); | ||
|
||
**smb_file_trustee_rights** takes two named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function obtains information about a files trustee SID with its access mask. The trustee SID corresponds to either an user or group. The access mask is a 32-bit value whose bits corresponds to the access rights supported by an object. | ||
For more information see: | ||
- access masks: [https://learn.microsoft.com/en-us/windows/win32/secauthz/access-rights-and-access-masks] | ||
- trustees SID: [https://learn.microsoft.com/en-us/windows/win32/secauthz/trustees] | ||
|
||
The named argument *smb_handle* is an *int* representing a connection to a SMB service. This connection can be opened with the **[smb_connect(3)](smb_connect.md)** functions. | ||
|
||
The named argument *filename* is a *string* containing the filename to get the permissions from. | ||
|
||
## RETURN VALUE | ||
|
||
The SID of a owner of the given file as *string* or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments is either missing, empty or invalid. | ||
|
||
File does not exist. | ||
|
||
## SEE ALSO | ||
|
||
**[smb_connect(3)](smb_connect.md)** |
19 changes: 19 additions & 0 deletions
19
doc/manual/nasl/built-in-functions/smb-functions/smb_versioninfo.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# smb_versioninfo | ||
|
||
## NAME | ||
|
||
**smb_versioninfo** - get a version string of the SMB implementation | ||
|
||
## SYNOPSIS | ||
|
||
*string* **smb_versioninfo**(); | ||
|
||
**smb_versioninfo** takes no arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function checks the current version of the SMB implementation and returns it. This can be used to check if functions are available in the current version. Can also be used to check if there is even any implementation for SMB functionality, as these are not mandatory for compiling the openvas-scanner. By default the openvas-scanner implementation just returns a *NULL* value for all functionalities. In order to use SMB **[openvas-smb](https://github.com/greenbone/openvas-smb)** has to be installed before. | ||
|
||
## RETURN VALUE | ||
|
||
The current version of the WMI implementation as *string* or *NULL* if there is none. |
31 changes: 31 additions & 0 deletions
31
doc/manual/nasl/built-in-functions/smb-functions/win_cmd_exec.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# win_cmd_exec | ||
|
||
## NAME | ||
|
||
**win_cmd_exec** - execute a command on a windows machine | ||
|
||
## SYNOPSIS | ||
|
||
*string* **win_cmd_exec**(username: *string*, password: *string*, cmd: *string*); | ||
|
||
**win_cmd_exec** takes three named arguments. | ||
|
||
## DESCRIPTION | ||
|
||
This function runs a command on a target windows machine. As this function just works with pipes, it is not necessary to have a SMB or WMI implementation. | ||
|
||
The named argument *username* is a *string* containing the user to run the command with. | ||
|
||
The named argument *password* is a *string* containing the password for the user. | ||
|
||
The named argument *cmd* is a *string* containing the command to execute. | ||
|
||
## RETURN VALUE | ||
|
||
The output of the run command as *string* or *NULL* on error. | ||
|
||
## ERRORS | ||
|
||
One of the arguments are missing or empty. | ||
|
||
All other error are specified on occurrences, as there can be many reasons, when using pipes. |