[Sophisticated Searches]

GDHough mr6re9-mI4xJ4qlgtBiLUuM0BA3LQ at public.gmane.org
Fri Dec 19 00:53:55 UTC 2003


On Thursday 18 December 2003 14:09, Fraser Campbell wrote:
> On Thursday 18 December 2003 13:39, Henry Spencer wrote:
> > that's aware of Internet addresses and can manipulate them as such.  I'm
> > sure somebody's got a library for that in Perl...
>
> Net::IPv4Addr ...
>
> use Net::IPv4Addr qw( :all );
> $logline = 'asdf 43tr gerag fdgdgf 34.23.45.222';
> if ($ip = ipv4_checkip($logline) ) {
>     print "$ip\n";
> }
OK, fine...I'll try to teach myself some perl over the winter. Is the above 
going to give me what I want; a subnet match?

I know how to tell iptables to drop all packets from a single IPv4Addr or it's 
assigned subnet.

iptables -I OUTPUT -p udp -d 209.239.224.0/19 -j drop-and-log-it
iptables -I OUTPUT -p tcp -d 209.239.0.7 -j drop-and-log-it

Now I may have 100k IPv4Addr addresses in a single log file or multiple 
preprocessed files and I want only the lines in which the IPv4Addr belongs to 
209.239.224.0/19, then either print to stdout or a file. 

This entire excersise I am doing betwix two machines using only ssh and sftp. 
I aim to preprocess some of the data on the server before transferring over 
for more detailed analysis.

Can anyone recommend a good book for learning perl from scrath?
-- 
Eating Crow is better with MyCrowSauce

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list