22 lines
642 B
Ruby
Executable file
22 lines
642 B
Ruby
Executable file
#!/usr/bin/env ruby
|
|
|
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "cookie_extractor"))
|
|
|
|
# TODO: Locate cookie dbs automatically
|
|
filename = ARGV.first
|
|
unless filename
|
|
puts "Usage: cookie_extractor /path/to/cookies.sqlite"
|
|
exit
|
|
end
|
|
|
|
if File.exists?(filename)
|
|
begin
|
|
extractor = CookieExtractor::BrowserDetector.new_extractor(filename)
|
|
puts extractor.extract.join("\n")
|
|
rescue SQLite3::NotADatabaseException,
|
|
CookieExtractor::BrowserNotDetectedException
|
|
puts "Error: File '#{filename}' is not a Firefox or Chrome cookie database"
|
|
end
|
|
else
|
|
puts "Error: File '#{filename}' does not exist"
|
|
end
|