New SFTP plugin available now

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Post by *JOUBE »

pe.ch wrote:...plugin... ... add function ... identical like in classic FTP in TC
For sure, SFPT (/SCP) should become integrated part of Tc, like "classic FTP" in Tc and with the same features (and with external Libs, like FTPS in Tc, to prevent legal issues).

JOUBE
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

ghisler(Author) wrote:Masking double Quotes is problably not needed because Windows doesn't support file names with double quotes anyway.
Problem is on the server side. I tested it with Linux and the following characters need quoted filename:

" ", "(", ")", "$", "&", ";", "'", """

and these:

""", "$"

also need slashes.

Here's another "works for me" solution:

http://web.hisoftware.cz/sob/download/sftpplug_src09beta-scp-quote-2.patch
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Sob
Thanks!

Unfortunately background operation isn't currently possible, because the plugin interface doesn't support it. Integration in the normal FTP client is also not possible (at least not easily) because FTP and SFTP are completely different things, they share only the name. SFTP and FTPS (over SSL) are very similar, though, so it was easy to integrate FTPS in the normal FTP client.
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

ghisler(Author) wrote:Integration in the normal FTP client is also not possible
Do we really need sftp integrated directly into TC? Wouldn't it be enough if it just behaved more like current integrated ftp? I mean centralized bookmarks, use of "<number> drive", etc. I think it wouldn't even be too complicated (at least some parts).

I played with it a little and the basic idea is this: extend FS plugin API with bookmark handling functions. When user opens "connect to ftp server" dialog, ask plugins for their bookmarks and display them together with internal ftp ones. Only two things are needed for it to work: a name to display and the path of the connection in plugin FS to open. Another function(s) would be needed to tell the plugin to add/edit/delete a connection. And that's all. Simple and backward compatible.
The whole thing would of course be optional. The plugins where bookmarks don't have much sense (undelete, ext2fs, ..) would just not export these functions.

This is what I played with (it very roughly shows the idea):

http://web.hisoftware.cz/sob/download/sftpplug_src09beta-bookmarks.patch
http://web.hisoftware.cz/sob/download/fsplugin_bookmarks_ext_testapp.zip
surrounder
Junior Member
Junior Member
Posts: 3
Joined: 2008-12-15, 16:03 UTC

Post by *surrounder »

Additionally we have the different types of Proxies we have in the FTP client. Is it planned to integrate them into the SFTP plugin as well?
andres992
Member
Member
Posts: 124
Joined: 2006-04-12, 21:26 UTC

Post by *andres992 »

Copy path to clipboard works nicely with FTP but in SFTP the actual path is not copied. An option to copy the real path also in SFTP would be most welcome...

EDIT: After some more thinking, I have to admit that my request in that form may have been a stupid one. It seems that sftp links are quite complicated. Therefore, I think that a way to get a decent copy path option is to specify in each connection's settings a user-defined replacement pattern (as a special option only for "Copy Path") to get the actual path of the specified connection, e.g.

The path in TC is:

\\\Secure FTP\Server\Dir1\Dir2\Dir3\Dir4\file.txt

and to get the real path, the user sets the replacement pattern as e.g.:

\\\Secure FTP\Server\Dir1\Dir2\ -> http://

(= http://Dir3/Dir4/file.txt)

or

\\\Secure FTP\Server\Dir1\Dir2\ -> sftp://

(= sftp://Dir3/Dir4/file.txt)

or maybe

\\\Secure FTP\Server\Dir1\Dir2\Dir3\ -> http://www.server.com/

(= http://www.server.com/Dir4/file.txt)
#68776 Personal Licence
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2surrounder
Sorry, SFTP has only the name in common with FTP, but it works in a completely different way. Think of it like secure telnet (SSH) where a special channel is opened for file transfers (SFTP or SCP). Therefore normal FTP proxies cannot be used with it. The only other proxy types which could work would be Socks4/5.

2andres992
Sorry, this isn't possible with the current plugin interface.
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Another little contribution:

http://web.hisoftware.cz/sob/download/sftpplug_src091beta-proxy.patch

The patch:

1) Fixes HTTP CONNECT type proxy to work with IPv6 (fixed parsing of proxy hostname and CONNECT request) and Apache's mod_proxy (added "Host" header to request, because Apache wants it).
Works fine.

2) Adds support for SOCKS 4A proxy.
Works fine.

3) Adds support for SOCKS 5 proxy.
Not completely working. Connection to proxy is ok, (optional) authentication works, connection to destination host is established, packets start flowing, but ssh initialization always fails with "unable to exchange encryption keys" and I'm out of ideas how I could influence that.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks a lot for these additions! I will soon integrate them into the plugin and then test why Socks5 fails ( I have a test proxy locally which works OK with FTPS).

Btw, can you recommend a patch tool for Windows? Currently I'm applying these all by hand. I have tortoisesvn installed for test purposes and .patch is associated with it, but it doesn't want to apply the patch because the files aren't controlled by svn...
Author of Total Commander
https://www.ghisler.com
andres992
Member
Member
Posts: 124
Joined: 2006-04-12, 21:26 UTC

Post by *andres992 »

This may be totally offtopical again but I have used the V_KLay freeware (http://www.vi-soft.com.ua/) to patch mobile phone binaries on my system disk. Apart from the fact that the app is meant for mobile phone fullflashes, I think it is possible to use V_Klay to apply any kind of binary patches through Flasher -> Open File ...

V_Klay has specific patch format (ordinary text files, where part of the file is the old binary segment and the other part is the new segment that replaces the old one).

Of course, if a specific binary patcher for Windows binaries comes up, it would probably be a better solution but I think V_Klay could be better than patching manually. Sorry if my recommendation is inappropriate, I was just trying to help...

Another one I have used is CodeFusion patch generator (http://www.kobik.net/codefusion.asp), which can "simply byte-patch at a particular offset".
#68776 Personal Licence
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Hmm, I doubt that these will work with the Unix text file .patch format...
Author of Total Commander
https://www.ghisler.com
User avatar
Hacker
Moderator
Moderator
Posts: 13141
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks, that worked fine!

I have put the SOCKS code from user "Sob" into the plugin now. It didn't work because the last SOCKS5 reply wasn't interpreted correctly, so some remaining SOCKS response remained in the data stream and made the SFTP negotiation impossible. I have also added support for SOCKS4 when the user has entered a numeric IPv4 address, and numeric IPv4 and IPv6 handling in SOCKS5.

There are also some more improvements in the new beta:
  • the complete connect process is now asnchronous, so the user can abort it at any time
  • the plugin now supports text file conversion from/to the Unix format (line feed only). The plugin tries to detect Unix servers in two ways: First it gets the environment variable $OSTYPE, and looks for Unix, Linux and Aix. Then it sends "ls -l" and looks for the type of line breaks sent by the server. Maybe someone has a better idea? Anyway, you can also configure it by hand.
  • text conversion is a bit more clever than the normal ftp servers: Files containing 0 bytes are not converted, and text files with Windows line breaks (0d 0a) are not converted again (would be resulting in 0d 0d 0a).
You can download the latest version 0.92 of the plugin from the first post of this thread now.

Please remember that this is still a beta version!
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Post by *JOUBE »

ghisler(Author) wrote:You can download the latest version 0.92 of the plugin...
Thank you.


Readme.txt of Plugin version 0.92:

Code: Select all

20081231 Added: CR <-> CRLF conversion for transfers from/to Unix servers.
Is it possible, to disable generaly this horrible feature?

JOUBE
Sob
Power Member
Power Member
Posts: 945
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

ghisler(Author) wrote:Btw, can you recommend a patch tool for Windows?
I use the same as Hacker already suggested. Not exactly very user-friendly, some nice gui would help sometimes, but it works.
ghisler(Author) wrote:It didn't work because the last SOCKS5 reply wasn't interpreted correctly, ...
Stupid error. :) But looking at the new code, I'd say there's brand new error there too. :) In case 3, buf[4] is not available. You can either read 5 bytes as I did (instead 4) and then read one less than needed for address, or read the extra byte (with domain name length) in case 3.
Post Reply