Created
November 14, 2019 15:45
-
-
Save dalmosantos/f82bc69b70927f8ccb86b5887d04bda6 to your computer and use it in GitHub Desktop.
view.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pass="secret" | |
# VncViewer jars are found here: https://code.google.com/archive/p/vncthumbnailviewer/downloads | |
viewer_jar="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/vncthumbnailviewer/VncThumbnailViewer%201.4.2.jar" | |
if [ ! -f ./viewer.jar ]; then | |
echo "Viewer.jar not found - downloading!" | |
curl $viewer_jar -o viewer.jar | |
fi | |
# prompt for host ip if not provided as a 1st parameter | |
if [ -z "${1}" ]; then | |
printf 'Enter host ip: ' | |
read -r host | |
else | |
host=${1} | |
fi | |
# set default port range | |
startPort=9001 | |
endPort=9020 | |
# set port range using 2nd param if available, param is colon delimited, ex 1:20 | |
if [ ! -z "${2}" ]; then | |
IFS=':' read -ra portRange <<< "${2}" | |
startPort=${portRange[0]} | |
if [ ${#portRange[*]} != 2 ]; then | |
endPort=${portRange[0]} | |
else | |
endPort=${portRange[1]} | |
fi | |
fi | |
for port in `seq ${startPort} ${endPort}`; | |
do | |
params="$params HOST $host PORT $port PASSWORD $pass" | |
done | |
java -jar viewer.jar $params | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment