国内自拍在线,久久久夜色精品,欧美日韩一区三区,国产黄a三级三级三级看三级男男,aaa一级片,久久久久久久久一区二区三区,中文一区在线

    電話

    0411-39943997

仟億科技
客服中心
  • 電話
  • 電話咨詢:0411-39943997
  • 手機(jī)
  • 手機(jī)咨詢:15840979770
    手機(jī)咨詢:13889672791
網(wǎng)絡(luò)營(yíng)銷 >更多
您現(xiàn)在的位置:首頁(yè) > 新聞中心 > 常見(jiàn)問(wèn)題

Windows IIS 網(wǎng)站日志文件分析程序

作者:billionnet 發(fā)布于:2011/12/19 15:49:49 點(diǎn)擊量:

Windows Server具有事件日志記錄的功能,其IIS日志文件里記錄了包括下列信息:誰(shuí)訪問(wèn)了您的站點(diǎn),訪問(wèn)者查看了哪些內(nèi)容等等。通過(guò)定期檢查這些日志文件,網(wǎng)站管理員可以檢測(cè)到服務(wù)器或站點(diǎn)的哪些方面易受攻擊或存在其他安全隱患。

  不過(guò),目前的日志分析工具并不是很完善,有些功能并不具備,特別是針對(duì)某個(gè)URL地址進(jìn)行攻擊的分析并不多,下面是一個(gè)VB Script程序,保存為VBS程序后可以在服務(wù)器上運(yùn)行,用于分析和檢測(cè)IIS日志里針對(duì)某個(gè)URL地址進(jìn)行攻擊的IP地址。

'代碼開(kāi)始
targeturl = "/archives/2761.html"  '受攻擊網(wǎng)站的URL地址。
logfilepath = "C:\LogFiles\W3SVC\ex110813.log"  '受攻擊網(wǎng)站的日志路徑。

 

On Error Resume Next
Set fileobj = CreateObject("scripting.filesystemobject")
Set fileobj2 = CreateObject("scripting.filesystemobject")
Set myfile = fileobj2.opentextfile(logfilepath, 1, False)
  
Do While myfile.atendofstream <> True
myline = myfile.readline()
myline2 = Split(myline, " ")
newip = myline2(9)
myurl = myline2(5)
If targeturl = myurl Then
      writelog newip
End If
Loop

myfile.Close
Set fileobj2 = Nothing
Msgbox "結(jié)束."

Sub writelog(errmes)
ipfilename = "blockip.txt"
Set logfile = fileobj.opentextfile(ipfilename, 8, True)
logfile.writeline errmes
logfile.Close
Set logfile = Nothing
End Sub
'代碼結(jié)束
 

IIS日志

  分析出來(lái)的IP如果出現(xiàn)異常,可以通過(guò)程序,將其批量添加到IIS的屏蔽IP列表里,下面是網(wǎng)上找到的一段VBScript代碼,將其改名為vbs后,把上面那段程序的IP導(dǎo)入,即可批量屏蔽攻擊者的IP地址。

'代碼開(kāi)始
'/*=========================================================================
' * Intro VBScript使用ADSI為IIS批量添加屏蔽或允許訪問(wèn)的IP 
' * FileName VBScript-ADSI-IIS-Add-Deny-Grant-IP-Change-MetaBase.xml.vbs 
' *==========================================================================*/ 
'AddDenyIP2All "192.168.1.106,255.255.255.0" 
'AddDenyIP "123456","127.0.0.1" 
'AddDenyIP2All "14.113.226.116"

 

'添加要屏蔽的IP或一組計(jì)算機(jī),到一個(gè)指定站點(diǎn)上 
Sub AddDenyIP(strWebNo, strDenyIp) 
On Error Resume Next 
Set SecObj = GetObject("IIS://LocalHost/W3SVC/" & strWebNo & "/Root") 
Set MyIPSec = SecObj.IPSecurity 
MyIPSec.GrantByDefault = True 
IPList = MyIPSec.IPDeny 
i = UBound(IPList) + 1 
ReDim Preserve IPList(i) 
IPList(i) = strDenyIp 
MyIPSec.IPDeny = IPList 
SecObj.IPSecurity = MyIPSec 
SecObj.Setinfo 
End Sub 
'添加要屏蔽的IP或一組計(jì)算機(jī),到IIS公共配置,以應(yīng)用到所有站點(diǎn) 
'如果之前對(duì)有些站點(diǎn)單獨(dú)做過(guò)屏蔽IP設(shè)置,在些設(shè)置不會(huì)生效,得在總的網(wǎng)站上設(shè)置一下,然后覆蓋所有子結(jié)點(diǎn) 
Sub AddDenyIP2All(strDenyIp) 
On Error Resume Next 
Set SecObj = GetObject("IIS://LocalHost/W3SVC") 
Set MyIPSec = SecObj.IPSecurity 
MyIPSec.GrantByDefault = True 
IPList = MyIPSec.IPDeny 
i = UBound(IPList) + 1 
ReDim Preserve IPList(i) 
IPList(i) = strDenyIp 
MyIPSec.IPDeny = IPList 
SecObj.IPSecurity = MyIPSec 
SecObj.Setinfo 
End Sub 
'添加允許的IP或一組計(jì)算機(jī),到一個(gè)指定站點(diǎn)上 
Sub AddGrantIP(strWebNo, strGrantIp) 
On Error Resume Next 
Set SecObj = GetObject("IIS://LocalHost/W3SVC/" & strWebNo & "/Root") 
Set MyIPSec = SecObj.IPSecurity 
MyIPSec.GrantByDefault = False 
IPList = MyIPSec.IPGrant 
i = UBound(IPList) + 1 
ReDim Preserve IPList(i) 
IPList(i) = strGrantIp 
MyIPSec.IPGrant = IPList 
SecObj.IPSecurity = MyIPSec 
SecObj.Setinfo 
End Sub 
'添加允許的IP或一組計(jì)算機(jī),到IIS公共配置,以應(yīng)用到所有站點(diǎn) 
'如果之前對(duì)有些站點(diǎn)單獨(dú)做過(guò)屏蔽IP設(shè)置,在些設(shè)置不會(huì)生效,得在總的網(wǎng)站上設(shè)置一下,然后覆蓋所有子結(jié)點(diǎn) 
Sub AddGrantIP2All(strGrantIp) 
On Error Resume Next 
Set SecObj = GetObject("IIS://LocalHost/W3SVC") 
Set MyIPSec = SecObj.IPSecurity 
MyIPSec.GrantByDefault = False 
IPList = MyIPSec.IPGrant 
i = UBound(IPList) + 1 
ReDim Preserve IPList(i) 
IPList(i) = strGrantIp 
MyIPSec.IPGrant = IPList 
SecObj.IPSecurity = MyIPSec 
SecObj.Setinfo 
End Sub 
'顯示IIS公共配置里禁止訪問(wèn)的IP 
Sub ListDenyIP() 
Set SecObj = GetObject("IIS://LocalHost/W3SVC") 
Set MyIPSec = SecObj.IPSecurity 
IPList = MyIPSec.IPDeny 'IPGrant/IPDeny 
WScript.Echo Join(IPList, vbCrLf) 
' For i = 0 To UBound(IPList) 
' WScript.Echo i + 1 & "-->" & IPList(i) 
' Next 
End Sub
 

 


分享到:


Copyright@ 2011-2016 版權(quán)所有:大連千億科技有限公司 遼ICP備11013762-3號(hào)   google網(wǎng)站地圖   百度網(wǎng)站地圖   網(wǎng)站地圖

公司地址:大連市沙河口區(qū)中山路692號(hào)辰熙星海國(guó)際2317 客服電話:0411-39943997 QQ:2088827823 37482752

法律聲明:未經(jīng)許可,任何模仿本站模板、轉(zhuǎn)載本站內(nèi)容等行為者,本站保留追究其法律責(zé)任的權(quán)利! 隱私權(quán)政策聲明