Sha256: 05026f8585e8636d1d34fd5ecc7e2f47fcad00334815af676e803175ef23e954

Contents?: true

Size: 977 Bytes

Versions: 4

Compression:

Stored size: 977 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 "oga"

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

  def passive(target)
    m = []

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_whatweb-0.4.1 lib/whatweb/plugins/title.rb
simple_whatweb-0.4.0 lib/whatweb/plugins/title.rb
simple_whatweb-0.3.0 lib/whatweb/plugins/title.rb
simple_whatweb-0.2.1 lib/whatweb/plugins/title.rb