The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


NET::IPFilter - Perl extension for Accessing eMule / Bittorrent IPFilter.dat Files and checking a given IP against this ipfilter.dat IP Range. IT uses conversion from IP to long integers in Perl and afterwards compairing these long integer ranges against the calculated number of the given IP

Warning: Please Update your Sources. Current Version fixed a very critical bug that prevents Program from working correctly.


  use NET::IPFilter;

 my $ipfilter = '/home/user/files/ipfilter.dat';
 my $IP = ""; # :)

 my $obj = NET::IPFilter->new(  ipfilter        => $ipfilter,
                                tmpdir          => '/var/tmp',
                                force_init      => '0'

 my $isValid    = $obj->isValid($IP);   #  1 not to be blocked | 0 to be blocked
print $isValid;


my $obj = NET::IPFilter->new( ipfilter => $ipfilter, tmpdir => '/var/tmp', force_init => '0' );

ipfilter can be an absolute file in the filesystem or an uri. the uri filename can be a normal textfile or a gzip compressed file

tmpdir classifies a folder where to store some temporary files

force_init can be 0 or 1 where 1 means that all files are downloaded again ( if uri is an http-link )

This current version is intended to be used on Linux/Unix OS System. My new Version NET::IPFilterSimple will be usable for both Linux/Unix and Windows. As i have no solaris or MAC i dont know how to fix the module to bring it to life on that mashines


use Carp; use strict; use 5.008008; use HTTP::Request; use LWP::UserAgent; use Compress::Zlib; use Fcntl ':flock';


        beautifyRawIPfromIPFilter - this function beautifies ips in the form of to - not used in programm

        readIPFilterFile - this is the function that reads and simply preparses the ipfilter.dat file
        httpGetStore - function that downloads the ipfilter.dat file if the uri is an http link
        _ip2long - transfers an ip to a long var ( in perl its a long integer )

        _long2ip - transfers an long integer back to an ip adress - not used in programm

        isValid - checks a given ip against the ipfilter.dat file

        gunzip - uncompression of an gzipped/zipped ipfilter.dat file in the form of ipfilter.dat.gz

        _init - initialising functions


eMule | BitTorrent | Torrent Sites using ipfilter.dat perl modules



Sebastian Enger, bigfish82 |ät! gmail?com


Copyright (C) 2008 by Sebastian Enger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

If you find an algorithm that is faster then mine than please send it to my email address.

Currently i am going to release a module NET::IPFilterSimple that i hope is some ms faster than NET::IPFilter

1 POD Error

The following errors were encountered while parsing the POD:

Around line 526:

Non-ASCII character seen before =encoding in '|ät!'. Assuming UTF-8