11/04/2004 Bruce Schneier :CRYPTO-GRAM, October 15, 2004:RSA Europe in Barcelona, on 4 November #### #!/usr/bin/perl -lw use diagnostics; use strict; use POSIX; use Time::Local; my ($from, $subject) = ("", ""); while(<>){ last if /^$/; chomp; if (/^From: (.*)/i){ $from = $1; $from =~ s/"?([^"]+)"?\s*<[^<]+>/$1/; $from =~ s/^([^,]+),\s*(.*)$/$2 $1/; } if (/^Subject: (.*)/i){ $subject = $1; $subject =~ s/\bRe://ig; $subject =~ s/\[.*?\]//ig; $subject =~ s/\s+/ /g; $subject =~ s/^ //; $subject =~ s/ $//; } } my %month; @month{qw( jan feb mar apr may jun jul aug sep oct nov dec )} = (1 .. 12); my $month = qr/ \b(?: a(?:pr(?:il)? |ug(?:ust)?) |(?:dec|nov|sept?)(?:ember)? |(?:febr?|jan)(?:uary)? |ju(?:ly?|ne?) |ma(?:y|r(?:ch)?) |oct(?:ober)? )\b/ix; my $text = ""; while (<>){ last if /^\s*-+Original Message-+$/; last if /^\s*Processing Initiated:/; last if /^Content-Type:\stext\/html/; next if /^[>:]/; next if /^On /; next if /\bwrote:\s*$/; chomp; $text .= $_ . " "; } for (split /(?> $ENV{HOME}/calendar"; print CALENDAR strftime("%m/%d/%Y\t$from:$subject:$_", localtime($time)); close CALENDAR; } sub test_date_weekday { return if /$month/; return unless /\b(? time){ print_report $time; return 1; } return; } sub test_date_text { my ($m, $d, $y) = @_; return test_date($month{lc substr($m, 0, 3)}, $d, $y); }