|
分程序来如何?VBS类似于:
- debug ("禁止联网/禁止连接网络的程序.")
- firewall_dict.add "Office_OfficeClickToRun","%ProgramFiles%\Common Files\microsoft shared\ClickToRun\OfficeClickToRun.exe"
- firewall_dict.add "Office_msoia","%ProgramFiles%\Microsoft Office\root\Office16\msoia.exe"
- firewall_dict.add "Office_WINWORD","%ProgramFiles%\Microsoft Office\root\Office16\WINWORD.EXE"
- firewall_dict.add "Office_EXCEL","%ProgramFiles%\Microsoft Office\root\Office16\EXCEL.EXE"
- firewall_dict.add "Office_POWERPNT","%ProgramFiles%\Microsoft Office\root\Office16\POWERPNT.EXE"
- firewall_dict.add "Office_VISIO","%ProgramFiles%\Microsoft Office\root\Office16\VISIO.EXE"
- firewall_dict.add "Office_WINPROJ","%ProgramFiles%\Microsoft Office\root\Office16\WINPROJ.EXE"
- firewall_dict.add "Office_MSPUB","%ProgramFiles%\Microsoft Office\root\Office16\MSPUB.EXE"
- firewall_dict.add "Office_MSACCESS","%ProgramFiles%\Microsoft Office\root\Office16\MSACCESS.EXE"
- firewall_dict.add "AutoCAD_LMU","%ProgramFiles%\Common Files\Autodesk Shared\AdLM\R11\LMU.exe"
- firewall_dict.add "AutoCAD_DADispatcherService","C:\Program Files\Autodesk\AutoCAD 2016\DADispatcherService.exe"
- firewall_dict.add "AutoCAD_acad","C:\Program Files\Autodesk\AutoCAD 2016\acad.exe"
- firewall_dict.add "Windows Update","wuauserv"
- For Each i in firewall_dict
- firewall_dict(i)=WshShell.ExpandEnvironmentStrings(firewall_dict(i))
- 'netsh advfirewall firewall del rule name=i
- tmp1=" del rule name=" & chr(34) & i & chr(34)
- 'netsh advfirewall firewall add rule name=i program=i action=block dir=out
- tmp2=" add rule name=" & chr(34) & i & chr(34) & " program=" & chr(34) & firewall_dict(i) & chr(34) & " action=block dir=out"
- 'netsh advfirewall firewall add rule name=i service=%%j action=block dir=out program="%svchost_exe%"
- tmp3=" add rule name=" & chr(34) & i & chr(34) & " service=" & chr(34) & firewall_dict(i) & chr(34) & " action=block dir=out program=" & chr(34) & windir & "\system32\svchost.exe" & chr(34)
- WshShell.Run "netsh advfirewall firewall " & tmp1 ,0,true '删除之前规则
- WshShell.Run "netsh advfirewall firewall " & tmp2 ,0,true '建立新规则
- if i="Windows Update" then WshShell.Run "netsh advfirewall firewall " & tmp3 ,0,0 '添加阻止服务出站规则
- next
复制代码 |
|