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

Helper function for IP Formats #3286

Merged
merged 9 commits into from
Feb 16, 2023
Merged

Conversation

xm1k3
Copy link
Contributor

@xm1k3 xm1k3 commented Feb 7, 2023

Proposed changes

Checklist

@xm1k3 xm1k3 self-assigned this Feb 7, 2023
@xm1k3 xm1k3 added the Type: Enhancement Most issues will probably ask for additions or changes. label Feb 7, 2023
@xm1k3 xm1k3 linked an issue Feb 7, 2023 that may be closed by this pull request
@xm1k3 xm1k3 marked this pull request as ready for review February 9, 2023 11:01
v2/pkg/operators/common/dsl/dsl.go Outdated Show resolved Hide resolved
@tarunKoyalwar
Copy link
Member

Example template

id: ip-format-example

info:
  name: ip format example template
  author: pdtm
  severity: info

variables:
  format: "1"

requests:
  - raw:
      - |+
        GET / HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - "print_debug(ip_format(ipvar,format))"%         

@tarunKoyalwar
Copy link
Member

$ ./nuclei -t ~/test/ipformat.yaml -V "ipvar=127.0.0.1" -V "format=5"  -u scanme.sh -v

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.8.8

		projectdiscovery.io

[INF] Using Nuclei Engine 2.8.8 (latest)
[INF] Using Nuclei Templates 9.3.6 (latest)
[INF] Templates added in last update: 30
[INF] Templates loaded for scan: 1
[INF] Targets loaded for scan: 1
[INF] Running httpx on input host
[INF] Found 1 URL from httpx
[VER] [ip-format-example] Sent HTTP request to https://scanme.sh/
[INF] print_debug value: [281472812449793]
[ip-format-example] [http] [info] https://scanme.sh/

Copy link
Member

@tarunKoyalwar tarunKoyalwar left a comment

Choose a reason for hiding this comment

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

lgtm!

$ ./nuclei -t ~/test/ipformat.yaml -V "ipvar=127.0.1.0" -V "format=11"  -u scanme.sh -v

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v2.8.8

		projectdiscovery.io

[INF] Using Nuclei Engine 2.8.8 (outdated)
[INF] Using Nuclei Templates 9.3.6 (latest)
[INF] Templates added in last update: 30
[INF] Templates loaded for scan: 1
[INF] Targets loaded for scan: 1
[INF] Running httpx on input host
[INF] Found 1 URL from httpx
[VER] [ip-format-example] Sent HTTP request to https://scanme.sh/
[INF] print_debug value: [127.0.256]
[ip-format-example] [http] [info] https://scanme.sh/

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - I suggest anyway to add ip_format to the integration test /nuclei/integration_tests/http/dsl-functions.yaml

@xm1k3 xm1k3 mentioned this pull request Feb 13, 2023
4 tasks
@xm1k3 xm1k3 requested a review from Mzack9999 February 14, 2023 07:46
@ehsandeep ehsandeep merged commit cc2f796 into dev Feb 16, 2023
@ehsandeep ehsandeep deleted the issue-2271-ip-format-helper-fn branch February 16, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helper function for IP Formats
4 participants