Windows2008R2 一键安全优化脚本

::author vim
::QQ 82996821
::filename Windows2008R2_safe_auto_set.bat
:start
@echo off
color 0a
@echo 请选择要服务操作类型:
@echo 1.更改远程端口,重启后生效
@echo 2.目录权限优化
@echo 3.系统服务优化
@echo 4.网络安全优化[修改注册表]
@echo 5.禁用所有IPV6组件,除IPV6环回接口
@echo 6.删除系统默认共享
@echo 7.卸载ASP漏洞wshom.ocx,shell32.dll组件
@echo 8.组策略优化
@echo 9.关闭防火墙
@echo 0.退出
set/p a=请选择服务操作类型:
goto start%a%
:start1
echo 请输入要修改的远程端口号:
set /p var=
echo 开始修改
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp" /v PortNumber /t REG_DWORD /d %var% /f
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v PortNumber /t REG_DWORD /d %var% /f
echo 修改成功,下面是添加防火墙规则
netsh advfirewall firewall add rule name="remote_"%var% protocol=TCP dir=in localport=%var% action=allow
@pause
cls
goto :start
:start2
echo 目录权限优化
echo ==========================================================
::echo 降低C盘权限
::cacls C:\  /e /r "CREATOR OWNER" "Users" >>log.log
echo windows系统文件夹权限设置
takeown /F C:\Windows\System32
takeown /F C:\Windows\System32\config
cacls C:\Windows\System32 /e /r "CREATOR OWNER">>log.log
cacls C:\Windows\System32\config /e /r "CREATOR OWNER">>log.log
echo 程序文件权限设置
takeown /F "C:\Program Files\Windows NT\Accessories"
takeown /F "C:\Program Files\Internet Explorer\iexplore.exe"
takeown /F "C:\Program Files\Common Files"
cacls "C:\Program Files\Windows NT\Accessories"  /e /r "CREATOR OWNER" "Users" >>log.log
cacls "C:\Program Files\Internet Explorer\iexplore.exe" /e /r system users >>log.log
cacls "C:\Program Files\Common Files"  /e /r "CREATOR OWNER" "Users" >>log.log
echo 用户配置信息的文件夹权限设置
takeown /F "C:\ProgramData\Documents"
takeown /F "C:\ProgramData\Application Data\Microsoft"
takeown /F "C:\ProgramData\Application Data"
takeown /F "C:\ProgramData\「开始」菜单"
takeown /F "C:\Documents and Settings"
cacls "C:\ProgramData\Documents" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data\Microsoft" /e /r everyone >>log.log
cacls "C:\ProgramData\Application Data" /e /r everyone >>log.log
cacls "C:\ProgramData\「开始」菜单" /e /r everyone >>log.log
cacls "C:\Documents and Settings"  /e /r everyone >>log.log
echo iis下的ASP,ASPX网站相关的EXE和DLL
takeown /F C:\Windows\System32\wscript.exe
takeown /F C:\Windows\System32\wshom.ocx
cacls  C:\Windows\System32\wscript.exe /e /r users >>log.log
cacls  C:\Windows\System32\wshom.ocx /e /r users >>log.log
echo windows系统文件夹下的关键二进制文件
takeown /f  C:\Windows\System32\zipfldr.dll
takeown /f  C:\Windows\System32\xcopy.exe
takeown /f  C:\Windows\System32\wshext.dll
takeown /f  C:\Windows\System32\where.exe
takeown /f  C:\Windows\System32\tracert.exe
takeown /f  C:\Windows\System32\syskey.exe
takeown /f  C:\Windows\System32\shutdown.exe
takeown /f  C:\Windows\System32\shadow.exe
takeown /f  C:\Windows\System32\setx.exe
takeown /f  C:\Windows\System32\sethc.exe
takeown /f  C:\Windows\System32\secedit.exe
takeown /f  C:\Windows\System32\sc.exe
takeown /f  C:\Windows\System32\runonce.exe
takeown /f  C:\Windows\System32\runas.exe
takeown /f  C:\Windows\System32\route.exe
takeown /f  C:\Windows\System32\replace.exe
takeown /f  C:\Windows\System32\regsvr32.exe
takeown /f  C:\Windows\System32\regedt32.exe
takeown /f  C:\Windows\System32\reg.exe
takeown /f  C:\Windows\System32\print.exe
takeown /f  C:\Windows\System32\powercfg.exe
takeown /f  C:\Windows\System32\ping.exe
takeown /f  C:\Windows\System32\nslookup.exe
takeown /f  C:\Windows\System32\notepad.exe
takeown /f  C:\Windows\System32\netstat.exe
takeown /f  C:\Windows\System32\netsh.exe
takeown /f  C:\Windows\System32\net1.exe
takeown /f  C:\Windows\System32\net.exe
takeown /f  C:\Windows\System32\mstsc.exe
takeown /f  C:\Windows\System32\mshta.exe
takeown /f  C:\Windows\System32\mountvol.exe
takeown /f  C:\Windows\System32\logoff.exe
takeown /f  C:\Windows\System32\ipconfig.exe
takeown /f  C:\Windows\System32\help.exe
takeown /f  C:\Windows\System32\gpupdate.exe
takeown /f  C:\Windows\System32\ftp.exe
takeown /f  C:\Windows\System32\format.com
takeown /f  C:\Windows\System32\finger.exe
takeown /f  C:\Windows\System32\find.exe
takeown /f  C:\Windows\System32\doskey.exe
takeown /f  C:\Windows\System32\cscript.exe
takeown /f  C:\Windows\System32\cmd.exe
takeown /f  C:\Windows\System32\cacls.exe
takeown /f  C:\Windows\System32\attrib.exe
takeown /f  C:\Windows\System32\at.exe
takeown /f  C:\Windows\System32\arp.exe
cacls  C:\Windows\System32\zipfldr.dll /e /r users >>log.log
cacls  C:\Windows\System32\xcopy.exe /e /r users >>log.log
cacls  C:\Windows\System32\wshext.dll /e /r users >>log.log
cacls  C:\Windows\System32\where.exe /e /r users >>log.log
cacls  C:\Windows\System32\tracert.exe /e /r users >>log.log
cacls  C:\Windows\System32\syskey.exe /e /r users >>log.log
cacls  C:\Windows\System32\shutdown.exe /e /r users >>log.log
cacls  C:\Windows\System32\shadow.exe /e /r users >>log.log
cacls  C:\Windows\System32\setx.exe /e /r users >>log.log
cacls  C:\Windows\System32\sethc.exe /e /r users >>log.log
cacls  C:\Windows\System32\secedit.exe /e /r users >>log.log
cacls  C:\Windows
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值