|
本帖最后由 comzhongwy 于 2016-12-24 14:02 编辑
Windows防火墙其实是个好东西,但是好像很少有人好好利用起来,这次简单说说利用Windows防火墙阻止程序联网。
1.先来看个图,这是我安装的Click-to-Run-Office2016,一打开word、Excel、PPT,表面上看不出来,实际上他们都在后台联网上传你的使用信息,对于很多人,根本不需要它们联网,再比如说,很多人装AutoCAD的时候,说明里都是断网激活,挺麻烦的,而且激活后,它还是会联网上传,下面我们看看如何利用Windows防火墙。
2.看下高级设置,这就是我们要配置的地方了,我不详细说了,简单说,入站规则设置远程主机连接本机的规则,出站规则设置本机连接远程主机的规则,也就是说,要阻止本地程序联网,只要在出站规则里添加就好了。
3.批处理添加禁止程序联网,这是我对office和AutoCAD程序,以及Windows Update服务的,这样,禁止联网什么的,就非常方便了,不只是对程序,还可以对服务、端口进行设置,我就说到这里了。
- @echo off
- setlocal ENABLEDELAYEDEXPANSION
- mode con: cols=65 lines=25
- color 0a
- rem 批处理获取管理员权限
- :-------------------------------------
- %1 mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&&exit /b
- CD /D "%~dp0"
- :-------------------------------------
- ::添加阻止程序出站规则
- (
- echo "Office_OfficeClickToRun","%ProgramFiles%\Common Files\microsoft shared\ClickToRun\OfficeClickToRun.exe"
- echo "Office_msoia","%ProgramFiles%\Microsoft Office\root\Office16\msoia.exe"
- echo "Office_WINWORD","%ProgramFiles%\Microsoft Office\root\Office16\WINWORD.EXE"
- echo "Office_EXCEL","%ProgramFiles%\Microsoft Office\root\Office16\EXCEL.EXE"
- echo "Office_POWERPNT","%ProgramFiles%\Microsoft Office\root\Office16\POWERPNT.EXE"
- echo "Office_VISIO","%ProgramFiles%\Microsoft Office\root\Office16\VISIO.EXE"
- echo "Office_WINPROJ","%ProgramFiles%\Microsoft Office\root\Office16\WINPROJ.EXE"
- echo "Office_MSPUB","%ProgramFiles%\Microsoft Office\root\Office16\MSPUB.EXE"
- echo "Office_MSACCESS","%ProgramFiles%\Microsoft Office\root\Office16\MSACCESS.EXE"
- echo "AutoCAD_LMU","%ProgramFiles%\Common Files\Autodesk Shared\AdLM\R11\LMU.exe"
- echo "AutoCAD_DADispatcherService","C:\Program Files\Autodesk\AutoCAD 2016\DADispatcherService.exe"
- echo "AutoCAD_acad","C:\Program Files\Autodesk\AutoCAD 2016\acad.exe"
- )>list.txt
- FOR /F "usebackq tokens=1,2 delims=," %%i in ( list.txt ) do (
- netsh advfirewall firewall del rule name="%%i">nul 2>nul
- netsh advfirewall firewall add rule name="%%i" program=%%j action=block dir=out>nul
- echo 阻止%%i程序出站规则已添加
- )
- del list.txt
- ::添加阻止服务出站规则
- (
- echo "Windows Update","wuauserv"
- )>list.txt
- set svchost_exe="%%systemroot%%\system32\svchost.exe"
- FOR /F "usebackq tokens=1,2 delims=," %%i in ( list.txt ) do (
- netsh advfirewall firewall del rule name=%%i>nul 2>nul
- netsh advfirewall firewall add rule name=%%i service=%%j action=block dir=out program="%svchost_exe%">nul
- echo 阻止%%i服务出站规则已添加
- )
- del list.txt
- pause
复制代码
6.这下,世界清静了!
|
评分
-
查看全部评分
|