2025-10-20 19:41:52 +03:00
|
|
|
Host = FunctionParameters["SSH_Host"];
|
|
|
|
|
Port = FunctionParameters["SSH_Port"];
|
2025-10-05 19:19:32 +03:00
|
|
|
|
|
|
|
|
UseProxy = True;
|
|
|
|
|
ProxySettings = Undefined;
|
|
|
|
|
AuthorizationType = "By login and password";
|
|
|
|
|
|
|
|
|
|
If AuthorizationType = "By login and password" Then
|
|
|
|
|
|
2025-10-20 19:41:52 +03:00
|
|
|
Login = FunctionParameters["SSH_User"];
|
|
|
|
|
Password = FunctionParameters["SSH_Password"];
|
2025-10-05 19:19:32 +03:00
|
|
|
|
|
|
|
|
SFTPSettings = OPI_SFTP.GetSettingsLoginPassword(Host, Port, Login, Password);
|
|
|
|
|
|
|
|
|
|
ElsIf AuthorizationType = "By key" Then
|
|
|
|
|
|
2025-10-20 19:41:52 +03:00
|
|
|
Login = FunctionParameters["SSH_User"];
|
2025-10-05 19:19:32 +03:00
|
|
|
PrivateKey = "./ssh_key";
|
|
|
|
|
PublicKey = "./ssh_key.pub";
|
|
|
|
|
|
|
|
|
|
SFTPSettings = OPI_SFTP.GetSettingsPrivateKey(Host, Port, Login, PrivateKey, PublicKey);
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
2025-10-20 19:41:52 +03:00
|
|
|
Login = FunctionParameters["SSH_User"];
|
2025-10-05 19:19:32 +03:00
|
|
|
SFTPSettings = OPI_SFTP.GetSettingsViaAgent(Host, Port, Login);
|
|
|
|
|
|
|
|
|
|
EndIf;
|
|
|
|
|
|
|
|
|
|
If UseProxy Then
|
|
|
|
|
|
2025-10-20 19:41:52 +03:00
|
|
|
ProxyType = FunctionParameters["Proxy_Type"]; // http, socks5, socks4
|
2025-10-05 19:19:32 +03:00
|
|
|
|
2025-10-20 19:41:52 +03:00
|
|
|
ProxyAddress = FunctionParameters["Proxy_IP"];
|
|
|
|
|
ProxyPort = FunctionParameters["Proxy_Port"];
|
|
|
|
|
ProxyLogin = FunctionParameters["Proxy_User"];
|
|
|
|
|
ProxyPassword = FunctionParameters["Proxy_Password"];
|
2025-10-05 19:19:32 +03:00
|
|
|
|
|
|
|
|
ProxySettings = OPI_SFTP.GetProxySettings(ProxyAddress, ProxyPort, ProxyType, ProxyLogin, ProxyPassword);
|
|
|
|
|
|
|
|
|
|
EndIf;
|
|
|
|
|
|
|
|
|
|
Connection = OPI_SFTP.CreateConnection(SFTPSettings, ProxySettings);
|
|
|
|
|
|
|
|
|
|
If OPI_SFTP.IsConnector(Connection) Then
|
|
|
|
|
Result = OPI_SFTP.GetFileInformation(Connection, "files_folder/pic_from_binary.png");
|
|
|
|
|
Else
|
|
|
|
|
Result = Connection; // Error of connection
|
|
|
|
|
EndIf;
|