/[perl]/dump-moz.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /dump-moz.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sun Jan 18 23:08:12 2004 UTC (20 years, 3 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
dump Mozilla's passwords which are stored in user profile

1 dpavlin 1.1 #!/usr/bin/perl -w
2    
3     use strict;
4     use MIME::Base64;
5    
6     my @data;
7     while(<>) {
8     chomp;
9     print "## read: $_\n";
10     push @data,$_;
11     }
12    
13     my $skip = 1;
14    
15     # skip "don't save password for host" list
16     while(@data && $skip) {
17     my $d = shift @data;
18     print "## $d\n";
19     $skip = 0 if ($d eq ".");
20     }
21    
22     while(@data) {
23    
24     my $host = shift @data;
25    
26     my $user_fld = shift @data;
27     $user_fld =~ s/^.*?=//g;
28     $user_fld =~ s/=.*$//g;
29    
30     my $user = shift @data;
31     if ($user =~ /^\~([A-Za-z0-9\+\=\/]+)/) {
32     $user = decode_base64($1),"\n";
33     } else {
34     die "can't decode username '$user'!";
35     }
36    
37     my $passwd_fld = shift @data;
38     $passwd_fld =~ s/^.*?=//g;
39     $passwd_fld =~ s/=.*$//g;
40    
41     my $passwd = shift @data;
42     if ($passwd =~ /^\~([A-Za-z0-9\+\=\/]+)/) {
43     $passwd = decode_base64($1),"\n";
44     } else {
45     die "can't decode password '$passwd'!";
46     }
47    
48     printf("%30s -- %10s: %10s %10s: %10s\n",$host,$user_fld,$user,$passwd_fld,$passwd);
49    
50     my $sep = shift @data;
51     if ($sep ne ".") {
52     die "can't find separator! [$sep]";
53     }
54    
55     }

  ViewVC Help
Powered by ViewVC 1.1.26