Simple SSH Client

Questions and comments specific to a particular plugin should go here.

Re: Simple SSH Client

Postby Sem;colon » Fri Apr 17, 2015 4:53 pm

kalia wrote:Could you make the password text box hidden (masked with asterisks)?


Yes, I could, however, I didn't do it because if you can access EventGhost you should be trusted already.
So as it is now, you can check the PW you entered, that can be helpfull in case of an issue, otherwise that would not be possible (that easy).
So, it's a feature that it's not hidden.

Can you desripe your use case, why do you like it to be hidden?

Thank you!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby kalia » Sat Apr 18, 2015 1:21 am

Sem;colon

I just wanted the password field masked so someone does not open the action and see the password. Don't worry about updating the plug-in. I already modified it for my own purpose to mask the password.

Thanks,

kalia
kalia
Experienced User
 
Posts: 109
Joined: Wed Aug 12, 2009 1:10 am

Re: Simple SSH Client

Postby Luca Brasi » Sun Apr 26, 2015 9:53 am

Hi sem;colon,

as mentioned in the Raspberry thread your plugin works great. Getting 2 way communication with a linux box is a blast.
I was wondering how you guys run things.
Do you add the host in your Autostart and have it run/connected all the time or do you add and delete the host for any command you issue to the ssh box?
If so how do you handle the timing? I had to put in some serious waits to get it working like that. So I am going with the first version right now but had to alter the ssh servers settings for that. Without that I guess the server would kick the connection after its default timeout.
Oh and if I might add something to the wishlist... it'd be cool to be able to send a series of commands from an action. Maybe a number of commands set in the actions config or from a file. I tried to do it like 'command a; command b; ...' to no avail.
Win8.1 x64 Prof. / Eventghost latest / auvisio vrc-1100-plugin and MCE Plugin / auvisio vrc-1100 and MCE Receiver / Logitech Harmony Hub / MediaPortal
User avatar
Luca Brasi
Experienced User
 
Posts: 224
Joined: Sat Oct 11, 2008 12:39 pm

Re: Simple SSH Client

Postby Sem;colon » Mon Apr 27, 2015 1:07 pm

Luca Brasi wrote:I was wondering how you guys run things.
Do you add the host in your Autostart and have it run/connected all the time or do you add and delete the host for any command you issue to the ssh box?

The plugin is designed the way that you first create a host (e.g. in autostart) and send commands when you need to.
Of course this leads to an always open ssh session, but that shouldn't be an issue.
The Plugin recognises if the host is not available and reconnects as soon as it becomes active again.
The big advantages of keeping the session open are:
-You can pass a series of commands within one session
-It's much faster, as the session doesn't need to be started again
-It has a lot less communication overhead while processing commands, as the session doesn't need to be started every singel time

Luca Brasi wrote:If so how do you handle the timing? I had to put in some serious waits to get it working like that.

You should split your macro in two:
macro 1: is triggered by your event and only Creates the ssh host
macro 2: is triggered by the "connected" event from the ssh plugin and contains all your ssh commands.

Luca Brasi wrote:Without that I guess the server would kick the connection after its default timeout.

It should reconnect when it's kicked, doesn't it?

Luca Brasi wrote:Oh and if I might add something to the wishlist... it'd be cool to be able to send a series of commands from an action. Maybe a number of commands set in the actions config or from a file. I tried to do it like 'command a; command b; ...' to no avail.

Hmm... No, I don't see the benefit of creating another GUI action for that.
You can write a script that does that very easy:
Code: Select all
commandList=["command a","command b"]
for item in commandList:
    eg.plugins.SSH.RunCommand(item, u'host1', False, False, False)
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Luca Brasi » Mon Apr 27, 2015 3:20 pm

Thank you very much for your detailed response sem;colon!
After setting it all up correctly it works like charm now on my sys.

The plugin is designed the way that you first create a host (e.g. in autostart) and send commands when you need to.
Of course this leads to an always open ssh session, but that shouldn't be an issue.
The Plugin recognises if the host is not available and reconnects as soon as it becomes active again.
The big advantages of keeping the session open are:
-You can pass a series of commands within one session
-It's much faster, as the session doesn't need to be started again
-It has a lot less communication overhead while processing commands, as the session doesn't need to be started every singel time


After setting it up like this I saw how nice it works that way. As my target is a 24/7 rpi I don't even have to think about reconnects but I am sure it'd handle those as well.

You should split your macro in two:
macro 1: is triggered by your event and only Creates the ssh host
macro 2: is triggered by the "connected" event from the ssh plugin and contains all your ssh commands.

I've put the create host action in the start action for my htpc.

It should reconnect when it's kicked, doesn't it?

Funny, I should have checked that. I went straight ahead and disabled the timeout on the rpi.

Hmm... No, I don't see the benefit of creating another GUI action for that.
You can write a script that does that very easy:

Code: Select all
commandList=["command a","command b"]
for item in commandList:
eg.plugins.SSH.RunCommand(item, u'host1', False, False, False)


Oh yeah, thanks, that comes in handy :-)
Win8.1 x64 Prof. / Eventghost latest / auvisio vrc-1100-plugin and MCE Plugin / auvisio vrc-1100 and MCE Receiver / Logitech Harmony Hub / MediaPortal
User avatar
Luca Brasi
Experienced User
 
Posts: 224
Joined: Sat Oct 11, 2008 12:39 pm

Re: Simple SSH Client

Postby arturmaj » Fri May 15, 2015 3:04 pm

Thanks for the plugin, Sem;colon.
It is working with my raspberry and ubuntu no problem. I have problems with my router. It is running tomato usb on Netgear R7000 arm7 processor. SSH server works OK. I can login with putty from the PC running eventghost but it seems that the plugin shortly after connecting disconnects gracefully. This is the log from my router:
May 15 06:02:11 NG-90 authpriv.info dropbear[3266]: Child connection from 192.168.90.1:49336
May 15 06:02:11 NG-90 authpriv.info dropbear[3266]: Exit before auth: Exited normally
May 15 06:02:11 NG-90 authpriv.info dropbear[3267]: Child connection from 192.168.90.1:49337
May 15 06:02:14 NG-90 authpriv.notice dropbear[3267]: Password auth succeeded for 'root' from 192.168.90.1:49337
May 15 06:02:21 NG-90 authpriv.info dropbear[3386]: Child connection from 192.168.90.1:49343
May 15 06:02:21 NG-90 authpriv.info dropbear[3386]: Exit before auth: Exited normally
May 15 06:02:25 NG-90 authpriv.info dropbear[3267]: Exit (root): Error writing
I tried both 1.6 and 1.7 verssions.
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby arturmaj » Fri May 15, 2015 4:49 pm

This is what EG says:
SSH.Connected.NG
SSH.New_line.NG 'Tomato v1.28.0000 -129 K26ARM USB AIO-64K'
SSH.New_line.NG ' ======================================================== '
SSH.New_line.NG ' Welcome to the Netgear R7000 [NG-90]'
SSH.New_line.NG ' Uptime: 09:45:35 up 7:14'
SSH.New_line.NG ' Load average: 0.58, 0.49, 0.40'
SSH.New_line.NG ' Mem usage: 13.3% (used 33.15 of 249.65 MB)'
SSH.New_line.NG ' WAN : 70.71.88.253/22 @ E4:F4:C6:1E:37:A6'
SSH.New_line.NG ' LAN : 192.168.90.254/24 @ DHCP: 192.168.90.1 - 192.168.90.50'
SSH.New_line.NG ' WL0 : e2500 @ channel: 8 @ E4:F4:C6:1E:37:A7'
SSH.New_line.NG ' WL1 : NG-90-5G @ channel: auto @ E4:F4:C6:1E:37:A8'
SSH.New_line.NG ' ======================================================== '
SSH.New_line.NG 'root@NG-90:/tmp/home/root# '
SSH.Disconnected.NG
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby Sem;colon » Sun May 17, 2015 4:10 pm

Hello arturmaj,

Thank you for reporting!
I just uploaded a new version (v1.72), can you please try it and tell me if it works with your devices?

Thank you!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby arturmaj » Sun May 17, 2015 8:42 pm

Thank you semi.
Unfortunately, it still does not work.
This is my login screen from putty:
login as: root
root@NG-90's password:


Tomato v1.28.0000 -129 K26ARM USB AIO-64K
========================================================
Welcome to the Netgear R7000 [NG-90]
Uptime: 13:35:08 up 11:03
Load average: 0.09, 0.06, 0.05
Mem usage: 14.6% (used 36.47 of 249.65 MB)
WAN : 70.71.88.253/22 @ E4:F4:C6:1E:37:A6
LAN : 192.168.90.254/24 @ DHCP: 192.168.90.1 - 192.168.90.50
WL0 : e2500 @ channel: 8 @ E4:F4:C6:1E:37:A7
WL1 : NG-90-5G @ channel: auto @ E4:F4:C6:1E:37:A8
========================================================

root@NG-90:/tmp/home/root#

this is my event ghost:

13:40:22 SSH.New_line.NG-90 'Tomato v1.28.0000 -129 K26ARM USB AIO-64K'
13:40:22 SSH.New_line.NG-90 ' ======================================================== '
13:40:22 SSH.New_line.NG-90 ' Welcome to the Netgear R7000 [NG-90]'
13:40:22 SSH.New_line.NG-90 ' Uptime: 13:40:18 up 11:08'
13:40:22 SSH.New_line.NG-90 ' Load average: 0.00, 0.02, 0.04'
13:40:22 SSH.New_line.NG-90 ' Mem usage: 14.7% (used 36.80 of 249.65 MB)'
13:40:22 SSH.New_line.NG-90 ' WAN : 70.71.88.253/22 @ E4:F4:C6:1E:37:A6'
13:40:22 SSH.New_line.NG-90 ' LAN : 192.168.90.254/24 @ DHCP: 192.168.90.1 - 192.168.90.50'
13:40:22 SSH.New_line.NG-90 ' WL0 : e2500 @ channel: 8 @ E4:F4:C6:1E:37:A7'
13:40:22 SSH.New_line.NG-90 ' WL1 : NG-90-5G @ channel: auto @ E4:F4:C6:1E:37:A8'
13:40:22 SSH.New_line.NG-90 ' ======================================================== '
13:40:22 SSH.New_line.NG-90 'root@NG-90:/tmp/home/root# '
13:40:28 SSH.Disconnected.NG-90

as you can see it is connected for 6 seconds.

ad here is my router log:

May 17 13:18:21 NG-90 authpriv.info dropbear[14662]: Child connection from 192.168.90.1:61306
May 17 13:18:21 NG-90 authpriv.info dropbear[14662]: Exit before auth: Exited normally
May 17 13:18:21 NG-90 authpriv.info dropbear[14663]: Child connection from 192.168.90.1:61307
May 17 13:18:23 NG-90 authpriv.notice dropbear[14663]: Password auth succeeded for 'root' from 192.168.90.1:61307
May 17 13:18:32 NG-90 authpriv.info dropbear[14786]: Child connection from 192.168.90.1:61920
May 17 13:18:32 NG-90 authpriv.info dropbear[14786]: Exit before auth: Exited normally
May 17 13:18:37 NG-90 authpriv.info dropbear[14663]: Exit (root): Error reading: Connection reset by peer
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby Sem;colon » Sun May 17, 2015 9:41 pm

Hmm, strange, maybe your router is just too slow..

I extended the timeout, please try the attached version!
(it should now print some text in the Log if the timeout is reached)
Attachments
__init__.py
v1.73
(18.88 KiB) Downloaded 88 times
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby arturmaj » Sun May 17, 2015 9:53 pm

Thanks again.
I tried this on 2 different PC with event ghost installed the results are identical:
14:50:53 SSH.Connected.NG-90
14:50:56 SSH.New_line.NG-90 'Tomato v1.28.0000 -129 K26ARM USB AIO-64K'
14:50:56 SSH.New_line.NG-90 ' ======================================================== '
14:50:56 SSH.New_line.NG-90 ' Welcome to the Netgear R7000 [NG-90]'
14:50:56 SSH.New_line.NG-90 ' Uptime: 14:50:52 up 12:19'
14:50:56 SSH.New_line.NG-90 ' Load average: 0.00, 0.04, 0.06'
14:50:56 SSH.New_line.NG-90 ' Mem usage: 14.7% (used 36.80 of 249.65 MB)'
14:50:57 SSH.New_line.NG-90 ' WAN : 70.71.88.253/22 @ E4:F4:C6:1E:37:A6'
14:50:57 SSH.New_line.NG-90 ' LAN : 192.168.90.254/24 @ DHCP: 192.168.90.1 - 192.168.90.50'
14:50:57 SSH.New_line.NG-90 ' WL0 : e2500 @ channel: 8 @ E4:F4:C6:1E:37:A7'
14:50:57 SSH.New_line.NG-90 ' WL1 : NG-90-5G @ channel: auto @ E4:F4:C6:1E:37:A8'
14:50:57 SSH.New_line.NG-90 ' ======================================================== '
14:50:57 SSH.New_line.NG-90 'root@NG-90:/tmp/home/root# '
14:51:20 SSH: Timeout reached, device is not responding, will disconnect!
14:51:20 SSH.Disconnected.NG-90
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby arturmaj » Sun May 17, 2015 9:56 pm

Looking at the router logs I can see that eventghost disconects from the router within one second of connecting.

May 17 14:50:52 NG-90 authpriv.notice dropbear[30867]: Password auth succeeded for 'root' from 192.168.90.1:49353
May 17 14:51:07 NG-90 authpriv.info dropbear[31080]: Child connection from 192.168.90.1:49388
May 17 14:51:07 NG-90 authpriv.info dropbear[31080]: Exit before auth: Exited normally
May 17 14:51:08 NG-90 daemon.warn miniupnpd[1848]: upnp_event_process_notify: connect(192.168.90.1:2869): Connection timed out
May 17 14:51:08 NG-90 daemon.warn miniupnpd[1848]: upnp_event_process_notify: connect(192.168.90.1:2869): Connection timed out
May 17 14:51:08 NG-90 daemon.warn miniupnpd[1848]: upnp_event_process_notify: connect(192.168.90.1:2869): Connection timed out
May 17 14:51:13 NG-90 daemon.err miniupnpd[1848]: upnp_event_recv: recv(): Connection reset by peer
May 17 14:51:15 NG-90 authpriv.info dropbear[31114]: Child connection from 192.168.90.2:53233
May 17 14:51:15 NG-90 authpriv.info dropbear[31115]: Child connection from 192.168.90.2:53234
May 17 14:51:16 NG-90 authpriv.notice dropbear[31115]: Password auth succeeded for 'root' from 192.168.90.2:53234
May 17 14:51:18 NG-90 authpriv.info dropbear[30867]: Exit (root): Error reading: Connection reset by peer
May 17 14:51:30 NG-90 authpriv.info dropbear[31297]: Child connection from 192.168.90.2:53248
May 17 14:51:30 NG-90 authpriv.info dropbear[31297]: Exit before auth: Exited normally
May 17 14:51:41 NG-90 authpriv.info dropbear[31115]: Exit (root): Error reading: Connection reset by peer
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby Sem;colon » Mon May 18, 2015 11:01 am

Hello arturmaj,

in the attached version I disabled the time-out or debugging, it shouldn't disconnect any more, but please try if you can properly send commands.
__init__.py
(18.88 KiB) Downloaded 88 times

if sending commands work, please try this version as well:
__init__.py
v1.74
(18.87 KiB) Downloaded 85 times


Thank you!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby arturmaj » Mon May 18, 2015 3:13 pm

Hi Semi;colon,
The one without the timeout works fine I can send a command.
The v 1.74 connects to the router fine and stay connected while I am sending a command but when I stop executing a command it disconnects after 10 seconds. After disconnecting it is not connecting again I have to boot my PC or the router. Killing eventghost does not help?
For now I will test the one without the timeout.
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby Sem;colon » Mon May 18, 2015 5:42 pm

Did EventGhost close correctly, did you get any Error?
If you kill EG (e.g. by using TaskManager) ports may stay open and cannot be closed as the process where they belong to doesn't exist any more.

One more thing, is your router capable to handle multiple SSH connections?
What happens if you connect to it via putty and while your session is open, connect another session via putty?

Thanks!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

PreviousNext

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 6 guests