使用curl命令查看服务器端口开放情况的方法

 更新时间:2024年05月08日 11:33:12   作者:sun0322  
这篇文章主要介绍了如何使用curl命令查看服务器端口开放情况的方法,文中通过代码示例和图文讲解的非常详细,具有一定的参考价值,需要的朋友可以参考下

1.ssh端口 22

curl -v 10.10.10.205:22

curl -v 10.10.10.205:22
*   Trying 10.10.10.205:22...
* Connected to 10.10.10.205 (10.10.10.205) port 22
> GET / HTTP/1.1
> Host: 10.10.10.205:22
> User-Agent: curl/8.4.0
> Accept: */*
>
* Received HTTP/0.9 when not allowed
* Closing connection
curl: (1) Received HTTP/0.9 when not allowed

2.mysql数据库端口 3306

curl -v 10.10.10.205:3306

curl -v 10.10.10.205:3306
*   Trying 10.10.10.205:3306...
* Connected to 10.10.10.205 (10.10.10.205) port 3306
> GET / HTTP/1.1
> Host: 10.10.10.205:3306
> User-Agent: curl/8.4.0
> Accept: */*
>
* Received HTTP/0.9 when not allowed
* Closing connection
curl: (1) Received HTTP/0.9 when not allowed

3.web应用端口 (Jellyfin 8082)

curl -v 10.10.10.205:8082

curl -v 10.10.10.205:8082
*   Trying 10.10.10.205:8082...
* Connected to 10.10.10.205 (10.10.10.205) port 8082
> GET / HTTP/1.1
> Host: 10.10.10.205:8082
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Content-Length: 0
< Date: Tue, 07 May 2024 13:22:55 GMT
< Server: Kestrel
< Location: /web/index.html
<
* Connection #0 to host 10.10.10.205 left intact

(wordpress 8088)

curl -v 10.10.10.205:8088

curl -v 10.10.10.205:8088
*   Trying 10.10.10.205:8088...
* Connected to 10.10.10.205 (10.10.10.205) port 8088
> GET / HTTP/1.1
> Host: 10.10.10.205:8088
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 07 May 2024 13:20:40 GMT
< Server: Apache/2.4.57 (Debian)
< X-Powered-By: PHP/8.2.18
< Link: <http://10.10.10.205:8088/wp-json/>; rel="https://api.w.org/"
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=UTF-8
<
<!DOCTYPE html>
。。。
。。。

(tomcat 8080)

curl -v 10.10.10.205:8080

curl -v 10.10.10.205:6666
*   Trying 10.10.10.205:6666...
* connect to 10.10.10.205 port 6666 failed: Connection refused
* Failed to connect to 10.10.10.205 port 6666 after 2051 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to 10.10.10.205 port 6666 after 2051 ms: Couldn't connect to server
 
C:\Users>curl -v 10.10.10.205:8080
*   Trying 10.10.10.205:8080...
* Connected to 10.10.10.205 (10.10.10.205) port 8080
> GET / HTTP/1.1
> Host: 10.10.10.205:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 200
< Content-Type: text/html;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Tue, 07 May 2024 13:19:25 GMT
<
 
 
 
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <title>Apache Tomcat/9.0.30</title>
。。。
。。。

4.不存在的端口

curl -v 10.10.10.205:6666

curl -v 10.10.10.205:6666
*   Trying 10.10.10.205:6666...
* connect to 10.10.10.205 port 6666 failed: Connection refused
* Failed to connect to 10.10.10.205 port 6666 after 2051 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to 10.10.10.205 port 6666 after 2051 ms: Couldn't connect to server

5.被防火墙阻挡的端口

连接一段时间后,提示timeout

以上就是使用curl命令查看服务器端口开放情况的方法的详细内容,更多关于curl查看端口开放情况的资料请关注脚本之家其它相关文章!

相关文章

  • 通过shell脚本循环进入目录执行命令的方法

    通过shell脚本循环进入目录执行命令的方法

    今天小编就为大家分享一篇通过shell脚本循环进入目录执行命令的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2018-06-06
  • python实现Linux异步epoll代码

    python实现Linux异步epoll代码

    本文提供了python实现Linux异步epoll的代码,供大家参考使用,希望对你有帮助
    2013-11-11
  • Linux bash Shell中的变量类型详解

    Linux bash Shell中的变量类型详解

    这篇文章主要介绍了Linux bash Shell中的变量类型详解,变量类型共分为本地变量、局部变量、环境变量、位置变量和特殊变量等,需要的朋友可以参考下
    2015-06-06
  • Linux使用文本编辑器vi常用命令

    Linux使用文本编辑器vi常用命令

    vi就是一种功能强大的文本编辑器,而vim则是高级版的vi,不但可以用不同颜色显示文字内容,还能进行诸如shell脚本、C语言程序编辑等功能,可以作为程序编辑器。下面通过本文给大家介绍linux 文本编辑器vi常用命令,一起看看吧
    2017-09-09
  • Linux 下vim使用教程

    Linux 下vim使用教程

    Vim是从 vi 发展出来的一个文本编辑器。这篇文章给大家介绍Linux 下vim使用教程,感兴趣的朋友跟随脚本之家小编一起看看吧
    2018-07-07
  • Linux shell中如何获取当前目录

    Linux shell中如何获取当前目录

    这篇文章主要介绍了Linux shell中如何获取当前目录问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2023-07-07
  • 浅析Linux打包压缩解压缩命令大全(收藏)

    浅析Linux打包压缩解压缩命令大全(收藏)

    本文给大家分享Linux打包压缩解压缩命令大全,非常不错,具有参考借鉴价值,需要的朋友参考下吧
    2017-09-09
  • Linux使用Split命令分割文件与合并的操作方法

    Linux使用Split命令分割文件与合并的操作方法

    Linux split是一个命令行工具,用于将文件分割成多个较小的文件,它可以按照文件大小、行数或者指定的分割符来进行分割,本文给大家介绍了Linux使用Split命令分割文件与合并的操作方法,需要的朋友可以参考下
    2024-03-03
  • linux下数据压缩的几种方法与查看方式(示例代码)

    linux下数据压缩的几种方法与查看方式(示例代码)

    这篇文章主要介绍了linux下数据压缩的几种方法与查看方式,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下
    2019-10-10
  • shell中set -e的具体使用

    shell中set -e的具体使用

    set -e 是一个 Shell 命令,它用于在脚本运行时自动退出,本文主要介绍了shell中set -e的具体使用,具有一定的参考价值,感兴趣的可以了解一下
    2024-05-05

最新评论