Created
May 7, 2010 06:30
-
-
Save mnutt/393140 to your computer and use it in GitHub Desktop.
Revisions
-
mnutt revised this gist
May 16, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # ffcurl # # This curl that automatically uses your firefox cookies. Use it like you would normally # use curl. Report bugs to michael@nuttnet.net. Or better yet, fork it from: # # http://gist.github.com/393140 # -
Brian Turnbull revised this gist
May 7, 2010 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,11 @@ host = URI.split(url)[2] top_level_host = host.split('.').slice(-2, 2).join('.') if File.directory? "#{ENV['HOME']}/Library" cookie_file = Dir["#{ENV['HOME']}/Library/Application\ Support/Firefox/**/cookies.sqlite"].first else cookie_file = Dir["#{ENV['HOME']}/.mozilla/firefox/**/cookies.sqlite"].first end FileUtils.cp(cookie_file, "/tmp/.ffcurl_db") -
mnutt revised this gist
May 7, 2010 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,8 @@ # use curl. Report bugs to michael@nuttnet. Or better yet, fork it from: # # http://gist.github.com/393140 # # Also for webkit/safari: http://gist.github.com/393141 require 'rubygems' require 'fileutils' -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ # This curl that automatically uses your firefox cookies. Use it like you would normally # use curl. Report bugs to michael@nuttnet. Or better yet, fork it from: # # http://gist.github.com/393140 require 'rubygems' require 'fileutils' -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/env ruby # ffcurl # # This curl that automatically uses your firefox cookies. Use it like you would normally # use curl. Report bugs to michael@nuttnet. Or better yet, fork it from: # # [ gist link to come ] require 'rubygems' require 'fileutils' require 'sqlite3' require 'uri' url = ARGV.select{|a| a =~ /http/ }.first host = URI.split(url)[2] top_level_host = host.split('.').slice(-2, 2).join('.') cookie_file = Dir["#{ENV['HOME']}/Library/Application\ Support/Firefox/**/cookies.sqlite"].first FileUtils.cp(cookie_file, "/tmp/.ffcurl_db") db = SQLite3::Database.new("/tmp/.ffcurl_db") File.open("/tmp/.ffcurl_cookie", "w") do |f| db.execute("SELECT host, 'TRUE', path, case isSecure when 0 then 'FALSE' else 'TRUE' end, expiry, name, value FROM moz_cookies WHERE host LIKE '%#{top_level_host}'") do |row| f.write(row.join("\t") + "\n") end end cmd = "curl " + ARGV.join(' ') + " --cookie /tmp/.ffcurl_cookie" Kernel.exec(cmd)