Sha256: 98e6e42d78abb879e9a9f86126e00c82a3676151142c6fe67c17263187f9e056

Contents?: true

Size: 1.81 KB

Versions: 6

Compression:

Stored size: 1.81 KB

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.6 # 2011-03-19 # Brendan Coles <bcoles@gmail.com>
# Updated regex
##
# Version 0.5
# find all email addresses, return only unique addresses, rename to email
##
# Version 0.4
# Updated regex, added > and comments
##
# Version 0.3
# added \' to regex
##
# Version 0.2
# removed :certainty
# end at an optional ?, return the email address as a :string
##
WhatWeb::Plugin.define "Email" do
  @author = "Andrew Horton"
  @version = "0.6"
  @description = "Extract email addresses. Find valid email address and syntactically invalid email addresses from mailto: link tags. We match syntactically invalid links containing mailto: to catch anti-spam email addresses, eg. bob at gmail.com. This uses the simplified email regular expression from http://www.regular-expressions.info/email.html for valid email address matching."

  # More Info:
  # The regex will only detect anti-spam e-mail addresses if present in "mailto:"
  # The regex does not validate e-mail addresses in "mailto:"
  #
  # Example:
  # <a href="mailto:bob at gmail dot com"> will return "bob at gmail dot com"
  # <p>Contact me:  bob at gmail dot com</p> will not be detected
  # <p>Contact me:  bob@gmail.com</p> will return "bob@gmail.com"

  # Google results as at 2011-03-19 #
  # 902 for "contact me" ("@hotmail.com"|"@gmail.com"|"@yahoo.com")

  # Matches #
  @matches = [

    # Detect valid email address in the page
    { string: /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i },

    # Detect any email address in a mailto: tag
    { string: /<[^>]+href=[^>]*mailto:([^\'\"\?>]+)[^>]*>/i },

  ]
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_whatweb-0.4.1 lib/whatweb/plugins/email.rb
simple_whatweb-0.4.0 lib/whatweb/plugins/email.rb
simple_whatweb-0.3.0 lib/whatweb/plugins/email.rb
simple_whatweb-0.2.1 lib/whatweb/plugins/email.rb
simple_whatweb-0.2.0 lib/whatweb/plugins/email.rb
simple_whatweb-0.1.0 lib/whatweb/plugins/email.rb