• netsh advfirewall firewall


    参考这个项目 https://github.com/xkevas24/ZhengHuo

    1.netsh advfirewall firewall show rule name="ZhengHuo"
    2.netsh advfirewall firewall add rule name="ZhengHuo" dir=out program="Hearthstone.exe" action=block enable=no

    需要注意的是,add rule会重复添加

    3.netsh advfirewall firewall delete rule name="ZhengHuo"

    Deleted 5 rule(s).
    Ok.

    How to use the "netsh advfirewall firewall" context instead of the "netsh firewall" context to control Windows Firewall behavior in Windows Server 2008 and in Windows Vista

    The netsh advfirewall firewall command-line context is available in Windows Server 2008 and in Windows Vista. This context provides the functionality for controlling Windows Firewall behavior that was provided by the netsh firewall context in earlier Windows operating systems.

    This context also provides functionality for more precise control of firewall rules. These rules include the following per-profile settings:

    • Domain
    • Private
    • Public

    The netsh firewall command-line context might be deprecated in a future version of the Windows operating system. We recommend that you use the netsh advfirewall firewall context to control firewall behavior.

    Note The netsh firewall command line is not recommended for use in Windows Vista.

    This article describes how to use the netsh advfirewall firewall context instead of the netsh firewall context to control Windows Firewall behavior in Windows Server 2008 and in Windows Vista. 

     More Information


    Important If you are a member of the Administrators group, and User Account Control is enabled on your computer, run the commands from a command prompt with elevated permissions. To start a command prompt with elevated permissions, find the icon or Start menu entry that you use to start a command prompt session, right-click it, and then click Run as administrator.

    Some examples of frequently used commands are provided in the following tables. You can use these examples to help you migrate from the older netsh firewall context to the new netsh advfirewall firewall context.

    Additionally, the netsh advfirewall commands that you can use to obtain detailed inline help are provided. 

    Example 1: Enable a program

    netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:MyAppMyApp.exe" enable=yes

    netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:MyAppMyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain

    Run the following commands:
    netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:MyAppMyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain

    netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:MyAppMyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=private

    For more information about how to add firewall rules, run the following command:

    netsh advfirewall firewall add rule ?

    Example 3: Delete enabled programs or ports

    netsh advfirewall firewall delete rule name=rule name program="C:MyAppMyApp.exe"

    netsh advfirewall firewall delete rule name=rule name protocol=udp localport=500

    For more information about how to delete firewall rules, run the following command:

    netsh advfirewall firewall delete rule ?

    Example 5: Set logging

    Run the following commands:

    netsh advfirewall set currentprofile logging filename %systemroot%system32LogFilesFirewallpfirewall.log

    netsh advfirewall set currentprofile logging maxfilesize 4096
    netsh advfirewall set currentprofile logging droppedconnections enable

    netsh advfirewall set currentprofile logging allowedconnections enable

    For more information, run the following command:

    netsh advfirewall set currentprofile ?

    If you want to set logging for a particular profile, use one of the following options instead of the "currentprofile" option:

      • Domainprofile
      • Privateprofile
      • Publicprofile 
  • 相关阅读:
    Data Mining --- Information theory:熵/条件熵/互信息(信息增益)/交叉熵(相对熵/KL距离)
    Data Minig --- Decision Tree & ID3 & C4.5 & Gini Index
    Machine Learning --- Boosting & AdaBoost & Bootstrap
    Machine Learning --- Logistic Regression
    jpa动态创建EntityManagerFactory 态设置数据库连接 EntityManager;
    Spring+jpa+access
    关于JDBC 连接Access 数据库
    关于JPA封装数据库数据到实体不调用属性的get和set的方法解决办法
    JDBC和JPA调用储存过程 接收存储过程有返回值
    springMVC+JAP整合彻底摆脱persistence.xml配置文件
  • 原文地址:https://www.cnblogs.com/chucklu/p/13410874.html
Copyright © 2020-2023  润新知