The following attached file contains an SSH Client extension
which I made for my own use, but it may also be useful for users of the MIT Application Inventor 2 (AI2) community, or even to the AppyBuilder community (code intrinsically compatible for the last one, but not tested). This is just the current stage of development, but if you want to get updated revisions, you can get the last released source code at Github.
It is being shared "as-is", which means that:
In the attached demo application, the text field displays only the last line, and for this reason, if you want to see the whole sentence got from host, you can make simple changes in the code in order to merge incoming messages subsequently.
It is worthy to mention that due to the oftentimes changes in the security policies of the protocols, it would not be improbable that the attached .aix file would not work in the future, therefore this extension should be re-compiled (with the Apache ANT builder), but now adding a more recent release of JSch at the LIB folder (current revision: jsch-0.1.54.jar).
Another point to remark is that, althought including the source code of the JSch library in the project, the correspondent compield JAR was necessary just to embed it into the application during build stage, without the need to give external dependencies to the user.
USAGE:
=====
Feel free to make experiments and give feedback.
which I made for my own use, but it may also be useful for users of the MIT Application Inventor 2 (AI2) community, or even to the AppyBuilder community (code intrinsically compatible for the last one, but not tested). This is just the current stage of development, but if you want to get updated revisions, you can get the last released source code at Github.
It is being shared "as-is", which means that:
- No implicit or expressed warranty provided - (leastwise worked for me),
- No functional optimization performed, no refactoring made,
- Not intended to be an "state-of-the-art" work, but rather a quick solution to a big problem,
- Not tested in all devices, OS builds, etc... (tested on Android 4.2 and 8.1, both Samsung mobiles)
- Attempted to follow good coding/style formatting practices, but not strictly committed to this.
In the attached demo application, the text field displays only the last line, and for this reason, if you want to see the whole sentence got from host, you can make simple changes in the code in order to merge incoming messages subsequently.
It is worthy to mention that due to the oftentimes changes in the security policies of the protocols, it would not be improbable that the attached .aix file would not work in the future, therefore this extension should be re-compiled (with the Apache ANT builder), but now adding a more recent release of JSch at the LIB folder (current revision: jsch-0.1.54.jar).
Another point to remark is that, althought including the source code of the JSch library in the project, the correspondent compield JAR was necessary just to embed it into the application during build stage, without the need to give external dependencies to the user.
USAGE:
=====
1 ) Fill string variables "SetUser", "SetHost" and "SetPasswords" accordingly, without queotes
2 ) Fill string variable "Command" with the Bash/Shell command to be issued, without queotes (e.g: ls )
3 ) Call the function "SendData"
4 ) Get result either:
4.1 ) ...from within "NewIncomingMessage" event, argument "data" contains current text line, indded the last one.
4.1 ) ...by reading "GetReceivedMessage" variable; be aware that it is assyncronously updated (intermediary values are superseded)
Feel free to make experiments and give feedback.