#!/usr/bin/perl -w

use strict;
use HTTP::Cookies;
use HTTP::Cookies::Netscape;

my ( $cookiefile, $cookies );
if($ARGV[0]) {
	$cookiefile = $ARGV[0];
}
else {
	$cookiefile = `find ~/.mozilla/ -name "cookies.txt" | head -1`;
}
$cookies = HTTP::Cookies::Netscape->new( file=>$cookiefile, autosave=>0 );
$cookies->scan(\&parsecookies);

sub parsecookies {
	my $newsec = 0;
	my ( $ignore1, $key, $val, $path, $domain, $ignore2, $ignore3, $secure, $expires, $ignore4, $ignore5 ) = @_ ;
	if($secure) {
		$newsec = 1;
	}
	print "$key\t$val\t$domain\t$path\t$domain\t$expires\t$newsec\n";
}
