To give you the best experience, this site uses cookies. Continuing to use 9bis.net means you agree to our use of cookies.
 

English version Russian version Version française Nederlandse versie Versión española Version portuguese Version polonaise Italian version Versiunea româna   KiTTY News

KiTTY : Forum

Last modification : -

KiTTY web site




Forum Home
 

Request: WinSCP when using PROXY

BAnt - Mon 12/06/2017 11:04:04 CEST +0200

Hi,

Sometimes I connect to servers using a PROXY (socks or HTTP). However, when connecting using it, the function Open WinSCP fails. This is because the tool only receives the target host info with this command-line:

$ winSCP.exe sftp://user@HOST-IP:HOST-PORT

However, using a SOCKS4 proxy it's possible to start the tool with:

$ winSCP.exe sftp://user@HOST-IP:HOST-PORT -rawsettings ProxyMethod=1 ProxyHost=SOCKS4-IP ProxyPort=SOCKS4-PORT

And as the KiTTY knows the SOCKS4-IP and SOCKS4-PORT values, why not pass them in the WinSCP call?


If you need more info for WinSCP proxy command-line parameters see:
http://winscp.net/forum/viewtopic.php?t=12191

I hope you like to implement it!

Cyd - Thu 15/06/2017 22:12:48 CEST +0200

Please test that beta build: http://www.9bis.net/kitty/data/beta/kitty.exe
I dont have any proxy to test it.

manu - Fri 16/06/2017 09:41:05 CEST +0200

Hi,

I tested this also, and... it works! Perfect!
KiTTY is the BEST ssh client in the world! ;)

manu - Fri 16/06/2017 11:18:32 CEST +0200

Hi,

After test this funtion (very useful), I recommand to make another extension that perhaps all users agree:

"Add a custom port to the command '__ws'"

As I see in the source code of the file "kitty.c"
http://svn.9bis.com/websvn/filedetails.php?repname=Sandbox&path=%2Fkitty%2Ftrunk%2Fkitty.c
this is the command that launches the WinSCP client. However, I like to add a third parameter for connect to another port than the default :22.

Why this? Because if I connect to another machine using SSH inside the terminal, and I add, for example: "-L 8022:127.0.0.1:22" then, with the command "winscp(8022)" (or similar sintax) then I'll start the WinSCP client connecting to the 8022 port. This works if in the KiTTY config I forward the local port 8022 to the remote 8022 (that is also forwarded to 22).

You agree?

manu - Fri 16/06/2017 14:40:36 CEST +0200

Hi,

After fully think on this, I suggest to provide this extension to the '__ws' command:

- Provide support for a custom URL that overrides the data. At time only "path" is used, however it can expanded to: "username@ip:port/path". Then, if some data is included, the "current" parameter is replaced.

Examples,

1) At time, is like "/current/directory" (it's implict that the full URL is "current-session-user@session-server-address:session-server-port/path")

2) If you send "master@/home/master" then the path is "/home/master/" and the user is replaced by "master" instead of the session user.

3) ":8022" replaces the target port to "8022" and the path is the default.

4) "admin@localhost:8022/root/" ...

I hope you get it!
You agree to extending this command in this way?
It will be compatible with the current implementation, so it doesn't break the legacy use.

Regards.

manu - Fri 16/06/2017 20:19:59 CEST +0200

Hi,

Using the command "__cm" I created some workaround that implements the requested functionality.

Perhaps you like to include this in the documentation of the integration with WinSCP, or futhermore add the option to use internal KiTTY variables in "__cm" (for address the "WinSCPPath" in the .INI file)

Here the function code:

winscp2() { BIN="${4:-C:\PROGRAM\WinSCP\WinSCP.exe}"; PORT="${1:-22}"; ADDR="${2:-127.0.0.1}"; LOGIN="${3:-${USER}}"; echo -ne "${BIN} sftp://${LOGIN}@${ADDR}:${PORT}"; }

If you put this inside one script (for easier use) or write directly in the shell, then you can call with:

$ winscp2
Launches the WinSCP using the path in the function using the default URL=current_user@127.0.0.1:22

$ winscp2 8022
Changes the default port

$ winscp2 8022 admin
Changes the default port and user

$ winscp2 8022 admin 192.168.1.1
Changes the default port, user and address

$ winscp2 8022 admin 192.168.1.1 'e:\bin\winscp\winscp.exe'
Changes the default port, user, address and binary

I hope this helps you. ;)
Regards.





Cyd - Mon 19/06/2017 09:15:04 CEST +0200

The fact is that you can already make it with an undocumented feature ... yet.
Jump at the very end off the configuration box, in the comment panel. You'll find a "SFTP Connect" field.
In you situation you have to enter 127.0.0.1:8022 ... and it should work with the normal winscp command.




Answer


The forum is actually closed