id: wordpress-hunk-companion

info:
  name: Hunk Companion Detection
  author: invisiblethreat
  severity: info
  reference:
    - https://wordpress.org/plugins/hunk-companion/
  metadata:
    max-request: 1
    plugin_namespace: hunk-companion
  tags: tech,wordpress,wp-plugin,discovery

http:
  - method: GET
    path:
      - "{{BaseURL}}/wp-content/plugins/hunk-companion/readme.txt"

    payloads:
      last_version: helpers/wordpress/plugins/hunk-companion.txt

    extractors:
      - type: regex
        part: body
        internal: true
        name: internal_detected_version
        group: 1
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'

      - type: regex
        part: body
        name: detected_version
        group: 1
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'

    matchers-condition: or
    matchers:
      - type: dsl
        name: "outdated_version"
        dsl:
          - compare_versions(internal_detected_version, concat("< ", last_version))

      - type: regex
        part: body
        regex:
          - '(?i)Stable.tag:\s?([\w.]+)'
# digest: 4b0a00483046022100cf7c6c05aca3cff33d3ea611d885b5b53c0879af250ee55d2946a19fb3886123022100c9734927d3be11a30217be27099345905b9039c7e7d76d854432dad46f2c04d4:922c64590222798bb761d5b6d8e72950