id: django-detect

info:
  name: Django Detection
  author: Chirag Mistry
  severity: info
  description: |
    An instance running Django is detected by looking for specific HTTP headers, HTML tags, and known endpoints.
  metadata:
    verified: true
    max-request: 9
    shodan-query: http.component:"django"
  tags: django,detect,tech

http:
  - method: GET
    path:
      - "{{BaseURL}}"
      - "{{BaseURL}}/robots.txt"
      - "{{BaseURL}}/sitemap.xml"
      - "{{BaseURL}}/favicon.ico"
      - "{{BaseURL}}/admin/"
      - "{{BaseURL}}/static/"
      - "{{BaseURL}}/media/"
      - "{{BaseURL}}/index.php"
      - "{{BaseURL}}/django-admin/"

    stop-at-first-match: true
    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - "Powered by Django"
          - "django-project"
          - "Django Software Foundation"
        condition: or
        case-insensitive: true

      - type: status
        status:
          - 200
          - 403
          - 404
        condition: or

    extractors:
      - type: regex
        part: body
        name: version
        regex:
          - 'Django ([0-9.]+)'
          - 'Powered by Django ([0-9.]+)'

      - type: regex
        part: body
        name: django_id
        regex:
          - 'django-site-id=([a-z0-9]+)'
          - 'django\.org/([^/]+)'
# digest: 4b0a00483046022100fc1cbcaeded3102b06d2d204a1c095a86739e706134664a900c059ff736c5778022100970dc16ce0842238c3d9d7cd6e2d4322eddaed9ea2769f8ea683fc8c7730d82d:922c64590222798bb761d5b6d8e72950