#!/bin/sh if [ "$#" -ne 3 ]; then echo "Usage: $0 [ip address] [user name] [password]" exit 1 fi IP=$1 IPMI_USER=$2 IPMI_PASS=$3 OUTFILE=/tmp/${IP}_jviewer.jnlp COOKIE=$(curl "http://${IP}/rpc/WEBSES/create.asp" --silent --raw --data "WEBVAR_USERNAME=${IPMI_USER}&WEBVAR_PASSWORD=${IPMI_PASS}" -o - | perl -ne "m/\'SESSION\_COOKIE\'\s\:\s\'(.*?)\'/sg ? print \$1 : ();") TOKEN=$(curl "http://${IP}/rpc/getsessiontoken.asp" -H "Cookie: SessionCookie=${COOKIE}" --silent --raw -o - | perl -ne "m/\'STOKEN\'\s\:\s\'(.*?)\'/sg ? print \$1 : ();") ( cat < JViewer American Megatrends, Inc. JViewer Console Redirection Application JViewer Console Redirection Application JViewer enables a user to view the video display of managed server via KVM. It also enables the user to redirect his local keyboard, mouse for managing the server remotely. ${IP} 7578 ${TOKEN} ${COOKIE} EOF ) > $OUTFILE javaws -nosecurity -jnlp $OUTFILE >/dev/null & disown && sleep 1 && rm -f $OUTFILE