| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4288
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
45
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
40
|
|
|
5
|
1
|
|
|
1
|
|
641
|
use Getopt::Long; |
|
|
1
|
|
|
|
|
13585
|
|
|
|
1
|
|
|
|
|
6
|
|
|
6
|
1
|
|
|
1
|
|
558
|
use Pod::Usage; |
|
|
1
|
|
|
|
|
56814
|
|
|
|
1
|
|
|
|
|
126
|
|
|
7
|
1
|
|
|
1
|
|
8
|
use File::Spec; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
458
|
use Crypt::TSD; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
2011
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Command line options |
|
12
|
1
|
|
|
|
|
129996
|
my $help = 0; |
|
13
|
1
|
|
|
|
|
3
|
my $version = 0; |
|
14
|
1
|
|
|
|
|
3
|
my $verbose = 0; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Parse command line options |
|
17
|
1
|
50
|
|
|
|
8
|
GetOptions( |
|
18
|
|
|
|
|
|
|
'help|h' => \$help, |
|
19
|
|
|
|
|
|
|
'version' => \$version, |
|
20
|
|
|
|
|
|
|
'verbose|v' => \$verbose, |
|
21
|
|
|
|
|
|
|
) or pod2usage(2); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Show help |
|
24
|
1
|
50
|
|
|
|
809
|
if ($help) { |
|
25
|
0
|
|
|
|
|
0
|
pod2usage(-verbose => 2); |
|
26
|
0
|
|
|
|
|
0
|
exit 0; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Show version |
|
30
|
1
|
50
|
|
|
|
3
|
if ($version) { |
|
31
|
0
|
|
|
|
|
0
|
print "tsd-info version $Crypt::TSD::VERSION\n"; |
|
32
|
0
|
|
|
|
|
0
|
exit 0; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Get input file from command line |
|
36
|
1
|
|
|
|
|
3
|
my $input_file = shift @ARGV; |
|
37
|
1
|
50
|
|
|
|
4
|
if (!$input_file) { |
|
38
|
0
|
|
|
|
|
0
|
print "Error: Input TSD file required\n"; |
|
39
|
0
|
|
|
|
|
0
|
pod2usage(1); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Check if input file exists |
|
43
|
1
|
50
|
|
|
|
31
|
unless (-f $input_file) { |
|
44
|
0
|
|
|
|
|
0
|
die "Error: Input file '$input_file' not found\n"; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
8
|
print "Analyzing TSD file: $input_file\n"; |
|
48
|
1
|
|
|
|
|
2
|
print "=" x 50 . "\n"; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Read TSD file |
|
51
|
1
|
|
|
|
|
2
|
my $tsd_data; |
|
52
|
1
|
|
|
|
|
3
|
eval { |
|
53
|
1
|
|
|
|
|
13
|
$tsd_data = Crypt::TSD->read_file($input_file); |
|
54
|
|
|
|
|
|
|
}; |
|
55
|
1
|
50
|
|
|
|
4
|
if ($@) { |
|
56
|
0
|
|
|
|
|
0
|
die "Error reading TSD file: $@\n"; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Display basic information |
|
60
|
1
|
|
50
|
|
|
16
|
print "Version: " . ($tsd_data->{version} || 'N/A') . "\n"; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Display metadata |
|
63
|
1
|
50
|
|
|
|
7
|
if ($tsd_data->{metaData}) { |
|
64
|
1
|
|
|
|
|
2
|
my $meta = $tsd_data->{metaData}; |
|
65
|
1
|
|
|
|
|
3
|
print "Metadata:\n"; |
|
66
|
1
|
50
|
|
|
|
5
|
print " Hash Protected: " . ($meta->{hashProtected} ? 'Yes' : 'No') . "\n"; |
|
67
|
1
|
|
50
|
|
|
4
|
print " File Name: " . ($meta->{fileName} || 'N/A') . "\n"; |
|
68
|
1
|
|
50
|
|
|
15
|
print " Media Type: " . ($meta->{mediaType} || 'N/A') . "\n"; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Display data URI |
|
72
|
1
|
50
|
|
|
|
5
|
if ($tsd_data->{dataUri}) { |
|
73
|
0
|
|
|
|
|
0
|
print "Data URI: " . $tsd_data->{dataUri} . "\n"; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Check for embedded content |
|
77
|
1
|
|
|
|
|
5
|
my $content = Crypt::TSD->extract_content_der($tsd_data); |
|
78
|
1
|
50
|
|
|
|
3
|
if (defined $content) { |
|
79
|
1
|
|
|
|
|
4
|
print "Embedded Content: Yes (" . length($content) . " bytes)\n"; |
|
80
|
|
|
|
|
|
|
} else { |
|
81
|
0
|
|
|
|
|
0
|
print "Embedded Content: No\n"; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Display temporal evidence |
|
85
|
1
|
50
|
|
|
|
4
|
if ($tsd_data->{temporalEvidence}) { |
|
86
|
1
|
|
|
|
|
3
|
my $evidence = $tsd_data->{temporalEvidence}; |
|
87
|
|
|
|
|
|
|
|
|
88
|
1
|
50
|
|
|
|
4
|
if ($evidence->{tstEvidence}) { |
|
89
|
1
|
|
|
|
|
3
|
my $tokens = $evidence->{tstEvidence}; |
|
90
|
1
|
|
|
|
|
3
|
print "Timestamp Tokens: " . scalar(@$tokens) . "\n"; |
|
91
|
|
|
|
|
|
|
|
|
92
|
1
|
50
|
33
|
|
|
4
|
if ($verbose && @$tokens > 0) { |
|
93
|
0
|
|
|
|
|
0
|
for my $i (0..$#$tokens) { |
|
94
|
0
|
|
|
|
|
0
|
my $token = $tokens->[$i]; |
|
95
|
0
|
0
|
|
|
|
0
|
if ($token->{timeStamp}) { |
|
96
|
0
|
|
|
|
|
0
|
print " Token " . ($i + 1) . ":\n"; |
|
97
|
0
|
|
0
|
|
|
0
|
print " Content Type: " . ($token->{timeStamp}->{contentType} || 'N/A') . "\n"; |
|
98
|
0
|
|
0
|
|
|
0
|
print " Content Size: " . (length($token->{timeStamp}->{content} || '') . " bytes\n"); |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
1
|
50
|
|
|
|
3
|
if ($evidence->{ersEvidence}) { |
|
105
|
0
|
|
|
|
|
0
|
print "Evidence Record: Yes\n"; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
1
|
50
|
|
|
|
4
|
if ($evidence->{otherEvidence}) { |
|
109
|
0
|
|
|
|
|
0
|
print "Other Evidence: Yes\n"; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
1
|
|
|
|
|
9
|
print "=" x 50 . "\n"; |
|
114
|
1
|
|
|
|
|
0
|
print "Analysis complete.\n"; |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
__END__ |