line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::KeePassHttp::Entry;
|
2
|
9
|
|
|
9
|
|
60652
|
use 5.012; # //, strict, s//r
|
|
9
|
|
|
|
|
48
|
|
3
|
9
|
|
|
9
|
|
40
|
use warnings;
|
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
238
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
402
|
use MIME::Base64;
|
|
9
|
|
|
|
|
671
|
|
|
9
|
|
|
|
|
370
|
|
6
|
9
|
|
|
9
|
|
402
|
use Crypt::Mode::CBC;
|
|
9
|
|
|
|
|
13479
|
|
|
9
|
|
|
|
|
215
|
|
7
|
9
|
|
|
9
|
|
615
|
use HTTP::Tiny;
|
|
9
|
|
|
|
|
42970
|
|
|
9
|
|
|
|
|
227
|
|
8
|
9
|
|
|
9
|
|
44
|
use JSON; # will use JSON::XS when available
|
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
51
|
|
9
|
9
|
|
|
9
|
|
1391
|
use Time::HiRes qw/gettimeofday sleep/;
|
|
9
|
|
|
|
|
1161
|
|
|
9
|
|
|
|
|
51
|
|
10
|
9
|
|
|
9
|
|
822
|
use MIME::Base64;
|
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
369
|
|
11
|
9
|
|
|
9
|
|
49
|
use Carp;
|
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
3082
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.020'; # auto-populated from W:KPH
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=pod
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
WWW::KeePassHttp::Entry - Object-oriented access to an Entry retrived using WWW::KeePassHttp
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use WWW::KeePassHttp;
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $kph = WWW::KeePassHttp->new(Key => $key);
|
26
|
|
|
|
|
|
|
$kph->associate() unless $kph->test_associate();
|
27
|
|
|
|
|
|
|
my @entries = @${ $kph->get_logins($search_string) };
|
28
|
|
|
|
|
|
|
print $entry[0]->url;
|
29
|
|
|
|
|
|
|
print $entry[0]->login;
|
30
|
|
|
|
|
|
|
print $entry[0]->password;
|
31
|
|
|
|
|
|
|
print $entry[0]->uuid;
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Object-oriented access to an Entry retrived using L.
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DETAILS
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item new
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $entry = WWW::KeePassHttp::Entry->new( Url => 'https://github.com', Login => 'username', Password => 'password');
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Creates a new Entry object.
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L will do this for you when you grab entries.
|
49
|
|
|
|
|
|
|
Or you can create a new Entry object when you want to L
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Url, Login, and Password are all required to be defined. If you want those fields "empty",
|
52
|
|
|
|
|
|
|
just use an emtpy string C<''> as the value. The Uuid will also be returned from an existing
|
53
|
|
|
|
|
|
|
Entry from the database (but will be ignored )
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub new
|
58
|
|
|
|
|
|
|
{
|
59
|
8
|
|
|
8
|
1
|
1431
|
my ($class, %opts) = @_;
|
60
|
8
|
|
|
|
|
18
|
my $self = bless {}, $class;
|
61
|
|
|
|
|
|
|
|
62
|
8
|
100
|
|
|
|
26
|
$self->{Url} = $opts{Url}; die "missing Url" unless defined $self->{Url};
|
|
8
|
|
|
|
|
29
|
|
63
|
7
|
100
|
|
|
|
12
|
$self->{Login} = $opts{Login}; die "missing Login" unless defined $self->{Login};
|
|
7
|
|
|
|
|
22
|
|
64
|
6
|
100
|
|
|
|
11
|
$self->{Password} = $opts{Password}; die "missing Password" unless defined $self->{Password};
|
|
6
|
|
|
|
|
30
|
|
65
|
5
|
|
100
|
|
|
18
|
$self->{Uuid} = $opts{Uuid} // ''; # Uuid is not required
|
66
|
|
|
|
|
|
|
|
67
|
5
|
|
|
|
|
27
|
return $self;
|
68
|
|
|
|
|
|
|
}
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item url
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item name
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
print $entry->url();
|
75
|
|
|
|
|
|
|
print $entry->name(); # gives same result as ->url()
|
76
|
|
|
|
|
|
|
$entry->url('https://new.url/'); # set new value
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The getter/setter for the Url of the Entry. Due to the nomenclature of the KeePassHttp plugin's
|
79
|
|
|
|
|
|
|
C structure, the Url can also be accessed as the Name of the entry (since KeePassHttp
|
80
|
|
|
|
|
|
|
uses the URL for both the URL field and the Title/Name field).
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub url
|
85
|
|
|
|
|
|
|
{
|
86
|
4
|
|
|
4
|
1
|
548
|
my ($self, $val) = @_;
|
87
|
4
|
100
|
|
|
|
12
|
$self->{Url} = $val if defined $val;
|
88
|
4
|
|
|
|
|
21
|
return $self->{Url};
|
89
|
|
|
|
|
|
|
}
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
*WWW::KeePassHttp::Entry::name = \&WWW::KeePassHttp::Entry::url;
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item login
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
print $entry->login();
|
96
|
|
|
|
|
|
|
$entry->login('https://new.url/'); # set new value
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The getter/setter for the Login of the Entry.
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub login
|
103
|
|
|
|
|
|
|
{
|
104
|
3
|
|
|
3
|
1
|
8
|
my ($self, $val) = @_;
|
105
|
3
|
100
|
|
|
|
9
|
$self->{Login} = $val if defined $val;
|
106
|
3
|
|
|
|
|
15
|
return $self->{Login};
|
107
|
|
|
|
|
|
|
}
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item password
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
print $entry->password();
|
112
|
|
|
|
|
|
|
$entry->password('https://new.url/'); # set new value
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
The getter/setter for the Password of the Entry.
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=cut
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub password
|
119
|
|
|
|
|
|
|
{
|
120
|
3
|
|
|
3
|
1
|
8
|
my ($self, $val) = @_;
|
121
|
3
|
100
|
|
|
|
37
|
$self->{Password} = $val if defined $val;
|
122
|
3
|
|
|
|
|
19
|
return $self->{Password};
|
123
|
|
|
|
|
|
|
}
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item uuid
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
print $entry->uuid(); # the UUID from the database entry
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The getter for the UUID of the Entry.
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub uuid
|
134
|
|
|
|
|
|
|
{
|
135
|
3
|
|
|
3
|
1
|
8
|
my ($self, $val) = @_;
|
136
|
3
|
100
|
|
|
|
12
|
$self->{Uuid} = $val if defined $val;
|
137
|
3
|
|
|
|
|
13
|
return $self->{Uuid};
|
138
|
|
|
|
|
|
|
}
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=for comment END OF DETAILS
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 AUTHOR
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Peter C. Jones Cpetercj AT cpan DOT orgE>
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Please report any bugs or feature requests
|
149
|
|
|
|
|
|
|
thru the repository's interface at L.
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=begin html
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=end html
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Copyright (C) 2021 Peter C. Jones
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 LICENSE
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it
|
169
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published
|
170
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License.
|
171
|
|
|
|
|
|
|
See L for more information.
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
1;
|