#!/usr/local/bin/perl
# WWWDENY - Simple Remote Host Identification & Rejection or Accept
# Created by Brock Eastman - Network Administrator - 2INTERACTIVE.COM
# info@2interactive.com
# Created on: 3/2/00 Last Modified on: 3/6/00
# Version 1.0
# Check http://www.2interactive.com/scripts/wwwDENY for the newest version.
# This script should be used as a server side include.
#
# Or you can call it as the script itself. http://2interactive.com/index.cgi
###NOTE!!! PLEASE READ THIS##
##THE $ADDRESS_DENY is the single ip address or block of ip addresses you want to deny.
##lets say you wanted to block all ip addresses from 199.5.* .
## All you have to do is put in 199.5.* - it's that simple.
## The information below is what I used the script for.
## We did not want volkswagen of america to see our main page, so we just denied their ip block.
## This was about a boycott - VWOA is doing very unethical things =( - check out www.vwmagazine.com/vwoa
########################################################
###################CONFIG VARS##########################
########################################################
$WRITE_PAGE="data.txt";
$ADDRESS_DENY="199.5.*";
###########################################################################################
#########NOTE : WRITE_PAGE is the file you want the script to log ip addresses to.#########
#########THIS WILL LET YOU KNOW WHO HAS BEEN HITTING THE SITE - CHMOD data.txt to 777######
###########################################################################################
#########################################################
##################DO NO TOUCH BELOW #####################
#########################################################
##REMOTE HOST ENV METHOD##
$ADDRESS=$ENV{'REMOTE_ADDR'};
####WRITE TO FILE####
sub write_entry {
open(FILE,">>$WRITE_PAGE");
print FILE "$ADDRESS\n";
close(FILE);
}
####GET HOST ADDRESS AND ANALYZE####
if($ADDRESS=~ /$ADDRESS_DENY/)
{
&write_entry;
#########################################################
#############YOU MAY EDIT THIS SECTION - BE CAREFUL######
#########################################################
print "Content-type: text/html\n\n";
print "Hello VWoA - You are not welcome to view this page\n";
print "
We have logged your IP address as: $ADDRESS\n";
print "
Have a nice day.\n";
print "
Here is a list of IP addresses attempting to access this page from VWOA. \n"; print "
CLICK HERE TO SEE WHAT MANY DISCONTENT VW ENTHUSIASTS HAVE HAD TO SAY ABOUT YOUR ACTIONS.
\n";
}
else {
print "Content-type: text/html\n\n";
print "Hello and Welcome to the STOP VWOA Page from $ENV{'REMOTE_ADDR'}\n";
print " You can view how many times they have been here by going to DATA FILE \n";
print "
Volkswagen of America has been visiting this site. \n";
print "
VWOA IS NOT ALLOWED TO VIEW THIS SITE, AND OUR SERVER IDENTIFIES THEM WITH NO ACCESS. \n";
print "