Class: Apullo::Fingerprint::HTTP

Inherits:
Base
  • Object
show all
Defined in:
lib/apullo/fingerprints/http.rb

Instance Attribute Summary

Attributes inherited from Base

#target

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, #name

Constructor Details

This class inherits a constructor from Apullo::Fingerprint::Base

Instance Method Details

#bodyObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/apullo/fingerprints/http.rb', line 34

def body
  return {} unless @body

  hash = Hash.new(@body)
  {
    md5: hash.md5,
    mmh3: hash.mmh3,
    sha1: hash.sha1,
    sha256: hash.sha256,
  }
end

#certObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/apullo/fingerprints/http.rb', line 22

def cert
  return {} unless @peer_cert

  hash = Hash.new(@peer_cert.to_der)
  {
    md5: hash.md5,
    serial: @peer_cert.serial,
    sha1: hash.sha1,
    sha256: hash.sha256,
  }
end

#faviconObject



46
47
48
49
50
51
52
# File 'lib/apullo/fingerprints/http.rb', line 46

def favicon
  url = favicon_url
  return {} unless url

  favicon = Favicon.new(url)
  favicon.results
end

#resultsObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/apullo/fingerprints/http.rb', line 10

def results
  @results ||= [].tap do |out|
    get(target.uri.path)

    out << {
      body: body,
      cert: cert,
      favicon: favicon
    }
  end.first
end