永恒之蓝 端口关闭与开启 bat脚本

@echo off
color 0A
title 您正在使用一键关闭危险端口和服务
echo 您正在使用一键关闭危险端口和服务
echo “按任意键继续”
pause
echo “正在帮您关闭这些危险端口,请稍等”
echo “正在开启防火墙服务”
net start MpsSvc
echo ”正在帮您开启防火墙自启动“
sc config MpsSvc start= auto
echo ”正在启用防火墙“
netsh advfirewall set allprofiles state on
echo “正在帮您屏蔽端口,请稍后….”
netsh advfirewall firewall add rule name=”deny udp 135 ” dir=in protocol=udp localport=135 action=block
pause
netsh advfirewall firewall add rule name=”deny tcp 135” dir=in protocol=tcp localport=135 action=block
netsh advfirewall firewall add rule name=”deny udp 137 ” dir=in protocol=udp localport=137 action=block
netsh advfirewall firewall add rule name=”deny tcp 137” dir=in protocol=tcp localport=137 action=block
netsh advfirewall firewall add rule name=”deny udp 138” dir=in protocol=udp localport=138 action=block
netsh advfirewall firewall add rule name=”deny tcp 138” dir=in protocol=tcp localport=138 action=block
netsh advfirewall firewall add rule name=”deny udp 139” dir=in protocol=udp localport=139 action=block
netsh advfirewall firewall add rule name=”deny tcp 139” dir=in protocol=tcp localport=139 action=block
netsh advfirewall firewall add rule name=”deny udp 445” dir=in protocol=udp localport=445 action=block
netsh advfirewall firewall add rule name=”deny tcp 445” dir=in protocol=tcp localport=445 action=block
echo “恭喜您,危险端口已经屏蔽成功”
echo “下面将帮您关闭勒索病毒相关的危险服务,请稍后….”
echo ”正在关闭Computer Browser的服务“
net stop Browser
echo ”正在关闭共享服务的服务“
net stop LanmanServer
echo ”TCP/IP NetBIOS Helper共享服务“
net stop lmhosts
echo ”正在关闭Workstation浏览服务“
net stop LanmanWorkstation
echo “恭喜您,危险端口已经关闭”
echo “按任意键退出 ”
pause

@echo off
color 0A
title 正在开启之前关闭的危险端口和服务
echo title 您正在使用一键关闭危险端口和服务
echo “按任意键继续”
pause
echo “正在帮您开启之前关闭的危险端口,请稍等”
echo “正在开启防火墙服务”
net start MpsSvc
echo ”开启防火墙自启动“
sc config MpsSvc start= auto
echo ”启用防火墙“
netsh advfirewall set allprofiles state on
echo “正在帮您解禁勒索病毒相关的防火墙规则”
netsh advfirewall firewall delete rule name=”deny udp 135 ”
netsh advfirewall firewall delete rule name=”deny tcp 135”
netsh advfirewall firewall delete rule name=”deny udp 137 ”
netsh advfirewall firewall delete rule name=”deny tcp 137”
netsh advfirewall firewall delete rule name=”deny udp 138”
netsh advfirewall firewall delete rule name=”deny tcp 138”
netsh advfirewall firewall delete rule name=”deny udp 139”
netsh advfirewall firewall delete rule name=”deny tcp 139”
netsh advfirewall firewall delete rule name=”deny udp 445”
netsh advfirewall firewall delete rule name=”deny tcp 445”
echo “恭喜您,共享服务的端口已经打开”
echo “下面将帮您开启共享的服务”
echo ”正在开启Computer Browser的服务“
net start Browser
echo ”正在开启共享服务的服务“
net start LanmanServer
echo ”TCP/IP NetBIOS Helper共享服务“
net start lmhosts
echo ”正在开启Workstation浏览服务“
net start LanmanWorkstation
echo “恭喜您,相关服务已经全部启动”
echo “按任意键退出”
echo 按任意键退出
pause>nul

你可能感兴趣的:(windows,shell)