Remote Interface
The Remote Interface is used to make connections to the remote server and transfer files.
RemoteInterface
Provides an interface for remote device communication over SSH and SCP.
Methods:
Name | Description |
---|---|
__init__ |
Create a new RemoteInterface instance. |
scp_receive |
Receive files from the remote device using SCP. |
scp_send |
Send files to the remote device using SCP. |
ssh_exec |
Execute a command on the remote device via SSH. |
__init__(hostname, username=None, password=None)
Create a new RemoteInterface instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hostname
|
str
|
The hostname or IP address of the remote device. |
required |
username
|
str | None
|
The username to use for authentication (optional). |
None
|
password
|
str | None
|
The password to use for authentication (optional). |
None
|
scp_receive(files_to_be_received, local_path=b'', recursive=False)
Receive files from the remote device using SCP.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files_to_be_received
|
str
|
The files to receive (can be a single file or a directory). |
required |
local_path
|
str
|
The destination path on the local device (defaults to the current directory). |
b''
|
recursive
|
Whether to receive directories recursively (defaults to False). |
False
|
scp_send(files_to_be_sent, remote_path=b'.', recursive=False)
Send files to the remote device using SCP.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
files_to_be_sent
|
str
|
The files to send (can be a single file or a directory). |
required |
remote_path
|
str
|
The destination path on the remote device (defaults to the current directory). |
b'.'
|
recursive
|
Whether to send directories recursively (defaults to False). |
False
|
ssh_exec(command)
Execute a command on the remote device via SSH.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command
|
str
|
The command to execute. |
required |
Returns:
Type | Description |
---|---|
str
|
The output of the command. |