Commit Graph

37 Commits

Author SHA1 Message Date
Meteorite c3ef8dcd8b
add option to stop scanning host after first successful protocol (#242) 2020-02-03 16:45:08 -08:00
Jeff Cody a38194a7fd
Add `port` to ScanTarget{} that overrides Config
The port field is tied to the configuration of each instance of
`Scanner` struct.  However, applications using zgrab2 scan modules may
want to specify specific ports to scan, without needing to initialize a
whole new module.

This patch adds a pointer to a uint describing a port to `ScanTarget{}`.
If that is nil, the specified port will override the port in the Config.
2019-08-21 14:53:56 -04:00
justinbastress 4a6dfdbcc4
Merge pull request #146 from zmap/jb/fixSNI
TLS SNI fixes / API cleanup
2019-01-23 13:43:31 -05:00
Jeff Cody ec59b49540
Add support for BytesReadLimit parameter in BaseFlags
Some protocols may require more data than others.  To accomodate those,
allow the BytesReadLimit to be changed by means of BaseFlags.

By setting BaseFlags.BytesReadLimit prior to calling .Open(), scanners
can override the default limit to one that is appropriate for the data
collected.
2018-10-22 21:59:01 -04:00
Justin Bastress 72dc9e7c5a fix UDP case 2018-09-28 11:52:02 -04:00
Justin Bastress 811eb38754 Add GetTLSConfigForTarget and GetTLSConnectionForTarget methods (allowing SNI to work without an explicit --server-name); Add scanTarget.OpenTLS() to give a uniform interface; Document TLS scan; use target.OpenTLS(), correctly report successful/failed detections 2018-07-05 14:34:17 -04:00
Alex Halderman 1f5e4b0f22 Provides a framework for modularized target input and result output functions. 2018-07-05 12:41:34 -04:00
Alex Holland 4f046b3085 Implement timeout to accept float value (#111)
* Implement timeout as a float value vs int

* remove unnecessary second multiplier

* whoops, missed one

* Switch type to time.Duration

* Fixup integration tests, change default and description

* Whoops, bad merge

* fix build
2018-07-02 13:00:45 -04:00
Zakir Durumeric 681d6e0a56
Merge branch 'master' into ah/trigger 2018-06-28 15:05:12 -04:00
justinbastress 77ed2ea3f4 support ScanTarget.IP/Domain being set correctly (#142)
* support ScanTarget.IP/Domain being set correctly

* add godocs on ScanTarget.Host
2018-06-28 14:44:08 -04:00
Alex Halderman 1147e936f9 Switch input processing to CSV and add tests 2018-06-28 08:04:50 -04:00
J. Alex Halderman bd8dc957ed mend 2018-06-27 14:07:07 -04:00
J. Alex Halderman 9df97e03cf Add support for tags and triggers. 2018-06-26 13:51:10 -04:00
Justin Bastress 952dd2ef78 Add a global --debug flag which specifies that zgrab:debug output should be included 2018-06-18 15:18:25 -04:00
Justin Bastress 0cfc4bdff3 lower log level of per-scan errors 2018-05-11 11:45:59 -04:00
Justin Bastress 66cbe41205 better error log 2018-05-11 10:57:27 -04:00
Justin Bastress 7a013ca261 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
Justin Bastress 58601e045a add output processing 2018-03-30 16:28:24 -04:00
justinbastress 2f7dfd76fe
Add NTP zgrab2 module (#39) 2018-02-07 12:25:46 -05:00
justinbastress 8eb958e22c
Add MSSQL zgrab2 module (#38) 2018-02-02 14:52:03 -05:00
justinbastress e1f04217a9
log scan target on panic (#43) 2018-01-31 10:14:52 -05:00
justinbastress f49887290d
Implements postgres zgrab2 module (#30)
* remove unnecessary indirection on net.Conn

* Ignore *.pyc

* fix NPE on nil handshake

* refactoring -- move status to status.go; add Open() methods for ScanTarget

* cherry-pick .gitignore fix

* pull in TLS fix

* status.go comments

* trim over-generalizations

* use /usr/bin/env bash instead of absolute path

* remove debug tcpwrap

* add integration tests for postgres

* hack for cleanup.sh to work on mingw -- use //var/lib instead of /var/lib

* cleanup should actually stop the process though

* comments / rearrange

* Bump up timeout in postgres tests; only pass user if explicitly requested to do so

* add schema stubs to new.sh

* Integration test fixes -- use /usr/bin/env bash; log all validation failures

* add postgres schemas

* fill out zcrypto.client_hello schema

* handle early get of TLSLog

* postgres: return SCAN_SUCCESS on success

* cleanup

* fix new.sh

* fix typo

* postgres container cleanup

* build.sh docs

* standardize container/image names

* add not to check for success

* shift mysql's connection management to ScanTarget.Open(); wrap Read/Write methods returned by ScanTarget.Open() to enforce timeouts

* catch schematically-valid but non-successful scans

* postgres: clean up output format; more scanning

* cleanup; better error handling; get detailed protocol version error

* refactor modules

* clean up dangling connections

* split gigantic postgres.go

* remove unused

* ServerParams gets its own type

* refactor integration tests: run zgrab2 in its own container, which is linked to the service containers, so that we don't need to keep track of unique ports on the host any more

* rename entrypoint; remove duplicate postgres tests

* comments for postgres schema

* Use param expansion to check for env variable [minor]

This is a *very* minor change to `docker-runner/docker-run.sh` checks to
see if the environment variable required to run the script has been set
to a non-empty string. If not, the script exits with a non-zero status
code and displays a default message:

```
❯ docker-runner/docker-run.sh
docker-runner/docker-run.sh: line 7: CONTAINER_NAME: parameter null or not set
```

This was the behavior before, but just uses a one-liner declarative bash
idiom.

For further reading on parameter expansion, see
https://stackoverflow.com/a/307735.

@justinbastress can tell me if I did something wrong and broke the
intent of the script :-)

* Add integration_test targets to makefile; use makefile instead of directly calling go build everywhere; run postgres schema through PEP8 linter

* use make in docker-runner entrypoint

* add .integration_test_setup to .gitignore

* more .gitignore items

* Makefile updates: Windows support; add docker-runner target; better cleanup.

* docker-runner Dockerfile: start from zgrab2_runner_base image

* cleanup postgres setup

* make travis use make

* add .gitattributes, try to prevent it from overriding lfs with crlfs in shell scripts at least

* fix folder name in Makefile

* update go (one of our dependencies now works only with >= 1.9)

* From travis: `I don't have any idea what to do with '1.9.0'.`

* explicit clean make

* fix dep order

* fix build.sh location

* popd

* use make to ensure zgrab2_runner exists

* Make docker-runner an order-dependency for integration-test-cleanup; don't do a cleanup after each integration test

* use explicit tag name for zgrab2_runner

* Add container-clean target to Makefile, to remove cyclic dependency on docker; use .id files to track docker images; add servce-base image; use Make to build / track images

* use LF in Makefiles; update .gitignore; use zgrab_service_base image in ssh container; fix line endings (?)

* remove overzealous cleanup

* let setup continue even if some containers are already running

* zgrab depends on *.go

* docker-runner depends on zgrab2 binary

* clean output before running integration tests
2018-01-15 14:24:57 -05:00
justinbastress a244ec15e6 TLS scan prototype + Travis integration (#25)
* Fix typo

* Actually call init per sender for each goroutine

* split out TLS handling

* Rename tls_handshake; update docs

* fix comments

* format fixes

* merge updates

* fix path

* refactor heartbleed logging (now the same as original zgrab)

* add ScanStatus, update modules to return it

* fix threaded for loop; fix styling of dict literal

* fix compile errors, note un-bubbled handshake error

* initial schema commit

* fix comment

* schema cleanup

* comments

* fix TODOs

* first attempt at docker integration in travis; also add schema validation

* add integration_tests.sh

* need sudo?

* try pip install --user

* revert regression

* add docker service again

* chmod +x integration_tests.sh

* fix path of binary

* Dump output file to stdout

* travis work

* use jp's build-self-contained script

* use go get/go build to get jp

* fix jp path

* switch from bogus regex to wildcard

* do all mysql versions; fix version comparison

* re-enable notifications; fix successful version check log message; comment TryGetScanStatus

* move to conf.d layout for integration tests

* update README

* add missing scripts

* add ./ to path
2017-12-15 09:25:17 -05:00
Alex a29dbdb775 Fix error handling 2017-10-22 21:19:10 -04:00
Alex d3490ddddd restructure to make sense 2017-10-04 11:32:42 -04:00
Alex 3545d223e9 gofmt, golint, add docs 2017-10-03 23:57:56 -04:00
Alex 7f71198296 utility.go changes 2017-09-26 14:15:15 -04:00
Alex 54817aa08d change structure of zgrab2 2017-09-26 14:02:27 -04:00
Alex Holland 49c8b6997c Uint to int connnectionsPerHost 2017-09-04 22:31:44 -04:00
Alex 7764297a42 connections per host implementation 2017-09-04 18:44:58 -04:00
Alex 8a607776f6 modify readme, processing 2017-09-02 23:14:33 -04:00
Alex 57e6357da9 review name changes, list of ips to ipnet 2017-08-31 17:24:05 -04:00
Alex 23a4636c34 order modules to run in specified order from .ini 2017-08-30 15:47:39 -04:00
Alex bd8dcd9b7b code review fixes 2017-08-30 15:39:25 -04:00
Alex 11de980f43 timeout to base module, parse ip/domain and do lookup 2017-08-28 21:23:16 -04:00
Alex d821336043 change timeout to module layer, s/makeHandler/runHandler, add time 2017-08-26 16:01:11 -04:00
Alex 41eb0fd7d4 refactor structure, monitor, modules (further work to be done on modules) 2017-08-16 12:09:20 -04:00