复制代码
- @ echo.
- @ echo.
- @ title Delshare2.0 by =亮子=
- @ color 1a
- @ echo 程序功能:
- @ echo 1、检测默认共享及IPC远程共享漏洞
- @ echo 2、自动删除默认共享并进行安全设置
- @ echo 3、对IPC远程共享进行安全设置
- @ echo.
- @ echo 欢迎访问“亮子空间” http://user.qzone.qq.com/378797716
- @ echo.
- @ echo 按任意键继续.....
- @ pause > nul
- @ cls
- @ echo off
- :start
- setlocal
- set ipc=0
- echo.
- echo -----------------------------
- echo 正在检测默认共享.....请稍等!
- echo -----------------------------
- echo.
- ping 127.0.0.1 -n 2 > nul
- net share | find "$" > dole.txt
- :checkshare
- findstr "默认共享" dole.txt > nul
- if errorlevel 1 (
- findstr /i "ipc" dole.txt > nul || goto end1
- set ipc=1
- echo ---------------------------------------------------------
- echo 您的计算机不存在默认共享,但是ipc远程共享处于开启状态!
- echo 正在检测ipc远程共享是否存在漏洞。。。。。。
- echo ---------------------------------------------------------
- if exist dole.txt del dole.txt
- goto :ipc_safecheck2
- )
- findstr /i "ipc" dole.txt > nul
- :delshare1
- if errorlevel 1 (
- echo -----------------------------------------------------------------
- for /F %%i in ( dole.txt ) do echo 您的系统存在如下默认共享 : %%i
- echo -----------------------------------------------------------------
- echo 准备删除共享 按任意键继续 !
- echo -----------------------------------------------------------------
- pause > nul
- for /F %%i in ( dole.txt ) do net share %%i /del
- echo 删除完毕!
- goto share_config
- )
- :delshare2
- if errorlevel 0 (
- set ipc=1
- echo -------------------------------------------------------------------
- for /F "eol=I" %%i in (dole.txt) do echo 您的系统存在如下默认共享 : %%i
- echo -------------------------------------------------------------------
- echo 准备删除共享 按任意键继续 !
- echo -----------------------------
- pause > nul
- for /F "eol=I" %%i in (dole.txt) do net share %%i /del
- echo 删除完毕
- )
- :share_config
- if exist dole.txt del dole.txt
- echo ----------------------------------------------------------------------
- echo 为了避免您的计算机在下次重新启动后自动开启默认共享,下面将对注册表
- echo 进行修改,禁止您的计算机开启默认共享。继续请按任意键;想自己手动删除
- echo 请关闭CMD窗口
- echo ----------------------------------------------------------------------
- pause > nul
- echo.
- echo 正在修改注册表.....
- ping 127.0.0.1 -n 2 >nul
- echo.
- echo Windows Registry Editor Version 5.00 > delshare.reg
- echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters] >> delshare.reg
- echo "AutoShareWks"=dword:0 >> delshare.reg
- echo "AutoShareServer"=dword:0 >> delshare.reg
- regedit /s delshare.reg
- del delshare.reg
- echo.
- echo -------------------
- echo 禁止默认共享成功!
- echo -------------------
- echo.
- echo.
- if %ipc%==0 goto end4
- :ipc_safecheck1
- echo -------------------------------------------
- echo 您的系统ipc远程共享处于开启状态!
- echo 正在检测ipc远程共享是否存在漏洞。。。。。。
- echo -------------------------------------------
- :ipc_safecheck2
- ping 127.0.0.1 -n 4 >nul
- echo.
- reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa > ipc.reg
- for /F " tokens=1,3 " %%i in ( ipc.reg ) do (
- if "%%i"=="restrictanonymous" set safe=%%j
- )
- del ipc.reg
- if not %safe%==0x0 goto end3
- :ipc_config
- echo ------------------------------------------------------------
- echo 您的计算机存在IPC$远程共享漏洞,下面将修改注册表进行安全设置!
- echo 继续请按任意键,想自己手动设置请关闭CMD窗口
- echo ------------------------------------------------------------
- pause > nul
- echo 正在修改注册表。。。。。。
- ping 127.0.0.1 -n 2 >nul
- echo.
- echo Windows Registry Editor Version 5.00 > jinzhiIPC.reg
- echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa] >> jinzhiIPC.reg
- echo "restrictanonymous"=dword:1 >> jinzhiIPC.reg
- regedit /s jinzhiIPC.reg
- del jinzhiIPC.reg
- echo ---------------
- echo 安全设置完毕!
- echo ---------------
- :end2
- echo.
- if exist dole.txt del dole.txt
- echo ===感谢使用AutoDelShare2.0 by 亮子===
- pause > nul
- exit
- :end1
- echo -------------------------------
- echo 您的系统很安全,不存在默认共享!
- echo -------------------------------
- echo.
- echo ===感谢使用AutoDelShare2.0 by 亮子===
- pause > nul
- exit
- :end3
- echo -------------------------------------
- echo 您的ipc配置很安全!按任意键退出程序!
- echo -------------------------------------
- echo.
- echo.
- echo ===感谢使用AutoDelShare2.0 by 亮子===
- pause > nul
- exit
- :end4
- echo --------------------------------------------
- echo 您的系统未开启ipc远程共享,按任意键退出程序!
- echo --------------------------------------------
- echo.
- echo.
- echo ===感谢使用AutoDelShare2.0 by 亮子===
- pause > nul
- exit
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |