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

js protocol: fix breaking json export issue #4893

Merged
merged 4 commits into from
Mar 15, 2024
Merged

js protocol: fix breaking json export issue #4893

merged 4 commits into from
Mar 15, 2024

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Mar 15, 2024

Proposed changes

  • Existing templates are written using to_json javascript function which use JSON.Stringify() implement of goja and does not respect key names specified in json tags of a struct
  • Latest Version of Nuclei used go native Json.Marshal to marshal objects and this resulted in different keynames, this fixes the issue
  • retracted version v3.2.0 in go.mod (https://go.dev/ref/mod#go-mod-file-retract)
$  nuclei -u 172.121.188.26 -t a.yaml  

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.2.0

		projectdiscovery.io

[INF] Current nuclei version: v3.2.0 (latest)
[INF] Current nuclei-templates version: v9.7.8 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 126
[INF] Templates loaded for current scan: 1
[WRN] Loaded 1 unsigned templates for scan. Use with caution.
[INF] Targets loaded for current scan: 1
[smb-enum-domains] [javascript] [info] 172.121.188.26:445 [{"dnsComputerName":"WIN-6KANFM4RCN6","dnsDomainName":"WIN-6KANFM4RCN6","netBIOSComputerName":"WIN-6KANFM4RCN6","netBIOSDomainName":"WIN-6KANFM4RCN6","osVersion":"6.3.9600","signingEnabled":true,"signingRequired":false}]
$ ./nuclei -u 172.121.188.26 -t a.yaml 

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.2.1-dev

		projectdiscovery.io

[INF] Current nuclei version: v3.2.1-dev (development)
[INF] Current nuclei-templates version: v9.7.8 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 126
[INF] Templates loaded for current scan: 1
[WRN] Loaded 1 unsigned templates for scan. Use with caution.
[INF] Targets loaded for current scan: 1
[smb-enum-domains] [javascript] [info] 172.121.188.26:445 [{"DNSComputerName":"WIN-6KANFM4RCN6","DNSDomainName":"WIN-6KANFM4RCN6","ForestName":"","NetBIOSComputerName":"WIN-6KANFM4RCN6","NetBIOSDomainName":"WIN-6KANFM4RCN6","OSVersion":"6.3.9600","SigningEnabled":true,"SigningRequired":false}]

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)

@tarunKoyalwar
Copy link
Member Author

id: smb-enum-domains

info:
  name: SMB - Enum Domains
  author: DhiyaneshDK
  severity: info
  description: |
     SMB enumeration of domains is often part of the reconnaissance phase, where security professionals or attackers attempt to gather information about the target network to identify potential vulnerabilities.
  reference:
    - https://nmap.org/nsedoc/scripts/smb-enum-domains.html
  metadata:
    verified: true
    max-request: 1
    shodan-query: port:445
  tags: js,network,smb,enum

javascript:
  - code: |
      var m = require("nuclei/smb");
      var c = new m.SMBClient();
      var response = c.ListSMBv2Metadata(Host, Port);
      Export(response)

    args:
      Host: "{{Host}}"
      Port: "445"


    matchers:
      - type: dsl
        dsl:
          - "success"

    extractors:
      - type: json
        json:
          - '.'

@ehsandeep ehsandeep merged commit 0b70d58 into dev Mar 15, 2024
12 checks passed
@ehsandeep ehsandeep deleted the js-hot-fix branch March 15, 2024 13:20
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

3 participants