检查远程主机上一个端口的状态 [英] Check status of one port on remote host

查看:74
本文介绍了检查远程主机上一个端口的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个命令行,可以检查远程主机上的端口状态.我尝试了ping xxx.xxx.xxx.xxx:161,但无法识别主机".我以为这是一个好"答案,直到我对一个我知道该端口已打开的主机执行了相同的命令.这是针对Windows上的批处理文件的,它将检查远程端口的状态,然后运行使用该远程端口获取信息的命令,然后再次运行remote port check命令,然后使用下一个服务器上的该端口获取信息的命令, 等等.我到处都看过了,以为ping可以做到这一点,但是我想必定存在ping的各种版本,因为我正在执行此操作的服务器上没有显示该选项.

I need a command line that can check the port status on a remote host. I tried ping xxx.xxx.xxx.xxx:161 but it doesn't recognize the "host". I thought it was a "good" answer until I did the same command against a host I know has that port open. This is for a batch file on Windows that will check the status of the remote port then run a command that uses that remote port for information, then the remote port check command again, then the command that uses that port on the next server for information, and so on. I've looked everywhere and thought the ping might do it, but there must be various versions of ping, I suppose as the server I am doing this on does not show that option.

只是出于轻笑,我从网站上尝试了基于Web的远程端口检查器-结果对于问题"服务器和正确的服务器都是正确的.但是,我不能在其中具有500多个服务器IP的批处理中使用它.

Just for chuckles, I tried a web-based remote port checker from a website - and the results were correct for both the "problem" server and the correct server. However, I can't use that in a batch run with 500+ server IPs in it.

我能做些简单的事情吗?我的Perl技能非常生锈(使用或丢失),除了批处理之外,不了解其他基于Windows的语言. Unix是我的技能,但这必须从Widows Server 2003中执行.

Is there something I can do that is simple? My Perl skills are extremely rusty (use it or lose it), don't know any other Windows based languages except batch. Unix is my skill, but this must be executed from Widows Server 2003.

推荐答案

您似乎正在寻找端口扫描程序,例如 nmap netcat ,它们都可用于Windows,Linux和Mac OS X.

You seem to be looking for a port scanner such as nmap or netcat, both of which are available for Windows, Linux, and Mac OS X.

例如,检查已知IP上的telnet:

For example, check for telnet on a known ip:

nmap -A 192.168.0.5/32 -p 23

例如,在host.example.com上查找从20到30的开放端口:

For example, look for open ports from 20 to 30 on host.example.com:

nc -z host.example.com 20-30

这篇关于检查远程主机上一个端口的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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