命令添加IP地址和屏蔽端口的批处理

将下面的文件存储为.bat的文件,修改内容后运行即可完成相关操作,注意去掉注释的中文部分:

@echo off
IF EXIST C:ipdone.txt exit
timeout 60
for /f "tokens=2 delims==" %%F in ('wmic nic where "NetConnectionStatus=2 and AdapterTypeId=0" get NetConnectionID /format:list') do set interfaceName=%%F
netsh interface ip set address "%interfaceName%" static addr=192.1168.158.130 mask=255.255.255.248 gateway=192.168.158.129 1
netsh interface ip set dns name="%interfaceName%" source=static addr=8.8.8.8 register=primary
net user Administrator Fb1evlc7a9nf! “修改用户名和密码”
netsh interface ipv4 set dns "%interfaceName%" static 8.8.8.8
netsh interface ipv4 set dns "%interfaceName%" 69.30.209.16 index=2
netsh interface ipv set dns "%interfaceName%" static 8.8.4.4
netsh interface ipv set dns "%interfaceName%" 69.30.209.16 index=2

netsh advfirewall set allprofile state on
netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=445 name="Block_TCP-445"
netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=139 name="Block_TCP-139"
netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=135 name="Block_TCP-135"
netsh advfirewall firewall add rule dir=in action=block protocol=TCP localport=49154 name="Block_TCP-49154"
netsh advfirewall firewall set rule name="DFS Management (DCOM-In)" new enable=no
netsh advfirewall firewall set rule name="DFS Management (SMB-In)" new enable=no
netsh advfirewall firewall set rule name="DFS Management (TCP-In)" new enable=no
netsh advfirewall firewall set rule name="DFS Management (WMI-In)" new enable=no

   

黑公网安备 23010302001330 黑ICP备16006342号

Copyright © 2005 淘主机 Taohost.com , All Rights Reserved

淘主机供应商:WHMCS管理系统金盾防火墙阿里云VEDNS 安全软件推荐: 服务器安全狗

 
QQ在线咨询
售前咨询热线
021-80392966
售后服务热线
021-80392966