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

Add Additional Generic Url Variables #935

Merged
merged 4 commits into from
Aug 13, 2021

Conversation

wdahlenburg
Copy link
Contributor

This PR attempts to address some of the items in #491 and #927.

This adds the following generic variables that are parsed from the url:

{{Domain}}
{{Path}}
{{Port}}

The {{BaseURL}} and {{Hostname}} variables should remain unchanged in any templates.

I broke out the code in the Make function within v2/pkg/protocols/http/build_request.go and added a generateVariables function. This felt like a more succinct way to handle this.

It should be pretty easy to expand this for anything else, but this seemed like a good start.

@ehsandeep
Copy link
Member

thanks a lot @wdahlenburg and creating this PR, @parrasajad is already on this so he might pick it from here or make additional PR, we will keep you updated.

Here is a list of global variables we intend to support:

https://hackerone.com:443/foo?profile=true

{{BaseURL}}		 - https://hackerone.com:443/foo?profile=true
{{RootURL}}		 - https://hackerone.com:443
{{Hostname}}	         - hackerone.com:443
{{Host}}		 - hackerone.com
{{Port}}		 - 443
{{Path}}		 - /foo
{{Scheme}}		 - https

http://104.16.100.52/foo?profile=true

{{BaseURL}}		 - http://104.16.100.52/foo?profile=true
{{RootURL}}		 - http://104.16.100.52
{{Hostname}}	         - 104.16.100.52:80
{{Host}}		 - 104.16.100.52
{{Port}}		 - 80
{{Path}}		 - /foo
{{Scheme}}		 - http

@ehsandeep ehsandeep changed the base branch from master to dev August 12, 2021 18:00
@Ice3man543
Copy link
Member

@wdahlenburg Added some more variables as mentioned by @ehsandeep. The changes look good to me, merging the pr! Thanks again for your contribution.

@Ice3man543 Ice3man543 merged commit 3c9c43e into projectdiscovery:dev Aug 13, 2021
This was linked to issues Aug 13, 2021
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.

[feature] Hostname w/o port [Feature] Add More Global Variables
3 participants