On Fri, Apr 23, 2010 at 3:58 PM, Andreas Müller <amuelle1_at_gmx.de> wrote:
> Hello,
>
> I know that I can't trust in XFF. What is new for me that the comma is optional and so its more difficult to parse the value.
>
Could use the function like Perl's split to get the last IP no matter
the comma exists or not.
$ perl -le '$ip="12.34.56.78,11.22.33.44,1.2.3.4";$last=(split/,/,$ip)[-1];print
$last'
1.2.3.4
$ perl -le '$ip="12.34.56.78,11.22.33.44";$last=(split/,/,$ip)[-1];print
$last'
11.22.33.44
$ perl -le '$ip="12.34.56.78";$last=(split/,/,$ip)[-1];print $last'
12.34.56.78
-- Jeff Pang http://home.arcor.de/pangj/Received on Fri Apr 23 2010 - 08:07:38 MDT
This archive was generated by hypermail 2.2.0 : Fri Apr 23 2010 - 12:00:05 MDT