Commit Graph

137 Commits

Author SHA1 Message Date
Clayton Zimmerman
26e22bad97 Makes redirect response chain (currently unused) a debug field. 2018-07-12 16:47:26 -04:00
Clayton Zimmerman
dc3d7d1cb7 Adds bounds checks to avoid panic when value-less attributes have the correct name to be recorded directly in results. 2018-07-11 14:57:22 -04:00
Clayton Zimmerman
9d1265db8b Avoids skipping retry when an application error is encountered. 2018-07-11 14:45:46 -04:00
Clayton Zimmerman
2c47dfc1f2 Makes Attributes default output (rather than debug). 2018-07-11 11:52:13 -04:00
Clayton Zimmerman
f9eb6e00db Rename tls-retry option to ipps-retry 2018-07-11 10:38:42 -04:00
clayzim
1fa9b886e4 Changes TLS-Retry to attempt TLS before plaintext, ideally gathering more information. 2018-07-10 16:07:28 -04:00
clayzim
3fa42bef49 Parses empty attribute-groups correctly by skipping to the next one. 2018-07-10 15:16:30 -04:00
clayzim
544652de9d Resolves merge conflict to fix timeouts. 2018-07-10 15:10:24 -04:00
Justin Bastress
2a4ffcc3d9 BaseFlags.Timeout is already a duration 2018-07-10 14:25:25 -04:00
clayzim
e77e11cb7f Compensates for change in Scanner.config.BaseFlags.Timeout's type. No longer casts to time.Duration. 2018-07-10 14:05:20 -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
Justin Bastress
3e76d14900 use standard method to get host in SSH scanner 2018-06-28 16:52:29 -04:00
Justin Bastress
ccbf497b84 resolve conflict with utility.go 2018-06-28 16:05:48 -04:00
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
Zakir Durumeric
681d6e0a56
Merge branch 'master' into ah/trigger 2018-06-28 15:05:12 -04:00
Clayton Zimmerman
9bbd62a5b6
(IPP) improve scan output (#140)
* Refactors sending IPP request and handling errors thereof into sendIPPRequest()

* Adds dependency of IPP zgrab2 schema on HTTP zgrab2 schema.

* Refactors out trying to grab with multiple versions into re-usable function.

* Determines whether to output nil result in a concise and accurate manner.

* Refactors reading attributes present in IPP response to its own function. Calls that in Grab and augmentWithCUPSData. Formats code using Go fmt.

* Rejects successful non-IPP responses with protocol error. Reports HTTP errors.

* Removes circular dependency upon http zgrab2 schema.

* Changes name of objects to make IPP schema actually work.
2018-06-28 14:58:40 -04:00
Alex Halderman
0c597e5a8d
Merge branch 'master' into ah/trigger 2018-06-26 17:53:20 -07:00
J. Alex Halderman
0c8413c8cd mend 2018-06-26 13:59:36 -04:00
J. Alex Halderman
cd2070d3bc mend 2018-06-26 13:57:28 -04: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
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
ffaeeab0f1 Cleans up TODOs and includes more results to collect from scans. 2018-06-12 09:27:45 -04:00
Clayton Zimmerman
6456dda5e1 Implements basic scanning, without checking for correct protocol. 2018-06-11 12:02:42 -04:00
Clayton Zimmerman
b076c7b005 Boilerplate for IPP scan module. 2018-06-07 15:13:01 -04:00
Justin Bastress
c35a9f29e2 add missing _unknown_error_tag to postgres error schema 2018-05-31 10:56:16 -04:00
Justin Bastress
01cd84926e Strip/cap the output value length; include output error in cases where format was not expected 2018-05-25 17:01:31 -04:00
Justin Bastress
71090d71b3 handshakeErr, not err 2018-05-22 18:23:19 -04:00
Justin Bastress
a14f3dc584 include negotiated encrypt_mode 2018-05-22 17:06:48 -04:00
Justin Bastress
05841e9ab4 raw_packets is debug; server_version is omitempty 2018-05-22 16:05:56 -04:00
Justin Bastress
486dc517a3 fix required/non-required in schemas; add error_ids, and code to get them; throw ERRPacket as APPLICATION_ERROR 2018-05-21 12:15:17 -04:00
Justin Bastress
89e0e956d5 MSSQL: Strip null terminator from instance_name; changeInstanceName to a pointer to distinguish the empty names (e.g. just a null terminator) from no name being returned. 2018-05-18 15:25:08 -04:00
Justin Bastress
f3437bbc62 don't log full packet; don't create packet until returning 2018-05-17 14:36:51 -04:00
Justin Bastress
3ffbf89c36 lower max packet size to 512k, not 128MB. Add maximum on number of packets as well. 2018-05-15 15:47:14 -04:00
Justin Bastress
bf1d74483e fix packet length calculation 2018-05-15 14:16:51 -04:00
Justin Bastress
88707e7a87 fix comment typo 2018-05-14 14:48:48 -04:00
Justin Bastress
531ba31c34 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
Justin Bastress
b5fbfcc690 ensure postgres connections get closed 2018-05-11 14:01:10 -04:00
Justin Bastress
e4388ad861 handle server returning < 2 bytes 2018-05-11 12:21:11 -04:00
Justin Bastress
7dc895a975 fix logrus collision 2018-05-11 11:52:08 -04:00
Justin Bastress
0cfc4bdff3 lower log level of per-scan errors 2018-05-11 11:45:59 -04:00
Justin Bastress
e77866dfea loglevel fixes 2018-05-11 11:43:08 -04:00
Justin Bastress
e0745c5323 another err->readErr 2018-05-11 11:18:20 -04:00
Justin Bastress
50e2dbbeb7 fix error variable name 2018-05-11 10:56:38 -04:00
Justin Bastress
3254857b58 Add a dialer for the non-TLS case in HTTP, so that --timeout is honored even if --use-https is not set (issue #109) 2018-05-01 13:33:21 -04:00
justinbastress
5c0cbeeee0
Merge pull request #97 from zmap/feature/stripDebugFields
zgrab2: Strip debug fields
2018-04-26 12:27:39 -04:00
Justin Bastress
42ae30babe add --retry-https flag to work with unknown HTTP/HTTPS servers; remove unused request.tls field from zschema (only used for HTTP servers, caused zschema errors because of ListOf(ListOf())) 2018-04-05 14:19:58 -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
c358b52018 add Protocol method 2018-03-26 11:46:27 -04:00