报错service unavailable 服务器被DDos攻击了

2025-12-03 07:00:18

1、判断网站是否是被DDOS攻击,浏览网页时会报错service unavailable。如图!

报错service unavailable 服务器被DDos攻击了

2、首先我们要去查看一下IIS日记!IIS的日记一般是在C:\WINDOWS\system32\LogFiles 这个路径下!或者你可以进入“Internet 信息服务(IIS)管理器”控制台界面,然后右键打开在控制台左边“网站”项目上,选择“属性”,进入设置窗口,在“网站”标签中,底下“启用IIS日记”栏下选择进入“属性”在里面就可以看到IIS日记的目录了!

报错service unavailable 服务器被DDos攻击了

3、进入IIS日记,我们可以看到IIS日记都有1G多,HTTPERR日志都有几十G,一般的服务器硬盘都要爆棚了!这是不正常的。

报错service unavailable 服务器被DDos攻击了

4、那么如何解决呢?首先HTTPERR是IIS访问错误的日志,我们先把HTTPERR关闭,在命令窗运行里输入 regedit 进入系统注册表编辑器。依次按顺序进入

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters]在其右边点鼠标右键 新建一个dword值 EnableErrorLogging 然后重新启动服务器就可以了 "EnableErrorLogging"=dword:00000000 

报错service unavailable 服务器被DDos攻击了

5、然后我们在来看看服务器日志!可以看出来这类攻击对index.html 的静态页面也是很暴力的。根据网站错误service unavailable判断,这应该是基于负载形式的攻击模式。日记上显示IP源头都是国内,都是没有经过伪处理的。首先要区分开正常访问,和攻击的IP。先把网站停止,修改日志文件,让IIS重新生成一份攻击日志,再来用VBS处理下处理攻击IP。

报错service unavailable 服务器被DDos攻击了

6、'代码开始

targeturl = "/index.html" '受攻击网站的URL地址。

logfilepath = "C:\WINDOWS\system32\LogFiles\W3SVC1\ex120526.log" '受攻击网站的日志路径。

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 "结束."

Sub writelog(errmes)

ipfilename = "ip.txt"

Set logfile = fileobj.opentextfile(ipfilename, 8, True)

logfile.writeline errmes

logfile.Close

Set logfile = Nothing

End Sub

'代码结束

写完后就生成一个 ip.txt 文件。记得要用去除文本文件中重复行的程序,对IP进行过滤。这样过滤出来的IP,就是攻击IP了。

接下来用批处理控制ipseccmd写组策略批量屏蔽IP。

@sc config   PolicyAgent start= AUTO@net start PolicyAgent@for /f %%i in (ip.txt) do (ipseccmd -w REG -p "DDosStop" -r "%%i" -f %%i/255.255.255.255=0/255.255.255.255:: -n BLOCK -x)

好了,问题这样就搞定了!

报错service unavailable 服务器被DDos攻击了

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢