Skip to content

Instantly share code, notes, and snippets.

@me-vlad
Created January 23, 2020 15:23
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 me-vlad/c50cef0078e6bfcab3dd81203e823176 to your computer and use it in GitHub Desktop.
Save me-vlad/c50cef0078e6bfcab3dd81203e823176 to your computer and use it in GitHub Desktop.
Open MegaRAC IPMI Java IPKVM from CLI
#!/bin/sh
# Script opens Java based IPKVM session on the old AMI MegaRAC IPMI.
# You need javaws (part of the Java JRE) installed.
if [ $# -ne 3 ]; then
echo -e "\n\tUsage:\n\t${0##*/} IPMI_HOST USER PASSWORD\n" && exit 1
fi
HOST="$1"
USER="$2"
PASS="$3"
JNLP="${PWD}/${HOST}_jviewer.jnlp"
COOKIE=$(curl -s -d "WEBVAR_USERNAME=${USER}&WEBVAR_PASSWORD=${PASS}" "http://${HOST}/rpc/WEBSES/create.asp" 2> /dev/null | grep "SESSION_COOKIE" | cut -d "'" -f 4)
curl -s -b Cookie=SessionCookie="${COOKIE}" http://$HOST/Java/jviewer.jnlp -o "$JNLP"
nohup javaws -Xnosplash "$JNLP" > /dev/null 2>&1 && sleep 1 && rm "$JNLP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment