Class: CookieExtractor::FirefoxCookieExtractor

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

Instance Method Summary collapse

Constructor Details

#initialize(cookie_file) ⇒ FirefoxCookieExtractor

Returns a new instance of FirefoxCookieExtractor.



7
8
9
# File 'lib/cookie_extractor/firefox_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/firefox_cookie_extractor.rb', line 11

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