This abstracts more of the help text into the ScanModule definition,
removing some more of the need for `zgrab2.AddCommand()`
https://github.com/zmap/zgrab2/pull/248
Commit a38194a added an optional port override as part of the
scan target. The HTTP and IPP modules, however, still compose
the URL (and select http vs https) by ignoring the override.
This checks for the override, and if present uses the scan target
port. Otherwise, it falls back to the config port.
https://github.com/zmap/zgrab2/pull/233
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.
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.
* 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.
* 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.
* 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.