批处理设置windows服务器的代码ThecSafe1.9.4第1/3页
程序员文章站
2022-03-22 09:01:20
@echo off title 常来网服务器高级安全设置器 :start cls color 1f rem 使用colo...
@echo off
title 常来网服务器高级安全设置器
:start
cls
color 1f
rem 使用color命令对控制台输出颜色进行更改
mode con: cols=32 lines=21
rem mode语句为设定窗体的宽和高
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
echo %date% %tm1%点%tm2%分%tm3%秒
echo ================================
echo 请选择要进行的操作,然后按回车
echo ───────────────
echo.
echo a. 一键搞定/全自动设置服务器
echo 0. 清理系统垃圾文件
echo 1. 给系统危险文件设置权限
echo 2. 给系统危险文件夹设置权限
echo 3. 系统服务优化
echo 4. 注册表危险组件删除
echo 5. 防ddos洪水攻击处理
echo 6. 导入常来网专用安全策略
echo 7. 重启iis使设置生效
echo 8. 刷新当前时间
echo 9. 锁定计算机
echo l. 注销当前用户
echo q. 退出安全设置器
echo.
:cho
set choice=
set /p choice=选择:
rem 设定变量"choice"为用户输入的字符
if not "%choice%"=="" set choice=%choice:~0,1%
rem 如果输入大于1位,取第1位,比如输入132,则返回值为1
echo.
if /i "%choice%"=="a" goto auto
if /i "%choice%"=="0" goto clear
if /i "%choice%"=="1" goto setfile
if /i "%choice%"=="2" goto setfolder
if /i "%choice%"=="3" goto service
if /i "%choice%"=="4" goto reg
if /i "%choice%"=="5" goto ddos
if /i "%choice%"=="6" goto ipsec
if /i "%choice%"=="7" goto restartiis
if /i "%choice%"=="8" goto start
if /i "%choice%"=="9" goto lock
if /i "%choice%"=="l" goto logoff
if /i "%choice%"=="q" goto end
rem 为避免出现返回值为空或含空格而导致程序异常,需在变量外另加双引号
rem 注意,if语句需要双等于号
rem 如果输入的字符不是以上数字,将返回重新输入
echo 选择无效,请重新输入
echo.
goto cho
:clear
cls
mode con: cols=80 lines=18
color 70
echo.
echo 正在清理系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /s /q %windir%\temp\*.*
del /f /s /q %userprofile%\cookies\*.*
del /f /s /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\local settings\temporary internet files\*.*"
del /f /s /q "%userprofile%\local settings\temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清理系统垃圾完成! 请按任意键返回并选1继续...
pause >nul
goto start
:setfile
cls
mode con: cols=80 lines=18
color 70
echo.
rem 删除系统危险文件的访问权限,只留管理组成员
cscript.exe xcacls.vbs "%systemdrive%/boot.ini" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/boot.ini" /d guests:f /e
cscript.exe xcacls.vbs "%systemdrive%/autoexec.bat" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/autoexec.bat" /d guests:f /e
cscript.exe xcacls.vbs "%systemdrive%/program files/internet explorer/iexplore.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/program files/internet explorer/iexplore.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/net.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/net.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/net1.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/net1.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cmd.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cmd.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ftp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ftp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/scrrun.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/scrrun.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shell.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shell.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netstat.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netstat.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/secedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/secedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/gpresult.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/gpresult.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/gpupdate.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/gpupdate.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/at.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/at.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/attrib.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/attrib.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/format.com" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/format.com" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/logoff.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/logoff.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shutdown.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shutdown.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/telnet.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/telnet.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wscript.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/doskey.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/doskey.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/help.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/help.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ipconfig.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ipconfig.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nbtstat.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nbtstat.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/print.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/print.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/xcopy.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/xcopy.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/edit.com" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/edit.com" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regedt32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regedt32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/reg.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/reg.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/register.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/register.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/replace.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/replace.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nwscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nwscript.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/share.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/share.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ping.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ping.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ipsec6.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ipsec6.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netsh.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netsh.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/debug.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/debug.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/route.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/route.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/tracert.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/tracert.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/powercfg.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/powercfg.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nslookup.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nslookup.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/arp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/arp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/rsh.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/rsh.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netdde.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netdde.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/mshta.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/mshta.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/mountvol.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/mountvol.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/tftp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/tftp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/setx.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/setx.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/find.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/find.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/finger.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/finger.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/where.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/where.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regsvr32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regsvr32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cacls.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cacls.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/sc.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/sc.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shadow.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shadow.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/runas.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runas.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wshom.ocx" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wshom.ocx" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wshext.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wshext.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shell32.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shell32.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/zipfldr.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/zipfldr.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/pchealth/helpctr/binaries/msconfig.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/pchealth/helpctr/binaries/msconfig.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/notepad.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/notepad.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/regedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/regedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/winhelp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/winhelp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/winhlp32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/winhlp32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/notepad.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/notepad.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/edlin.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/edlin.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/posix.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/posix.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/atsvc.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/atsvc.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/qbasic.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/qbasic.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runonce.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runonce.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/syskey.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/syskey.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cscript.exe" /d guests:f /e
echo 给系统危险文件设置权限设定完毕! 请按任意键返回并选2继续...
pause >nul
goto start
:setfolder
cls
mode con: cols=80 lines=18
color 70
echo.
rem 删除c盘所有的everone权限
cd/
cscript.exe xcacls.vbs "%systemdrive%" /r "everyone" /e
cscript.exe xcacls.vbs "%systemroot%" /r "everyone" /e
@rem "cscript.exe xcacls.vbs "%systemroot%/registration" /r "everyone" /e " 这个不能去everyone权限
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/inetpub/aspnet_client" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /r "everyone" /e
rem 删除c盘所有的creator owner权限
cd/
cscript.exe xcacls.vbs "%systemroot%" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/program files/windowsupdate" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "creator owner" /e
rem 删除c盘所有的power users权限
cd/
cscript.exe xcacls.vbs "%systemroot%" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files/windowsupdate" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /r "power users" /e
rem 删除c盘所有的terminal server user权限
cd/
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "terminal server user" /e
rem 添加guests组拒绝权限[iusr_xxx或某个虚拟主机用户组禁止列目录,可有效防止fso类木马]
cd/
cscript.exe xcacls.vbs "%systemdrive%/program files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/repair" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv/metaback" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv/asp compiled templates" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework/v1.1.4322/temporary asp.net files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework/v2.0.50727/temporary asp.net files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/crypto/dss/achinekeys" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/crypto/rsa/machinekeys" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /d guests:1;1 /e
rem 删除c盘的所有的users的访问权限
cd/
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/addins" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/apppatch" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/connection wizard" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/debug" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/driver cache" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/help" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/java" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/msagent" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/mui" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/resources" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/security" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/tapi" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/twain_32" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/web" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/3com_dmi" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/administration" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/cache" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/catroot2" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/com" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/dhcp" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/drivers" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/export" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/icsxml" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/lls" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/logfiles" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/microsoftpassport" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/mui" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/oobe" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/shellext" /r "users" /e
@rem cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "users" /e 这里影响.net程序的正常运行,所以去掉!
rem 添加iis_wpg的访问权限
cscript.exe xcacls.vbs "%systemdrive%" /g iis_wpg:;b468 /e
cscript.exe xcacls.vbs "%systemroot%" /g iis_wpg:b1468;b1468 /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /g iis_wpg:r /e
cscript.exe xcacls.vbs "%systemroot%/downloaded program files" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/help" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/offline web pages" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/system32" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/tasks" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/web" /g iis_wpg:c /e
rem 添加iis_wpg的访问权限[装了macfee的软件专用]
rem cscript.exe xcacls.vbs "%systemdrive%/program files/network associates" /g iis_wpg:r /e
rem 添加users的访问权限
cscript.exe xcacls.vbs "%systemroot%/temp" /g everyone:m /e
cscript.exe xcacls.vbs "%systemdrive%/program files/common files" /g users:r /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework" /g users:b1468;b1468 /e
rem 禁止[列出文件夹 / 读取数据]此权限出现
rem -------------------------------------------
rem 添加users的访问权限[装了php的服务器专用]
cscript.exe xcacls.vbs "c:\php5" /g users:b468;b468 /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /g users:b468;b468 /e
rem -------------------------------------------
rem 删除d盘的所有的users的访问权限
cscript.exe xcacls.vbs "d:\" /r "users" /e
cscript.exe xcacls.vbs "d:\" /r "everyone" /e
cscript.exe xcacls.vbs "d:\" /r "creator owner" /e
rem 删除e盘的所有的users的访问权限
cscript.exe xcacls.vbs "e:\" /r "users" /e
cscript.exe xcacls.vbs "e:\" /r "everyone" /e
cscript.exe xcacls.vbs "e:\" /r "creator owner" /e
rem 删除f盘的所有的users的访问权限
cscript.exe xcacls.vbs "f:\" /r "users" /e
cscript.exe xcacls.vbs "f:\" /r "everyone" /e
cscript.exe xcacls.vbs "f:\" /r "creator owner" /e
rem 删除c盘windows下的所有的危险文件夹
attrib %systemroot%/web/printers -s -r -h
del %systemroot%\web\printers\*.* /s /q /f
rd %systemroot%\web\printers /s /q
attrib %systemroot%\help\iishelp -s -r -h
del %systemroot%\help\iishelp\*.* /s /q /f
rd %systemroot%\help\iishelp /s /q
attrib %systemroot%\system32\inetsrv\iisadmpwd -s -r -h
del %systemroot%\system32\inetsrv\iisadmpwd\*.* /s /q /f
rd %systemroot%\system32\inetsrv\iisadmpwd /s /q
echo 给系统危险文件夹设置权限设定完毕! 请按任意键返回并选3继续...
pause >nul
goto start
:service
cls
mode con: cols=80 lines=18
color 70
echo.
@rem application experience lookup service
@rem 在应用程序启动时为应用程序处理应用程序兼容性查找请求。
@rem 建议: 禁用
sc config aelookupsvc start= disabled
sc stop aelookupsvc
@rem background intelligent transfer service
@rem 在后台传输客户端和服务器之间的数据。如果禁用了 bits,一些功能,如 windows update,就无法正常运行。
@rem 建议: 禁用
sc config bits start= disabled
sc stop bits
@rem dhcp client
@rem 为此计算机注册并更新 ip 地址。如果此服务停止,计算机将不能接收动态 ip 地址和 dns 更新。如果此服务被禁用,所有明确依赖它的服务都将不能启动。
@rem 建议: 禁用
sc config dhcp start= disabled
sc stop dhcp
@rem network location awareness (nla)
@rem 收集并保存网络配置和位置信息,并在信息改动时通知应用程序。
@rem 建议: 禁用
sc config nla start= disabled
sc stop nla
@rem secondary logon
@rem 启用替换凭据下的启用进程。如果此服务被终止,此类型登录访问将不可用。如果此服务被禁用,任何依赖它的服务将无法启动。
@rem 建议: 禁用
sc config seclogon start= disabled
sc stop seclogon
@rem tcp/ip netbios helper
@rem 提供 tcp/ip (netbt) 服务上的 netbios 和网络上客户端的 netbios 名称解析的支持,从而使用户能够共享文件、打印和登录到网络。如果此服务被停用,这些功能可能不可用。如果此服务被禁用,任何依赖它的服务将无法启动。
@rem 建议: 禁用
sc config lmhosts start= disabled
sc stop lmhosts
@rem wireless configuration
@rem 启用 ieee 802.11 适配器的自动配置。如果此服务停止,自动配置将不可用。如果此服务被禁用,所有明确依赖它的服务都将不能启动。
@rem 建议: 禁用
sc config wzcsvc start= disabled
sc stop wzcsvc
@rem distributed transaction coordinator
@rem 协调跨多个数据库、消息队列、文件系统等资源管理器的事务。如果停止此服务,则不会发生这些事务。如果禁用此服务,显式依赖此服务的其他服务将无法启动。
@rem 建议: 禁用
sc config msdtc start= disabled
sc stop msdtc
@rem smart card (智慧卡)
@rem 微软:管理这个计算机所读取智能卡的存取。如果这个服务被停止,这个计算机将无法读取智能卡。如果这个服务被停用,任何明确依存于它的服务将无法启动。
@rem 补充: 如果你不使用 smart card ,那就可以关了
@rem 依存: plug and play
@rem 建议: 禁用
sc config scardsvr start= disabled
sc stop scardsvr
@rem internet connection firewall (icf) / internet connection sharing (ics)[for xp]
@rem 微软:为您的家用网络或小型办公室网络提供网络地址转译、寻址及名称解析服务和/或防止干扰的服务。
@rem 补充: 如果你不使用因特网联机共享(ics)或是 xp 内含的因特网联机防火墙(icf)你可以关掉
@rem 依存: application layer gateway service、network connections、network location awareness(nla)、remote access connection manager
@rem 建议: 禁用
sc config sharedaccess start= demand
sc stop sharedaccess
@rem windows image acquisition (wia) (windows影像取得程序)
@rem 微软: 为扫描仪和数字相机提供影像撷取服务。
@rem 补充:如果扫描仪和数字相机内部具有支持wia功能的话,那就可以直接看到图档,不需要其它的驱动程序,所以没有扫描仪和数字相机的使用者大可关了
@rem 依存:remote procedure call (rpc)
@rem 建议: 禁用
sc config stisvc start= disabled
sc stop stisvc
@rem ms software shadow copy provider[for xp]
@rem 微软:管理磁盘区阴影复制服务所取得的以软件为主的磁盘区阴影复制。如果停止这个服务,就无法管理以软件为主的磁盘区阴影复制。
@rem 补充: 如上所说的,用来备份的东西,如 ms backup 程序就需要这个服务
@rem 依存:remote procedure call (rpc)
@rem 建议: 禁用
sc config swprv start= disabled
sc stop swprv
title 常来网服务器高级安全设置器
:start
cls
color 1f
rem 使用color命令对控制台输出颜色进行更改
mode con: cols=32 lines=21
rem mode语句为设定窗体的宽和高
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
echo %date% %tm1%点%tm2%分%tm3%秒
echo ================================
echo 请选择要进行的操作,然后按回车
echo ───────────────
echo.
echo a. 一键搞定/全自动设置服务器
echo 0. 清理系统垃圾文件
echo 1. 给系统危险文件设置权限
echo 2. 给系统危险文件夹设置权限
echo 3. 系统服务优化
echo 4. 注册表危险组件删除
echo 5. 防ddos洪水攻击处理
echo 6. 导入常来网专用安全策略
echo 7. 重启iis使设置生效
echo 8. 刷新当前时间
echo 9. 锁定计算机
echo l. 注销当前用户
echo q. 退出安全设置器
echo.
:cho
set choice=
set /p choice=选择:
rem 设定变量"choice"为用户输入的字符
if not "%choice%"=="" set choice=%choice:~0,1%
rem 如果输入大于1位,取第1位,比如输入132,则返回值为1
echo.
if /i "%choice%"=="a" goto auto
if /i "%choice%"=="0" goto clear
if /i "%choice%"=="1" goto setfile
if /i "%choice%"=="2" goto setfolder
if /i "%choice%"=="3" goto service
if /i "%choice%"=="4" goto reg
if /i "%choice%"=="5" goto ddos
if /i "%choice%"=="6" goto ipsec
if /i "%choice%"=="7" goto restartiis
if /i "%choice%"=="8" goto start
if /i "%choice%"=="9" goto lock
if /i "%choice%"=="l" goto logoff
if /i "%choice%"=="q" goto end
rem 为避免出现返回值为空或含空格而导致程序异常,需在变量外另加双引号
rem 注意,if语句需要双等于号
rem 如果输入的字符不是以上数字,将返回重新输入
echo 选择无效,请重新输入
echo.
goto cho
:clear
cls
mode con: cols=80 lines=18
color 70
echo.
echo 正在清理系统垃圾文件,请稍等......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
del /f /s /q %windir%\temp\*.*
del /f /s /q %userprofile%\cookies\*.*
del /f /s /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\local settings\temporary internet files\*.*"
del /f /s /q "%userprofile%\local settings\temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清理系统垃圾完成! 请按任意键返回并选1继续...
pause >nul
goto start
:setfile
cls
mode con: cols=80 lines=18
color 70
echo.
rem 删除系统危险文件的访问权限,只留管理组成员
cscript.exe xcacls.vbs "%systemdrive%/boot.ini" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/boot.ini" /d guests:f /e
cscript.exe xcacls.vbs "%systemdrive%/autoexec.bat" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/autoexec.bat" /d guests:f /e
cscript.exe xcacls.vbs "%systemdrive%/program files/internet explorer/iexplore.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemdrive%/program files/internet explorer/iexplore.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/net.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/net.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/net1.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/net1.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cmd.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cmd.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ftp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ftp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/scrrun.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/scrrun.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shell.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shell.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netstat.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netstat.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/secedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/secedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/gpresult.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/gpresult.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/gpupdate.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/gpupdate.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/at.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/at.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/attrib.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/attrib.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/format.com" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/format.com" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/logoff.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/logoff.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shutdown.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shutdown.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/telnet.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/telnet.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wscript.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/doskey.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/doskey.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/help.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/help.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ipconfig.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ipconfig.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nbtstat.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nbtstat.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/print.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/print.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/xcopy.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/xcopy.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/edit.com" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/edit.com" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regedt32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regedt32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/reg.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/reg.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/register.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/register.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/replace.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/replace.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nwscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nwscript.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/share.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/share.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ping.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ping.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/ipsec6.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/ipsec6.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netsh.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netsh.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/debug.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/debug.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/route.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/route.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/tracert.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/tracert.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/powercfg.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/powercfg.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/nslookup.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/nslookup.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/arp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/arp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/rsh.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/rsh.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/netdde.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/netdde.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/mshta.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/mshta.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/mountvol.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/mountvol.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/tftp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/tftp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/setx.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/setx.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/find.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/find.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/finger.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/finger.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/where.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/where.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/regsvr32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/regsvr32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cacls.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cacls.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/sc.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/sc.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shadow.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shadow.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/runas.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runas.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wshom.ocx" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wshom.ocx" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/wshext.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/wshext.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/shell32.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/shell32.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/zipfldr.dll" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/zipfldr.dll" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/pchealth/helpctr/binaries/msconfig.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/pchealth/helpctr/binaries/msconfig.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/notepad.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/notepad.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/regedit.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/regedit.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/winhelp.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/winhelp.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/winhlp32.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/winhlp32.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/notepad.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/notepad.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/edlin.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/edlin.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/posix.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/posix.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/atsvc.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/atsvc.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/qbasic.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/qbasic.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runonce.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/runonce.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/syskey.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/syskey.exe" /d guests:f /e
cscript.exe xcacls.vbs "%systemroot%/system32/cscript.exe" /g administrators:f
cscript.exe xcacls.vbs "%systemroot%/system32/cscript.exe" /d guests:f /e
echo 给系统危险文件设置权限设定完毕! 请按任意键返回并选2继续...
pause >nul
goto start
:setfolder
cls
mode con: cols=80 lines=18
color 70
echo.
rem 删除c盘所有的everone权限
cd/
cscript.exe xcacls.vbs "%systemdrive%" /r "everyone" /e
cscript.exe xcacls.vbs "%systemroot%" /r "everyone" /e
@rem "cscript.exe xcacls.vbs "%systemroot%/registration" /r "everyone" /e " 这个不能去everyone权限
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/inetpub/aspnet_client" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /r "everyone" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /r "everyone" /e
rem 删除c盘所有的creator owner权限
cd/
cscript.exe xcacls.vbs "%systemroot%" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/program files/windowsupdate" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "creator owner" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "creator owner" /e
rem 删除c盘所有的power users权限
cd/
cscript.exe xcacls.vbs "%systemroot%" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "power users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files/windowsupdate" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /r "power users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /r "power users" /e
rem 删除c盘所有的terminal server user权限
cd/
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "terminal server user" /e
rem 添加guests组拒绝权限[iusr_xxx或某个虚拟主机用户组禁止列目录,可有效防止fso类木马]
cd/
cscript.exe xcacls.vbs "%systemdrive%/program files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/repair" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv/metaback" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/system32/inetsrv/asp compiled templates" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework/v1.1.4322/temporary asp.net files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework/v2.0.50727/temporary asp.net files" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/crypto/dss/achinekeys" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/crypto/rsa/machinekeys" /d guests:1;1 /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data/microsoft/html help" /d guests:1;1 /e
rem 删除c盘的所有的users的访问权限
cd/
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/documents" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings/all users/application data" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /r "users" /e
cscript.exe xcacls.vbs "%systemdrive%/documents and settings" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/addins" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/apppatch" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/connection wizard" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/debug" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/driver cache" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/help" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/java" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/msagent" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/mui" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/repair" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/resources" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/security" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/tapi" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/twain_32" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/web" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/3com_dmi" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/administration" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/cache" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/catroot2" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/com" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/config" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/dhcp" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/drivers" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/export" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/icsxml" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/lls" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/logfiles" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/microsoftpassport" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/mui" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/oobe" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32/shellext" /r "users" /e
@rem cscript.exe xcacls.vbs "%systemroot%/system32/wbem" /r "users" /e 这里影响.net程序的正常运行,所以去掉!
rem 添加iis_wpg的访问权限
cscript.exe xcacls.vbs "%systemdrive%" /g iis_wpg:;b468 /e
cscript.exe xcacls.vbs "%systemroot%" /g iis_wpg:b1468;b1468 /e
cscript.exe xcacls.vbs "%systemdrive%/program files" /g iis_wpg:r /e
cscript.exe xcacls.vbs "%systemroot%/downloaded program files" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/help" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/iis temporary compressed files" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/offline web pages" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/system32" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/tasks" /g iis_wpg:c /e
cscript.exe xcacls.vbs "%systemroot%/web" /g iis_wpg:c /e
rem 添加iis_wpg的访问权限[装了macfee的软件专用]
rem cscript.exe xcacls.vbs "%systemdrive%/program files/network associates" /g iis_wpg:r /e
rem 添加users的访问权限
cscript.exe xcacls.vbs "%systemroot%/temp" /g everyone:m /e
cscript.exe xcacls.vbs "%systemdrive%/program files/common files" /g users:r /e
cscript.exe xcacls.vbs "%systemroot%/microsoft.net/framework" /g users:b1468;b1468 /e
rem 禁止[列出文件夹 / 读取数据]此权限出现
rem -------------------------------------------
rem 添加users的访问权限[装了php的服务器专用]
cscript.exe xcacls.vbs "c:\php5" /g users:b468;b468 /e
cscript.exe xcacls.vbs "%systemroot%/system32" /r "users" /e
cscript.exe xcacls.vbs "%systemroot%/system32" /g users:b468;b468 /e
rem -------------------------------------------
rem 删除d盘的所有的users的访问权限
cscript.exe xcacls.vbs "d:\" /r "users" /e
cscript.exe xcacls.vbs "d:\" /r "everyone" /e
cscript.exe xcacls.vbs "d:\" /r "creator owner" /e
rem 删除e盘的所有的users的访问权限
cscript.exe xcacls.vbs "e:\" /r "users" /e
cscript.exe xcacls.vbs "e:\" /r "everyone" /e
cscript.exe xcacls.vbs "e:\" /r "creator owner" /e
rem 删除f盘的所有的users的访问权限
cscript.exe xcacls.vbs "f:\" /r "users" /e
cscript.exe xcacls.vbs "f:\" /r "everyone" /e
cscript.exe xcacls.vbs "f:\" /r "creator owner" /e
rem 删除c盘windows下的所有的危险文件夹
attrib %systemroot%/web/printers -s -r -h
del %systemroot%\web\printers\*.* /s /q /f
rd %systemroot%\web\printers /s /q
attrib %systemroot%\help\iishelp -s -r -h
del %systemroot%\help\iishelp\*.* /s /q /f
rd %systemroot%\help\iishelp /s /q
attrib %systemroot%\system32\inetsrv\iisadmpwd -s -r -h
del %systemroot%\system32\inetsrv\iisadmpwd\*.* /s /q /f
rd %systemroot%\system32\inetsrv\iisadmpwd /s /q
echo 给系统危险文件夹设置权限设定完毕! 请按任意键返回并选3继续...
pause >nul
goto start
:service
cls
mode con: cols=80 lines=18
color 70
echo.
@rem application experience lookup service
@rem 在应用程序启动时为应用程序处理应用程序兼容性查找请求。
@rem 建议: 禁用
sc config aelookupsvc start= disabled
sc stop aelookupsvc
@rem background intelligent transfer service
@rem 在后台传输客户端和服务器之间的数据。如果禁用了 bits,一些功能,如 windows update,就无法正常运行。
@rem 建议: 禁用
sc config bits start= disabled
sc stop bits
@rem dhcp client
@rem 为此计算机注册并更新 ip 地址。如果此服务停止,计算机将不能接收动态 ip 地址和 dns 更新。如果此服务被禁用,所有明确依赖它的服务都将不能启动。
@rem 建议: 禁用
sc config dhcp start= disabled
sc stop dhcp
@rem network location awareness (nla)
@rem 收集并保存网络配置和位置信息,并在信息改动时通知应用程序。
@rem 建议: 禁用
sc config nla start= disabled
sc stop nla
@rem secondary logon
@rem 启用替换凭据下的启用进程。如果此服务被终止,此类型登录访问将不可用。如果此服务被禁用,任何依赖它的服务将无法启动。
@rem 建议: 禁用
sc config seclogon start= disabled
sc stop seclogon
@rem tcp/ip netbios helper
@rem 提供 tcp/ip (netbt) 服务上的 netbios 和网络上客户端的 netbios 名称解析的支持,从而使用户能够共享文件、打印和登录到网络。如果此服务被停用,这些功能可能不可用。如果此服务被禁用,任何依赖它的服务将无法启动。
@rem 建议: 禁用
sc config lmhosts start= disabled
sc stop lmhosts
@rem wireless configuration
@rem 启用 ieee 802.11 适配器的自动配置。如果此服务停止,自动配置将不可用。如果此服务被禁用,所有明确依赖它的服务都将不能启动。
@rem 建议: 禁用
sc config wzcsvc start= disabled
sc stop wzcsvc
@rem distributed transaction coordinator
@rem 协调跨多个数据库、消息队列、文件系统等资源管理器的事务。如果停止此服务,则不会发生这些事务。如果禁用此服务,显式依赖此服务的其他服务将无法启动。
@rem 建议: 禁用
sc config msdtc start= disabled
sc stop msdtc
@rem smart card (智慧卡)
@rem 微软:管理这个计算机所读取智能卡的存取。如果这个服务被停止,这个计算机将无法读取智能卡。如果这个服务被停用,任何明确依存于它的服务将无法启动。
@rem 补充: 如果你不使用 smart card ,那就可以关了
@rem 依存: plug and play
@rem 建议: 禁用
sc config scardsvr start= disabled
sc stop scardsvr
@rem internet connection firewall (icf) / internet connection sharing (ics)[for xp]
@rem 微软:为您的家用网络或小型办公室网络提供网络地址转译、寻址及名称解析服务和/或防止干扰的服务。
@rem 补充: 如果你不使用因特网联机共享(ics)或是 xp 内含的因特网联机防火墙(icf)你可以关掉
@rem 依存: application layer gateway service、network connections、network location awareness(nla)、remote access connection manager
@rem 建议: 禁用
sc config sharedaccess start= demand
sc stop sharedaccess
@rem windows image acquisition (wia) (windows影像取得程序)
@rem 微软: 为扫描仪和数字相机提供影像撷取服务。
@rem 补充:如果扫描仪和数字相机内部具有支持wia功能的话,那就可以直接看到图档,不需要其它的驱动程序,所以没有扫描仪和数字相机的使用者大可关了
@rem 依存:remote procedure call (rpc)
@rem 建议: 禁用
sc config stisvc start= disabled
sc stop stisvc
@rem ms software shadow copy provider[for xp]
@rem 微软:管理磁盘区阴影复制服务所取得的以软件为主的磁盘区阴影复制。如果停止这个服务,就无法管理以软件为主的磁盘区阴影复制。
@rem 补充: 如上所说的,用来备份的东西,如 ms backup 程序就需要这个服务
@rem 依存:remote procedure call (rpc)
@rem 建议: 禁用
sc config swprv start= disabled
sc stop swprv
1
上一篇: jquery中怎么跳转页面
下一篇: c++中vector的用法详解