Copy Code code as follows:
<%@ Language=vbscript%>
<%
Dim StrIP
StrIP = Request ("IP")
%>
<form action=? Method=post>
Enter Ip:<input type=text value= "<%=strIP%>" style= BORDER: #AAAAAA 1px solid; "Name=" IP >
<input type= "Submit" value= "OK send" >
</FORM>
<%
If strip= "List" then
Call Listdenyip ("2443")
Response.End
End If
If strip= "Query" then
Call Checkwebsitesetup
Response.End
End If
#
If strip<> "" Then
Call Adddenyip ("2443", StrIP)
End If
Sub Checkwebsitesetup ()
Set iisobj=getobject ("Iis://localhost/w3svc")
For each website in IIsObj
If website. class= "IIsWebServer" Then
For each B in website. ServerBindings
Response.Write ("Server" &website.adspath "has binding" &b)
Response.Write ("<br>")
Next
End If
Next
End Sub
#
Sub Listdenyip (strwebno)
Set secobj = GETObject ("iis://localhost/w3svc/" +strwebno+ "/root")
Set myipsec = secobj.ipsecurity
Iplist=myipsec.ipdeny
If UBound (iplist) <0 Then
Response.Write "<BR> No data, please add a free <BR>"
Exit Sub
End If
#
Intiplistcount=ubound (IPList) +1
#
For i=0 to UBound (IPList)
Response.Write i+1
Response.Write ":"
Response.Write IPList (i)
Response.Write "<br>"
Next
End Sub
Sub Adddenyip (STRWEBNO,STRDENYIP)
Set secobj = GETObject ("iis://localhost/w3svc/" +strwebno+ "/root")
Set myipsec = secobj.ipsecurity
' Make sure grantbydefault=true or your changes would not count.
If (FALSE = myipsec.grantbydefault) Then
Response.Write "<br>grantbydefault is not TRUE. Setting to True.<br> "
MyIPSec.GrantByDefault = TRUE
End If
Iplist=myipsec.ipdeny
If UBound (iplist) <0 Then
Response.Write "<BR> No data, please add a free <BR>"
Exit Sub
End If
#
Intiplistcount=ubound (IPList) +1
#
For i=0 to UBound (IPList)
If Strdenyip = Left (IPList (i), Len (Strdenyip)) Then
Response.Write "<BR> duplicate data. <BR> "
Exit Sub
End If
Next
ReDim Preserve IPList (Intiplistcount)
IPList (Intiplistcount) =strdenyip
Response.Write "New Add:"
Response.Write Strdenyip
Response.Write "<br>"
Myipsec.ipdeny = IPList
Secobj.ipsecurity = MyIPSec
Secobj.setinfo
End Sub
%>