Win7安全关闭139、135、445等端口的方法
1、在“开始”菜单选择“运行”,输入“gpedit.msc”后回车,打开本地组策略编辑器。依次展开“计算机配置---windows设置---安全设置---ip安全策略,在 本地计算机”;

2、以关闭135端口为例(其他端口操作相同):
在本地组策略编辑器右边空白处 右键单击鼠标,选择“创建IP安全策略”,弹出IP安全策略向导对话框,单击下一步;在出现的对话框中的名称处写“关闭端口”(可随意填写),点击下一步;对话框中的“激活默认响应规则”选项不要勾选,然后单击下一步;勾选“编辑属性”,单击完成。

3、在出现的“关闭端口 属性”对话框中,选择“规则”选项卡,去掉“使用 添加向导”前边的勾后,单击“添加”按钮;

4、在弹出的“新规则 属性”对话框中,选择“IP筛选器列表”选项卡,单击左下角的“添加”

5、出现添加对话框,名称出填“封端口”(可随意填写),去掉“使用 添加向导”前边的勾后,单击右边的“添加”按钮

6、在出现的“IP筛选器 属性”对话框中,选择“地址”选项卡,“源地址”选择“任何”,“目标地址”选择“我的IP地址”; 选择“协议”选项卡,各项设置如图片中所示。设置好后点击“确定”;

7、返回到“ip筛选器列表”,点击“确定”。返回到“新规则 属性”对话框;

8、在ip筛选器列表中选择刚才添加的“封端口”,然后选择“筛选器操作”选项卡,,去掉“使用 添加向导”前面的勾,单击“添加”按钮;

9、在“筛选器操作 属性”中,选择“安全方法”选项卡,选择“阻止”选项;在“常规”选项卡中,对该操作命名,点确定;

10、选中刚才新建的“新建1”,单击关闭,返回到“关闭端口 属性“对话框,确认“IP安全规则”中 封端口 规则被选中后,单击 确定;

11、在组策略编辑器中,可以看到刚才新建的“关闭端口”规则,选中它并单击鼠标右键,选择“分配”选项,使该规则开始应用!
到此,大功告成,同样的方法你可以添加对任何你想限制访问的端口的规则

注意事项
注意:IPSEC Services这个服务千万不能停止哦,停止了ip策略就失去作用了。通过Windows组策略来一次性关闭所有想要关闭的危险端口。