Sha256: f4f91c94feb13058923578fc080737af70fa6f46f3f761f20a173ebb208f2663

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##

# Version 0.3 - 2014-08-22
# Remove newlines in title, give warning when newlines are found.
# Version 0.2
# removed :certainty=>100

require "nokogiri"

WhatWeb::Plugin.define "Title" do
  @author = "Andrew Horton"
  @version = "0.3"
  @description = "The HTML page title"

  def passive(target)
    m = []

    html = Nokogiri.parse(target.body)
    title = html.css("title")
    if title
      # Give warining if title element contains newline(s)
      if title.text.include? "\n"
        m << { name: "WARNING", module: "Title element contains newline(s)!" }
      end
      # Strip all newlines in title string (for better output)
      m << { name: "page title", string: title.text.strip }
     end
    m
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_whatweb-0.1.0 lib/whatweb/plugins/title.rb