Class: PhisherPhinder::Display

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

Instance Method Summary collapse

Instance Method Details

#display_report(input_data) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/phisher_phinder/display.rb', line 6

def display_report(input_data)
  origin_table = Terminal::Table.new(
    title: 'Origin',
    rows: format_origin_data(input_data)
  )

  puts origin_table

  puts "\n\n"

  spf_table = Terminal::Table.new(
    headings: ['SPF Pass?', 'Sender Host', 'From Address'],
    title: 'SPF',
    rows: [
      [
        input_data[:authentication][:spf][:success] ? 'Yes' : 'No',
        input_data[:authentication][:spf][:ip],
        input_data[:authentication][:spf][:from_address]
      ]
    ]
  )

  puts spf_table

  puts "\n\n"

  data = input_data[:tracing].map do |entry|
    [
      entry[:sender][:ip],
      display_email_addresses(entry[:sender_contact_details][:ip][:email]),
      entry[:sender][:host],
      display_email_addresses(entry[:sender_contact_details][:host][:email]),
      entry[:advertised_sender] || entry[:helo],
      entry[:recipient]
    ]
  end

  trace_table = Terminal::Table.new(
    headings: ['Sender IP', 'IP Contacts', 'Sender Host', 'Host Contacts', 'Advertised Sender', 'Recipient'],
    title: 'Trace',
    rows: data
  )

  puts trace_table

  puts "\n\n"

  puts 'Body Content'
  puts "\n"
  puts "Linked URLs"
  input_data[:content][:linked_urls].each do |link_set|
    link_set.each_with_index do |link_host, tab_count|
      puts "#{"\t"*tab_count}" +
        "#{link_host.url.to_s} " +
        "(#{display_creation_date(link_host)}) " +
        "[#{display_email_addresses(link_host.host_information[:abuse_contacts])}]" +
        "\n"
    end
    puts "\n"
  end
end