Go to file
2022-11-11 05:10:37 -08:00
.github Update CI 2022-11-10 12:20:13 -08:00
bin Fix synchronization for Monitor 2020-02-18 14:57:46 -05:00
cmd/zgrab2 Add support for importing the ZGrab2 main (#224) 2019-09-25 08:51:31 -04:00
docker-runner Go get module package dependencies. 2018-08-17 14:31:31 -04:00
integration_tests Fix panics in Modbus scanner (#265) 2020-05-29 13:07:47 -04:00
lib Attempt to appease go vet ./ 2022-11-10 19:02:44 -08:00
modules Attempt to appease go vet ./ 2022-11-10 19:02:44 -08:00
tools/keys sed name changes 2017-10-22 21:19:49 -04:00
zgrab2_schemas Add NativeOS, NTLM, and GroupName to SMBv1 results (#286) 2021-03-15 09:23:55 -04:00
.gitattributes Implements postgres zgrab2 module (#30) 2018-01-15 14:24:57 -05:00
.gitignore Fix various issues found when testing 2022-11-10 12:05:48 -08:00
config.go Remove source IP option (#356) 2022-07-01 15:03:00 -06:00
conn_bytelimit_test.go Fix: conn_bytelimit_test 2022-11-11 05:10:37 -08:00
conn_timeout_test.go Attempt to appease go vet ./ 2022-11-10 19:02:44 -08:00
conn.go Fix: conn_bytelimit_test 2022-11-11 05:10:37 -08:00
errors.go port POP3 2018-03-15 13:10:10 -04:00
fake_resolver.go Update header comment for fake_resolver.go 2020-01-31 23:08:58 -05:00
go.mod Fix various issues found when testing 2022-11-10 12:05:48 -08:00
go.sum Fix various issues found when testing 2022-11-10 12:05:48 -08:00
input_test.go end 2018-06-28 08:10:25 -04:00
input.go Provides a framework for modularized target input and result output functions. 2018-07-05 12:41:34 -04:00
LICENSE initial commit with readme and license 2016-08-19 16:25:49 -07:00
Makefile Add output unit tests; add output.Process to strip debug; make MySQL debug fields omitempty too; use processor to strip data in Process() 2018-04-03 17:15:20 -04:00
module_set.go Add ModuleSet object (#247) 2020-02-18 10:23:43 -05:00
module.go Add Description() to ScanModule (#248) 2020-02-18 10:24:04 -05:00
monitor.go Fix synchronization for Monitor 2020-02-18 14:57:46 -05:00
multiple.go add option to stop scanning host after first successful protocol (#242) 2020-02-03 16:45:08 -08:00
output_test.go Add shared FlagsToSet function in output.go (#62) 2018-03-01 14:32:12 -05:00
output.go fix compilation error introduced by #244 merge 2021-03-04 09:03:34 -07:00
processing.go Extract the creation and Marshal of a Grab object (#256) 2020-03-17 11:50:54 -04:00
README.md Attempt to appease go vet ./ 2022-11-10 19:02:44 -08:00
requirements.txt fix zcrypto_schemas egg name 2018-05-04 11:15:40 -04:00
scanner.go Scanner modules return the protocol ID, scan returns the protocol in the results. 2018-03-12 13:36:11 -04:00
setup.py schemas.zgrab2 -> zgrab2_schemas 2018-05-04 11:15:09 -04:00
status.go add initial work 2018-10-17 16:07:12 -04:00
tls.go Attempt to appease go vet ./ 2022-11-10 19:02:44 -08:00
utility.go jarm: update jarm to not fail on handshake failure (#328) 2021-09-30 15:40:46 -04:00

ZGrab 2.0

Fork Changes

ZGrab is a fast, modular application-layer network scanner designed for completing large Internet-wide surveys. ZGrab is built to work with ZMap (ZMap identifies L4 responsive hosts, ZGrab performs in-depth, follow-up L7 handshakes). Unlike many other network scanners, ZGrab outputs detailed transcripts of network handshakes (e.g., all messages exchanged in a TLS handshake) for offline analysis.

ZGrab 2.0 contains a new, modular ZGrab framework, which fully supersedes https://github.com/zmap/zgrab.


You will need to have a valid $GOPATH set up, for more information about $GOPATH, see https://golang.org/doc/code.html.

Once you have a working $GOPATH, run:

$ go get github.com/zmap/zgrab2

This will install zgrab under $GOPATH/src/github.com/zmap/zgrab2

$ cd $GOPATH/src/github.com/zmap/zgrab2
$ make

Single Module Usage

ZGrab2 supports modules. For example, to run the ssh module use

./zgrab2 ssh

Module specific options must be included after the module. Application specific options can be specified at any time.

Input Format

Targets are specified with input files or from stdin, in CSV format. Each input line has three fields:


Each line must specify IP, DOMAIN, or both. If only DOMAIN is provided, scanners perform a DNS hostname lookup to determine the IP address. If both IP and DOMAIN are provided, scanners connect to IP but use DOMAIN in protocol-specific contexts, such as the HTTP HOST header and TLS SNI extension.

If the IP field contains a CIDR block, the framework will expand it to one target for each IP address in the block.

The TAG field is optional and used with the --trigger scanner argument.

Unused fields can be blank, and trailing unused fields can be omitted entirely. For backwards compatibility, the parser allows lines with only one field to contain DOMAIN.

These are examples of valid input lines:
domain.com, domain.com, domain.com, tag, , tag
, domain.com, tag, , tag

Multiple Module Usage

To run a scan with multiple modules, a .ini file must be used with the multiple module. Below is an example .ini file with the corresponding zgrab2 command.


[Application Options]
./zgrab2 multiple -c multiple.ini

Application Options must be the initial section name. Other section names should correspond exactly to the relevant zgrab2 module name. The default name for each module is the command name. If the same module is to be used multiple times then name must be specified and unique.

Multiple module support is particularly powerful when combined with input tags and the --trigger scanner argument. For example, this input contains targets with two different tags:, , tagA, censys.io, tagB

Invoking zgrab2 with the following multiple configuration will perform an SSH grab on the first target above and an HTTP grab on the second target:



Adding New Protocols

Add module to modules/ that satisfies the following interfaces: Scanner, ScanModule, ScanFlags.

The flags struct must embed zgrab2.BaseFlags. In the modules init() function the following must be included.

func init() {
    var newModule NewModule
    _, err := zgrab2.AddCommand("module", "short description", "long description of module", portNumber, &newModule)
    if err != nil {

Output schema

To add a schema for the new module, add a module under schemas, and update schemas/__init__.py to ensure that it is loaded.

See zgrab2_schemas/README.md for details.

Integration tests

To add integration tests for the new module, run integration_tests/new.sh [your_new_protocol_name]. This will add stub shell scripts in integration_tests/your_new_protocol_name; update these as needed. See integration_tests/mysql/* for an example. The only hard requirement is that the test.sh script drops its output in $ZGRAB_OUTPUT/[your-module]/*.json, so that it can be validated against the schema.

How to Run Integration Tests

To run integration tests, you must have Docker installed. Then, you can follow the following steps to run integration tests:

$ go get github.com/jmespath/jp && go build github.com/jmespath/jp
$ pip install --user zschema
$ make integration-test

Running the integration tests will generate quite a bit of debug output. To ensure that tests completed successfully, you can check for a successful exit code after the tests complete:

$ echo $?


ZGrab2.0 is licensed under Apache 2.0 and ISC. For more information, see the LICENSE file.