module Intrigue
module Ident
module Check
  class Generic < Intrigue::Ident::Check::Base

    def generate_checks(url)
      [
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Connection Reset (attempted HTTP connection)",
          description:"connection reset or timeout",
          version: nil,
          hide: true,
          match_type: :content_code,
          match_content:  0,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Error Page",
          description:"There's a generic error message in the title.",
          version: nil,
          hide: false,
          match_type: :content_title,
          match_content:  /^Error$/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Error Page",
          description:"There's a generic error message in the title.",
          version: nil,
          hide: false,
          match_type: :content_title,
          match_content:  /^Service Unavailable$/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Error Page",
          description:"There's a generic error message in the body.",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /internal error - server connection terminated/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        #{
        #  type: "fingerprint",
        #  category: "none",
        #  vendor: "Generic",
        #  product: "Empty Response",
        #  description:"No response received!",
        #  version: nil,
        #  hide: true,
        #  match_type: :content_body,
        #  match_content:  /^$/i,
        #  paths: [ { path: "#{url}", follow_redirects: true } ],
        #  inference: false
        #},
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked title",
          version: nil,
          hide: false,
          match_type: :content_title,
          match_content:  /^Domain Parked$/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked title",
          version: nil,
          hide: false,
          match_type: :content_title,
          match_content:  /is parked/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },        
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /registered and parked/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /page is parked/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /site is parked/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /domain is parked/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /This domain is currently parked./i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /THIS DOMAIN IS REGISTERED AND PARKED/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"generic parked string",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /is a parked domain/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "service",
          tags: ["Parked"],
          vendor: "Generic",
          product: "Parked Page",
          description:"parked for free",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /is a parked domain/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Unauthorized",
          description:"error in body",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /<STRONG>401 Unauthorized/,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Unauthorized",
          description:"Title",
          version: nil,
          hide: false,
          match_type: :content_title,
          match_content:  /^Access Denied$/,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Under Construction",
          description:"under construction page",
          version: nil,
          hide: false,
          match_type: :content_body,
          match_content:  /<HEAD><TITLE>Under construction/i,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          product: "Load Balancer",
          description:"There's a semi-generic xserver header being sent from this asset.",
          version: nil,
          hide: false,
          match_type: :content_headers,
          match_content:  /^xserver:/,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        },
        {
          type: "fingerprint",
          category: "none",
          vendor: "Generic",
          tags: ["Load Balancer"],
          product: "Page Missing (404)",
          description:"Could be an API, or just serving something at another location. TODO ... is this ECS-specific? (check header)",
          version: nil,
          hide: true,
          match_type: :content_body,
          match_content:  /<title>404 - Not Found<\/title>/,
          paths: [ { path: "#{url}", follow_redirects: true } ],
          inference: false
        }
      ]
    end

  end
end
end
end
