Telnet 测试 UDP 端口?

Telnet 并不支持 UDP 端口的测试,可以使用 nc 命令来进行测试。nc 命令两种都支持:

TCP

bash 复制代码
# nc -z -v -u [hostname/IP address] [port number] 

 

# nc -z -v 192.168.10.12 22 

Connection to 192.118.20.95 22 port [tcp/ssh] succeeded!

UDP

bash 复制代码
# nc -z -v [hostname/IP address] [port number] 

 

# nc -z -v -u 192.168.10.12 123 

Connection to 192.118.20.95 123 port [udp/ntp] succeeded!

下面是一些 nc 的简单用例:

bash 复制代码
  - Start a listener on the specified TCP port and send a file into it:
    nc -l -p port < filename

  - Connect to a target listener on the specified port and receive a file from it:
    nc host port > received_filename

  - Scan the open TCP ports of a specified host:
    nc -v -z -w timeout_in_seconds host start_port-end_port

  - Start a listener on the specified TCP port and provide your local shell access to the connected party (this is dangerous and can be abused):
    nc -l -p port -e shell_executable

  - Connect to a target listener and provide your local shell access to the remote party (this is dangerous and can be abused):
    nc host port -e shell_executable

  - Act as a proxy and forward data from a local TCP port to the given remote host:
    nc -l -p local_port | nc host remote_port

  - Send an HTTP GET request:
    echo -e "GET / HTTP/1.1\nHost: host\n\n" | nc host 80
相关推荐
数据知道4 分钟前
claw-code 源码分析:洁净室重写——在公开仓库里如何做「学得会、抄不得」的架构迁移?
网络·ai·claude code
很懒的程序员雄6 分钟前
OpenClaw 快速上手
网络·ai
数据知道6 分钟前
claw-code 源码分析:Python 快迭代 + Rust 硬化——双轨策略的成本、收益与边界在哪里?
网络·ai·claude code
派大星酷12 分钟前
跨域是什么 有什么影响 怎么解决
java·网络
wanhengidc19 分钟前
云手机 热血传奇游戏挂机
服务器·网络·安全·游戏·智能手机
航Hang*34 分钟前
网络安全技术基础——第3章:网络攻击技术
运维·网络·笔记·安全·web安全·php
洛水水42 分钟前
高性能网络编程:io_uring vs epoll、QPS测试工具实现与10道网络面试题解析
c++·udp·tcp·io_uring
OPHKVPS1 小时前
React2Shell漏洞攻击中的新型恶意软件EtherRAT详解
网络·安全·web安全
@insist1231 小时前
网络工程师-因特网与网络互联(四):传输层协议,TCP 与 UDP 的可靠与高效之道
网络·网络工程师·软考·软件水平考试
Once_day1 小时前
光通信(1)概述
网络·光通信