* Add `--fail-http-to-https` to retry as HTTPS when --retry-https is used and certain known responses are encountered indicating HTTPS should be used
* Apache: HTTP/400, substring "You're speaking plain HTTP to an SSL-enabled server port"
* NGINX: HTTP/400, substring "The plain HTTP request was sent to HTTPS port"
* Add additional substring observed indicating http->https
* Add another observed substring, adjust whitespace
* Use go-ism for slicing implicitly from index 0
Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
* Add support for specifying arbitrary HTTP headers
* * (Minor, Comment) Fix incorrect comment, replace with more helpful (and accurate) comment
* (Minor, Linting) Rename raw_hash => rawHash, 4 occurences (linter)
* (Minor, Linting) Rename s -> scanner, 1 occurence (linter)
* (Sanity Checking) Prevent duplicate custom headers
* (Sanity Checking) Prevent attempts to set known immutable headers (host, content-length)
* Add --custom-header-delimeter for convenience, in practice, quoting the header values that contain comma can be problematic
* Make the separator consistent for both custom-headers-names and custom-headers-values. It's just weird having them be different :>
* Spelling delimiter correctly would probably help...
* Update modules/http/scanner.go
Co-authored-by: engn33r <engn33r@users.noreply.github.com>
Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
Co-authored-by: Zakir Durumeric <zakird@gmail.com>
Co-authored-by: engn33r <engn33r@users.noreply.github.com>
* Set SNI explicitly, in case it's a redirect (fix for #300)
* Fix the SNI issue correctly, using the host portion of addr, while respecting --server-name and --no-sni
* Clean up double error logging pointed out by dadrien
* Comply with RFC4366, do not set SNI server name for IP address
Co-authored-by: Adam Greene <copyright@mzpqnxow.com>
https://github.com/zmap/zgrab2/pull/306
So that we can advertise a slightly more expansive default set of
signature/hash algorithms in the signature_algorithms extension of
the TLS Client Hello, provide an option to use a pre-defined override.
This also splits up the TLS connection helper in tls.go, so that the
tls.Config can be modified by a scanner module.
If the --max-redirects value is exceeded, we return
SCAN_APPLICATION_ERROR with "Too many redirect" as the error message.
Add an option to suppress this error, and return success even if we
exceed the maximum specified number of redirects.
The Scanner.config struct is a configuration for all instances of
Scanner. Scanner.Scan() is called concurrently by multiple worker
goroutines; while Scanner is dereferenced before the call, the config
struct is a pointer, and so modifications to it will affect all other
running scans done with that Scanner.
Make sure we treat it as immutable during anything invoked by
Scanner.Scan() in the http module.
https://github.com/zmap/zgrab2/pull/245
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
If both an IP address and a domain are specified for a scan, have the
HTTP scanner use a fake resolver in the DialContext, so that we always
scan the intended IP and Domain name pair.
However, make sure redirects still function as normal, so only use our
fake resolver if the domain name matches the original targeted domain
name.
In addition, the custom resolver is only used if the network specified
is one that supports domain names.
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
Previous addition of GetTLSConfigForTarget (811eb38) did not modify
HTTP module to use SNI. This let to the very cryptic unknown-error:
remote error: internal error. Some servers give Fatal alerts when
they don't get an SNI extension. Discovered on a `Pagely-ARES/1.3.21`
Server
* 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