通过另一个系统从一个系统到另一个系统进行Telnet [英] Doing Telnet from one System to another System via another system

查看:90
本文介绍了通过另一个系统从一个系统到另一个系统进行Telnet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络中有3个系统(计算机)相互连接。



1. MineOne

2. SourceOne

3 DestOne



我是在 MineOne 上运行我的应用程序,我想从 SourceOne 系统检查TELNET状态通过添加DestOne计算机的IP和端口。因为DestOne允许对 MineOne 计算机进行一些限制。



我尝试使用VB.net使用System.Net.Sockets.TcpClient但是如果我使用session.Connect(DestOneIP,DestOnePORT),我如何确定我正在运行/检查来自SourceOne计算机的Telnet事件?



请建议我怎么样我执行此测试。

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.

推荐答案

在尝试编写此代码之前,最好先阅读Sock代理。我在谈论你的MineOne代码,而不是你需要的代理。



坦率地说,你在浪费时间去编写一个袜子代理服务器。它们已经存在,遵循代理标准并且编写起来相当复杂。获得一个现成的,将其安装在SourceOne框中并完成它。这不是你的MineOne代码应该关注的东西。



你也不能只指定DestOneIP。由于您有一个中间人(SourceOne上的代理),您必须直接连接到该代理,而不是DestOne。您告诉代理您要连接到哪个服务器。然后,代理将知道在两者之间来回移动数据所需的两端。没有它,它就无法完成它的工作。



开始阅读此处 [ ^ ] ...
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[^]...

正如我所提到的,你闯入受保护的网络。防火墙的目标是阻碍从外到内的访问。正如你所说,你想闯入你自己的系统。如果这是真的,你有办法:



A)要么更改防火墙设置,要让MineOne(但只有那台机器)通过它,然后到达DestOne直接,



B)或安装代理(如Dave所解释)。代理是危险的!为什么?因为如果你没有实现访问控制是盲目的,让某人使用代理,你打开整个保护区。所以要小心使用适当的访问控制。



C)甚至更好,在SourceOne上安装监控系统来监控DestOne,你可以暴露显示器或服务通过防火墙



D)从MineOne远程执行SourceOne上的代码。您是否尝试过 psexec [ ^ ]?你可以在psexec中做什么,你也可以在 c# [ ^ ]。因此,如果您的用户拥有SourceOne的适当权限,您可以远程执行 tcping [ ^ ]例如。



还有一个我能想象到的场景:SourceOne是两个物理上分离的网络之间的网关。如果是这种情况,则选项A不可用。



只是注意telnet,是危险的,因为它没有加密。我可以,切换到ssh。
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.


我决定制作一个应该存在于SourceOne计算机(HDD中某处)的exe文件,我为其路径设置了环境变量。



这个exe文件将接受2参数,并将测试来自SourceOne系统本身的连接并返回响应。



现在我必须捕获该响应并将其显示回我在MineOne计算机系统中运行的主exe(应用程序)。通过这种方式,我可以解决它。



我在我的本地系统中尝试过,但是按照真实场景尝试...希望这应该有效。



代码在这里



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

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


这篇关于通过另一个系统从一个系统到另一个系统进行Telnet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆