$ show postmodern/ruby-nmap
ruby-nmap is a Ruby library that provides programmatic access to the nmap network scanning tool. It consists of two main components: 1) A command-line interface builder (Nmap::Command) that allows Ruby programs to configure and execute nmap scans with full access to nmap's options through a Ruby DSL, and 2) An XML parser (Nmap::XML) that converts nmap's XML output into navigable Ruby objects representing hosts, ports, services, OS detection results, and script output. The library acts as a bridge between Ruby applications and the nmap executable, handling the complexity of command-line argument construction and XML parsing while providing an idiomatic Ruby interface. The project is actively maintained with recent commits, comprehensive test coverage, and support for multiple Ruby versions.
The LLM identified 1 files worth highlighting for reuse:
The Nmap::Command class and its associated type system (Port, PortRange, PortRangeList, Time, HexString, ScanFlags) implement a sophisticated command-line argument builder. It handles complex nmap specifications like port ranges ("1-22,80,443,8000-9000"), protocol-specific flags ("T:1-22,U:8000-9000"), and hash-based formats ({tcp: [1,2,3], udp: [100,200]}). Each type provides robust validation and formatting, demonstrating expertise in parsing and representing complex input domains. This system could be extracted as a standalone library for building command-line interfaces with rich type systems.