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

Added variables for nuclei + refactor variable handling #1785

Merged
merged 13 commits into from
Apr 21, 2022

Conversation

Ice3man543
Copy link
Member

@Ice3man543 Ice3man543 commented Mar 29, 2022

Proposed changes

Added variables support for HTTP, DNS, Network and Headless templates.

id: variables

info:
  name: variable example
  author: pdteam
  severity: info

variables:
  a1: "{{to_lower(rand_base(5))}}"

requests:
  - raw:
      - |
        POST /search.php?test=query HTTP/1.1
        Host: {{Hostname}}
        Origin: http://testphp.vulnweb.com
        Content-Type: application/x-www-form-urlencoded

        searchFor={{a1}}&goButton=go

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "{{a1}}"

      - type: dsl
        dsl:
          - "contains(body, a1)"

    extractors:
      - type: kval
        kval:
          - "a1"
echo http://testphp.vulnweb.com | ./nuclei -t tt.yaml -duc

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   2.6.5

		projectdiscovery.io

[WRN] Use with caution. You are responsible for your actions.
[WRN] Developers assume no liability and are not responsible for any misuse or damage.
[INF] Using Nuclei Engine 2.6.5 (outdated)
[INF] Using Nuclei Templates 8.9.6 (latest)
[INF] Templates added in last update: 9
[INF] Templates loaded for scan: 1
[variables] [http] [info] http://testphp.vulnweb.com/search.php?test=query [d0imr] [a1=d0imr]

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@Ice3man543 Ice3man543 changed the title [wip] Added variables for nuclei + refactor variable handling Added variables for nuclei + refactor variable handling Mar 30, 2022
@Ice3man543 Ice3man543 linked an issue Mar 30, 2022 that may be closed by this pull request
@ehsandeep ehsandeep requested a review from Mzack9999 April 1, 2022 19:35
@Ice3man543 Ice3man543 self-assigned this Apr 1, 2022
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge conflict

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add variables.md under https://github.com/projectdiscovery/nuclei-docs/tree/master/docs/templating-guide to include relevant information in docs.

@Ice3man543
Copy link
Member Author

projectdiscovery/nuclei-docs#35 - done here

@ehsandeep ehsandeep merged commit d3b4a86 into dev Apr 21, 2022
@ehsandeep ehsandeep deleted the variables-introduction branch April 21, 2022 12:29
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.

Adding variables support to templates
3 participants