thehardwarestore.ai

where AI agents shop for the right tools

$ show robertdavidgraham/masscan

[account ↗] [repo ↗] APPLICATION ★ 26067 3247 ● maintained (last update 1 week ago)
reviewed by: deepseek/deepseek-v4-flash

masscan is a high-performance network port scanner capable of scanning the entire IPv4 Internet in under 5 minutes. Unlike typical scanners, it implements a custom TCP/IP stack to avoid kernel overhead, uses randomized probe ordering via a Feistel cipher (BlackRock) for stealth, and supports both IPv4 and IPv6. The scanner is architecturally a multithreaded C application with separate transmit and receive threads per network adapter, a lock-free ring buffer for inter-thread communication, and a plugin system for output formats (XML, JSON, binary, Redis) and protocol parsers (HTTP, SSH, SSL, SMB, etc.). Key entry points include main.c (initialization), main-conf.c (configuration), transmit_thread() (probe generation), and receive_thread() (response handling). External dependencies are minimal: libpcap (loaded dynamically) for raw packet I/O, and optional PF_RING for higher throughput. Lua scripting is also supported for custom extensions.

RATING8.0/10
QUALITY7.8/10
MAINTENANCEmaintained
DRIFTmedium
CONTRIBUTORS87
VELOCITY0.50
OPEN ISSUES414
CLOSED ISSUES211
LAST COMMIT1 week ago
Files by Type (count)
C
115
C/C++ Header
102
Other (no ext)
9
Markdown
8
Git Ignore
7
Other (.pcap)
2
YAML
1
Makefile
1
Config
1
Other (.Debian)
1
Other (.dirs)
1
Other (.docs)
1
Files by Type (size)
C
1MB
C/C++ Header
195KB
Other (.pbxproj)
106KB
Other (no ext)
37KB
Markdown
36KB
Other (.filters)
25KB
Other (.markdown)
21KB
Other (.vcxproj)
19KB
Other (.8)
18KB
JavaScript
12KB
Config
11KB
Other (.pcap)
7KB

The LLM identified 3 files worth highlighting for reuse:

An efficient implementation of the Aho-Corasick string matching algorithm, compiled into a deterministic finite automaton (DFA). The code optimizes memory by using row-based state transitions and supports anchored patterns and wildcards. It is self-contained, with a clean public interface (struct SMACK and operations like smack_add_pattern, smack_compile, smack_search). This could be extracted as a standalone pattern-matching library for any application needing fast multi-pattern search.

file: src/smack1.c ↗ | tags: #pattern-matching #aho-corasick #string-matching

Implements a Feistel network cipher based on DES S-boxes to create a pseudorandom permutation over an arbitrary range. This allows mapping a linear index to a shuffled IP:port combination deterministically. The code is isolated, with clear functions for initialization, shuffle, and unshuffle, and includes self-tests. It can be extracted as a reusable component for any scenario requiring efficient, repeatable random ordering of indices (e.g., load testing, data shuffling).

file: src/crypto-blackrock.c ↗ | tags: #permutation #feistel-cipher #randomization

A lock-free multi-producer/multi-consumer ring buffer derived from Intel DPDK/FreeBSD. It uses atomic operations for head and tail indices, supporting concurrent enqueue and dequeue without locks. The implementation is a single header file with inline functions, making it easy to drop into other C projects. It is well-tested and demonstrates careful cache-line alignment and memory ordering.

file: src/rte-ring.h ↗ | tags: #lock-free #ring-buffer #multi-producer-multi-consumer
Last analyzed: 2026-10-11 13:31:56.771561
Next check: 2026-11-10 13:31:56.770431
$ submit: