Go to file
justinbastress 724d02d90d read full banners (#103)
* read full banners

* account for cases where smaller packets are returned
2018-06-28 15:06:39 -04:00
.github add GitHub PR template (#37) 2018-01-18 12:30:12 -05:00
cmd/zgrab2 Add memory and CPU profiling (if ZGRAB_[MEM/CPU]PROFILE is set); add upper bound on data read from postgres 2018-05-14 11:24:25 -04:00
docker-runner make base-apt-update a phony target 2018-05-30 12:08:08 -04:00
integration_tests Feature/create ipp module (#137) 2018-06-26 12:00:27 -04:00
lib merge client/server header list (#134) 2018-06-28 14:46:19 -04:00
modules read full banners (#103) 2018-06-28 15:06:39 -04:00
tools/keys sed name changes 2017-10-22 21:19:49 -04:00
zgrab2_schemas (IPP) improve scan output (#140) 2018-06-28 14:58:40 -04:00
.gitattributes Implements postgres zgrab2 module (#30) 2018-01-15 14:24:57 -05:00
.gitignore Merge #45 into master (#52) 2018-01-31 13:01:14 -05:00
.travis.yml install 2018-05-04 11:36:07 -04:00
config.go reformat config.go 2018-06-18 16:44:09 -04:00
conn.go read full banners (#103) 2018-06-28 15:06:39 -04:00
errors.go port POP3 2018-03-15 13:10:10 -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.go Set default timeout to 10s 2018-04-05 14:50:12 -04:00
monitor.go Add memory and CPU profiling (if ZGRAB_[MEM/CPU]PROFILE is set); add upper bound on data read from postgres 2018-05-14 11:24:25 -04:00
multiple.go gofmt, golint, add docs 2017-10-03 23:57:56 -04:00
output_test.go Add shared FlagsToSet function in output.go (#62) 2018-03-01 14:32:12 -05:00
output.go Add shared FlagsToSet function in output.go (#62) 2018-03-01 14:32:12 -05:00
processing.go support ScanTarget.IP/Domain being set correctly (#142) 2018-06-28 14:44:08 -04:00
README.md Update README.md (#61) 2018-02-21 09:26:22 -05: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 modbus scanner 2018-03-21 10:36:58 -04:00
tls.go ensure postgres connections get closed 2018-05-11 14:01:10 -04:00
utility.go read full banners (#103) 2018-06-28 15:06:39 -04:00

ZGrab 2.0

This repo contains the new ZGrab framework, and will eventually replace https://github.com/zmap/zgrab.

Building

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.

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.

multiple.ini

[Application Options]
output-file="output.txt"
input-file="input.txt"
[http]
name="http80"
port=80
endpoint="/"
[http]
name="http8080"
port=8080
endpoint="/"
[ssh]
port=22
./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.

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 {
        log.Fatal(err)
    }
}

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 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 $?
0

License

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