Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  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 google.com ^| find /v "Aliases"') do set my_dns_result=%%a
  7.  
  8. echo Result from Your DNS Settings : %my_dns_result%
  9.  
  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. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement