-1

I am using this code for connecting to an SFTP server:

var connectionInfo = new PasswordConnectionInfo(txtHost.Text, 22, txtUsername.Text, txtPassword.Text, ProxyTypes.Http, "209.xx.xxx.xxx", 3128,"proxyUser","proxyPass");

sftp = new SftpClient(connectionInfo);
try
{
    sftp.Connect();
    addItemToListBox("Connect", "Connect to server Success.");
    BeginInvoke((MethodInvoker)delegate()
    {
        connect_state(false);
    });
    connection_flag = true;
}
catch
{
    addItemToListBox("Connect", "Connect to server failed.");
    addItemToListBox("Connect", "Try agine.");
    connection_flag = false;
}

Now, when sniffing my connection with Wireshark, I can see the HTTP request, including the SFTP server IP address.

How can I hide the SFTP server IP address from the proxy server?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
abedi98
  • 61
  • 6

1 Answers1

1

All you can see is the proxy request. The underlying SSH and SFTP packets are (should be) encrypted.

Regarding hiding IP address from the proxy server:
You cannot hide IP address from any proxy server (or router or another network component) on the way to the destination server, because the proxy server (or another component) needs to know where to route the request to.

The only workaround is to tunnel through the proxy server. But for that you have to be able to setup the end of the tunnel on some network component before the destination server, but behind the proxy (and you have to be willing to make the end-of-the-tunnel IP address visible to the proxy). This way the end-of-the-tunnel is made the destination for the proxy.

Simply said, if you do not control any network component between the proxy and the destination, you have to let the proxy know the destination IP. There's no way around that. That's how Internet works. The IP address is the only way to identify the destination.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992