远程检查IP端口状态
我找到了一篇关于在计算机上获取活动 tcp/udp 连接的文章。
http://www.codeproject.com/KB/IP/iphlpapi.aspx
然而,我的问题是我需要能够远程确定活动连接 - 以查看特定端口是否正在运行或侦听而不篡改机器。
这可能吗?
看起来不像是原生的,否则可能会带来安全问题。 另一种方法是查询远程服务,然后该服务可以在本地计算机上进行必要的调用。
有什么想法吗?
I found an article on getting active tcp/udp connections on a machine.
http://www.codeproject.com/KB/IP/iphlpapi.aspx
My issue however is I need to be able to determine active connections remotely - to see if a particular port is running or listening without tampering with the machine.
Is this possible?
Doesn't seem like it natively, otherwise it could pose a security issue. The alternative would be to query a remoting service which could then make the necessary calls on the local machine.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Nmap 就是您要找的。
Nmap is what you are looking for.
如果远程计算机不知道,则无法知道哪些端口已打开。 但是您可以在端口上运行的程序不知道该信息的情况下确定该信息(即不干扰程序)。
使用 SYN 扫描:
为了建立连接,TCP 使用三向握手。 可以利用这一点在程序不知道的情况下查明端口是否打开。
握手的工作原理如下:
来源维基百科
正如下面提到的,我认为nmap 可以进行SYN扫描。
使用套接字进行 TCP 端口扫描:
确定哪些端口打开的一种方法是打开该端口的套接字。 或者像您提到的那样到另一个端口为您找到信息。
例如,从命令提示符或终端:
UDP 端口扫描:
如果 UDP 数据包发送到未开放的端口,系统将响应 ICMP 端口不可达消息。 您可以使用此方法来确定端口是打开还是关闭。 但接收程序会知道。
There is no way to know which ports are open without the remote computer knowing it. But you can determine the information without the program running on the port knowing it (i.e. without interfering with the program).
Use SYN scanning:
To establish a connection, TCP uses a three-way handshake. This can be exploited to find out if a port is open or not without the program knowing.
The handshake works as follows:
Source Wikipedia
As is mentioned below, I think nmap can do SYN scanning.
Using sockets for TCP port scanning:
One way to determine which ports are open is to open a socket to that port. Or to a different port which finds out the information for you like you mentioned.
For example from command prompt or a terminal:
UDP Port scanning:
if a UDP packet is sent to a port that is not open, the system will respond with an ICMP port unreachable message. You can use this method to determine if a port is open or close. But the receiving program will know.
neouser99(等人)建议NMAP。 如果您只想检测远程计算机上打开的端口,则 NMAP 非常有用。
但从您的问题的声音来看,您实际上是在尝试确定远程计算机上打开和连接的端口和。 如果您需要通用监控解决方案(包括连接的端口),那么您可以在远程计算机上安装 snmp 服务器。 有两个 MIB 可让您检查端口状态,它们是 TCP-MIB::tcpConnectionTable 和 UDP-MIB::udpEndpointTable。
net-snmp 中提供的守护进程(服务器)很可能获得了对这些 mib 的支持。
neouser99 (et al) has suggested NMAP. NMAP is very good if all you're trying to do is to detect ports that are open on the remote machine.
But from the sounds of your question you're actually trying to determine what ports are both open and connected on your remote machine. If you're after a general monitoring solution, including the connected ports, then you could install an snmp server on your remote machine. There are two MIBs that let you check for port status which are TCP-MIB::tcpConnectionTable and UDP-MIB::udpEndpointTable.
The daemon (server) supplied in net-snmp has most likely got support for these mibs.