Advertisement

01.06.2007 at 10:08AM PST, ID: 22113418
[x]
Attachment Details

Want to interact with IIS://localhost/MSFTPSVC/1/Root and add denied IP addresses

Asked by cougar694u in Microsoft Visual Basic.Net

Tags: iis

I have a VBS that does what i need it to do, but I'm wanting to rewrite it in VB.NET 2k5 to add more functionality.  I use the logparser com object to query the log file and retrieve IP addresses of failed login attempts and count them.  For every IP address where 'times >= 5' I add the IP address to the deny list in MSFTPSVC.

This function enumerates the already denied list:

FUNCTION GetBlockedIPs()

      DIM rootObj : SET rootObj = GetObject("IIS://localhost/MSFTPSVC/1/Root")

      DIM ipSecObj : SET ipSecObj = rootObj.IPSecurity

      GetBlockedIPs = ipSecObj.IPDeny

END FUNCTION

This function adds IP addresses to the denied list:

FUNCTION BlockIPs(IPAddresses)

      DIM rootObj : SET rootObj =  GetObject("IIS://localhost/MSFTPSVC/1/Root")

      DIM ipSecObj : SET ipSecObj = rootObj.IPSecurity

      ipSecObj.GrantByDefault = TRUE

      ipSecObj.IPDeny = IPAddresses

      rootObj.IPSecurity = ipSecObj

      rootObj.SetInfo

END FUNCTION

Again, the above functions are in my VB Script, which works and adds IP addresses to the denied list exactly the way I want it.  That's the part I don't know how to do in VB.NET 2k5.  Can anyone help me out?Start Free Trial
 
 
[+][-]01.07.2007 at 11:24PM PST, ID: 18265219

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: iis
Sign Up Now!
Solution Provided By: farsight
Participating Experts: 1
Solution Grade: B
 
 
[+][-]01.09.2007 at 09:20AM PST, ID: 18277025

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.11.2007 at 01:06PM PST, ID: 18296495

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32