line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# file::ole Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::File::Ole; |
7
|
1
|
|
|
1
|
|
777
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
8
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
415
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub brik_properties { |
13
|
|
|
|
|
|
|
return { |
14
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
15
|
|
|
|
|
|
|
tags => [ qw(unstable read vbs) ], |
16
|
|
|
|
|
|
|
author => 'GomoR ', |
17
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
18
|
|
|
|
|
|
|
attributes => { |
19
|
|
|
|
|
|
|
input => [ qw(file) ], |
20
|
|
|
|
|
|
|
output => [ qw(file) ], |
21
|
|
|
|
|
|
|
olevba => [ qw(olevba.py) ], |
22
|
|
|
|
|
|
|
}, |
23
|
|
|
|
|
|
|
attributes_default => { |
24
|
|
|
|
|
|
|
olevba => '/usr/local/lib/python2.7/dist-packages/oletools/olevba.py', |
25
|
|
|
|
|
|
|
}, |
26
|
|
|
|
|
|
|
commands => { |
27
|
|
|
|
|
|
|
install => [ ], # Inherited |
28
|
|
|
|
|
|
|
extract_vbs => [ qw(input|OPTIONAL output|OPTIONAL) ], |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
require_modules => { |
31
|
|
|
|
|
|
|
'Metabrik::File::Text' => [ ], |
32
|
|
|
|
|
|
|
'Metabrik::System::Os' => [ ], |
33
|
|
|
|
|
|
|
'Metabrik::System::Package' => [ ], |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
require_binaries => { |
36
|
|
|
|
|
|
|
'python' => [ ], |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
need_packages => { |
39
|
|
|
|
|
|
|
ubuntu => [ qw(python python-pip) ], |
40
|
|
|
|
|
|
|
debian => [ qw(python python-pip) ], |
41
|
|
|
|
|
|
|
kali => [ qw(python python-pip) ], |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub install { |
47
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Install system dependant packages |
50
|
0
|
0
|
|
|
|
|
$self->SUPER::install or return; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Then Python dependant packages |
53
|
0
|
|
|
|
|
|
$self->sudo_system('pip install oletools --upgrade'); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return 1; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub extract_vbs { |
59
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
my ($input, $output) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
0
|
|
|
|
$input ||= $self->input; |
63
|
0
|
|
0
|
|
|
|
$output ||= $self->output; |
64
|
0
|
|
|
|
|
|
my $olevba = $self->olevba; |
65
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('extract_vbs', $input) or return; |
66
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('extract_vbs', $output) or return; |
67
|
0
|
0
|
|
|
|
|
$self->brik_help_run_file_not_found('extract_vbs', $olevba) or return; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
my $out = $self->capture("python $olevba $input"); |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
|
|
|
|
my $ft = Metabrik::File::Text->new_from_brik_init($self) or return; |
72
|
0
|
0
|
|
|
|
|
$ft->write($out, $output) or return; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
return 1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |