LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bi-directional SSH communication

I have a blackbox device that we currently connect to using PuTTY.  I now need to integrate that functionality into a LabVIEW VI.  I have tried using PuTTY and PLink through the system exec VI which works but I need to be able to read the responses back from the blackbox into my VI.  Using the system exec I am simply launching a PuTTY window, this is not exchanging data with my VI.  I then tried the "Native SSH" example I found in this community.  I entered the Username, IP and password and the VI runs with no errors but I am not seeing the response from the black box.  I will need to send additional commands to the box based on the responses received.  Any help?

0 Kudos
Message 1 of 13
(4,736 Views)

Hi JerpVTX,

 

I have written a library that creates an SSH session where you can interactively communicate with a remote machine.

 

Have a look at the following blog post where I have videos showing how to use the library and also a download for the library. http://www.labvolution.com/ssh-with-labview/

 

There is also an SFTP component which allows transfering of files. http://www.labvolution.com/sftp-file-transfer-labview/

 

I hope this helps,

 

Greg

0 Kudos
Message 2 of 13
(4,711 Views)

Greg,

Thanks for the reply.  I haven't dug into your application as it appears to be created in a newer version than I am running.  I'm on LV '14.  I believe there is a link for converting which I will try to find.

0 Kudos
Message 3 of 13
(4,699 Views)

I have a 2014 version at home which I can email to you later this evening. If you DM me your email address I can send it.

 

There used to be an online converter on LabVIEW Hacker, but I couldn't find it when I looked the other day.

0 Kudos
Message 4 of 13
(4,694 Views)

Please support this idea:

 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Native-SSH-and-SFTP-Support/idi-p/1141529

 

6 years and 200+ kudos later and still no native support for SSH.

 

Products under test as well as test & measurement equipment (like IoT) is migrating to secure comms and we still have to limp around without native support. Smiley Mad

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 5 of 13
(4,676 Views)
Hi Phillip,

I totally agree. It's really strange why a protocol so widely used is not supported in LabVIEW.

My library is part of the Reference Design Portal https://decibel.ni.com/content/docs/DOC-47959 and I am planning to submit it to the tools network, just need to find some time to get packaged properly.
0 Kudos
Message 6 of 13
(4,668 Views)

OK, fella's these tools are great and I am happy that Greg was kind enough to post them.  I have made some progress but am now, once again, stumped.  When I write a single letter out to my end device (the letter being 'c') I am actually sending c^J.  I put in a message box so I could pause execution and grab the following screenshot.  What am I doing wrong (and I assume I am).  THANKS!!!

EntryError

0 Kudos
Message 7 of 13
(4,593 Views)

Hi John, 

I'm glad you are making pogress. One thing that might be happening is that when you send 'c', a line feed (\n) is automatically concatenated to the string to simulate the return key being pressed. This is done by the dll.

When trying to change the serial number, the device might be expecting 'c' only, without the line feed. Have you tried to do this process manually using PuTTY? What are the process steps?

I'll compile a new version of the dll that does not concatenate a line feed so you can try it out. You will then have to concatenate a line feed to all the other commands you input to Write.vi.

Do this for normal commands: (This change only applies to Write.vi)

concatenate.png

Do this for commands that do not require a line feed:

concatenate2.png

I've DM'd you a link to the new dll. I've versioned it 3.1.0.4.

I hope this helps.

Cheers, 

Greg

Message 8 of 13
(4,575 Views)

Greg,

You are absolutely correct.  In PuTTY, I just enter 'c' without a carriage return so the line feed is probably the issue. I'll try the new DLL.  Being a rather remedial LabView coder I try to power through things to see if I can figure them out on my own.  But one thing I don't understand is how the .DLL's come into play.  Is it as simple as deleting the old one and copying the new one in its place (in the...\references directory) or is there something I need to do inside of my project?

 

Thnaks!

0 Kudos
Message 9 of 13
(4,563 Views)

Hi John, 

 

Just close down all your LabVIEW code and the LabVIEW getting started window.

Copy and replace the LabSSH.dll in the references folder of my library.

Open your LabVIEW project, this will cause the conflict dialog to open which you can just skip through as it is only indicating that the dll version has changed. 

Add a line feed to the commands where you need them in your LabVIEW code. 

 

That should be it. If it doesn't work then let me know and there is another step that you could do.

Cheers, 

Greg

0 Kudos
Message 10 of 13
(4,559 Views)