开发者

Telnet Connectionstate Query

开发者 https://www.devze.com 2023-03-18 16:26 出处:网络
I would like to know if there is any way we can see programatically if a telnet connection has been established.

I would like to know if there is any way we can see programatically if a telnet connection has been established.

We use a telnet to authenticate against a firewall inside our domain, after we authenticated we can access the hosts behind the firewall. Is their any way in C# how to query this connection state without using third party libraries?

Thanks in advance,

Kevin

UPDATE: These firewalls also have a url login webpage, currently we query those to see if we are connected but this process is far from consistent.

  1. only 75% of 开发者_JAVA技巧our firewalls can be tested like this
  2. this process relates on a timeout which makes the application hang

    -> C# - Testing Internet page - Waiting for timeout


From my experimentation in a similar environment, the Telnet connection will only show up in netstat when the end user is being prompted to enter their credentials to log onto the firewall/server etc.

This connection will be between the IP of the SSL connection and the IP of the firewall/server on the same domain.

The status of this connection shows as ESTABLISHED while it is waiting for input but once the username and password have been authenticated this connection is no longer listed in the netstat output from the host.

However, a seperate connection from the SSL gateway IP and the host will be shown and the status of this will be in TIME_WAIT

Because you are going through an SSL connection there is no direct connection between the host and the destination.

Ideally you need to be able to programatically link the SSL to Firewall connection with the SSL to Host connection that is created. I would suggest capturing the netstat output during authentication using C#.


Can you perform some netstat functions in C# and query against that?

The Telnet connection should show up, right?


C# - Socket to log on to Firewall

--> This fixed the issue on a more speedy and elegant way.

-KL-

0

精彩评论

暂无评论...
验证码 换一张
取 消