For firewall regression tests, how do hping3, Scapy and nping differ, and what does hping3's own source tree say about its currency?
answer
- command line against library
- one ships inside the Nmap package
- scripted checks and exit codes
- version string in the source
- check the installed build
basics
~10 shping3 is a command-line packet crafter, Scapy a Python library, and nping ships with Nmap. The hping3 tree shows version 3.0.0-alpha-1 and a last commit in December 2014, so verify your installed build.
solid answer
~40 shping3 suits quick, hand-built probes: one command, one packet, and the reply on screen. Scapy is a Python library, so a test can build packets, send them, inspect each reply and fail a pipeline step with ordinary code. nping is distributed with Nmap and is described in its reference guide as a custom packet crafter. For simple scripted checks hping3 has `--tcpexitcode`, which turns the last TCP reply's flags into the exit status. Its source tree shows `3.0.0-alpha-1`, a CHANGES entry for the first public release on 30 Mar 2004 and a last commit on 26 Dec 2014 in the pinned clone, so confirm option behaviour on the installed build and do not assume a current release.
go deeper
Recall that hping3 is a command-line packet crafter, Scapy a Python library, and nping a tool that comes with Nmap.
Explain when each fits: quick probes, coded repeatable tests, and Nmap-adjacent crafting, and name --tcpexitcode for simple scripting.
Choose for a recurring regression test, pin the version, and state the age of hping3 from the source tree without overclaiming.
Decide how a team standardises packet-level checks across change windows, and what evidence each tool's output provides to an auditor.
## Three tools, three shapes All three can send a hand-built packet and show the reply. They differ in how you drive them. | Tool | Form | Best for | Where it comes from | |---|---|---|---| | hping3 | Command-line program, optional Tcl scripting | One-off probes, quick checks during a change window | Its own source tree and distributions | | Scapy | Python library | Repeatable tests that build, send, inspect and assert in code | Its own Python project | | nping | Command-line tool | Packet crafting alongside Nmap work | Packaged with Nmap | hping3 is the fastest way to ask one question and read the raw answer. Scapy is the choice when the test is code: a regression suite that sends a defined set of packets after each firewall change, compares each reply with an expected result and fails a build on a mismatch. nping is the natural choice when Nmap is already installed. Nmap's reference guide calls it a custom packet crafter and suggests it for measuring round-trip times where a plain ICMP ping may not get through a firewall. The Nmap 7.991 download page lists it as a separate package and as part of the source bundle. ## What hping3 offers for scripts For small automation, hping3 has `--tcpexitcode`: the process exits with the last received packet's TCP flags as its exit code, so a shell script can tell SYN/ACK from RST. The manual describes it as useful for checking whether a port replies with SYN/ACK or RST in response to a SYN. The README also describes Tcl scripting, started with `hping3 exec ScriptName.htcl`, and says Tcl/Tk support is optional at build time. Anything richer, such as comparing many replies, is easier in a Python library. ## What the source tree says about currency Read these files in the tree itself, not a blog or a package page: 1. **CHANGES** records "30Mar2004 - First public release of hping3". 2. **release.h** defines the version string `3.0.0-alpha-1`, and `hping3 -v` prints it. 3. **TODO** says hping2 bugs "will no longer be handled" and that the hping2 code inside hping3 is a compatibility layer to be dropped. 4. **The manual page** is bundled as `hping3.8` but is still headed HPING2 and dated 2001 Aug 14, and it differs from the hping2 page only by two option entries added for hping3. 5. **The git history** of the pinned clone ends at a commit of 26 Dec 2014 whose subject is ".gitignore file added." Those facts support a modest conclusion: the tool is old, stable in what it does and carries an alpha version string. They do not show that it is abandoned or unusable, and nothing here says what any particular distribution ships, so check the installed build's `-v` output and `--help`. ## What a recurring test must record Whatever tool sends the packet, a regression test needs three things on file: the packet, the expected reply and the observed reply. hping3 prints human-readable text lines, so a script that parses them should be re-checked when the installed build changes. The INSTALL file also notes that from hping3 on, libpcap is used for capture, which matters when building it on a locked-down host. ## Choosing for a recurring test - **A one-time check in a change window:** hping3, with the command line recorded in the change record. - **A test that runs after every change:** a Scapy script, or hping3 with `--tcpexitcode` wrapped in a script, with expected replies stored beside it. - **Nmap already in use:** nping avoids another dependency. Whatever you pick, pin the version used, record the exact commands, and keep the expected outcome next to each probe so a failure is visible without interpretation. ## Rules of engagement Whichever tool sends the packet, the conditions are the same: a written scope, a window you own, a known source address and a bounded count. A packet crafter in a pipeline is still a tool that sends packets at a network, so its targets should be a lab or an environment you are authorised to test.
- Which hping3 option helps a shell script tell a SYN/ACK from a RST?`--tcpexitcode`. The process exits with the last received packet's TCP flags as its exit code, so a script can branch on whether a port answered SYN/ACK or RST. It is suited to a simple allow or reject check, not to comparing many replies.
- What would you say if asked whether hping3 is still maintained?Report only what the tree shows: version string 3.0.0-alpha-1, the first public release recorded as 30 Mar 2004, and a last commit on 26 Dec 2014 in the pinned clone. That says nothing about forks or distribution patches, so check the installed build and record its version in your test notes.
- Nping is a Scapy module bundled with Nmap
- hping3 has a stable 3.x release and active development in its source tree
- hping3 cannot be used in scripts at all
- Scapy is a command-line tool you run with flags like hping3
- The hping3 manual page is dated to the hping3 release