line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tsk; |
2
|
7
|
|
|
7
|
|
21339
|
use 5.012005; |
|
7
|
|
|
|
|
27
|
|
|
7
|
|
|
|
|
412
|
|
3
|
7
|
|
|
7
|
|
41
|
use strict; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
230
|
|
4
|
7
|
|
|
7
|
|
35
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
6100
|
|
5
|
|
|
|
|
|
|
require Exporter; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Tsk - Perl bindings for Tsk (a library for disk image inspection). |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.03 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
For now, see tests in ./t/ included with this distribution. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 INSTALLATION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
If you want to install using cpanm, make sure you allow for big timeouts |
22
|
|
|
|
|
|
|
(the dependency has to be built): |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
cpanm --configure-timeout 3600 --build-timeout 3600 Tsk |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SEE ALSO |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
L |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 BUGS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
L |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
L |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 AUTHOR |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Stefan Petrea, C<< >> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $TSK_VS_TYPE_DETECT = 0x0000; |
45
|
|
|
|
|
|
|
our $TSK_VS_PART_FLAG_META = 0x0004; |
46
|
|
|
|
|
|
|
our $TSK_VS_PART_FLAG_UNALLOC = 0x0002; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our $TSK_IMG_TYPE_DETECT = 0x0000; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
our $TSK_FS_META_TYPE_DIR = 0x0002; |
51
|
|
|
|
|
|
|
our $TSK_FS_META_TYPE_REG = 0x0001; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
our $TSK_FS_NAME_FLAG_ALLOC = 0x0001; |
54
|
|
|
|
|
|
|
our $TSK_FS_NAME_FLAG_UNALLOC = 0x0002; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
### $TSK_FS_TYPE_* |
57
|
|
|
|
|
|
|
our $TSK_FS_TYPE_DETECT = 0x00000000; |
58
|
|
|
|
|
|
|
our $TSK_FS_TYPE_NTFS = 0x00000001; |
59
|
|
|
|
|
|
|
our $TSK_FS_TYPE_NTFS_DETECT = 0x00000001; |
60
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FAT12 = 0x00000002; |
61
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FAT16 = 0x00000004; |
62
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FAT32 = 0x00000008; |
63
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FAT_DETECT = 0x0000000e; |
64
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FFS1 = 0x00000010; |
65
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FFS1B = 0x00000020; |
66
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FFS2 = 0x00000040; |
67
|
|
|
|
|
|
|
our $TSK_FS_TYPE_FFS_DETECT = 0x00000070; |
68
|
|
|
|
|
|
|
our $TSK_FS_TYPE_EXT2 = 0x00000080; |
69
|
|
|
|
|
|
|
our $TSK_FS_TYPE_EXT3 = 0x00000100; |
70
|
|
|
|
|
|
|
our $TSK_FS_TYPE_EXT_DETECT = 0x00002180; |
71
|
|
|
|
|
|
|
our $TSK_FS_TYPE_SWAP = 0x00000200; |
72
|
|
|
|
|
|
|
our $TSK_FS_TYPE_SWAP_DETECT = 0x00000200; |
73
|
|
|
|
|
|
|
our $TSK_FS_TYPE_RAW = 0x00000400; |
74
|
|
|
|
|
|
|
our $TSK_FS_TYPE_RAW_DETECT = 0x00000400; |
75
|
|
|
|
|
|
|
our $TSK_FS_TYPE_ISO9660 = 0x00000800; |
76
|
|
|
|
|
|
|
our $TSK_FS_TYPE_ISO9660_DETECT = 0x00000800; |
77
|
|
|
|
|
|
|
our $TSK_FS_TYPE_HFS = 0x00001000; |
78
|
|
|
|
|
|
|
our $TSK_FS_TYPE_HFS_DETECT = 0x00001000; |
79
|
|
|
|
|
|
|
our $TSK_FS_TYPE_EXT4 = 0x00002000; |
80
|
|
|
|
|
|
|
our $TSK_FS_TYPE_YAFFS2 = 0x00004000; |
81
|
|
|
|
|
|
|
our $TSK_FS_TYPE_YAFFS2_DETECT = 0x00004000; |
82
|
|
|
|
|
|
|
our $TSK_FS_TYPE_UNSUPP = 0xffffffff; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_ALLOC = 0x01; |
85
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_UNALLOC = 0x02; |
86
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_USED = 0x04; |
87
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_UNUSED = 0x08; |
88
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_COMP = 0x10; |
89
|
|
|
|
|
|
|
our $TSK_FS_META_FLAG_ORPHAN = 0x20; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
our @EXPORT = qw{ |
94
|
|
|
|
|
|
|
$TSK_VS_TYPE_DETECT |
95
|
|
|
|
|
|
|
$TSK_VS_PART_FLAG_META |
96
|
|
|
|
|
|
|
$TSK_VS_PART_FLAG_UNALLOC |
97
|
|
|
|
|
|
|
$TSK_IMG_TYPE_DETECT |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$TSK_FS_META_TYPE_DIR |
100
|
|
|
|
|
|
|
$TSK_FS_META_TYPE_REG |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
$TSK_FS_NAME_FLAG_ALLOC |
103
|
|
|
|
|
|
|
$TSK_FS_NAME_FLAG_UNALLOC |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
$TSK_FS_TYPE_DETECT |
106
|
|
|
|
|
|
|
$TSK_FS_TYPE_NTFS |
107
|
|
|
|
|
|
|
$TSK_FS_TYPE_NTFS_DETECT |
108
|
|
|
|
|
|
|
$TSK_FS_TYPE_FAT12 |
109
|
|
|
|
|
|
|
$TSK_FS_TYPE_FAT16 |
110
|
|
|
|
|
|
|
$TSK_FS_TYPE_FAT32 |
111
|
|
|
|
|
|
|
$TSK_FS_TYPE_FAT_DETECT |
112
|
|
|
|
|
|
|
$TSK_FS_TYPE_FFS1 |
113
|
|
|
|
|
|
|
$TSK_FS_TYPE_FFS1B |
114
|
|
|
|
|
|
|
$TSK_FS_TYPE_FFS2 |
115
|
|
|
|
|
|
|
$TSK_FS_TYPE_FFS_DETECT |
116
|
|
|
|
|
|
|
$TSK_FS_TYPE_EXT2 |
117
|
|
|
|
|
|
|
$TSK_FS_TYPE_EXT3 |
118
|
|
|
|
|
|
|
$TSK_FS_TYPE_EXT_DETECT |
119
|
|
|
|
|
|
|
$TSK_FS_TYPE_SWAP |
120
|
|
|
|
|
|
|
$TSK_FS_TYPE_SWAP_DETECT |
121
|
|
|
|
|
|
|
$TSK_FS_TYPE_RAW |
122
|
|
|
|
|
|
|
$TSK_FS_TYPE_RAW_DETECT |
123
|
|
|
|
|
|
|
$TSK_FS_TYPE_ISO9660 |
124
|
|
|
|
|
|
|
$TSK_FS_TYPE_ISO9660_DETECT |
125
|
|
|
|
|
|
|
$TSK_FS_TYPE_HFS |
126
|
|
|
|
|
|
|
$TSK_FS_TYPE_HFS_DETECT |
127
|
|
|
|
|
|
|
$TSK_FS_TYPE_EXT4 |
128
|
|
|
|
|
|
|
$TSK_FS_TYPE_YAFFS2 |
129
|
|
|
|
|
|
|
$TSK_FS_TYPE_YAFFS2_DETECT |
130
|
|
|
|
|
|
|
$TSK_FS_TYPE_UNSUPP |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_ALLOC |
133
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_UNALLOC |
134
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_USED |
135
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_UNUSED |
136
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_COMP |
137
|
|
|
|
|
|
|
$TSK_FS_META_FLAG_ORPHAN |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
describe_flag |
140
|
|
|
|
|
|
|
}; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub describe_flag { |
143
|
1
|
|
|
1
|
0
|
16
|
my ($flag,$pattern) = @_; |
144
|
1
|
|
|
|
|
4
|
my @relevant_flags = grep { $_ =~ $pattern } @EXPORT; |
|
41
|
|
|
|
|
163
|
|
145
|
1
|
|
|
|
|
3
|
my @flags_on ; |
146
|
|
|
|
|
|
|
my @flags_off; |
147
|
1
|
|
|
|
|
3
|
for my $f (@relevant_flags) { |
148
|
6
|
100
|
|
|
|
275
|
if( $flag & eval($f) ) { |
149
|
2
|
|
|
|
|
7
|
push @flags_on , $f; |
150
|
|
|
|
|
|
|
} else { |
151
|
4
|
|
|
|
|
45
|
push @flags_off, $f; |
152
|
|
|
|
|
|
|
}; |
153
|
|
|
|
|
|
|
}; |
154
|
1
|
|
|
|
|
6
|
return @flags_on; |
155
|
|
|
|
|
|
|
}; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
require XSLoader; |
160
|
|
|
|
|
|
|
XSLoader::load('Tsk', $VERSION); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |