Class: CookieExtractor::ChromeCookieExtractor

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/cookie_extractor/chrome_cookie_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(cookie_file) ⇒ ChromeCookieExtractor

Returns a new instance of ChromeCookieExtractor.



7
8
9
# File 'lib/cookie_extractor/chrome_cookie_extractor.rb', line 7

def initialize(cookie_file)
  @cookie_file = cookie_file
end

Instance Method Details

#extractObject



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

def extract
  db = SQLite3::Database.new @cookie_file
  db.results_as_hash = true
  result = []
  db.execute("SELECT * FROM cookies") do |row|
    result << [ row['host_key'],
      true_false_word(is_domain_wide(row['host_key'])),
      row['path'],
      true_false_word(row['secure']),
      row['expires_utc'],
      row['name'],
      row['value']
    ].join("\t")
  end
  db.close
  result
end