Class: CloudbleedChecker::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/cloudbleed_checker/cli.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cloudbleed_checker/cli.rb', line 11

def check
  Dir.mktmpdir do |tmpdir|
    puts 'Extracting history....'
    tmpdir = Pathname.new(tmpdir)
    domains = Chrome.extract_domains(tmpdir)
    domains.merge(Safari.extract_domains(tmpdir))
    domains.merge(Firefox.extract_domains(tmpdir))
    puts "Extracted #{domains.size} unique hosts from your browser histories"

    puts 'Checking sites'
    num_checked = 0
    domains_path = File.join(File.dirname(__FILE__), 'domains.gz')
    Zlib::GzipReader.open(domains_path) do |file|
      file.each_line do |domain|
        domain.chomp!
        if domains.include?(domain)
          puts "History included '#{domain}' from list"
        end
      end
    end
  end
  puts "Check complete"
end