a guest Oct 18th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. :: version 1.0
  2. echo off
  3. set PORT=8081
  4. set RULE_NAME="Open Port %PORT%"
  5. cls
  6. for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup ^| find /v "Aliases"') do set my_dns_result=%%a
  8. echo Result from Your DNS Settings : %my_dns_result%
  10. netsh advfirewall firewall show rule name=%RULE_NAME% >nul
  11. if not ERRORLEVEL 1 (
  12.     netsh advfirewall firewall set rule name=%RULE_NAME% new remoteip=%my_dns_result%
  13.     echo Remote-IP updated.
  14. ) else (
  15.     echo Rule %RULE_NAME% does not exist. Creating...
  16.     netsh advfirewall firewall add rule name=%RULE_NAME% dir=in action=allow protocol=TCP localport=%PORT% remoteip=%my_dns_result%
  17. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand