The Addon will provide functionality to connect via SSH, SFTP and FTP.  The code is based on SSH.NET (https://sshnet.codeplex.com/) and is open source under the MIT license. 

The FTP source is based on the FTP client library for NET (http://www.codeproject.com/Articles/11991/An-FTP-client-library-for-NET) and is open source under the CPOL license.



Variables and Commands



FTPHOSTNAME

Set or gets the HostName for the FTP functionality

RW

FTPUSERNAME

Set or gets the UserName for the FTP functionality

RW

FTPPASSWORD

Set or gets the Password for the FTP functionality

RW

FTPCURRENTDIR

Set or gets the Current Directory for the FTP functionality

RW

FTPSSLENABLED

Set or gets if SSL is enabled for the FTP functionality

RW

FTPKEEPALIVE

Set or gets KeepAlive property for the FTP functionality

RW

FTPUSEPASSIVE

Set or gets UsePassive property for the FTP functionality

RW

SSHCONNECTED

Returns TRUE if SSH is connected, otherwise FALSE

R

SSHFWDPORTSTARTED

Returns TRUE if a ForwaredPort is started, otherwise FALSE

R

SSHFWDPORTLOG

Determines if logging is done on events with the Forwarded Port. Default value is FALSE.

RW

SSHMULTIREPLACEXML

The MultiReplace functionality is used to remove invalid characters and color codes in the returned string from SSH. This XML sets the replacements options.

RW

SFTPCONNECTED

Returns TRUE if SFTP is connected, otherwise FALSE

R

SFTPCURRENTDIR

Set or gets the Current Directory for the SFTP functionality

RW



Functions


SSHConnect(host As String, username As String, password As String, _

                      Optional port As Integer = 22, 

                      Optional timeOutCounter As Integer = 5000,

                      Optional keepAliveIntervalInSeconds as integer = 0) As String

If keepAliveIntervalInSeconds > 0 then the value is set.

timeOutCounter is in ms, so default is 5 seconds.

SSHDisconnect() As String

SSHRunCommand(cmd As String) As String

    This function opens a seperate shell and runs all commands.

    Multiple commands can be given as "ls -lsa && pwd && cd \volume1\Test"

SSHSendCommand(cmd As String, 
                                   optional checkAgainAfterReadTime as Integer=100) As String

checkAgainAfterReadTime is the time in ms, to wait for new available data (default is 100 ms).

SSHWriteData(input As String, Optional timeOut As Integer = 5000) As String

timeOut is in ms, so default is 5 seconds.

SSHReadData(Optional timeOut As Integer = 500, 

                         Optional ignoreTimeOutWarning as Boolean=False, 
                         Optional checkAgainAfterReadTime as Integer=100) As String

timeOutCounter is in ms, so default is 5 seconds.

ignoreTimeOutWaning to true will return an empty string on a timeout.

checkAgainAfterReadTime is the time in ms, to wait for new available data (default is 100 ms).

SSHStartForwardedPort(boundHost As String, boundPort As UInteger, 

                                        host As String, port As UInteger, 

                                        Optional AsRemote As Boolean = False) As String

SSHStartForwardedPortDynamic(host As String, port As UInteger) As String

SSHStopForwardedPort() As String


SFTPConnect(host As String, username As String, password As String, _

                        Optional port As Integer = 22, 

                        Optional timeOutCounter As Integer = 50) As String

timeOutCounter is in 100 ms, so default is 5 seconds.

SFTPDisconnect() As String

SFTPDownload(remoteFileName As String, localFileName As String) As String

SFTPUpload(localFileName As String, remoteFileName As String) As String

SFTPRenameFile(oldPath As String, newPath As String) As String

SFTPExists(Path As String) As Boolean

SFTPDelete(Path) As String

SFTPCreateDir(Path) As String

SFTPChangePermission(path As String, mode As Short) As String

SFTPGetPathType(path As String) As Integer

        0  path does not exits

        1  path is file

        2  path is directory

        -1 Error or other type

SFTPGetInfo(path As String, info As String) As String

        info:

        LASTACCESS, LASTWRITE, NAME, TYPE (DIR/FILE/SOCKET/LINK/PIPE/BLOCKDEVICE)

        PATH, PERMISSION, SIZE, FULLNAME

SFTPScan(ByVal Path As String, Optional sOption As Integer = 0) As Boolean

        options:

        Search Top directory only = 0

        Search All directories = 1

        Return Files = 0

        Return Directories = 2

SFTPCount() As Integer

SFTPIndex() As Integer

SFTPValue() As String

SFTPValue(ByVal index As Integer) As String

SFTPRead() As Boolean


FTPConnect(host As String, username As String, password As String) As String

FTPDownload(remoteFileName As String, localFileName As String) As Boolean

FTPUpload(localFileName As String, Optional remoteFileName As String = "") As Boolean

FTPRename(oldPath As String, newPath As String) As Boolean

FTPFileExists(Path As String) As Boolean

FTPDirExists(Path As String) As Boolean

FTPDeleteFile(Path) As String

FTPDeleteDir(Path) As String

FTPCreateDir(Path) As String

FTPGetDateTimeStamp(path As String) As Date

FTPScan(ByVal Path As String, Optional sOption As Integer = 0) As Boolean

        options:

        Search Top directory only = 0

        Search All directories = 1

        Return Files = 0

        Return Directories = 2

FTPCount() As Integer

FTPIndex() As Integer

FTPValue(Optional info As String = "FULLNAME") As String

        info:

        EXT (Extension), LASTWRITE, FILENAME, TYPE (DIR/FILE), NAME

        PATH, PERMISSION, SIZE, FULLNAME

FTPValueIndex(ByVal index As Integer, Optional info As String = "FULLNAME") As String

        info:

        EXT (Extension), LASTWRITE, FILENAME, TYPE (DIR/FILE), NAME

        PATH, PERMISSION, SIZE, FULLNAME

FTPRead() As Boolean

FTPValues() As String



Created with the Personal Edition of HelpNDoc: Full-featured Documentation generator