Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
there are 3 systems (computers) connected to each other in a networks.

1. MineOne,
2. SourceOne and
3 DestOne

I'm running my application on MineOne and I want to check TELNET Status from SourceOne system By adding the IP and Port of DestOne computer. Because DestOne has allowed some restriction on MineOne computer.

I tried using System.Net.Sockets.TcpClient using VB.net but if I use session.Connect(DestOneIP,DestOnePORT), How Can I be sure that I'm running / checking the Telnet event from SourceOne computer?

Please Suggest me how can I perform this testing.
Posted
Updated 1-Jun-13 10:23am
v2
Comments
Zoltán Zörgő 1-Jun-13 16:13pm    
You want to access DestOne via SourceOne as proxy from MineOne, because you can't access DestOne from MineOne directly? And you don't want to install anything on SourceOne? Am I right?
santosh.giri 1-Jun-13 16:21pm    
Yes Zoltan, I want to test the connectivity (Telnet) on DestOne via SourceOne as Proxy from MineOne.

Its not about Installing anything it is just about checking the DestOne(using Telnet) port from SourceOne computer using MineOne computer.
Zoltán Zörgő 1-Jun-13 16:35pm    
But you can't do that without installing a proxy on it. You need at least a socks proxy on SourceOne.
santosh.giri 1-Jun-13 16:43pm    
Ok, How can I install proxy on SourceOne Computer with my own application.

One more Question, I believe telnet.exe normally present in every windows computer can't we use that exe and use it by adding their relevant parameters?
Zoltán Zörgő 1-Jun-13 17:30pm    
What do you want exactly? It looks like hacking to me... and we don't tolerate that here.

You better read up on a Sock proxy before you evern attempt to write this. I'm talking about your "MineOne" code, not the proxy you need.

Frankly, you'd be wasting your time trying to write a socks proxy server. They already exist, follow standard for proxies and are quite complex to write. Get one "off-the-shelf", install it on "SourceOne" box and be done with it. This is not something your "MineOne" code should be concerned with at all.

You also cannot just specify the "DestOne" IP. Since you have a "man in the middle" (the proxy on "SourceOne"), you have to connect directly to that proxy, not "DestOne". You tell the proxy which server you want to connect to. The proxy will then know which two ends it needs to shuffle data back and forth between. Without that, its can't do its job.

Start reading here[^]...
 
Share this answer
 
As I mentioned, you "break into" a protected network. And the goal of the firewalls is to hinder access from outside to inside. And as you stated, you want to "break into" your own system. If this is true, you have the means to:

A) either change firewall settings, to let MineOne (but only that machine) get trough it, and reach DestOne directly,

B) or to install a proxy (as Dave explained). Proxying is dangerous! Why? Because it is blind if you don't implement access control, letting somebody use the proxy, you open your whole protected area. So be careful to use proper access control.

C) or even better, to install a monitoring system on SourceOne to monitor DestOne, and you could expose the monitor or service via the firewall

D) remotely execute code on SourceOne from MineOne. Have you tried psexec[^]? What you can do in psexec, you can do also in c#[^]. So if you have a user with proper rights on SourceOne, you can remotely execute something like tcping[^] for example.

There is an other scenario I can imagine: SourceOne is a gateway between two physically separated networks. If this is the case, option A is not usable.

Just a note telnet, is dangerous, since it is not encrypted. I you can, switch to ssh.
 
Share this answer
 
I decided to make an exe file that should be present in SourceOne Computer (somewhere in HDD), I set the environment variable for its path.

This exe file will accept the 2 parameter and will test the connectivity from SourceOne system itself and return the response back.

Now I have to catch that response and show it back to my main exe (application) which is running in MineOne computer system. In this way I can fix it.

I tried in my local system, but going to try as per the real scenario... Hope this should work.

Code Here

VB
Imports System.Net.TcpClient
 Sub Main()
        Dim cmdLineparams As String() = Environment.GetCommandLineArgs()

        If cmdLineparams.Length > 2 Then

            Dim IP= cmdLineparams(1)
            Dim port = cmdLineparams(2)

            ' Check Input Parameter for null/empty/white-space characters  
            If String.IsNullOrEmpty(IP) Then
               ' MsgBox("Parameter 1 Invalid", MsgBoxResult.Ok)


            ElseIf String.IsNullOrEmpty(Port) Then
               ' MsgBox("Parameter 2 Invalid", MsgBoxResult.Ok)
            Else
                Dim checkConn As New TcpClient
                Try
                    checkConn.Connect(IP, Port)
                    return true
                Catch ex As Exception
                    Return false
                End Try
            End If

        Else
'            MsgBox("Two parameters are required", MsgBoxResult.Ok)
        End If
    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900