Commit Graph

61 Commits

Author SHA1 Message Date
Benjamin Wireman
cfd48de9d6
Fix panics in Modbus scanner (#265)
* Check message and body length in in GetModbusResponse()

* add timeout to waiting when PSQL container to start

https://github.com/zmap/zgrab2/pull/265
2020-05-29 13:07:47 -04:00
Jeff Cody
fb49609733
Remove GetPort() from modules
The previous patch allows the port to be specified in the
`ScanTarget{}`.

Since the port option in the Config may not be the port currently being
scanned, delete the `GetPort()` function provided by each module.

The `GetPort()` function is also not used.  While we could just change
the meaning of this function, to mean "Return the port in the Config",
it is probably better to go ahead and just remove all references to it
as there are no users.
2019-08-21 14:55:14 -04:00
Ricky Diaz Gomez
e23894590d Redis: Removed the tests that test the --mappings and --custom-commands
flags for the Redis scanner.
2019-07-08 10:23:18 -04:00
Ricky Diaz Gomez
4bae7a74dd Redis: Quoted the docker-run.sh file path within test.sh 2019-06-25 10:57:46 -04:00
Ricky Diaz Gomez
5be58b2b0d Redis: Actually send the custom commands and store the responses. Also updated the zschema 2019-06-17 17:32:51 -04:00
Ricky Diaz Gomez
f0d9070733 Redis: Takes JSON/YAML file that allows for renaming of commands 2019-06-17 15:23:56 -04:00
justinbastress
a137e76c73
Merge branch 'master' into jb/jp-fix 2019-01-25 16:54:16 -05:00
Justin Bastress
aa2d162c9c re: @codyprime's comments in #188 2019-01-25 16:32:53 -05:00
Justin Bastress
369cb29d78 mkdir zgrab-output 2019-01-25 16:05:00 -05:00
Justin Bastress
45d3516729 install zschema 2019-01-25 15:47:00 -05:00
Justin Bastress
3400be2b3c use a virtualenv to install zschema 2019-01-25 13:33:28 -05:00
Justin Bastress
108ce0a0ab use jp on path (and get/build it if not available) 2019-01-18 13:33:23 -05:00
Paul A. Parkanzky
7386c5d3fa Fix script #! invocations 2018-08-21 13:33:56 -04:00
Paul A. Parkanzky
2f316b2242 Add mongodb integration tests. 2018-08-21 13:11:34 -04:00
Clayton Zimmerman
c11be290dc
Feature/IPP: Fix Retry-TLS and Collect All IPP Attributes (#143)
* Correctly enables TLS only during retry grab when retry-tls flag is set.
* Fixes evaluation which caused too many arguments error in IPP integration test.
* Updates IPP zgrab2 schema to reflect storing all attributes in response.
* Adds Attributes member to ScanResults
* Ensures tryReadAttributes only reads attributes in the case of a postive detection. Cleans up isIPP
* Reads all attributes in IPP response
* Detects invalid length errors when reading IPP attributes.
* Returns the correct amount of uris, ipp versions, and cups versions in ScanResults.
2018-07-09 14:39:54 -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
Alex Halderman
0c597e5a8d
Merge branch 'master' into ah/trigger 2018-06-26 17:53:20 -07:00
J. Alex Halderman
9df97e03cf Add support for tags and triggers. 2018-06-26 13:51:10 -04:00
Clayton Zimmerman
9b00db7f29
Feature/create ipp module (#137)
* Changes grab to return *ScanResults. Implements ippInContentType correctly.

* Slots in an operational re-working of several HTTP module functions, and adds dependency on zgrab's http module. Includes some laregly copy-pasted sections worthy of scrutiny.

* Adds support to retry failed HTTP over HTTPS. Removes vestigial functions.

* Implements sending CUPS-get-printers request if CUPS is detected, yielding more detailed & accurate version information. Also handles URI's more correctly.

* Creates separate container to run IPP over TLS on CUPS. Runs basic tests against both containers.

* Creates virtual printer on each container to test for augmenting data with CUPS-get-printers request (which only works when printers exist).

* Augments version information with CUPS-get-printers response if possible.

* Allows specifying IPP version in constructed requests. Checks for version-not-supported server error.

* Allows resending IPP requests with different versions if we hit a version-not-supported error.

* Updates IPP zgrab2 schema to include fields added in modules/ipp/scanner.go

* Removes unnecessary TODO's

* Updates testable example for new definition of AttributeByteString

* Removes versionNotSupported's dependency on bufferFromBody. Checks bounds on generated requests' fields correctly.

* Updates zgrab2 IPP schema to match ScanResults object in modules/ipp/scanner.go

* Corrects IPP tests, bounds checking, zgrab schema formatting.

* Logs errors for unexpected behavior in buffer io operations. Updates schema to include standalone fields for attributes described in CUPS-get-printers response.

* Logs at debug level only when verbose flag is set. Prints accurate error message when CUPSVersion test fails.

* Handles HTTP request errors before checking for nil response/body. Fixes and tests convertURIToIPP.
2018-06-26 12:00:27 -04:00
linus torvalds
baa8744ae5 compatible new.sh with OSX 2018-06-22 11:28:45 +08:00
Clayton Zimmerman
2afd7d8a2d Addresses comments from pull request #135. Makes ipp Dockerfile conform to best practices. Makes reference to IPP RFC where appropriate. 2018-06-12 17:00:52 -04:00
Clayton Zimmerman
e46f988d28 Configures docker container to run scanner correctly. 2018-06-11 16:52:26 -04:00
Clayton Zimmerman
84100ce1b8 Makes necessary initial changes so Dockerfile and testing scripts install and run cups. 2018-06-11 11:53:07 -04:00
Clayton Zimmerman
b076c7b005 Boilerplate for IPP scan module. 2018-06-07 15:13:01 -04:00
Justin Bastress
2b8f04234e Fix new.sh, add sample container setup; add apt-update target for zgrab2_service_base 2018-05-30 12:07:24 -04:00
Justin Bastress
24dad0b670 handle module rename 2018-05-04 11:31:53 -04:00
Justin Bastress
a472e0b560 updates schema template to match current layout 2018-04-23 16:41:34 -04:00
Justin Bastress
735cb3a4c3 port DNP3 scanner 2018-03-21 16:52:53 -04:00
Justin Bastress
0f7a265bdd add modbus scanner 2018-03-21 10:36:58 -04:00
Justin Bastress
0fbf68b9e9 fix input flags 2018-03-15 13:25:53 -04:00
Justin Bastress
8dd7a62768 remove port forwarding from pop3 container 2018-03-15 13:17:52 -04:00
Justin Bastress
f1c9bfbc89 merge master 2018-03-15 13:12:21 -04:00
Justin Bastress
ad6295f421 port POP3 2018-03-15 13:10:10 -04:00
Justin Bastress
57bc835bcf Add integration tests; Post PR comment updates: stray further from original ZGrab input/output in favor of more zgrab2-like input/output; make QUIT optional (default off). 2018-03-15 11:07:18 -04:00
Justin Bastress
b52d4c47bc chmod +x shell scripts 2018-03-14 09:20:03 -04:00
Justin Bastress
fa6a7ce50c port telnet module from zgrab; add basic integration tests and schema 2018-03-13 15:23:57 -04:00
Justin Bastress
17a5c0e85c Scanner modules return the protocol ID, scan returns the protocol in the results. 2018-03-12 13:36:11 -04:00
justinbastress
9a8080e543 Fix typo in scanner template (#63)
'module that proves for (target)' to 'modules that scans for (target)'

https://github.com/zmap/zgrab2/pull/63
2018-02-27 14:59:24 -05:00
justinbastress
f02bd59f8a Add redis zgrab2 module (#53) 2018-02-13 13:25:47 -05:00
justinbastress
bd952d9809
golint and godocs for mysql module (#56) 2018-02-12 10:42:45 -05:00
justinbastress
2766a7ae08
Port http from zgrab (#31) 2018-02-09 13:45:50 -05: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
a8b4461d29
Merge #45 into master (#52)
Remove integration-test-setup (no longer needed)
2018-01-31 13:01:14 -05:00
Zakir Durumeric
f47026adb3
Merge pull request #44 from zmap/feature/updateIntegrationTestScriptTemplates
Update integration test script templates
2018-01-31 11:05:34 -05:00
Justin Bastress
e6739acff9 fix service test scripts -- remove useless i flags to docker run; if container is already running, use it; smarter wait conditions for postgres and mysql 2018-01-29 16:53:50 -05:00
Justin Bastress
c5747b7198 sandwich each module's test.sh with its setup.sh and cleanup.sh; fix some relative paths in test.sh 2018-01-29 16:48:57 -05:00
Justin Bastress
59aa3d8571 Update README; fix output file in test 2018-01-29 16:36:45 -05:00
Justin Bastress
da294f7f1e Add .templates folder in lieu of inline scripts; update templates to match more common scenarios 2018-01-29 16:03:32 -05:00
justinbastress
a1fca68c04
Port FTP module from zgrab (#32)
* 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

* port over ftp support from the original zgrab; add schema / integration tests for FTP; fix log line in ssh test

* 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

* cleanup

* add ftp schema

* 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

* ftp: use zgrab2_service_base for ftp container; restart container if already running

* FTP: remove redundant prefix; add non-authtls test

* zgrab depends on *.go

* docker-runner depends on zgrab2 binary

* clean output before running integration tests

* address Zakir's comments: rename auth_*_resp -> auth_*, 'a FTP banner' -> 'an FTP banner'

* fix schema

* update/rebuild when necessary in container
2018-01-18 13:41:51 -05:00