Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor port override when composing URL #233

Merged
merged 1 commit into from
Nov 20, 2019
Merged

Conversation

codyprime
Copy link
Member

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.

How to Test

Verify existing behavior works (no regression):

A) echo hostname | zgrab2 http --use-https -p 443
B) echo hostname | zgrab2 http --use-https

Run A should end in success, and also grab the TLS cert.
Run B should end in error, as it attempted against the default port 80 (assuming of course https is not running on this port on the host).

Verify new behavior

This is a bit trickier, you need a different framework other than cmd/zgrab2 that initializes the module, and performs a scan. However, if that is done, then if the ScanTarget contains a port number, it should override both the default and cmdline passes ports, and use the port specified in ScanTarget

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.
@dadrian
Copy link
Member

dadrian commented Nov 19, 2019

Does this still handle redirects correctly?

@codyprime
Copy link
Member Author

Does this still handle redirects correctly?

It should not have any effect on redirects, it just affects the port used when composing the initial request.

I verified a redirected domain by:

$ echo subdomain.domain.tld | ./zgrab2 http 
[...]
"error":"Too many redirects"
"http":{"successes":0,"failures":1}}
$  echo subdomain.domain.tld | ./zgrab2 http --max-redirects=1
[...]
"http":{"successes":1,"failures":0}}

@dadrian dadrian merged commit d12c70e into master Nov 20, 2019
@dadrian dadrian deleted the jcody/http-ipp-port branch November 20, 2019 15:14
AnthraX1 pushed a commit to AnthraX1/zgrab2 that referenced this pull request Jul 21, 2020
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.

zmap#233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants