line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# binjitsu::checksec Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Binjitsu::Checksec; |
7
|
1
|
|
|
1
|
|
575
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
434
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
commands => { |
19
|
|
|
|
|
|
|
file => [ qw(input) ], |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
require_binaries => { |
22
|
|
|
|
|
|
|
checksec => [ ], |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub file { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
0
|
|
|
|
|
|
my ($file) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('file', $file) or return; |
32
|
0
|
0
|
|
|
|
|
my $ref = $self->brik_help_run_invalid_arg('file', $file, 'ARRAY', 'SCALAR') |
33
|
|
|
|
|
|
|
or return; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if ($ref eq 'ARRAY') { |
36
|
0
|
|
|
|
|
|
my @result = (); |
37
|
0
|
|
|
|
|
|
for my $this (@$file) { |
38
|
0
|
0
|
|
|
|
|
my $r = $self->file($this) or next; |
39
|
0
|
|
|
|
|
|
push @result, $r; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return \@result; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
else { |
44
|
0
|
|
|
|
|
|
my $cmd = "checksec --file \"$file\""; |
45
|
0
|
0
|
|
|
|
|
my $buf = $self->capture($cmd) or return; |
46
|
0
|
|
|
|
|
|
my %r = (); |
47
|
0
|
|
|
|
|
|
for my $line (@$buf) { |
48
|
0
|
0
|
|
|
|
|
if ($line =~ /^\s+(\S+):\s+(.*)\s*$/) { |
49
|
0
|
|
|
|
|
|
$r{lc($1)} = $2; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return \%r; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |