line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# $Id$ |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# forensic::scalpel Brik |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
package Metabrik::Forensic::Scalpel; |
7
|
1
|
|
|
1
|
|
996
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
1713
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Default attribute values put here will BE inherited by subclasses |
13
|
|
|
|
|
|
|
sub brik_properties { |
14
|
|
|
|
|
|
|
return { |
15
|
0
|
|
|
0
|
1
|
|
revision => '$Revision$', |
16
|
|
|
|
|
|
|
tags => [ qw(unstable carving carve file filecarve filecarving) ], |
17
|
|
|
|
|
|
|
author => 'GomoR ', |
18
|
|
|
|
|
|
|
license => 'http://opensource.org/licenses/BSD-3-Clause', |
19
|
|
|
|
|
|
|
attributes => { |
20
|
|
|
|
|
|
|
datadir => [ qw(datadir) ], |
21
|
|
|
|
|
|
|
extensions => [ qw($extensions_list) ], |
22
|
|
|
|
|
|
|
conf => [ qw(file) ], |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
attributes_default => { |
25
|
|
|
|
|
|
|
extensions => [ qw(doc pdf jpg png zip odt) ], |
26
|
|
|
|
|
|
|
conf => 'scalpel.conf', |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
commands => { |
29
|
|
|
|
|
|
|
install => [ ], # Inherited |
30
|
|
|
|
|
|
|
generate_conf => [ qw($extensions_list|OPTIONAL file|OPTIONAL) ], |
31
|
|
|
|
|
|
|
scan => [ qw(file output|OPTIONAL conf|OPTIONAL) ], |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
require_modules => { |
34
|
|
|
|
|
|
|
'Metabrik::File::Find' => [ ], |
35
|
|
|
|
|
|
|
'Metabrik::File::Text' => [ ], |
36
|
|
|
|
|
|
|
'Metabrik::File::Type' => [ ], |
37
|
|
|
|
|
|
|
'Metabrik::System::File' => [ ], |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
require_binaries => { |
40
|
|
|
|
|
|
|
'scalpel' => [ ], |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
need_packages => { |
43
|
|
|
|
|
|
|
ubuntu => [ qw(scalpel) ], |
44
|
|
|
|
|
|
|
debian => [ qw(scalpel) ], |
45
|
|
|
|
|
|
|
kali => [ qw(scalpel) ], |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub generate_conf { |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
0
|
|
|
|
|
|
my ($extensions, $file) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $datadir = $self->datadir; |
55
|
0
|
|
0
|
|
|
|
$extensions ||= $self->extensions; |
56
|
0
|
|
0
|
|
|
|
$file ||= $datadir.'/'.$self->conf; |
57
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('generate_conf', $extensions) or return; |
58
|
0
|
0
|
|
|
|
|
$self->brik_help_run_invalid_arg('generate_conf', $extensions, 'ARRAY') or return; |
59
|
0
|
0
|
|
|
|
|
$self->brik_help_run_undef_arg('generate_conf', $file) or return; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
my $sf = Metabrik::System::File->new_from_brik_init($self) or return; |
62
|
0
|
0
|
|
|
|
|
$sf->remove($file) or return; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $ext = [ |
65
|
|
|
|
|
|
|
{ case => "y", ext => "art", footer => "\\xcf\\xc7\\xcb", header => "\\x4a\\x47\\x04\\x0e", size => 150000, }, |
66
|
|
|
|
|
|
|
{ case => "y", ext => "art", footer => "\\xd0\\xcb\\x00\\x00", header => "\\x4a\\x47\\x03\\x0e", size => 150000, }, |
67
|
|
|
|
|
|
|
{ case => "y", ext => "gif", footer => "\\x00\\x3b", header => "\\x47\\x49\\x46\\x38\\x37\\x61", size => 5000000, }, |
68
|
|
|
|
|
|
|
{ case => "y", ext => "gif", footer => "\\x00\\x3b", header => "\\x47\\x49\\x46\\x38\\x39\\x61", size => 5000000, }, |
69
|
|
|
|
|
|
|
{ case => "y", ext => "jpg", footer => "\\xff\\xd9", header => "\\xff\\xd8\\xff\\xe0\\x00\\x10", size => 200000000, }, |
70
|
|
|
|
|
|
|
{ case => "y", ext => "png", footer => "\\xff\\xfc\\xfd\\xfe", header => "\\x50\\x4e\\x47?", size => 20000000, }, |
71
|
|
|
|
|
|
|
{ case => "y", ext => "bmp", footer => undef, header => "BM??\\x00\\x00\\x00", size => 100000, }, |
72
|
|
|
|
|
|
|
{ case => "y", ext => "tif", footer => undef, header => "\\x49\\x49\\x2a\\x00", size => 200000000, }, |
73
|
|
|
|
|
|
|
{ case => "y", ext => "tif", footer => undef, header => "\\x4D\\x4D\\x00\\x2A", size => 200000000, }, |
74
|
|
|
|
|
|
|
{ case => "y", ext => "avi", footer => undef, header => "RIFF????AVI", size => 50000000, }, |
75
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????moov", size => 10000000, }, |
76
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????mdat", size => 10000000, }, |
77
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????widev", size => 10000000, }, |
78
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????skip", size => 10000000, }, |
79
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????free", size => 10000000, }, |
80
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????idsc", size => 10000000, }, |
81
|
|
|
|
|
|
|
{ case => "y", ext => "mov", footer => undef, header => "????pckg", size => 10000000, }, |
82
|
|
|
|
|
|
|
{ case => "y", ext => "mpg", footer => "\\x00\\x00\\x01\\xb9", header => "\\x00\\x00\\x01\\xba", size => 50000000, }, |
83
|
|
|
|
|
|
|
{ case => "y", ext => "mpg", footer => "\\x00\\x00\\x01\\xb7", header => "\\x00\\x00\\x01\\xb3", size => 50000000, }, |
84
|
|
|
|
|
|
|
{ case => "y", ext => "fws", footer => undef, header => "FWS", size => 4000000 }, |
85
|
|
|
|
|
|
|
{ case => "y", ext => "doc", footer => "\\xd0\\xcf\\x11\\xe0\\xa1\\xb1\\x1a\\xe1\\x00\\x00", header => "\\xd0\\xcf\\x11\\xe0\\xa1\\xb1\\x1a\\xe1\\x00\\x00", size => 10000000, }, |
86
|
|
|
|
|
|
|
{ case => "y", ext => "doc", footer => undef, header => "\\xd0\\xcf\\x11\\xe0\\xa1\\xb1", size => 10000000, }, |
87
|
|
|
|
|
|
|
{ case => "y", ext => "pst", footer => undef, header => "\\x21\\x42\\x4e\\xa5\\x6f\\xb5\\xa6", size => 500000000, }, |
88
|
|
|
|
|
|
|
{ case => "y", ext => "ost", footer => undef, header => "\\x21\\x42\\x44\\x4e", size => 500000000, }, |
89
|
|
|
|
|
|
|
{ case => "y", ext => "dbx", footer => undef, header => "\\xcf\\xad\\x12\\xfe\\xc5\\xfd\\x74\\x6f", size => 10000000, }, |
90
|
|
|
|
|
|
|
{ case => "y", ext => "idx", footer => undef, header => "\\x4a\\x4d\\x46\\x39", size => 10000000, }, |
91
|
|
|
|
|
|
|
{ case => "y", ext => "mbx", footer => undef, header => "\\x4a\\x4d\\x46\\x36", size => 10000000, }, |
92
|
|
|
|
|
|
|
{ case => "y", ext => "wpc", footer => undef, header => "?WPC", size => 1000000 }, |
93
|
|
|
|
|
|
|
{ case => "n", ext => "htm", footer => " |