4 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
use MIME::Parser;
...
my $parser = new MIME::Parser();
$parser->ignore_errors(1);
$parser->output_dir($output);
$parser->output_prefix("msg");
$parser->extract_nested_messages(0);
$parser->output_to_core(0);
$parser->tmp_to_core(0);
$parser->use_inner_files(0);
$self->{entity} = $parser->parse_data($lines);
...
$self->extract_entity($cfg, $self->{entity});
...
sub extract_entity
{
my ($self, $cfg, $entity) = @_;
my @parts = $entity->parts;
if(scalar(@parts))
{
$self->extract_entity($cfg, $_) foreach (@parts);
}
else
{
my $type = $entity->head->mime_type || "";
my $location = $entity->head->mime_attr("content-location") || "";
my $charset = $entity->head->mime_attr('content-type.charset') || "";
my $body = $entity->bodyhandle;
my $cntid = $entity->head->mime_attr('content-id');
if($body)
{
my $path = $body->path;
$path =~ s!\\!/!g;
my $folder = Sources::Global::get_filepath($path);
if($cntid)
{
$cntid =~ s!^<|>$!!g;
my $temp = "$folder/$cntid";
Sources::Global::move_file($path, $temp);
$path = $temp;
}
$cfg->insert($path, "$type###$charset###$location");
# Sources::Global::encrypt($path);
if($type eq "message/rfc822")
{
}
elsif($type =~ m!ms-tnef!i)
{
my $tnef = Sources::Tnef->read_ent($entity, { output_dir => $folder });
my @atts = $tnef->attachments;
foreach my $attch (@atts)
{
my $fullpath = "$folder/".$attch->longname;
$cfg->insert($fullpath, "######");
if(open(FILE, "> $fullpath"))
{
binmode FILE;
print FILE $attch->data;
close FILE;
}
# Sources::Global::encrypt($fullpath);
}
$tnef->purge;
}
}
}
}
4 Einträge, 1 Seite |