HTTPD-ADS

 view release on metacpan or  search on metacpan

scripts/DefenseServer.pl  view on Meta::CPAN

my $ipv4regex = "/^".$ipv4octetregex."\.".$ipv4octetregex."\.".$ipv4octetregex."\.".$ipv4octetregex."\$/o";
study $ipv4regex;
my $fifo = "/tmp/BlackList";
if (-e $fifo) {
  die "socket file present and I can't delete it" if((unlink $fifo) !=1);
}
my $message;
my @parts;

my $listen = IO::Socket::UNIX->new(Local=>$fifo, Listen=>0) || die "$!"; #per io_unix.t of IO::Socket::UNIX
my $rv = chown((getpwnam($target_user))[2,3],$fifo); #adapted from p691 of _Programming Perl_,3rd ed.
print "socket set blocking, was ".$listen->blocking(1);	#1 is TRUE
#my $oldtimeout = $listen->timeout(3600);
#print "\ntimeout set, was ".(defined $oldtimeout? $oldtimeout: "undefined\n");
my @ipaddr;
my $sock;
while (1) {
  $sock = $listen->accept();
  if (defined $sock) {
    $message= $sock->getline;
    if (!defined $message) {

scripts/EventServer.pl  view on Meta::CPAN

my $ADSDatabase="wwwads";
my $ADSDataUser="";
my $ADSDataPassword="";
my $webserverusername="wwwrun";
my $webpw = getpwnam($webserverusername);
my $fifo = "/tmp/AttackWatch";
die "socket file present and I can't delete it" if(-e $fifo and (unlink $fifo) !=1);
my $default_filepermissions = umask 07 ;#INVERSE: bit set is deny access this denys Other, allows user and group rwx
my $listen = IO::Socket::UNIX->new(Local=>$fifo, Listen=>0) || die "$!"; #per io_unix.t of IO::Socket::UNIX
#the above line creates the socket file but we 
my $rv = chown (-1,$webpw->gid,$fifo);#-1 is supposed to mean leave it alone
carp "Could not change group of socket file $fifo, LiveWatch may not be able to use socket" unless $rv==1;
my $message;
my $oldtimeout = $listen->timeout(3600);
print "timeout set, was ".(defined $oldtimeout? $oldtimeout:  "not defined\n");
print "blocking mode set, was ".$listen->blocking(0);
my  $sock = $listen->accept();
my %args;
my $apacheids = HTTPD::ADS->new (
			       ADSDataUser => $ADSDataUser,
			       ADSDataPassword   => $ADSDataPassword,



( run in 1.196 second using v1.01-cache-2.11-cpan-71847e10f99 )