Class: Okayu::FirefoxCookieThief
Class Method Summary
collapse
Methods inherited from CookieThief
cookiestxt_from_array, do_on_tmpfile, get, send_query
Class Method Details
.cookies_filename ⇒ Object
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
# File 'lib/cookie_thief.rb', line 109
def cookies_filename
cookies_filename = nil
case OS
when 'Linux'
if dir = Dir.glob("#{ENV['HOME']}/.mozilla/firefox/*").select{|path| path =~ /.*\.default$/}.first
if File.exist?("#{dir}/cookies.sqlite")
cookies_filename = "#{dir}/cookies.sqlite"
end
end
when 'Windows'
dir = Dir.glob("#{APPDATA_PATH}/Mozilla/Firefox/Profiles/*").select{|path| path =~ /.*\.default$/}.first
if dir && File.exist?("#{dir}/cookies.sqlite")
cookies_filename = "#{dir}/cookies.sqlite"
end
end
cookies_filename
end
|
.sql_from_hash(args) ⇒ Object
103
104
105
106
107
|
# File 'lib/cookie_thief.rb', line 103
def sql_from_hash args
sql = "select host, isHttpOnly, path, isSecure, expiry, name, value from moz_cookies where "
sql << args.map{|key, value|"#{key.to_s} = '#{value}'"}.join(' and ')
sql << ';'
end
|