Bl

Blitzping – A far faster nping/hping3 SYN-flood alternative with CIDR

Hacker News

Blitzping – A far faster nping/hping3 SYN-flood alternative with CIDR

I found hping3 and nmap's nping to be far too slow in terms of sending individual, bare-minimum (40-byte) TCP SYN packets; other than inefficient socket I/O, they were also attempting to do far too much unnecessary processing in what should have otherwise been a tight execution loop. Furthermore, none of them were able to handle CIDR notations (i.e., a range of IP addresses) as their source IP parameter. Being intended for embedded devices (e.g., low-power MIPS/Arm-based routers), Blitzping only depends on standard POSIX headers and C11's libc (whether musl or gnu). To that end, even when supporting CIDR prefixes, Blitzping is significantly faster compared to hping3, nping, and whatever else that was hosted on GitHub. Here are some of the performance optimizations specifically done on Blitzping: * Pre-Generation : All the static parts of the packet buffer get generated once, outside of the sendto() tightloop; * Asynchronous : Configuring raw sockets to be non-blocking by default; * Multithreading : Polling the same socket in sendto() from multiple threads; and * Compiler Flags : Compiling with -Ofast, -flto, and -march=native (though these actually had little effect; by this point, the bottleneck is on the Kernel's own sendto() routine). Shown below are comparisons between the three software across two CPUs (more details at the GitHub repository): # Quad-Core "Rockchip RK3328" CPU @ 1.3 GHz. (ARMv8-A) # +--------------------+--------------+--------------+---------------+ | ARM (4 x 1.3 GHz) | nping | hping3 | Blitzping | +--------------------+ -------------+--------------+---------------+ | Num. Instances | 4 (1 thread) | 4 (1 thread) | 1 (4 threads) | | Pkts. per Second | ~65,000 | ~80,000 | ~275,000 | | Bandwidth (MiB/s) | ~2.50 | ~3.00 | ~10.50 | +--------------------+--------------+--------------+---------------+ # Single-Core "Qualcomm Atheros QCA9533" SoC @ 650 MHz. (MIPS32r2) # +--------------------+--------------+--------------+---------------+ | MIPS (1 x 650 MHz) | nping | hping3 | Blitzping | +----------------------+------------+--------------+---------------+ | Num. Instances | 1 (1 thread) | 1 (1 thread) | 1 (1 thread) | | Pkts. per Second | ~5,000 | ~10,000 | ~25,000 | | Bandwidth (MiB/s) | ~0.20 | ~0.40 | ~1.00 | +--------------------+--------------+--------------+---------------+ I tested Blitzping against both hpign3 and nping on two different routers, both running OpenWRT 23.05.03 (Linux Kernel v5.15.150) with the "masquerading" option (i.e., NAT) turned off in firewall; one device was a single-core 32-bit MIPS SoC, and another was a 64-bit quad-core ARMv8 CPU. On the quad-core CPU, because both hping3 and nping were designed without multithreading capabilities (unlike Blitzping), I made the competition "fairer" by launching them as four individual processes, as opposed to Blitzping only using one. Across all runs and on both devices, CPU usage remained at 100%, entirely dedicated to the currently running program. Finally, the connection speed itself was not a bottleneck: both devices were connected to an otherwise-unused 200 Mb/s (23.8419 MiB/s) download/upload line through a WAN ethernet interface. It is important to note that Blitzping was not doing any less than hping3 and nping; in fact, it was doing more. While hping3 and nping only randomized the source IP and port of each packet to a fixed address, Blitzping randomized not only the source port but also the IP within an CIDR range---a capability that is more computionally intensive and a feature that both hping3 and nping lacked in the first place. Lastly, hping3 and nping were both launched with the "best-case" command-line parameters as to maximize their speed and disable runtime stdio logging.

Share card

Actual performance

44points
11comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Strong signals: para, maximize · Missing: supports, reddit linkedin, podcasting
88%88% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Hacker NewsStrong engagement from HN community · Strong signals: ide, 000, io · Missing: https docs, excited, just released
79%79% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
Product HuntOn track for Day 1 leaderboard · Strong signals: single, using, open · Missing: mac, agents, macos
76%76% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Strong signals: host, interface, efficient · Missing: plus, platform, intuitive
49%49% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: para · Missing: mobile apps, ios, personal
43%43% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
18%18% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Su
Sucrase, 20x faster smaller-scoped alternative to Babel75%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Sucrase, 20x faster smaller-scoped alternative to Babel

Hacker News88
Cl
Cleora – faster alternative to PyTorch-BigGraph53%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Cleora – faster alternative to PyTorch-BigGraph

Hacker News7
A
A much faster alternative to logstash68%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A much faster alternative to logstash

Hacker News18
Cl
Clp, a Faster Alternative to Bat56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Clp, a Faster Alternative to Bat

Hacker News4
Ra
Rambda – Faster alternative to Ramda in just 10kB61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Rambda – Faster alternative to Ramda in just 10kB

Hacker News5
fr
frozen - Storm alternative without Java43%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

frozen - Storm alternative without Java

Hacker News2
Di
Diffboard, a pastebin alternative with diffs56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Diffboard, a pastebin alternative with diffs

Hacker News5
du
dump_r() - print_r() and var_dump() alternative58%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

dump_r() - print_r() and var_dump() alternative

Hacker News12
de
developing a techmeme alternative.56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

developing a techmeme alternative.

Hacker News3
Okfans
Okfans41%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

OnlyFans alternative.

TrustMRREntertainment