Giter Site home page Giter Site logo

ai2_android_ssh_client_extension's Introduction

AI2_SSH_EXTENSION:

Android client SSH extension for MIT Application Inventor 2

This is an AI2 extension made in Java for Android, compiled with the Apache ANT builder. It allows issuing Linux Bash/Shell commands to a remote SSH server, prefereably done in short execution, once the runnable thread runs under the AssyncTask, otherwise the whole application will become unresponsive to user interactions.

The code may be also useful for users of the AppyBuilder community; note however that although being intrinsically compatible, it were not tested on this development platform.

Bellow, a snapshot of the Component collection:

USAGE:

1 ) Fill string variables "SetUser", "SetHost" and "SetPasswords" accordingly, without queotes

2 ) Fill string variable "Command" with the Bash/Sheel 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 "msgIn" contains current text line, indded the last one.

4.1 ) ...by reading "GetReceivedMessage" variable; it is assyncronously updated (intermediary values are superseded)

APPLICATION EXAMPLE:

A simple application with few components can be made to show check the extension working:

With the suggested arrangement:

If you want to give suggestions or if you notice any problem, please report it on the above 'Issue' section.

ai2_android_ssh_client_extension's People

Contributors

aluis-rcastro avatar watermelonoof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ai2_android_ssh_client_extension's Issues

change ssh port

if i want to change the default port from 22 to another one is it possible?

Auth Fail ( after remove local keys )

Whenever clearing cache or data from previous install, unable to connect again. This sounds like .ssh/keys/ are being removed on this process.

There is an option in the library to ignore these keys and work with the password-mode option.

How to append all log

I use the extension in Kodular. I have to read a file of 1500 lines by executing the command "tail -n1500 /home/pi/user.txt" but it only shows 500 lines of the file. I tried to add all the "NewIncomingMessage" to a string but still the same result. If I change the command to "tail -n800 /home/pi/user.txt" it only shows me 400 lines, If I run "tail -n400 /home/pi/user.txt" it does show me all 400 lines.

Can you help me check.

Change channel session from "exec" to "shell" mode

According to a feedback took from a member of the AI2 community, an implementation of the JSch allowing sent of multiple commands interactivelly would be better.

Worthy to mention that similar feature (a "turn-around" solution) could be achieved by issuing a single Bash/Shell command &&-separated (< cmd1 >&&< cmd2 >&&...< cmd[n] >), or in other words, once finished the previous command < cmd[n-1] > no reply from host will be sent until the last command < cmd[n+1] > have been accomplished.

extension ssh permission too well done

First of all thank you for this great extension!

I use a restricted user created with sudo useradd -s /bin/rbash baye.
with Putty I'm not able to use com commands "ls", but through the extension I can run "ls" which means my restriction is not really complete or your extension managed to bypass it.

I restarted the server, reinstalled the app in case of old connection but it doesn't change anything.

In order to do an investigation I would like to have an idea how you managed to run these commands even in a restricted account.

Edit:
I finally understood that there are two types of restriction: shell restriction and ssh restriction, to restrict it from ssh I used this very good script : https://github.com/RaymiiOrg/boa-diminish-restricted-shell

Trying to run a shell script on a remote machine

Hello! Andre Luis,

Firstly, I would like to thank you your extension. It's incredible.

I found the extension that you did several years ago and obsviously it doesn't work but this one works great for me.

But now I'm trying to run a shell script on a remote machine and I'm having a problem. When I run the script with ssh from my computer on a remote machine it works. When I try to do the same from my mobile phone it doesn't work. The app on the mobile phone works perfect with commands like ls and something like that but it doesn't work with "./prueba.sh"

Thank you for your time and your extension.

Best regards

ability for non default port

Feature request. Looks like port 22 is hard coded. Add SetPort to give the ability to use ssh connections on any port number

DX compilation error in AI2

When I tried to compile my project after importing the SSH Client Extension I got an "YAIL compiler - DX execution failed" error

Missing "Disconnect" option

Although all the times I've tested the process as a whole exited by itself from the session/connection, it is worthy to add such a functionality (this is a user request).

How to append all log NOT only the last line of recived messages

Hello! Andre Luis,

First of all I would like to thank you your extension. It's incredible.

second I am trying to send more than on command one after another & I try to collect all the received messages came from server (not only the last line) , but unfortunately I did not get it to work OK thought I try more than one scenario

here is the method I used in my project by appending to txt file then read that file , but the result was not correct

kindly I need your support to get all the revived output not only the last line

blocks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.