id: smb2-capabilities

info:
  name: smb2-capabilities - Enumeration
  author: pussycat0x
  severity: info
  description: |
    Attempts to list the supported capabilities in a SMBv2 server for each enabled dialect.
  reference:
    - https://nmap.org/nsedoc/scripts/smb2-capabilities.html
  metadata:
    max-request: 1
    shodan-query: port:445
    product: dionaea
    vendor: dionaea
  tags: js,network,smb,enum,discovery

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

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

    extractors:
      - type: json
        part: response
        json:
          - '.Capabilities | with_entries(select(.value == true)) | keys'
# digest: 490a00463044022063c444297129f2b3bc0568804afc02215afef4083909cf810e53d172fb2ecd8902201d60c134768aa6be4364139bd891f31cb06156c9d12be4b60497df0f2f9ca68f:922c64590222798bb761d5b6d8e72950