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

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: 4a0a00473045022100e718f7b9d409bba53cd26e9567ac59f934de8168695b4dd6e8a831903f23bcde02207f0f651fa54cd8a4b4946680564ca603233378201fd80e7d8d7f4483edcf9366:922c64590222798bb761d5b6d8e72950