Thursday, 7 November 2013

How to Detect Listen port Bitvise Ssh Client

Hi, finally i'm back to share posting "How to Detect Listen port Bitvise Ssh Client".

Why I'm share this posting?
Because i'm always use Bitvise to access my VPS on desktop, and i has build application that used Bitvise SSH. Then i have problem how to detect listen port of my bitvise profile is connected or not. I'm already looking on google how to that, but at the end I can not found it. So I have an idea with used third party application, that's "Paping".
What is Paping
Paping (pronounced pah ping) is a computer network administration utility used to test the reachability of a host on an Internet Protocol (TCP/IP) network and to measure the time it takes to connect to a specified port.

Syntax: paping [options] destination
Options:
  • -?, --help
  • -p, --port N
  •  -t, --timeout
  • -c, --count N
Bitvise services socks is TCP/IP listen interface, so that why i use paping command.
SSH port forwarding https://www.bitvise.com/port-forwarding


As you can see my SSH port forwarding is listen on 127.0.0.1 port 1081, below is the log if my SSH server success connected.
Question is how to automation my ssh with other application.
Oke let's begin, you must read our current article :
Our Application :
After that open our project "RedirectStandardOutput-Paping" , do some modified in Method OutputHandler 
I will send command paping to ping localhost/127.0.0.1 with port 1081
Command : 127.0.0.1 -p 1081

public void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
        {
            SetText(outLine.Data);
//Add if conditional
if(outLine.Data.Contains("Connected")) MessageNox.Show("Your SSH Connected");
else(outLine.Data.Contains("Connection timed out")) MessageNox.Show("Your SSH Disconnected");
        }

Finally , rebuild your project.
Thank You