Simple SSH Client

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

Re: Simple SSH Client

Postby arturmaj » Mon May 18, 2015 11:35 pm

The router can handle multiple connections. It has 256Megs of ram double CPU arm7. It is quite powerful. Runs web server and mysql etc.
Fresh booted PC, SSH v1.74 - EG connects and after 10 secs disconnects. I can exit EG cleanly but when I run EG again I onlt get : 16:30:09 SSH: Add Host: 192.168.90.254
but no connection is made. I will reboot my PC and post the log from EG.
By the way the other PC running SSH without timeout keeps connection opened for over 4 hours now.
Thanks again.
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby arturmaj » Mon May 18, 2015 11:38 pm

16:36:31 SSH.Connected.NG
16:36:34 SSH.New_line.NG 'Tomato v1.28.0000 -129 K26ARM USB AIO-64K'
16:36:34 SSH.New_line.NG ' ======================================================== '
16:36:34 SSH.New_line.NG ' Welcome to the Netgear R7000 [NG-90]'
16:36:34 SSH.New_line.NG ' Uptime: 16:36:31 up 8:38'
16:36:34 SSH.New_line.NG ' Load average: 0.04, 0.06, 0.12'
16:36:34 SSH.New_line.NG ' Mem usage: 16.4% (used 41.04 of 249.65 MB)'
16:36:34 SSH.New_line.NG ' WAN : 70.71.88.253/22 @ E4:F4:C6:1E:37:A6'
16:36:34 SSH.New_line.NG ' LAN : 192.168.90.254/24 @ DHCP: 192.168.90.1 - 192.168.90.50'
16:36:34 SSH.New_line.NG ' WL0 : e2500 @ channel: 8 @ E4:F4:C6:1E:37:A7'
16:36:34 SSH.New_line.NG ' WL1 : NG-90-5G @ channel: auto @ E4:F4:C6:1E:37:A8'
16:36:34 SSH.New_line.NG ' ======================================================== '
16:36:34 SSH.New_line.NG 'root@NG-90:/tmp/home/root# '
16:36:49 Task.Created.chrome
16:36:49 Task.NewWindow.chrome
16:36:49 Task.Activated.chrome
16:36:49 Task.Deactivated.chrome
16:36:49 Task.ClosedWindow.chrome
16:36:49 Task.Destroyed.chrome
16:36:49 Task.Created.chrome
16:36:49 Task.NewWindow.chrome
16:36:49 Task.Activated.chrome
16:36:53 SSH: Host NG is not responding, will disconnect!
16:36:53 SSH.Disconnected.NG
arturmaj
 
Posts: 23
Joined: Sun Apr 19, 2009 4:55 pm

Re: Simple SSH Client

Postby Sem;colon » Sat Jun 20, 2015 3:37 pm

New Version!

v1.75:
-Added option to turn off the "automatic disconnect" feature if the host becomes inactive on a per host basis (as it appears to make problems with some devices).
-Increased the stability of the connection.
-Bug fixes.

@ arturmaj: I have no idea how to really fix your issue, please use the new function to disable automatic disconnect on your Netgear router.

Download link at the first post!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Phil » Thu Sep 17, 2015 3:14 pm

Hi
I have an issue with trying to connect to a draytek router, the plugin is stuck in a loop,
- Host "Home Router" found on network trying to connect
- Faild to connect to (with a missing E as well!

This loop repeats every few seconds until I shutdown eventghost

I think part of the issue is with the plug in not stopping after a failure and part of it being draytek
When you log onto the router using putty you get the message
Server refused to allocate pty

which some sites suggest you need to do ssh -T admin@1.1.1.1 to resolve, however this isnt an option with the plugin.

Any suggestions? I'd like to be able to put a time-out on one of the SSIDs to stop the kids brains rotting too much and ssh seems to be the way (or telnet).

thanks
Phil
Experienced User
 
Posts: 105
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

Re: Simple SSH Client

Postby Sem;colon » Fri Sep 18, 2015 8:55 am

Hi Phil,

thank you for pointing out that typo :)

The attached version should give you a little more information about what failed, can you please post the error you are getting with this one?

Thank you
Attachments
__init__.py
(19.46 KiB) Downloaded 79 times
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Phil » Fri Sep 18, 2015 9:01 am

Hi
This is what I get:
Code: Select all
09:59:27   SSH: Add Host: 172.20.1.1
09:59:27      SSH: Add Host: 172.20.1.1
09:59:27   SSH: Host "Home-Router" found on the network, trying to connect to 172.20.1.1:22...
09:59:31   Exception in thread Thread-45:
09:59:31   Traceback (most recent call last):
09:59:31     File "threading.pyc", line 532, in __bootstrap_inner
09:59:31     File "threading.pyc", line 484, in run
09:59:31     File "C:\Program Files (x86)\EventGhost\plugins\Simple SSH\__init__.py", line 225, in Receive
09:59:31       self.Connect(self.ip, self.port, self.user, self.pw, self.host)
09:59:31     File "C:\Program Files (x86)\EventGhost\plugins\Simple SSH\__init__.py", line 117, in Connect
09:59:31       eg.PrintError(e)
09:59:31     File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 185, in PrintError
09:59:31       self._Print(args, **kwargs)
09:59:31     File "C:\Program Files (x86)\EventGhost\eg\Classes\Log.py", line 171, in _Print
09:59:31       self.Write(sep.join(args) + end, icon, source)
09:59:31   TypeError: sequence item 0: expected string, SSHException found
09:59:31 
Phil
Experienced User
 
Posts: 105
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

Re: Simple SSH Client

Postby Sem;colon » Fri Sep 18, 2015 3:15 pm

hmm, looks like I made a mistake in the error handling (sorry)
Can you provide me the error message that this version will produce?
Thank you!
Attachments
__init__.py
(19.46 KiB) Downloaded 79 times
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Phil » Mon Sep 21, 2015 7:14 am

thank you, here it is

08:11:28 SSH: Host "Home-Router" found on the network, trying to connect to 172.20.1.1:22...
08:11:32 Channel closed.
08:11:32 SSH: Failed to connect to 172.20.1.1:22
08:11:35 SSH: Host "Home-Router" found on the network, trying to connect to 172.20.1.1:22...
08:11:35 No handlers could be found for logger "paramiko.transport"
08:11:35 Error reading SSH protocol banner
08:11:35 SSH: Failed to connect to 172.20.1.1:22
08:11:38 SSH: Host "Home-Router" found on the network, trying to connect to 172.20.1.1:22...
08:11:42 Channel closed.
08:11:42 SSH: Failed to connect to 172.20.1.1:22
08:11:45 SSH: Host "Home-Router" found on the network, trying to connect to 172.20.1.1:22...
08:11:45 Error reading SSH protocol banner
08:11:45 SSH: Failed to connect to 172.20.1.1:22
Phil
Experienced User
 
Posts: 105
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

Re: Simple SSH Client

Postby Sem;colon » Mon Sep 21, 2015 9:13 pm

hmm, try this one, I added a timeout... I don't know if it helps.
Attachments
__init__.py
(19.49 KiB) Downloaded 87 times
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Phil » Tue Sep 22, 2015 9:18 am

Hi
a new log

10:07:07 SSH: Add Host: 192.168.1.254
10:07:07 SSH: Add Host: 192.168.1.254
10:07:07 SSH: Host "Router" found on the network, trying to connect to 192.168.1.254:22...
10:07:11 Channel closed.
10:07:11 SSH: Failed to connect to 192.168.1.254:22
10:07:14 SSH: Host "Router" found on the network, trying to connect to 192.168.1.254:22...
10:07:14 ERROR:paramiko.transport:Exception: Error reading SSH protocol banner
10:07:14 ERROR:paramiko.transport:Traceback (most recent call last):
10:07:14 ERROR:paramiko.transport: File "C:\Program Files (x86)\EventGhost\lib26\site-packages\paramiko\transport.py", line 1582, in run
10:07:14 ERROR:paramiko.transport: self._check_banner()
10:07:14 ERROR:paramiko.transport: File "C:\Program Files (x86)\EventGhost\lib26\site-packages\paramiko\transport.py", line 1709, in _check_banner
10:07:14 ERROR:paramiko.transport: raise SSHException('Error reading SSH protocol banner' + str(e))
10:07:14 ERROR:paramiko.transport:SSHException: Error reading SSH protocol banner
10:07:14 ERROR:paramiko.transport:
10:07:14 Error reading SSH protocol banner
10:07:14 SSH: Failed to connect to 192.168.1.254:22
10:07:17 SSH: Host "Router" found on the network, trying to connect to 192.168.1.254:22...
10:07:20 Channel closed.
10:07:20 SSH: Failed to connect to 192.168.1.254:22
10:07:23 SSH: Host "Router" found on the network, trying to connect to 192.168.1.254:22...
10:07:24 ERROR:paramiko.transport:Exception: Error reading SSH protocol banner
10:07:24 ERROR:paramiko.transport:Traceback (most recent call last):
10:07:24 ERROR:paramiko.transport: File "C:\Program Files (x86)\EventGhost\lib26\site-packages\paramiko\transport.py", line 1582, in run
10:07:24 ERROR:paramiko.transport: self._check_banner()
10:07:24 ERROR:paramiko.transport: File "C:\Program Files (x86)\EventGhost\lib26\site-packages\paramiko\transport.py", line 1709, in _check_banner
10:07:24 ERROR:paramiko.transport: raise SSHException('Error reading SSH protocol banner' + str(e))
10:07:24 ERROR:paramiko.transport:SSHException: Error reading SSH protocol banner
10:07:24 ERROR:paramiko.transport:
10:07:24 Error reading SSH protocol banner
10:07:24 SSH: Failed to connect to 192.168.1.254:22

I think there are two issues here,
- The plugin would benefit from a setting to restrict the number of re-tries, so that it doesnt get caught in a continuous loop, it if it returns a trigger as and error the user can create their own retry if they want
- The draytek seems to support a weird level of SSH where in it doesnt like you to create a pseudo-terminal when you log in (I think!)
http://stackoverflow.com/questions/31964108/environment-variable-differences-when-using-paramiko The first answer of this suggests adding get_pty=False to the exec_command

Maybe this is too much as its just me that is after it, I can maybe find a way to do it via telnet instead.

thanks for your help!
Phil
Experienced User
 
Posts: 105
Joined: Tue Apr 15, 2014 10:42 am
Location: Merseyside, UK

Re: Simple SSH Client

Postby Sem;colon » Tue Sep 22, 2015 12:51 pm

Phil wrote:- The plugin would benefit from a setting to restrict the number of re-tries, so that it doesnt get caught in a continuous loop, it if it returns a trigger as and error the user can create their own retry if they want

Hmm, no, that's by design... I don't want the user to deal with connection errors - and usually the user is not getting one anyway ;-)
But I just created a new version of the plugin which creates an event if the connection fails, so you could remove the host in that case so that it will not try again.
Phil wrote:- The draytek seems to support a weird level of SSH where in it doesnt like you to create a pseudo-terminal when you log in (I think!)http://stackoverflow.com/questions/31964108/environment-variable-differences-when-using-paramiko The first answer of this suggests adding get_pty=False to the exec_command

Well, that's just not working with the plugin - the plugin invokes a shell, that's how it works, no exec_command.

All in all it's very hart to find the issue when I don't have a device with this issue for testing. I don't think I can solve this, sorry
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby tivotyro » Thu Jun 09, 2016 2:38 pm

Good morning, and may I just take a moment to say BRAVO on all your hard work.

I have been trying my hand with it and can't seem to get a successful response.

I have the "SSH Add Host" in the Autostart.

I have a macro, with a single "SSH Send Command" action which all it does is send an "ls -al /etc" to the server.

It logs that it fires but never sends the command.

Any guidance you can give in regards to this would be greatly appreciated.

The server I am connecting to is a SuSE 13x server if that matters.

Code: Select all
09:23:13   ---> Welcome to EventGhost <---
09:23:15   Autostart
09:23:15      Plugin: SSH
09:23:15   Main.OnInit
09:24:33   SSH: Add Host: dc1probaeslu01.xxxxxx.com
09:24:44   SSH: Add Host: dc1probaeslu01.xxxxxx.com
09:24:44   SSH: Host "dc1probaeslu01" found on the network, trying to connect to dc1probaeslu01.xxxxxx.com:22...
09:24:46   SSH.Connected.dc1probaeslu01
09:24:49   SSH: dc1probaeslu01: Last login: Wed Jun  8 10:11:03 2016 from bftslbhw0000quh.xxxxxx.com
09:24:49   SSH: dc1probaeslu01: WARNING: Authorized use only.  Usage may be monitored.
09:24:49   SSH: dc1probaeslu01: tivotyro@dc1probaeslu01:~>
09:25:08   SSH: Send Command: ls -al /etc
09:25:47   SSH: Send Command: ls -al /etc
tivotyro
 
Posts: 1
Joined: Thu Jun 09, 2016 2:14 pm

Re: Simple SSH Client

Postby Sem;colon » Sat Jun 11, 2016 7:24 am

Hi tivotyro,

I think I know where the problem is, try this one:
__init__.py
(19.44 KiB) Downloaded 69 times


If it doesn't work:
what happens when you fire the command in Putty, does it immediately return the result, or does it maybe require some additional input?
can you try another command - something like ifconfig ?
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Sem;colon » Sat Aug 20, 2016 11:25 am

New Version!

v1.77:
-Added compatibillity with EventGhost 0.5.0 (should also work with old versions of EG again)
-The plugin is now in the .egplugin format, you can import it by doing a dobble-click on it (make sure EventGhost IS running when you do it!)

Get it from the first post!
Sem;colon
Experienced User
 
Posts: 579
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Simple SSH Client

Postby Sem;colon » Wed Dec 28, 2016 8:20 pm

New version!

v1.79:
-Category changed form external to other
-Added option "Additional Suffix" to the Send Command event, to specify a custom suffix for the "Data" event.
-Some minor improvements

Get it from the first post!
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 3 guests