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