jkSSH2
This libary is based on Ganymed SSH-2 libary. An open source java implementation of the SSH2 protocol. The licence is included in the zip file.
Summary
This libary currently offers the following SSH2 features:
Installation
Example
This example shows how to execute a shell command on the server.
This libary is based on Ganymed SSH-2 libary. An open source java implementation of the SSH2 protocol. The licence is included in the zip file.
Summary
This libary currently offers the following SSH2 features:
- Several authorization methods (None/Username and Password/Key)
- Execute shell commands on the server.
- Create local port forwardings.
- Download files with the scp command.
- Upload files with the scp command.
Installation
- Download and unzip the attached zip file.
- Copy jkSSH2.jar and jkSSH2.xml to the additional libaries folder.
Example
This example shows how to execute a shell command on the server.
B4X:
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim SSH2 As jkSSH2
End Sub
Sub Activity_Create(FirstTime As Boolean)
SSH2.initialize("SSH", "hostname", 22)
SSH2.authenticateWithPassword("username", "password")
SSH2.execCommand("uname -a && date && uptime && who", 10)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub SSH_CmdExecuted (Success As Boolean, Result As List, TaskId As Int)
Log (TaskId)
If Success Then
For i=0 To Result.Size-1
Log(Result.Get(i) & CRLF)
Next
End If
SSH2.close
End Sub
Sub SSH_ConnectionLost (Reason As String)
Log(Reason)
End Sub
Attachments
Last edited: