line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenSSH::Fingerprint; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
14807
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
4
|
use Digest::MD5; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
448
|
use MIME::Base64; |
|
1
|
|
|
|
|
531
|
|
|
1
|
|
|
|
|
50
|
|
8
|
1
|
|
|
1
|
|
473
|
use Crypt::Digest::SHA256; |
|
1
|
|
|
|
|
9324
|
|
|
1
|
|
|
|
|
268
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
our @EXPORT = qw(unbase64 md5_sum sub sha256); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
OpenSSH::Fingerprint - The great new OpenSSH::Fingerprint! |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.01 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Quick summary of what the module does. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Perhaps a little code snippet. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use OpenSSH::Fingerprint; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $foo = OpenSSH::Fingerprint->new(); |
35
|
|
|
|
|
|
|
... |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 EXPORT |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
A list of functions that can be exported. You can delete this section |
40
|
|
|
|
|
|
|
if you don't export anything, such as for a purely object-oriented module. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
sub unbase64 { |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
0
|
|
my ( $file_name) = @_; |
48
|
0
|
|
|
|
|
|
my ( $FD, $mydstr, $md5 ); |
49
|
0
|
0
|
|
|
|
|
open( $FD, $file_name ) or warn "Can't open $file_name !"; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
while(<$FD>) { |
52
|
0
|
0
|
|
|
|
|
next if /#^/; |
53
|
0
|
0
|
|
|
|
|
next unless (split)[1]; |
54
|
0
|
|
|
|
|
|
push @{$mydstr},decode_base64((split)[1]); |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $mydstr; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub md5_sum { |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
0
|
0
|
|
my $key = shift; |
65
|
0
|
|
|
|
|
|
my $ctx = Digest::MD5->new; |
66
|
0
|
|
|
|
|
|
$ctx->add($key); |
67
|
0
|
|
|
|
|
|
my $md5 = $ctx->hexdigest; |
68
|
0
|
|
|
|
|
|
$md5=~s/(..)/$1:/g; |
69
|
0
|
|
|
|
|
|
$md5=~s/:$//; |
70
|
0
|
|
|
|
|
|
return $md5; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub sha256 { |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
0
|
|
my $key = shift; |
76
|
0
|
|
|
|
|
|
my $ctx = Crypt::Digest::SHA256->new; |
77
|
0
|
|
|
|
|
|
$ctx->add($key); |
78
|
0
|
|
|
|
|
|
my $md5 = $ctx->digest; |
79
|
0
|
|
|
|
|
|
return $md5; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
ORANGE, C<< >> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 BUGS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
90
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
91
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 SUPPORT |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
perldoc OpenSSH::Fingerprint |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
You can also look for information at: |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=over 4 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * CPAN Ratings |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * Search CPAN |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Copyright 2017 ORANGE. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This program is released under the following license: Perl |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; # End of OpenSSH::Fingerprint |