Swimlane Samba Share
The Swimlane Samba Share connector facilitates automated interactions with Samba network file shares, enabling efficient file management.
Samba Share is a widely-used network file sharing protocol that allows seamless access to files and directories across different operating systems. The Swimlane Samba Share Connector enables users to automate file management tasks such as creating, deleting, listing, and moving files and directories within a Samba network. By integrating with Swimlane Turbine, users can streamline their security operations, enhance collaboration, and improve efficiency by automating routine file management tasks without writing code.
This connector integrates with Swimlane Samba Share and extends its infrastructure capabilities. With this connector, you can connect to a Samba shared network drive, create a directory, delete a directory, delete a file, list all files in a specified directory, list all shared directories, rename or move a file, and retrieve contents of a file.
Asset Setup or Prerequisites
Before you can use the Swimlane Samba Share connector, ensure you have the following:
- Swimlane Samba Share API Authentication using the following parameters:
- Username: The username required to authenticate with the Samba server.
- Password: The password associated with the provided username.
- IP: The IP address of the Samba server.
- Remote Name: The name of the remote Samba service to connect to.
Capabilities
- Create a Directory
- Delete a Directory
- Delete a File
- List All Directories
- List All Files in a Directory
- Rename or Move a file
- Retrieve Contents of a File
- Upload a File
Notes
To access pysmb API Documentation for the Connector - Check Here
Configurations
Swimlane Samba Share API Authentication
Swimlane Samba Share API Authentication.
Configuration Parameters
Parameter | Description | Type | Required |
|---|---|---|---|
username | Username of account in which samba server is hosted. | string | Required |
password | Password of account in which samba server is hosted. | string | Required |
local_netbios_machine_name | The local NetBIOS machine name that will identify where this connection is originating from. | string | Optional |
remote_name | The NetBIOS machine name of the remote server. | string | Required |
domain | The network domain. | string | Optional |
use_ntlm_v2 | Indicates whether pysmb should be NTLMv1 or NTLMv2 authentication algorithm for authentication. | boolean | Optional |
sign_options | Determines whether SMB messages will be signed. Default is SIGN_WHEN_REQUIRED. If SIGN_WHEN_REQUIRED (value=2), SMB messages will only be signed when remote server requires signing. If SIGN_WHEN_SUPPORTED (value=1), SMB messages will be signed when remote server supports signing but not requires signing. If SIGN_NEVER (value=0), SMB messages will never be signed regardless of remote serverβs configurations. | number | Optional |
is_direct_tcp | Controls whether the NetBIOS over TCP/IP (is_direct_tcp=False) or the newer Direct hosting of SMB over TCP/IP (is_direct_tcp=True) will be used for the communication. | boolean | Optional |
ip | Ip address of host. | string | Required |
port | Defaults to 139. If you are using direct TCP mode (is_direct_tcp=true when creating this SMBConnection instance), use 445. | number | Optional |
sock_family | In Python 3.x, use None as we can infer the socket family from the provided ip. In Python 2.x, it must be either socket.AF_INET or socket.AF_INET6. | string | Optional |
timeout | Timeout. | number | Optional |
verify_ssl | Verify SSL certificate | boolean | Optional |
http_proxy | A proxy to route requests through. | string | Optional |
Actions
Create a Directory
Create a new directory on the specified path within Swimlane Samba Share using 'service_name' and 'path'.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | Contains the name of the shared folder. |
path | string | Required | The path of the new folder (relative to) the shared folder. |
timeout | number | Optional | Parameter for Create a Directory |
Input Example
{"service_name":"sambashare","path":"testfolder","timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
message | string | Response message |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"message":"Directory Created"}}
Delete a Directory
Remove an empty directory from a specified path on the Samba service, requiring 'service_name' and 'path' as inputs.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | Contains the name of the shared folder. |
path | string | Required | The path of the to-be-deleted folder (relative to) the shared folder. |
timeout | number | Optional | Parameter for Delete a Directory |
Input Example
{"service_name":"sambashare","path":"testfolder","timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
message | string | Response message |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"message":"Directory Deleted"}}
Delete a File
Remove specified files from a Samba Share using patterns and wildcards. Requires inputs for service name and file path.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | Contains the name of the shared folder. |
path_file_pattern | string | Required | The pathname of the file(s) to be deleted, relative to the service_name. Wildcards may be used in th filename component of the path. |
delete_matching_folders | boolean | Optional | Parameter for Delete a File |
timeout | number | Optional | Parameter for Delete a File |
Input Example
{"service_name":"sambashare","path_file_pattern":"parent/sample.txt","delete_matching_folders":false,"timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
message | string | Response message |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"message":"File Deleted"}}
List All Directories
Retrieve a comprehensive list of all shared directories from the specified Samba server.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
timeout | number | Optional | Parameter for List All Directories |
Input Example
{"timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
shared_dirs | array | Output field: shared_dirs |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"shared_dirs":["print$","sambashare","IPC$"]}}
List All Files in Directory
Retrieve all files and folders within a specified directory on Swimlane Samba Share using the provided service name and path.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | The name of the shared folder for the path. |
path | string | Required | Path relative to the service_name where we are interested to learn about its files/sub-folders. |
pattern | string | Optional | The filter to apply to the results before returning to the client. |
search | number | Optional | Integer value made up from a bitwise-OR of SMB_FILE_ATTRIBUTE_xxx bits |
timeout | number | Optional | Parameter for List All Files in Directory |
Input Example
{"service_name":"sambashare","path":"parent","pattern":"*","search":65591,"timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
files | array | Output field: files |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"files":[".","..","sample.txt"]}}
Rename or Move a File
Rename or move a file/folder in Swimlane Samba Share using service name, old path, and new path.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | Contains the name of the shared folder. |
old_path | string | Required | Referring to the old path of the renamed resources (relative to) the shared folder. |
new_path | string | Required | Referring to the new path of the renamed resources (relative to) the shared folder. |
timeout | number | Optional | Parameter for Rename or Move a File |
Input Example
{"service_name":"sambashare","old_path":"testfolder/newfile.txt","new_path":"parent/sample.txt","timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
message | string | Response message |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"message":"File Was Renamed or Moved"}}
Retrieve Contents of a File
Retrieve the contents of a specified file from a Samba Share using the provided service name and path.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | The name of the shared folder for the path. |
path | string | Required | Path of the file on the remote server. |
timeout | number | Optional | Parameter for Retrieve Contents of a File |
Input Example
{"service_name":"sambashare","path":"parent/sample.txt","timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
file_contents | string | Response content |
Output Example
{"status_code":200,"response_headers":{},"reason":"OK","json_body":{"file_contents":"hello world\n"}}
Retrieve File as Attachment
Retrieve a file from a Samba Share as a binary attachment using the specified service name and path for downstream actions.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
service_name | string | Required | The name of the shared folder for the path. |
path | string | Required | Path of the file on the remote server. |
timeout | number | Optional | Timeout for the operation. |
Input Example
{"service_name":"sambashareservice","path":"parent/sambashareservice/sample.txt","timeout":30}
Output
Parameter | Type | Description |
|---|---|---|
status_code | number | HTTP status code of the response |
reason | string | Response reason phrase |
file | object | The retrieved file as an attachment. |
file.filename | string | Name of the resource |
file.file_data | string | Response data |
Output Example
{"file":{"filename":"Example Name","file_data":"string"}}
Upload a File
Upload a specified file to a Samba network storage directory, requiring samba_share_dir, files, and file_path.
Input
Argument Name | Type | Required | Description |
|---|---|---|---|
samba_share_dir | string | Required | Contains the name of the shared folder. |
files | object | Required | A Swimlane file attachment object. |
files.file_name | string | Required | Name of the resource |
files.file | string | Required | Parameter for Upload a File |
file_path | string | Required | The pathname of the file to be uploaded, relative to the service_name. Wildcards may be used in th filename component of the path.If your path/filename contains non-English characters, you must pass in an unicode string. |
Input Example
{"samba_share_dir":"C$","files":{"file_name":"TEST_IMPORT.ssp","file":"TEST_IMPORT.ssp"},"file_path":"/Path/To/File/"}
Output
Parameter | Type | Description |
|---|---|---|
message | string | Response message |
Output Example
{"message":"File Uploaded"}
Response Headers
Header | Description | Example |
|---|---|---|
Content-Type | The media type of the resource | application/json |
Date | The date and time at which the message was originated | Thu, 01 Jan 2024 00:00:00 GMT |