Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
whatportis — Whatportis:探索 IANA 的端口列表 | Kitploit
工具/GitHubGitHub/ncrocfer/whatportis
通用工具网络映射信息收集
GitHubncrocfer/whatportis

whatportis

Whatportis:探索 IANA 的端口列表

查看仓库
690673年前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

whatportis

.. image:: https://github.com/opencve/opencve/workflows/Tests/badge.svg :target: https://github.com/ncrocfer/whatportis/actions/workflows/tests.yml

.. image:: https://badge.fury.io/py/whatportis.svg :target: https://pypi.python.org/pypi/whatportis/

.. image:: https://img.shields.io/badge/python-3.6%2B-blue.svg :target: https://pypi.python.org/pypi/whatportis/

.. image:: https://img.shields.io/github/license/ncrocfer/whatportis.svg :target: https://github.com/ncrocfer/whatportis/blob/master/LICENSE.txt

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/python/black

搜索服务的默认端口号是一项常见任务。/etc/services 文件中提供了一些端口,但列表不完整且该解决方案不可移植。

Whatportis 是一个简单的工具,它下载 Iana.org <http://www.iana.org/assignments/port-numbers>_ 数据库并使用它来探索官方端口列表。

用法

Whatportis 允许你查找某个服务关联的端口:

.. code-block:: shell

root@kitploit:~
$ whatportis redis
+-------+------+----------+---------------------------------------+
| Name  | Port | Protocol | Description                           |
+-------+------+----------+---------------------------------------+
| redis | 6379 |   tcp    | An advanced key-value cache and store |
+-------+------+----------+---------------------------------------+

或者,反过来,查找某个端口号关联的服务:

.. code-block:: shell

root@kitploit:~
$ whatportis 5432
+------------+------+----------+---------------------+
| Name       | Port | Protocol | Description         |
+------------+------+----------+---------------------+
| postgresql | 5432 | tcp, udp | PostgreSQL Database |
+------------+------+----------+---------------------+

你也可以通过添加 :code:--like 选项来搜索模式,而无需知道确切名称:

.. code-block:: shell

root@kitploit:~
$ whatportis mysql --like
+----------------+-------+----------+-----------------------------------+
| Name           |  Port | Protocol | Description                       |
+----------------+-------+----------+-----------------------------------+
| mysql-cluster  |  1186 | tcp, udp | MySQL Cluster Manager             |
| mysql-cm-agent |  1862 | tcp, udp | MySQL Cluster Manager Agent       |
| mysql-im       |  2273 | tcp, udp | MySQL Instance Manager            |
| mysql          |  3306 | tcp, udp | MySQL                             |
| mysql-proxy    |  6446 | tcp, udp | MySQL Proxy                       |
| mysqlx         | 33060 |   tcp    | MySQL Database Extended Interface |
+----------------+-------+----------+-----------------------------------+

安装

.. code-block:: shell

root@kitploit:~
$ pip install whatportis

数据库同步

Whatportis 使用本地 JSON 文件 (:code:~/.whatportis_db.json) 来查询端口列表。首次使用时会自动创建该文件,之后你可以使用 :code:--update 选项进行同步:

.. code-block:: shell

root@kitploit:~
$ whatportis --update
Previous database will be updated, do you want to continue? [y/N]: y
Downloading https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv...
Populating database...
14145 ports imported.

JSON 输出

你可以使用 :code:--json 选项将结果以 JSON 格式显示:

.. code-block:: shell

root@kitploit:~
$ whatportis 5432 --json
[
    {
        "name": "postgresql",
        "port": "5432",
        "protocol": "tcp, udp",
        "description": "PostgreSQL Database"
    }
]

REST API

Whatportis 也可以作为 RESTful API 服务器启动。此功能默认未启用,你需要安装一个额外的包:

.. code-block:: shell

root@kitploit:~
$ pip install whatportis[server]
$ whatportis --server localhost 8080
 * Serving Flask app "whatportis.server" (lazy loading)
 * Environment: prod
 * Debug mode: off
 * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)

端点 :code:/ports 用于获取完整列表(可能很长),:code:/ports/<search> 用于搜索特定端口:

.. code-block:: shell

root@kitploit:~
$ curl http://127.0.0.1:8080/ports/3306
{"ports":[{"description":"MySQL","name":"mysql","port":"3306","protocol":"tcp, udp"}]}

$ curl http://localhost:8080/ports/redis
{"ports":[{"description":"An advanced key-value cache and store","name":"redis","port":"6379","protocol":"tcp"}]}

你可以使用 :code:?like 参数搜索模式。

下载工具