Skip to content

Instantly share code, notes, and snippets.

@wuxiangzhou2010
Created December 7, 2019 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuxiangzhou2010/11c2d7848b4741b8887fc88bebe9277b to your computer and use it in GitHub Desktop.
Save wuxiangzhou2010/11c2d7848b4741b8887fc88bebe9277b to your computer and use it in GitHub Desktop.
open upnp port using miniupnc
#!/bin/bash
ports=(65000 # web
65001 # web
65005 # transmission
32400 # plex
6690 #cloud station
)
protocols=(tcp udp)
cmd="./upnpc-static"
myip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | grep -v "169.")
for port in "${ports[@]}"
do
echo $port
for protocol in "${protocols[@]}"
do
echo $protocol
$cmd -d $port $protocol
$cmd -a $myip $port $port $protocol
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment