id: truenas-api-key

info:
  name: TrueNAS API Key (WebSocket)
  author: DhiyaneshDK
  severity: info
  reference:
    - https://github.com/praetorian-inc/noseyparker/blob/main/crates/noseyparker/data/default/builtin/rules/truenas.yml
    - https://www.truenas.com/docs/api/core_websocket_api.html
    - https://www.truenas.com/docs/api/scale_rest_api.html
    - https://www.truenas.com/docs/scale/scaletutorials/toptoolbar/managingapikeys/
    - https://www.truenas.com/docs/scale/scaleclireference/auth/cliapikey/
    - https://www.truenas.com/docs/scale/api/
    - https://www.truenas.com/community/threads/api-examples-in-perl-python.108053/
  metadata:
    verified: true
    max-request: 1
  tags: truenas,exposure,tokens

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    extractors:
      - type: regex
        part: body
        regex:
          - '"params"\s*:\s*\[\s*"(\d+-[a-zA-Z0-9]{64})"\s*\]'
# digest: 4b0a0048304602210090346afe776ac98dfb6cd52fcabc07c676464d8aa89b956f162734c82a8e07e9022100806373edce01add9621d0a845a92c0dddfddcf86d203228cfabc4a34f318b312:922c64590222798bb761d5b6d8e72950