a guest Oct 18th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- :: version 1.0
- echo off
- set PORT=8081
- set RULE_NAME="Open Port %PORT%"
- for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup google.com ^| find /v "Aliases"') do set my_dns_result=%%a
- echo Result from Your DNS Settings : %my_dns_result%
- netsh advfirewall firewall show rule name=%RULE_NAME% >nul
- if not ERRORLEVEL 1 (
- netsh advfirewall firewall set rule name=%RULE_NAME% new remoteip=%my_dns_result%
- echo Remote-IP updated.
- ) else (
- echo Rule %RULE_NAME% does not exist. Creating...
- netsh advfirewall firewall add rule name=%RULE_NAME% dir=in action=allow protocol=TCP localport=%PORT% remoteip=%my_dns_result%
RAW Paste Data