SSH with bah.libcurlSSL
BlitzMax Forums/Brucey's Modules/SSH with bah.libcurlSSL
| ||
Is it possible to write something like a ssh client with bah.libcurlSSL? Thanks René |
| ||
It should be possible, with a suitable ssh library. |
| ||
I've added provisional support for ssh with libcurlssl. This means you can now use protocols such as SFTP. You can find the updated code in SVN (for now). You will need : BaH.libcurlssl BaH.libssh2 (and of course, OpenSSL) For specific ssh support, it will probably need to be done via a wrapper to the API - but I'll need to look into that. Note: Mac and Linux build of libssh2 is broken for now (until I get home and fix it). |
| ||
Fixed for Mac... :-p |
| ||
I'll give it a try... Thank you!!! :) |
| ||
I've tested it with SFTP specifically (eg. sftp://servername.com/path/to/dir ) and it works as expected. I've yet to read up on implementing "normal" ssh, which you might use as a telnet replacement, for example. Linux builds also. |
| ||
Compile error on Windows for me: Compiling:channel.c In file included from c:/code/blitzmax/mod/bah.mod/libssh2.mod/src/channel.c:42: C:/MinGW/include/unistd.h:36: error: conflicting types for 'usleep' c:/code/blitzmax/mod/bah.mod/libssh2.mod/src/libssh2_priv.h:138: error: previous definition of 'usleep' was here Build Error: failed to compile c:/code/blitzmax/mod/bah.mod/libssh2.mod/src/channel.c |
| ||
That's interesting. My original build was on Windows. What version of MinGW are you using?? |
| ||
5.1.4 -- the one that was recommended to use with Max3D |
| ||
If I remark out the usleep bit in libssh2_priv.h the module compiles without error, but no idea if that breaks anything else... |
| ||
Okay. Fixed the header. (rev 600) Looks like a libssh2 bug, although it compiles fine on 5.1.3. Does 5.1.4 use a different gcc version? Also included local copy of openssl headers for Win32, to remove the dependency on bah.libcurlssl, since the two shouldn't rely on each other... |
| ||
Looks like a libssh2 bug, although it compiles fine on 5.1.3. Does 5.1.4 use a different gcc version? No idea which version 5.1.3 uses, but it appears that 5.1.4 uses GCC 3.4.5. Anyway, I just synced up SVN again, and it looks like it compiles without error now. |
| ||
it looks like it compiles without error now. I had to wrap that function in an #ifdef ... weird. I've started implementation of the library. It's very cool. So far I've been able to SSH onto the Linux server in the office using Keyboard Interactive Authorization. Lots to do still, but I like it - nice, basic API. |
| ||
There's probably a really clever way to do all of this, but for now I've just knocked together a small example which SSH's onto a machine, and runs "ls". Example session: Executing:example_01.debug Authentication by keyboard-interactive succeeded. Last login: Wed Jan 28 20:34:50 2009 from localhost Bruceys-Mac-Mini:~ brucey$ ls Applications Pictures Desktop Public Documents Sites Downloads coretest.o Library test.sh Movies test.txt Music untitled.applescript NapSymbDn.ttf viewone NapSymbUp.ttf Bruceys-Mac-Mini:~ brucey$ Process complete Which isn't bad, I suppose. |
| ||
If anyone can work out how to do this reading/writing properly, I'd be really interested to hear about it :-p |
| ||
Streams maybe? I've compiled your example and encountered the same problem ;-) |
| ||
I have a cross-platform "putty" module lying around somewhere which is kind of interesting... which does telnetty things properly, and uses a Graphics context to display stuff... As you can imagine, I probably have as many experimental modules as I have released ones... |
| ||
Any chance of putt(y)ing it on svn? :-) Last edited 2011 |
| ||
It's not quite ready for the big time yet... But here's an example of it running the other day using a Max2D session renderer. I first ssh'd to my localhost, then telnetted to a remote server to watch something... ;-) ![]() |
| ||
If anyone can work out how to do this reading/writing properly, I'd be really interested to hear about it :-p How about something like this? while not right(out$,28) = "~nBruceys-Mac-Mini:~ brucey$ " read data loop wend If I'm not mistaken, you're referring to the unknown amount of data to read 'thing' I've also encountered... But this would not be properly though it probably won't cut off the remaining bytes on slow networks.... (?) |