|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/share/lftp/ |
Upload File : |
#!/usr/bin/perl
# Copyright (c) 2001,2005 Alexander V. Lukyanov <lav@yars.free.net>
# See COPYING file (GNU GPL) for complete license.
# This script converts netscape-style cookies to lftp set commands.
$file=$ARGV[0] if defined $ARGV[0];
$file=qx{
ls -t \$HOME/.netscape/cookies \\
`find \$HOME/.mozilla -name cookies.txt` | head -1
},chomp $file if !defined $file;
open COOKIES,"<$file" or die;
print "# converted from $file\n";
while(<COOKIES>)
{
chomp;
next if /^#/ or /^$/;
s/"/\\"/g;
s/ /%20/g;
($domain,undef,$path,$secure_bool,$expires,$name,$value)=split /\t/;
$secure='';
$secure=';secure' if $secure_bool eq 'TRUE';
$domain="*$domain" if $domain =~ /^\./;
$path='' if $path eq '/';
$path=";path=$path" if $path ne '';
$value="=$value" if $name ne '';
$cookie{"$domain$path$secure"}.=" $name$value";
}
foreach(sort keys %cookie)
{
$cookie{$_}=~s/^ //;
print "set http:cookie/$_ \"$cookie{$_}\"\n";
}