服务器安全加固BAT

来源:互联网 发布:深圳gdp超广州 知乎 编辑:程序博客网 时间:2024/05/22 17:06
以下保存为bat文件,运行时还需xcacls.vbs,可以到网上下载。
 
:: 禁用WS命令行组件
regsvr32 /s wshom.ocx
 
:: 防止WINDOWS漏洞[粘滞键]的"变态入侵之有史以来最酷的Windows后门sethc.exe"
 
cscript.exe xcacls.vbs "%SystemRoot%/system32/sethc.exe" /D Everyone:M /E
cscript.exe xcacls.vbs "%SystemRoot%/ServicePackFiles/i386/sethc.exe" /D Everyone:M /E
 
 
:: 删除system32\npptools.dll,新建npptools.dll设为只读,权限上限制 可防止所有arp病毒
 
del %SystemRoot%\system32\npptools.dll /A/F/Q
dir %SystemRoot%\system32\com > %SystemRoot%\system32\npptools.dll
attrib +R +S +H %SystemRoot%\system32\npptools.dll
cscript.exe xcacls.vbs "%SystemRoot%/system32/npptools.dll" /D Everyone:M /E
 
:: 删除system32\packet.dll,新建packet.dll设为只读,权限上限制 可防止所有arp病毒
 
del %SystemRoot%\system32\packet.dll /A/F/Q
dir %SystemRoot%\system32\com > %SystemRoot%\system32\packet.dll
attrib +R +S +H %SystemRoot%\system32\packet.dll
cscript.exe xcacls.vbs "%SystemRoot%/system32/packet.dll" /D Everyone:M /E
 
:: 删除system32\pthreadVC.dll,新建pthreadVC.dll设为只读,权限上限制 可防止所有arp病毒
 
del %SystemRoot%\system32\pthreadVC.dll /A/F/Q
dir %SystemRoot%\system32\com > %SystemRoot%\system32\pthreadVC.dll
attrib +R +S +H %SystemRoot%\system32\pthreadVC.dll
cscript.exe xcacls.vbs "%SystemRoot%/system32/pthreadVC.dll" /D Everyone:M /E
 
:: 删除system32\wpcap.dll,新建wpcap.dll设为只读,权限上限制 可防止所有arp病毒
 
del %SystemRoot%\system32\wpcap.dll /A/F/Q
dir %SystemRoot%\system32\com > %SystemRoot%\system32\wpcap.dll
attrib +R +S +H %SystemRoot%\system32\wpcap.dll
cscript.exe xcacls.vbs "%SystemRoot%/system32/wpcap.dll" /D Everyone:M /E
 
:: 删除system32\npf.sys,新建npf.sys设为只读,权限上限制 可防止所有arp病毒
 
del %SystemRoot%\system32\drivers\npf.sys /A/F/Q
dir %SystemRoot%\system32\com > %SystemRoot%\system32\drivers\npf.sys
attrib +R +S +H %SystemRoot%\system32\npf.sys
cscript.exe xcacls.vbs "%SystemRoot%/system32/drivers/npf.sys" /D Everyone:M /E
 
Echo 禁用通过重启重命名方式加载启动项
 
:: 重启重命名的执行优先级比传统的自启动(一般指HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\ CurrentVersion\Run)要高, 启
 
动完成后又将自己删除或改名回去. 这种方式自启动极为隐蔽,现有的安全工具都无法检测的出来. 
:: 病毒通过重启重命名方式加载,位于注册表HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ BackupRestore\KeysNotToRestore下
 
的Pending Rename Operations字串。
 
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations /f
 
:: 关闭事件跟踪程序
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Reliability" /v ShutdownReasonOn /t REG_DWORD /d 
 
"00000000" /f
 
:: 防止 Windows 运行您在这个设置中指定的程序。
:: 如果启用这个设置,用户则无法运行添加到不允许的应用程序列表的程序。
 
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /t REG_DWORD /d 
 
"00000001" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v login.scr /t REG_SZ 
 
/d login.scr /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v xsiff.exe /t REG_SZ 
 
/d xsiff.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v xsniff.exe /t 
 
REG_SZ /d xsniff.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v sethc.exe /t REG_SZ 
 
/d sethc.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v WinPcap.exe /t 
 
REG_SZ /d WinPcap.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v nc.exe /t REG_SZ /d 
nc.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v sql.exe /t REG_SZ 
 
/d sql.exe /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /v su.exe /t REG_SZ /d 
 
su.exe /f
 
regsvr32 /s /u wshom.ocx
 
Echo 应用软件限制组策略,进一步加强服务器安全性能!
c:
cd\
cd "%SystemRoot%/system32/GroupPolicy/Machine"
copy Registry.pol Registry.old /y
copy Registry.pol "%SystemRoot%/system32/GroupPolicy/Machine" /y
gpupdate /force
Echo 应用软件限制组策略设置完毕,现在请按任意键返回并选其他操作继续...
PAUSE >nul
exit
 
总结,考虑的很周全,必须学习!
原创粉丝点击