hping3

使用 hping3 构造自定义 TCP/UDP/ICMP 数据包。适用于测试防火墙规则、使用非默认标志探测服务、测量到 TCP 端口的往返时间(RTT)、在 ICMP 被屏蔽的主机后映射开放端口,或在用户控制的系统上模拟数据包模式以进行网络故障排查。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "hping3":https://skillpi.com/zh/skills/deepskill-f1b81b9ac73eec010620b62ffe4d94d5ec70e95de858264572bfd08a64ffcd60。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

使用 hping3 构造自定义 TCP/UDP/ICMP 数据包。适用于测试防火墙规则、使用非默认标志探测服务、测量到 TCP 端口的往返时间(RTT)、在 ICMP 被屏蔽的主机后映射开放端口,或在用户控制的系统上模拟数据包模式以进行网络故障排查。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: hping3
description: >-
  Craft custom TCP/UDP/ICMP packets with hping3. Use when a user asks to
  test firewall rules, probe services with non-default flags, measure RTT
  to a TCP port, map open ports behind an ICMP-blocking host, or simulate
  packet patterns for network troubleshooting on systems they control.
license: Apache-2.0
compatibility: 'hping3 3.0.0-alpha-2, Linux'
metadata:
  author: terminal-skills
  version: 1.0.0
  category: devops
  tags:
    - hping3
    - packet-crafting
    - network-testing
    - firewall-testing
    - penetration-testing

hping3

Overview

hping3 is a command-line TCP/IP packet crafter. Unlike ping (ICMP only), hping3 can send TCP, UDP, and raw IP packets with any flag combination, arbitrary payloads, spoofed sources, and fragmentation — useful for firewall auditing, ACL testing, reachability probes where ICMP is filtered, and low-level network experiments on your own infrastructure. It is interactive and scriptable.

Instructions

Step 1: Basic TCP/UDP/ICMP Probes

# TCP SYN ping to port 443 — works even when ICMP is dropped
sudo hping3 -S -p 443 -c 3 example.com
# -S: SYN flag
# -p: destination port
# -c: packet count

# TCP ACK ping — often passes stateful firewalls that drop SYN
sudo hping3 -A -p 80 -c 3 target.local

# UDP probe
sudo hping3 --udp -p 53 -c 3 ns.example.com

# Traceroute using TCP SYNs (ICMP-agnostic)
sudo hping3 --traceroute -V -S -p 443 example.com

Step 2: Port Scan a Host that Blocks ICMP

# Sweep a port range with SYN packets
sudo hping3 -S -p ++80 -c 50 target.local
# ++80: increment destination port starting at 80
# Watch replies: SA=open, RA=closed, nothing=filtered

# Target a specific list of ports via a shell loop
for p in 22 80 443 3306 5432 6379; do
  sudo hping3 -S -p $p -c 1 target.local 2>&1 | grep -E 'flags|unreach'
done

Step 3: Test Firewall and ACL Rules

# Confirm the firewall drops packets with a specific source port
sudo hping3 -S -s 53 -p 80 --keep -c 3 target.local
# -s 53     spoof source port 53
# --keep    don't randomize the source port between packets

# Confirm fragmented packets are allowed / blocked
sudo hping3 -S -p 80 -f -c 3 target.local
# -f: fragment the packet

# Verify whether the firewall lets through packets with the evil bit / reserved flags
sudo hping3 -S -p 80 --tcp-timestamp -c 3 target.local

Step 4: Measure RTT Precisely to a TCP Port

# Per-packet RTT for a specific service (better than ping for SLA checks)
sudo hping3 -S -p 443 -c 20 -i u200000 api.example.com
# -i u200000: one packet every 200ms

# Summary at the end:
# --- api.example.com hping statistic ---
# 20 packets transmitted, 20 packets received, 0% packet loss
# round-trip min/avg/max = 12.3/14.1/18.7 ms

Step 5: Scripted Use and Custom Payloads

# Send a custom payload from a file
sudo hping3 -S -p 80 -d 200 -E payload.bin target.local
# -d 200     data size 200 bytes
# -E file    read payload from file

# Listen mode — capture packets with a signature
sudo hping3 --listen 'HTTP' -I eth0

# Tcl scripting (hping3 embeds a Tcl interpreter)
sudo hping3 exec myscript.htcl

Examples

Example 1: Validate a New Firewall Rule

# The ops team just allowed TCP/5432 from the app tier to db.example.internal.
# Verify the rule without installing a real Postgres client on the test host.

# From an in-scope app host
sudo hping3 -S -p 5432 -c 5 db.example.internal
# Expected: SA flags (SYN+ACK) → port reachable and listening
# If RA (RST+ACK) → reachable but no listener
# If nothing → firewall is still dropping

# Negative control: prove TCP/6379 is still blocked
sudo hping3 -S -p 6379 -c 5 db.example.internal
# Expected: no response (100% loss) — rule is tight

Example 2: Troubleshoot Asymmetric Latency

# App team reports "intermittent 500ms latency to api.example.com"
# ping shows steady 30ms but that's ICMP. Measure the real TCP path:

sudo hping3 -S -p 443 -c 200 -i u100000 api.example.com \
  | tee /tmp/hping-api.log

# Look for outliers
awk '/rtt/ {print $NF}' /tmp/hping-api.log | sort -n | tail -20
# 31.2 ms
# 32.0 ms
# 498.6 ms   <-- confirmed outlier
# 502.1 ms

# Traceroute via TCP to locate the slow hop
sudo hping3 --traceroute -V -S -p 443 api.example.com

Guidelines

  • Only test networks and hosts you are authorized to touch. Crafted packets trip IDS/IPS and can be read as an attack.
  • hping3 needs raw socket privileges — it's sudo or CAP_NET_RAW.
  • Response interpretation: SA=SYN+ACK (open), RA=RST+ACK (closed), no reply=filtered. Learn these three by heart.
  • Do not use source spoofing (-a / --spoof) across the public internet. Upstream filters drop it and it's illegal on networks you don't own.
  • Flood mode (--flood) and high rates (-i u1) are denial-of-service tools. Do not use them on shared infrastructure — ever. They are here for lab/stress testing on your own gear only.
  • For TCP RTT to a specific service, hping3 is more reliable than ping because it hits the actual listener.
  • Modern replacements worth knowing: nping (Nmap's packet crafter — actively maintained) and scapy (programmable in Python). Reach for them when hping3 falls short.
  • Always pair packet crafting with a packet capture (tshark, tcpdump) on at least one end — it's how you confirm what actually hit the wire.

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供防火墙测试、端口扫描、RTT 测量等实用网络诊断能力
  • 适用于 DevOps 和安全测试人员的明确工作场景
触发精准90/100

亮点

  • 触发词精准覆盖多种网络测试场景
  • 边界清晰,不易与其他工具混淆
结构规范95/100

待提升项

  • description 内容重复 原报告严重程度:轻微

    顶层 frontmatter 和 skill_body 内部均包含 description 字段

    改进建议:建议移除 skill_body 内部的 description 字段,保持唯一性

亮点

  • 步骤划分清晰(Step 1-5)
  • 包含完整的端到端示例
  • frontmatter 完整规范
执行可靠90/100

亮点

  • 工具参数正确且符合实际语法
  • 覆盖权限、授权、IDS 等主要异常场景
  • 强调仅测试授权网络的安全准则
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。