Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Steven Black
  Where is Steven Black?
 Kingston
 Canada
 Steven Black
 To: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 Tags
Subject: RE: Have to switch off comments
Thread ID: 143202 Message ID: 143307 # Views: 2 # Ratings: 0
Version: Not Applicable Category: Foxite: feedback
Date: Monday, August 27, 2007 5:19:35 PM         
   


Hi Eric,

Here's the code I use to AUTOMATICALLY deny IPs in the wiki. I used to do it manually too :)

This is Win2K server code...


**********************************
FUNCTION Deny( tcIP, tcSubnet)
**********************************
LOCAL llRetVal
llRetVal= .F.

IF tcIP= "127.0.0.1"
RETURN llRetVal
ENDIF

*-- Now, spin through IPs making sure there are no overlaps
LOCAL lnStart, lnEnd, lnTestStart, lnTestEnd
lnStart= IPToNum(tcIP)
lnEnd= lnStart+ SubnetToNum(tcSubnet)
LOCAL IIS, IPList, lcIP1, lcIP2
IIS = GetObject( "IIS://LocalHost/W3SVC" )
IPList= IIS.IPSecurity.IpDeny
FOR EACH lcIP IN IPList
lcIP1= GETWORDNUM(lcIp,1,",")
lcIP2= GETWORDNUM(lcIp,2,",")
lnTestStart= IPToNum(lcIP1)
lnTestEnd= lnTestStart+ SubnetToNum(lcIP2)
IF BETWEEN(lnStart, lnTestStart, lnTestEnd)
RETURN llRetVal
ENDIF
IF BETWEEN(lnTestStart, lnStart, lnEnd)
RETURN llRetVal
ENDIF
ENDFOR
llRetVal= .T.

*-- We're Good to go!
LOCAL lcIPToDeny, lctoRun

lcIPToDeny=tcIP+","+tcSubnet
lcToRun= [RUN "IPDeny.VBS ]+ lcIPToDeny+ ["]
&lcToRun

RETURN llRetVal


************************************
FUNCTION IpToNum(ip)
************************************
RETURN INT(VAL(GETWORDNUM(ip,1,"."))*256^3+ ;
VAL(GETWORDNUM(ip,2,"."))*256^2+ ;
VAL(GETWORDNUM(ip,3,"."))*256+ ;
VAL(GETWORDNUM(ip,4,".")))

************************************
FUNCTION SubnetToNum(ip)
************************************
RETURN INT((255-(VAL(GETWORDNUM(ip,1,"."))))*256^3+ ;
(255-VAL(GETWORDNUM(ip,2,".")))*256^2+ ;
(255-VAL(GETWORDNUM(ip,3,".")))*256+ ;
(255-VAL(GETWORDNUM(ip,4,"."))))



' This is IPDeny.vbs
Dim SecObj
Dim MyIPSec
Dim IPArray
Dim ArraySize
Dim num
Dim args
Dim IPtoDeny
'
Set SecObj=GetObject("IIS://localhost/w3svc")

set args = WScript.Arguments
num = args.Count

if num <> 1 then
WScript.Quit 1
end if

IPtoDeny = args.Item(0)

Set MyIPSec = SecObj.IPSecurity
'
IPArray = MyIPSec.IPDeny
arraySize = UBound(IPArray)

ReDim Preserve IPArray(arraySize+1)
IPArray(arraySize + 1) = IPtoDeny
MyIPSec.IPDeny = IPArray
'
SecObj.IPSecurity = MyIPSec
SecObj.setinfo



> > Hi people
> >
> > Due to the huge amount of spam that I am now getting from the weblogs.foxite.com I have decided to switch off ALL comments for the site. Unfortunately there is no facility to enter a generated code and all this spam is clogging my email box.
> >
> > Besides the Community Server 2.0 is outdated and very very slow.
> >
> > Thanks to Eric for providing this facility for free to members.
> >
> > If anyone has genuine comments please post it here and I will answer them and post them manually.
> >
> > Bernard
> >
> > ** If you see someone without a smile, give em one of yours :) **
>
> There isn't much I can do about it. The folks at Community Server did provide me with their latest version, but I had too much troubles upgrading.
>
> I do waste 3 hours per week adding IP's to the blacklist but these are all bot networks and later show up from new ip's. FWIW: you do not have to turn off the comments. You can simply turn off anonymous comments. If one wants to post information to your blog, they have to create an account there first.
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts

ENTIRE THREAD

Have to switch off comments Posted by Bernard Bout @ 8/25/2007 11:48:06 PM
RE: Have to switch off comments Posted by Eric den Doop @ 8/26/2007 9:35:12 AM
RE: Have to switch off comments Posted by Bernard Bout @ 8/26/2007 11:26:24 AM
RE: Have to switch off comments Posted by Eric den Doop @ 8/26/2007 12:53:08 PM
RE: Have to switch off comments Posted by Bernard Bout @ 8/27/2007 7:05:27 AM
RE: Have to switch off comments Posted by Cesar Chalom @ 8/27/2007 2:31:00 PM
RE: Have to switch off comments Posted by Bernard Bout @ 8/27/2007 11:21:26 PM
RE: Have to switch off comments Posted by Cesar Chalom @ 8/27/2007 11:59:14 PM
RE: Have to switch off comments Posted by Bernard Bout @ 8/28/2007 6:35:17 AM
RE: Have to switch off comments Posted by Eric den Doop @ 8/28/2007 8:15:13 AM
RE: Have to switch off comments Posted by Bernard Bout @ 8/29/2007 7:03:53 AM
RE: Have to switch off comments Posted by Steven Black @ 8/27/2007 5:19:35 PM
RE: Have to switch off comments Posted by Eric den Doop @ 8/27/2007 5:23:12 PM