#!/usr/local/bin/perl -w
use MIME::Parser;
use File::Basename;
use strict;
# derive the base filenames of extracted parts from
# the name of the script.
my ($parsed) = (basename($0))[0];
#Create a Parser object
my $parser = MIME::Parser->new();
# output directory for parsed files
$parser->output_dir("/tmp");
# Basenames for parsed files
$parser->output_prefix($parsed);
$parser->output_to_core();
open(INPUT, "/tmp/email-test/AuthenticationReport.msg") or die("Input error: $!");
my $entity = $parser->read(\*INPUT)
or die "couldn't parse MIME stream";
close(INPUT);
# Tell us about the MIME entities! this is for debugging
$entity->dump_skeleton;
####
------=_Part_64_24417480.1094663686411
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: BASE64
------=_Part_64_24417480.1094663686411
Content-Type: application/octet-stream;
name=User_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
Content-Transfer-Encoding: BASE64
Content-Disposition: attachment;
filename=User_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
------=_Part_64_24417480.1094663686411
Content-Type: application/octet-stream;
name=Admin_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
Content-Transfer-Encoding: BASE64
Content-Disposition: attachment;
filename=Admin_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
------=_Part_64_24417480.1094663686411
Content-Type: application/octet-stream;
name=Disabled_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
Content-Transfer-Encoding: BASE64
Content-Disposition: attachment;
filename=Disabled_Logins_UnitDaily_Test_User_09_08_2004_10_14_45_DAY2004-9-8_18.mhtml
------=_Part_64_24417480.1094663686411--
####
Cisco Reports
-------------
Scheduled report for Cisco at IP
address 18.187.12.10(Test1 - 0002321)
-------------------------------------------------------------------
Disabled Logins for 2004-10-02
Time Address
10.10.58 18.188.10.12
10.12.34 17.199.13.100