class PhisherPhinder::Mail
Attributes
authentication_headers[R]
body[R]
headers[R]
original_body[R]
original_email[R]
original_headers[R]
tracing_headers[R]
Public Class Methods
new( original_email:, original_headers:, original_body:, headers:, tracing_headers:, body:, authentication_headers: )
click to toggle source
# File lib/phisher_phinder/mail.rb, line 13 def initialize( original_email:, original_headers:, original_body:, headers:, tracing_headers:, body:, authentication_headers: ) @original_email = original_email @original_headers = original_headers @original_body = original_body @headers = headers @tracing_headers = tracing_headers @authentication_headers = authentication_headers @body = body end
Public Instance Methods
hypertext_links()
click to toggle source
# File lib/phisher_phinder/mail.rb, line 33 def hypertext_links body_as_html. xpath('//a'). select { |el| el.attributes['href'] }. map { |el| BodyHyperlink.new(el.attributes['href'].value, el.text) } end
reply_to_addresses()
click to toggle source
# File lib/phisher_phinder/mail.rb, line 25 def reply_to_addresses (@headers[:reply_to] || []).map do |value_string| value_string.split(",") end.flatten.map do |email_address_string| extract_email_address(email_address_string) end.uniq end
Private Instance Methods
body_as_html()
click to toggle source
# File lib/phisher_phinder/mail.rb, line 42 def body_as_html require 'nokogiri' Nokogiri::HTML(body[:html]) end
extract_email_address(email_address_string)
click to toggle source
# File lib/phisher_phinder/mail.rb, line 48 def extract_email_address(email_address_string) if email_address_string.include? '<' email_address_string =~ /<([^>]+)>/ $1 else email_address_string end.downcase.strip end