| version 1.5, 2007/08/10 05:13:31 |
version 1.8, 2008/02/27 23:54:02 |
|
|
| #!/usr/bin/perl |
#!/usr/bin/perl |
| # $RedRiver: example3.pl,v 1.4 2007/02/10 16:24:16 andrew Exp $ |
# $RedRiver: example3.pl,v 1.7 2007/12/04 03:37:48 andrew Exp $ |
| ######################################################################## |
######################################################################## |
| # palmkeyring.pl *** a command line client for Keyring databases. |
# palmkeyring.pl *** a command line client for Keyring databases. |
| # |
# |
|
|
| my $PDBFile; |
my $PDBFile; |
| my $Categories; |
my $Categories; |
| my $Names; |
my $Names; |
| |
my $Accounts; |
| my $Action_List; |
my $Action_List; |
| my $Action_Show; |
my $Action_Show; |
| |
|
|
|
| "file|f=s" => \$PDBFile, |
"file|f=s" => \$PDBFile, |
| "categories|c:s@" => \$Categories, |
"categories|c:s@" => \$Categories, |
| "name|n=s@" => \$Names, |
"name|n=s@" => \$Names, |
| |
"account|a=s@" => \$Accounts, |
| "list|l" => \$Action_List, |
"list|l" => \$Action_List, |
| "show|s" => \$Action_Show, |
"show|s" => \$Action_Show, |
| ); |
); |
|
|
| next if ( @{ $Categories } || @{ $Names } ) && not $matched; |
next if ( @{ $Categories } || @{ $Names } ) && not $matched; |
| |
|
| # XXX Fix up formatting |
# XXX Fix up formatting |
| print $r->{decrypted}->{0}->{data} . |
print $r->{plaintext}->{0}->{data} . |
| ":" . |
":" . |
| $r->{category} . |
$r->{category} . |
| ":" . |
":" . |
|
|
| get_password() || die "Couldn't decrypt file!"; |
get_password() || die "Couldn't decrypt file!"; |
| |
|
| foreach (0..$#{ $pdb->{'records'} }) { |
foreach (0..$#{ $pdb->{'records'} }) { |
| next if $_ == 0; |
|
| my $r = $pdb->{'records'}->[$_]; |
my $r = $pdb->{'records'}->[$_]; |
| |
|
| my $category = |
my $category = |
|
|
| $matched++ if uc($category) eq uc($cat); |
$matched++ if uc($category) eq uc($cat); |
| } |
} |
| foreach my $name (@{ $Names}) { |
foreach my $name (@{ $Names}) { |
| $matched++ if uc($r->{decrypted}->{0}->{data}) eq uc($name); |
$matched++ if uc($r->{plaintext}->{0}->{data}) eq uc($name); |
| } |
} |
| next if ( @{ $Categories } || @{ $Names } ) && not $matched; |
next if ( @{ $Categories } || @{ $Names } ) && not $matched; |
| |
|
| my $a = $pdb->Decrypt($r); |
my $a = $pdb->Decrypt($r); |
| |
$matched = 0; |
| |
|
| |
foreach my $account (@{ $Accounts }) { |
| |
$matched++ if uc($r->{plaintext}->{1}->{data}) eq uc($account); |
| |
} |
| |
next if ( @{ $Accounts } ) && not $matched; |
| |
|
| # XXX Fix up formatting |
# XXX Fix up formatting |
| print $a->{0}->{data} . "\n\t" . |
print $a->{0}->{data} . "\n\t" . |