Script to Parse Ema...
 
Notifications
Clear all

Script to Parse Email Header

9 Posts
5 Users
0 Reactions
817 Views
cybarkop2007
(@cybarkop2007)
New Member
Joined: 18 years ago
Posts: 2
Topic starter  

I am looking for a script that can parse through several thousand email headers. I want to pull out Originating IP, From To etc. I can't image that no one else has needed such a script. Any help appreciated


   
Quote
(@ancient)
Active Member
Joined: 18 years ago
Posts: 16
 

actual i think the fbi has a project that they've been working on that does this exact thing.. I have some info on this ill post it later


   
ReplyQuote
keydet89
(@keydet89)
Famed Member
Joined: 21 years ago
Posts: 3568
 

This is a pretty easy job for Perl…

Open the file (either a single email, or whatever you've got), and look for

X-Originating-IP
From
To
etc.

Seems pretty straight forward…


   
ReplyQuote
(@ancient)
Active Member
Joined: 18 years ago
Posts: 16
 

I think they were working on something more complicated. >P~
my bad, my post was a little our of place


   
ReplyQuote
(@kovar)
Prominent Member
Joined: 18 years ago
Posts: 805
 

Greetings,

I'll toss it off for you tomorrow. Windows, Linux? Where are the messages stored - directory, pst file, … ? Output to … what? Drop me a line and let me know.

-David


   
ReplyQuote
(@kovar)
Prominent Member
Joined: 18 years ago
Posts: 805
 

Greetings,

If you'll send me a pm, I'll send you the script.

The script is straight forward, handling arbitrary email formats, even using existing perl modules, is a bit of a pain.

Anyhow, it'll either take a directory or a list of files on the command line and give you a single file containing the name of each file and all of the headers in it.

Easily modified to do other things you might need.

-David


   
ReplyQuote
cybarkop2007
(@cybarkop2007)
New Member
Joined: 18 years ago
Posts: 2
Topic starter  

Thanks all. I know that Perl can handle it. But with no programing skills, I am stuck cutting and pasting. And that is not working. Kovar. I just sent a PM to you. At least I hope I did.


   
ReplyQuote
(@bsd-roo)
Active Member
Joined: 18 years ago
Posts: 8
 

there are regular expressions tools out there that will generate the expression for you,
i wrote a font end GUI in PHP a while back that parses server logs and spot attacks.

preg in php is very good, uses perl regular expressions.

hope that helps


   
ReplyQuote
(@kovar)
Prominent Member
Joined: 18 years ago
Posts: 805
 

PMs just went back out.

-David


   
ReplyQuote
Share: