NGEN(1)

NAME
ngen - create a baseline set of nmap results from command-line specifications and/or an nmap results file.

SYNOPSIS
 ngen [-o|-output <filename-or-:tag>] [-p|-ports <port list>]
      [-h|-host <specification> ... -h|-host <specification N>]

      <specification> =
      [!]<host spec>[:<port spec>][:ignored state]

DESCRIPTION
The ngen utility creates an nmap-style machine-readable results file for use as a baseline for ndiff comparision.

OPTIONS

-o <filename-or-:tag>
-output <filename-or-:tag>
    Specifies the output filename, or optionally a data store tag, if begins with a colon (:). See "DATA STORES" below for more information.

-p <port list>
-ports <port list>
    Specifies the set of all ports scanned, comma-separated. Ranges may be specified. For example:

        -p 80,443,6000-6010,22
        -ports 53

    By default, tcp is assumed; udp may be specified by appending the "u" flag. ("t" may be specified but is redundant)

        -p 323u,80,6000-6010t

    If the -p option is omitted, ngen will grab the set of ports from /usr/local/lib/nmap/nmap-services and /etc/services.

    The default, "Ignored" specified for a given host is applied to all ports in this list, except for "interesting" ports, which are specified below with the -h option.

    See the description of port specifications with the -h option below for more information.

-h [!]<host ranges>[:<port ranges>][:<ignored state>]
-host  [!]<host ranges>[:<port ranges>][:<ignored state>]
    Adds a host or range of hosts. For example

        -h 192.168.2.2                   # one host
        -h 10.0.2.0-64                   # 65 hosts
        -host 192.168.1.0/26             # 64 hosts
        -host 192.168.*.*                # 65536 hosts

    The above examples add hosts with all ports closed. To add ports to the hosts, append a colon and a port spec. For example to add localhost with tcp ports 80 and 53 open, ignored state "closed", the specification would be

        -host 127.0.0.1:80,53

    Flags may be appended to change the protocol or state for a given port, for example:

        -host 127.0.0.1:7uf

    which adds echo service, udp port 7 filtered state.

    The full list of port flags are as follows:

        t - tcp port  (default)
        u - udp port

        o - port is in open state (default)
        c - port is in closed state
        f - port is in filtered state
        x - port is in unfiltered state

    The ignored state for the host may be specified by appending a colon and the state to the host spec. Acceptable state labels are "open", "closed", "filtered", and "unfiltered".

      -h 10.0.2.0:80f:closed

    which says all scanned ports default to closed state, except for 80/tcp which is filtered.

    A host spec is treated as a negation if it starts with "!". If ports are specified as part of the host spec, those ports are deleted from any hosts previously added which fall in the host range.

    Host specs are applied in order as they appear on the command line, and their effects are cumulative.

DATA STORES
Nrun and its related tools can manipulate results in regular nmap-format files, in any user-specified location, or they can handle storing and organizing the data on behalf of the user, through a user-configurable "data store".

Whenever you precede a results tag with a colon (:), the tag will be treated as a unique key into a data store, identifying the results set.

Currently the only supported data store is nmap format files placed in a preconfigured directory. Other types may be added at a later date.

A legal tag may contain any alphanumeric string, plus dash, underscore, and dot. %-style substitutions in the ilk of the "date" command are also supported, allowing a tag to contain date, time, or the local hostname. See "SUBSTITUTIONS" below for more information.

SUBSTITUTIONS
%-style substitutions supported in tags as follows:

%H = hour
%M = minute
%S = second
%D = day of month
%m = month of year (01-12)
%Y = year, four digits
%j = day of year, three digits
%w = day of week (0-6) one digit

Except where noted, the above items are two digits, and local time. All are zero-padded as appropriate.

In addtion-

%F = output of "hostname" on the local machine

BUGS
It is possible to create invalid nmap result files with ngen if you really try to. No support for human-readable hostnames and portnames.

AUTHOR
James Levine <jdl@vinecorp.com>