本文介绍了socat如何达到测试远程端口的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过socat测试远程端口是否可以访问?

How to test a remote port is reachable with socat?

使用netcat,我们可以

with netcat we can

nc -zv 192.168.1.15 22

如何用socat做到这一点?

How to do that with socat?

推荐答案

我认为手册页中的第一个示例可以工作

I would imagine that the first example in the man page would work

socat - TCP4:www.domain.org:80

在您的示例中,这将是(并添加2秒的连接超时):

For your example, this would be (and adding 2 second connect timeout):

socat - TCP4:192.168.1.15:22,connect-timeout=2

,响应将是sshd connect标语(如果正在监听)

and the response would be the sshd connect banner (if that is what is listening)

SSH-2.0-OpenSSH_5.3

socat[12650] E connecting to AF=2 192.168.189.6:23: Connection timed out

这篇关于socat如何达到测试远程端口的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 07:18