Re[2]: Help - How to unwind an SRS address?

Chris Drake <[email protected]> Sun, 21 Nov 2004 10:44:49 +1100
Newsgroups gmane.mail.spam.srs.general
Message-ID <[email protected]>
Hi All,

I must admit surprise that nobody seems to know how to do this
already; doing basic checks on the purported sender is a fundamental
element of email!!!  Anyhow, from what I can glean from the docs, from
inspection, and from your comments, it looks like... this might do it,
at least for now.  Only problem is that from inspection, "+" seems to
be interchangeable with "=", while from looking at marks code "-" also
seems interchangeable with it, and I recall someone mentioning base64
which I'm sure includes at least some of those characters... oh yeah,
and I'm not sure if "srs0" is legal like "SRS0" is?

If anyone wants to stick their hand up and state unambiguously that
specific elements of SRS rewritten addresses are separated by one and
only one specific character (and which), I'd be grateful: I've
accepted any of the 3 ( + - = ) as separators for the time being,
which will no doubt result in more angry customers down the track if
I'm wrong.  I also only process internet mail, so I enforce a ".tld"
in encoded host parts.  Hopefully nothing's going to line-wrap my email... which should have lines going out at least this far to read ---|
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789

#!perl

my(@srsers)=qw( [email protected]
                [email protected]
                SRS0=7/[email protected]
                [email protected]
                [email protected]
                SRS0=HHH=TT=host.com.au=local-part@local-host
                SRS1=HHH=first-forwarder==HHH=TT=host.com=local-part@local-host );

foreach my $i (@srsers) {
  print "$i\n --> " . &unsrs($i) . "\n";
}

sub unsrs {
  my($addy)=@_;
  
  #             SRS      0     =    HHH        =    TT         =    host.tld      = user    @local-host
  if($addy =~ /^SRS (?:  0[\+\-=][^\+\-=]+[\+\-=][^\+\-=]+[\+\-=]([^=]+\.[^=]{2,})=([^\@]+)\@.+  |
  #             SRS      1     =    HHH        = 1stfwdr   =      =   HHH         =    TT         =    host.tld      = user    @local-host
                         1[\+\-=][^\+\-=]+[\+\-=][^=]+[\+\-=][\+\-=][^\+\-=]+[\+\-=][^\+\-=]+[\+\-=]([^=]+\.[^=]{2,})=([^\@]+)\@.+)$/sx) {

    return "$2$4\@$1$3";
  } else {
    return $addy;
  }    
}

Kind Regards,
Chris Drake

Sunday, November 21, 2004, 2:53:57 AM, you wrote:

MWW> would you be able to post an example address that you want
MWW> to unwind?

MWW> On Sat, Nov 20, 2004 at 10:00:17PM +1100, Chris Drake wrote:
MWW> | Hi,
MWW> | 
MWW> | Please can someone give me a regex or *simple* instructions on how to
MWW> | reconstruct the real senders email address from an SRS one (pref
MWW> | without installing anything)?
MWW> | 
MWW> | And yes - I've looked at the docs, but there's loads and loads of
MWW> | detail - *so* much that I can't figure out easily how to do this with
MWW> | any confidence that it's going to work properly or indefinitely!
MWW> | 
MWW> | Many thanks to anyone who can help!
MWW> | 
MWW> | Kind Regards,
MWW> | Chris Drake
MWW> | 
MWW> | 
MWW> | -------
MWW> | To unsubscribe, change your address, or temporarily
MWW> deactivate your subscription, 
MWW> | please go to
MWW> http://v2.listbox.com/member/[email protected]

MWW> -------
MWW> To unsubscribe, change your address, or temporarily
MWW> deactivate your subscription, 
MWW> please go to
MWW> http://v2.listbox.com/member/[email protected]