Class: PhisherPhinder::TracingReport

Inherits:
Object
  • Object
show all
Defined in:
lib/phisher_phinder/tracing_report.rb

Instance Method Summary collapse

Constructor Details

#initialize(mail:, host_information_finder:, link_explorer:) ⇒ TracingReport

Returns a new instance of TracingReport.



5
6
7
8
9
# File 'lib/phisher_phinder/tracing_report.rb', line 5

def initialize(mail:, host_information_finder:, link_explorer:)
  @mail = mail
  @host_information_finder = host_information_finder
  @link_explorer = link_explorer
end

Instance Method Details

#reportObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/phisher_phinder/tracing_report.rb', line 11

def report
  {
    authentication: {
      mechanisms: [:spf],
      spf: {
        success: latest_spf_entry[:result] == :pass,
        ip: latest_spf_entry[:ip],
        from_address: latest_spf_entry[:mailfrom],
        client_ip: latest_spf_entry[:client_ip],
      }
    },
    origin: extract_origin_headers(@mail.headers),
    tracing: extract_tracing_headers(@mail.tracing_headers, latest_spf_entry),
    content: explore_hyperlinks(@mail.hypertext_links)
  }
end