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

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