🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #197973

Re: mail2news - perl help required

#197973
From: Zax
Date: Sun, 04 Dec 2005 11:44
29 lines
1772 bytes
On Sun, 04 Dec 2005 10:26:14 +0000, Anonymous wrote in
Message-Id: <14c7789fd2c2965e8e995b6b4fd23f18@remailer.org.uk>:

> (using email::simple)
>
> The received headers are gathered by:
>
> @received=$mail->header("Received");
>
> How can I extract the IP address of the machine that passed the 
> email to me into a variable $ipaddress?
>
> The problem can be simplified to:
>
> I want to extract the first IP address (they are always enclosed 
> within []) that does not match mine, or that of any of my 
> secondary MX's (IP4 or IP6 addresses).

I do it with a regex filter:
s/^Received:.*\[(.*)\]/$1/

This will strip a received header into just the ipaddress enclosed
within the [...].

-- 
pub  1024D/8ED57743 2003-07-08 Bananasplit Operator
     Key fingerprint = 796F 67E0 E890 A0BB BDAE  EBB4 94A6 7A09 8ED5 7743
uid                            Admin <admin.bananasplit.info>
Technical Details
Message-ID: <dmukrq$pgp$1@bananasplit.info>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news2.google.com!proxad.net!news.wiretrip.org!news.bananasplit.info!not-for-mail
References: <14c7789fd2c2965e8e995b6b4fd23f18@remailer.org.uk>

Show Full Headers
Complete Article Headers
Message-ID: <dmukrq$pgp$1@bananasplit.info>
Subject: Re: mail2news - perl help required
Date: Sun, 04 Dec 2005 11:44:58 +0000
From: Zax <fleegle@bananasplit.info>
References: <14c7789fd2c2965e8e995b6b4fd23f18@remailer.org.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news2.google.com!proxad.net!news.wiretrip.org!news.bananasplit.info!not-for-mail
Newsgroups: alt.privacy.anon-server
Organization: Bananasplit
Lines: 29
X-Complaints-To: abuse@bananasplit.info
NNTP-Posting-Date: Sun, 4 Dec 2005 11:44:58 +0000 (UTC)
User-Agent: slrn/0.9.8.1pl1 (Debian)