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