PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/email.rb

https://github.com/eliasdorneles/WhatWeb
Ruby | 57 lines | 15 code | 6 blank | 36 comment | 1 complexity | 38bbe7cb42fc2cbdca3984e5d0db910e MD5 | raw file
Possible License(s): GPL-2.0
  1. ##
  2. # This file is part of WhatWeb and may be subject to
  3. # redistribution and commercial restrictions. Please see the WhatWeb
  4. # web site for more information on licensing and terms of use.
  5. # http://www.morningstarsecurity.com/research/whatweb
  6. ##
  7. # Version 0.6 # 2011-03-19 # Brendan Coles <bcoles@gmail.com>
  8. # Updated regex
  9. ##
  10. # Version 0.5
  11. # find all email addresses, return only unique addresses, rename to email
  12. ##
  13. # Version 0.4
  14. # Updated regex, added > and comments
  15. ##
  16. # Version 0.3
  17. # added \' to regex
  18. ##
  19. # Version 0.2
  20. # removed :certainty
  21. # end at an optional ?, return the email address as a :string
  22. ##
  23. Plugin.define "Email" do
  24. author "Andrew Horton"
  25. version "0.6"
  26. 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."
  27. # More Info:
  28. # The regex will only detect anti-spam e-mail addresses if present in "mailto:"
  29. # The regex does not validate e-mail addresses in "mailto:"
  30. #
  31. # Example:
  32. # <a href="mailto:bob at gmail dot com"> will return "bob at gmail dot com"
  33. # <p>Contact me: bob at gmail dot com</p> will not be detected
  34. # <p>Contact me: bob@gmail.com</p> will return "bob@gmail.com"
  35. # Google results as at 2011-03-19 #
  36. # 902 for "contact me" ("@hotmail.com"|"@gmail.com"|"@yahoo.com")
  37. # Examples #
  38. examples %w|
  39. plugins/mailto.rb
  40. |
  41. # Matches #
  42. matches [
  43. # Detect valid email address in the page
  44. { :string=>/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i },
  45. # Detect any email address in a mailto: tag
  46. { :string=>/<[^>]+href=[^>]*mailto:([^\'\"\?>]+)[^>]*>/i },
  47. ]
  48. end