判断端口通不通的几种方法
1、使用telnet判断 telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.用法: telnet ip port1)先用telnet连接不存在的端口[root@localhost ~]# telnet 10.0.250.3 80Trying 10.0.250.3...telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝2)再连接存在的端口[root@localhost ~]# telnet localhost 22Trying ::1...Connected to localhost. #看到Connected就连接成功了Escape character is '^]'.SSH-2.0-OpenSSH_5.3aProtocol mismatch.Connection closed by foreign host.2、使用ssh判断ssh是linux的标准配置并且最常用,可以用来判断端口吗?用法: ssh -v -p port username@ip-v 调试模式(会打印日志).-p 指定端口username可以随意1)连接不存在端口[root@localhost ~]# ssh 10.0.250.3 -p 80ssh: connect to host 10.0.250.3 port 80: Connection refused[root@localhost ~]# ssh 10.0.250.3 -p 80 -vOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.debug1: connect to address 10.0.250.3 port 80: Connection refusedssh: connect to host 10.0.250.3 port 80: Connection refused2)连接存在的端口[root@localhost ~]# ssh ... -pa^]^C[root@localhost ~]# ssh ... -p -vOpenSSH_.p, OpenSSL ..e-fips Febdebug: Reading configuration data /etc/ssh/ssh_configdebug: Applying options for *debug: Connecting to ... [...] port .debug: Connection established.debug: permanently_set_uid: /debug: identity file /root/.ssh/identity type -debug: identity file /root/.ssh/identity-cert type -debug: identity file /root/.ssh/id_rsa type -debug: identity file /root/.ssh/id_rsa-cert type -debug: identity file /root/.ssh/id_dsa type -debug: identity file /root/.ssh/id_dsa-cert type -a^C不用-v选项也可以咯3、使用wget判断wget是linux下的下载工具,需要先安装.用法: wget ip:port1)连接不存在的端口[root@localhost ~]# wget ...:---- ::--http://.../Connecting to ...:... failed: Connection refused.2)连接存在的端口[root@localhost ~]# wget ...:---- ::--http://...:/Connecting to ...:... connected. HTTP request sent, awaiting response...
设备端口还是面板端口,这是有区别,主要的就是专门设备检测或者替换法。

查看远程服务器的某一端口是否开启
工具/原料nctelnet方法/步骤1、首先端口分tcp、udp之分,所以同一个端口号还有tcp协议和udp协议之分。2、最常见的工具是telnet,但是telnet使用的是tcp协议,换句话说telnet只能检测tcp的这个端口打开了没。3、假设要看192.192.193.211这个IP的tcp 22端口是否打开,则运行telnet 192.192.193.211 22 来查看,如果出现下列信息,则表示该端口已打开。4、如果出现下面信息,表是该端口未打开。5、除了telnet以外,还有一个命令nc也可查看端口是否打开。6、同样查看tcp 22端口是否打开,可以运行nc -z 192.192.193.211 22,打开着就会出现下列信息:7、那如果想要查看udp 22 端口是否打开,运行 nc –uz 192.192.193.211 22, 打开这就会出现这些信息:8、如果查询的端口没有打开,会出现以下输出:8、nc 还可以一次性查看多了端口,例如:
以oracle数据库服务为例,oracle正常运行时1521是打开的。假设该服务器的ip是10.25.101.234。可在windows环境运行命令行窗口然后输入“telnet 10.25.101.234 1521”来判断1521端口是否开启。回车后如果命令行窗口不显示任何信息说明1521端口处于开启状态。如果1521端口处于关闭状态,命令行窗口会显示连接失败如果提示“不是内部或外部命令”则需要在“程序和功能”中进行设置。在控制面板中选择“程序和功能”,在“程序和功能”界面选择“打开或关闭Windows功能”。在弹出的“windows功能”窗口中将Telnet服务器和Telnet客户端勾选并保存设置。设置完成后需要重新打开一个命令行窗口运行telnet命令,设置前打开的命令窗口运行telnet是无效的。
1、安装telnet。我的win7下就没有telnet,在cmd下输入telnet提示没有该命令。于是我们进入控制面板---->程序---->打开或关闭windows功能。然后等一段时间,在出来的对话框把telnet客户端和telnet服务器勾选上,其他的不用管,然后点击确定。这样就安装好了telnet组件了。 2、 下面开始测试某个端口是否开启,比如我测的是192.168.3.42的2121这个端口。在cmd下输入start /min telnet 192.168.3.42 2121之后会出现一个窗口,是最小化的,你等一会,如果窗口自动关闭了,说明端口是关闭的或主机ping不通,反之端口开放.比如这个2121端口是开放的,就出现如图所以的窗口,否则窗口关闭。3、你可以用自己的机子做实验.在CMD下输入netstat -anp tcp可以查看当前主机tcp开放了哪些端口. 最后 ping命令是不能检测端口,只能检测你和相应IP是否能连通.
使用端口扫描工具扫一下就出来了,如果服务器是通过路由连接到INTERNET上来的,要注意在路由上设备一个端口映射
window服务器下用TelnetIP Address Port Number 命令,你试试吧。希望对你有帮助。

python 查看端口是否开通
一、常见端口扫描的原理 0、秘密扫描秘密扫描是一种不被审计工具所检测的扫描技术。它通常用于在通过普通的防火墙或路由器的筛选(filtering)时隐藏自己。秘密扫描能躲避IDS、防火墙、包过滤器和日志审计,从而获取目标端口的开放或关闭的信息。由于没有包含TCP 3次握手协议的任何部分,所以无法被记录下来,比半连接扫描更为隐蔽。但是这种扫描的缺点是扫描结果的不可靠性会增加,而且扫描主机也需要自己构造IP包。现有的秘密扫描有TCP FIN扫描、TCP ACK扫描、NULL扫描、XMAS扫描和SYN/ACK扫描等。1、Connect()扫描此扫描试图与每一个TCP端口进行“三次握手”通信。如果能够成功建立接连,则证明端口开发,否则为关闭。准确度很高,但是最容易被防火墙和IDS检测到,并且在目标主机的日志中会记录大量的连接请求以及错误信息。TCP connect端口扫描服务端与客户端建立连接成功(目标端口开放)的过程:① Client端发送SYN;② Server端返回SYN/ACK,表明端口开放;③ Client端返回ACK,表明连接已建立;④ Client端主动断开连接。建立连接成功(目标端口开放)TCP connect端口扫描服务端与客户端未建立连接成功(目标端口关闭)过程:① Client端发送SYN;② Server端返回RST/ACK,表明端口未开放。优点:实现简单,对操作者的权限没有严格要求(有些类型的端口扫描需要操作者具有root权限),系统中的任何用户都有权力使用这个调用,而且如果想要得到从目标端口返回banners信息,也只能采用这一方法。另一优点是扫描速度快。如果对每个目标端口以线性的方式,使用单独的connect()调用,可以通过同时打开多个套接字,从而加速扫描。缺点:是会在目标主机的日志记录中留下痕迹,易被发现,并且数据包会被过滤掉。目标主机的logs文件会显示一连串的连接和连接出错的服务信息,并且能很快地使它关闭。2、SYN扫描扫描器向目标主机的一个端口发送请求连接的SYN包,扫描器在收到SYN/ACK后,不是发送的ACK应答而是发送RST包请求断开连接。这样,三次握手就没有完成,无法建立正常的TCP连接,因此,这次扫描就不会被记录到系统日志中。这种扫描技术一般不会在目标主机上留下扫描痕迹。但是,这种扫描需要有root权限。端口开放:1、Client发送SYN 2、Server端发送SYN/ACK 3、Client发送RST断开(只需要前两步就可以判断端口开放)端口关闭:1、Client发送SYN 2、Server端回复RST(表示端口关闭)优点:SYN扫描要比TCP Connect()扫描隐蔽一些,SYN仅仅需要发送初始的SYN数据包给目标主机,如果端口开放,则相应SYN-ACK数据包;如果关闭,则响应RST数据包; 3、NULL扫描
1. 可以调用系统命令netstat 比如说22端口,查看如下有无返回netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ":2"'2. 用socket module, 例如 import socket;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)result = sock.connect_ex(('你的ip',22))if result == 0: print "Port is open"else: print "Port is not open"
可能是对filter的返回规则不熟悉造成的 它返回的是,筛选满足条件为True的实际变量值的迭代器,而不是True或False这两个布尔值。注意:py2.7返回的是list列表,py3.X返回的是迭代器这个函数的两个参数,需要解释一下第一个参数,要求是一个函数,比如你这个自定义的带变量参数的函数prime第二个参数,是作为你这个自定义函数的变量输入的序列或迭代器,比如你的这个range(1,100)其实你如果想要返回布尔值可能根本用不到filter这个函数应该只需要把下面的列表生成器改为:L = [ prime(i) for i in range(1,100) ]即可实现你想要的效果最后建议同时关注map函数map用法与其类似 而且py2和py3返回规则也不一样
import socket sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)sk.settimeout(1)try:sk.connect((‘IP地址’,端口号))print(“ok”)except Exception:print(“Failed”)sk.close()1. 可以调用系统命令netstat比如说22端口,查看如下有无返回netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ":2"'2. 用socket module, 例如import socket;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)result = sock.connect_ex(('你的ip',22))if result == 0: print "Port is open"else: print "Port is not open"或者def check_servers(self):logger.debug("Check honeypot servers thread start.")cmd = "netstat -tlnp"while (True):try:config_data = self.get_config_data()agentid = config_data["agentid"]global_par.evt_overtime = int(config_data["evt_overtime"])global_par.evt_cycle = int(config_data["evt_cycle"])sleep_time = config_data["heartbeat"]time.sleep(int(sleep_time))proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)buff = proc.communicate()proc.stdout.close()for server_config in agentid:if server_config["enabled"]:if server_config["id"] in str(buff):logger.info("{0}:{1} server running normal.".format(server_config["service"], server_config["id"]))else:logger.info("{0}:{1} server running error or is starting.".format(server_config["service"], server_config["id"]))except Exception as e:logger.error("Check servers error:", e)def monitor_honeypot_services(self):try:threading.Thread(target=self.check_servers).start()except Exception as e:logger.error("Monitor thread error:{0}".format(e)) self.monitor_honeypot_services()
1. 可以调用系统命令netstat 比如说22端口,查看如下有无返回netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ":2"'2. 用socket module, 例如 import socket;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)result = sock.connect_ex(('你的ip',22))if result == 0: print "Port is open"else: print "Port is not open"

如何ping一台主机的端口?意思是如何知道它的某个端口是否开启
可以使用telnet命令ping一个主机的端口,默认情况下telnet功能未启用,可以在电脑中开启这个功能。1、右击电脑桌面上的“我的电脑”图标,在展开的菜单中点击“属性”按钮打开属性窗口:2、点击弹出窗口上方的“控制面板”按钮,然后点击“程序”按钮:3、进入程序界面后,点击窗口中“启用或关闭Windows功能”按钮设置界面:4、在弹出的窗口中将“Telnet客户端”选中,然后点击“确定”按钮启动Telnet客户端:5、这时在cmd中使用telnet命令,后面填写ip和端口号即可查看端口是否开启:
1 首先端口分tcp、udp之分,所以同一个端口号还有tcp协议和udp协议之分。2我们一般最常见的工具是telnet,但是telnet使用的是tcp协议,换句话说telnet只能检测tcp的这个端口打开了没。方法很简单,假设我们要看192.192.193.211这个IP的tcp 22端口是否打开,则运行telnet 192.192.193.211 22 来查看,如果出现下列信息,则表示该端口已打开。3如果出现下面信息,表是该端口未打开。4除了telnet以外,还有一个命令nc(netcat)也可查看端口是否打开。同样查看tcp 22端口是否打开,可以运行nc -z 192.192.193.211 22,打开着就会出现下列信息:5那如果想要查看udp 22 端口是否打开,用什么可以做到呢?nc 也可以噢~ 运行 nc –uz 192.192.193.211 22(u代表UDP), 打开这就会出现这些信息:6如果查询的端口没有打开,会出现以下输出:7nc 还可以一次性查看多了端口,例如:END
如果仅仅通过CMD可以用 netstat -a查看端口 不过只能查询本机
如果你要ping 192.168.1.1的23端口 输入命令 ping 192.163.1.1:23就可以了
ping IP:端口 如果出现Timeout就是没开

判断端口通不通的几种方法
判断端口通不通的几种方法 1、使用telnet判断telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.用法: telnet ip port1)先用telnet连接不存在的端口[root@localhost ~]# telnet 10.0.250.3 80Trying 10.0.250.3...telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝2)再连接存在的端口[root@localhost ~]# telnet localhost 22Trying ::1...Connected to localhost. #看到Connected就连接成功了Escape character is '^]'.SSH-2.0-OpenSSH_5.3aProtocol mismatch.Connection closed by foreign host.2、使用ssh判断ssh是linux的标准配置并且最常用,可以用来判断端口吗?用法: ssh -v -p port username@ip-v 调试模式(会打印日志).-p 指定端口username可以随意1)连接不存在端口[root@localhost ~]# ssh 10.0.250.3 -p 80ssh: connect to host 10.0.250.3 port 80: Connection refused[root@localhost ~]# ssh 10.0.250.3 -p 80 -vOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.debug1: connect to address 10.0.250.3 port 80: Connection refused ssh: connect to host 10.0.250.3 port 80: Connection refused
1、使用telnet判断 telnet是windows标准服务,可以直接用;如果是linux机器,需要安装telnet.用法: telnet ip port1)先用telnet连接不存在的端口[root@localhost ~]# telnet 10.0.250.3 80Trying 10.0.250.3...telnet: connect to address 10.0.250.3: Connection refused #直接提示连接被拒绝2)再连接存在的端口[root@localhost ~]# telnet localhost 22Trying ::1...Connected to localhost. #看到Connected就连接成功了Escape character is '^]'.SSH-2.0-OpenSSH_5.3aProtocol mismatch.Connection closed by foreign host.2、使用ssh判断ssh是linux的标准配置并且最常用,可以用来判断端口吗看用法: ssh -v -p port username@ip-v 调试模式(会打印日志).-p 指定端口username可以随意1)连接不存在端口[root@localhost ~]# ssh 10.0.250.3 -p 80ssh: connect to host 10.0.250.3 port 80: Connection refused[root@localhost ~]# ssh 10.0.250.3 -p 80 -vOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Applying options for *debug1: Connecting to 10.0.250.3 [10.0.250.3] port 80.debug1: connect to address 10.0.250.3 port 80: Connection refusedssh: connect to host 10.0.250.3 port 80: Connection refused2)连接存在的端口[root@localhost ~]# ssh ... -pa^]^C[root@localhost ~]# ssh ... -p -vOpenSSH_.p, OpenSSL ..e-fips Febdebug: Reading configuration data /etc/ssh/ssh_configdebug: Applying options for *debug: Connecting to ... [...] port .debug: Connection established.debug: permanently_set_uid: /debug: identity file /root/.ssh/identity type -debug: identity file /root/.ssh/identity-cert type -debug: identity file /root/.ssh/id_rsa type -debug: identity file /root/.ssh/id_rsa-cert type -debug: identity file /root/.ssh/id_dsa type -debug: identity file /root/.ssh/id_dsa-cert type -a^C不用-v选项也可以咯3、使用wget判断wget是linux下的下载工具,需要先安装.用法: wget ip:port1)连接不存在的端口[root@localhost ~]# wget ...:---- ::--Connecting to ...:... failed: Connection refused.2)连接存在的端口[root@localhost ~]# wget ...:---- ::--Connecting to ...:... connected. HTTP request sent, awaiting response...

本文由 在线网速测试 整理编辑,转载请注明出处,原文链接:https://www.wangsu123.cn/news/312502.html。