Skip to content

Instantly share code, notes, and snippets.

@vbezhenar
Created April 6, 2017 13:31
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save vbezhenar/3cecb75b79103fe782f097035f05633c to your computer and use it in GitHub Desktop.
Save vbezhenar/3cecb75b79103fe782f097035f05633c to your computer and use it in GitHub Desktop.
#!/bin/bash
address=https://ilo.mysite.com:34043
username=Administrator
password=********
session_key=$(
curl -fsS \
--insecure \
"$address/json/login_session" \
--data "{\"method\":\"login\",\"user_login\":\"$username\",\"password\":\"$password\"}" |
sed 's/.*"session_key":"\([a-f0-9]\{32\}\)".*/\1/'
) || {
echo "Error retrieving session key" >&2
exit 1
}
jnlp=$(mktemp)
cat >"$jnlp" <<eof
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="$address/" href="">
<information>
<title>Integrated Remote Console</title>
<vendor>HPE</vendor>
<offline-allowed></offline-allowed>
</information>
<security>
<all-permissions></all-permissions>
</security>
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"></j2se>
<jar href="$address/html/intgapp_228.jar" main="false" />
</resources>
<property name="deployment.trace.level property" value="basic"></property>
<applet-desc main-class="com.hp.ilo2.intgapp.intgapp" name="iLOJIRC" documentbase="$address/html/java_irc.html" width="1" height="1">
<param name="RCINFO1" value="$session_key"/>
<param name="RCINFOLANG" value="en"/>
<param name="INFO0" value="7AC3BDEBC9AC64E85734454B53BB73CE"/>
<param name="INFO1" value="17988"/>
<param name="INFO2" value="composite"/>
</applet-desc>
<update check="background"></update>
</jnlp>
eof
nohup sh -c "$HOME/Applications/jre-8/bin/javaws -wait $jnlp; rm $jnlp" >/dev/null 2>&1 &
@nuriyevn
Copy link

nuriyevn commented May 31, 2018

Hi,
java says unable to load https://192.168.1.103/html/intgapp_228.jar
another version of java says class not found com.hp.ilo2.intgapp.intgapp.class
which is obviously because of can not find that file.
The question that must that file be in that location? and where is that location physically?

in other words, what do you think is the problem in the end?

thanks in advance.

@zersh01
Copy link

zersh01 commented Jun 26, 2018

for some version iLO need only JRE-1.5.0-16
Thanx for script!

@karlsenpark
Copy link

karlsenpark commented Apr 23, 2020

This script is still working great.

My client triggered this script is macOS Catalina 10.15.4.
iLO4 version on my HP Microserver Gen8 is 2.73 Feb 11 2020. Just upgraded it when trying this.
Then I have made some minor modifications to fit this code into my machine.

First off, followed by new iLO-jirc.jnlp, I've replaced line 33.
<jar href="$address/html/intgapp4_231.jar" main="false" />

Then, based on the folder, where javaws is located, I've updated line 47:
nohup sh -c "/usr/bin/javaws -wait $jnlp; rm $jnlp" >/dev/null 2>&1 &

Boom. all sorted.
Thanks for sharing this awesome code vbezhenar!

@mfaerevaag
Copy link

Awesome, thanks!

Also had to change the address of the .jar file, which I found through the making the following request manually:

curl -v --insecure "$address/html/java_irc.html?sessionKey=$session_key&lang=en"

@kiler129
Copy link

@karlsenpark, @mfaerevaag: I create a slightly more user-friendly version and doesn't hardcode params. Should work with both iLO 3 & 4.

https://gist.github.com/kiler129/904fe463b008e740315c4abaf33c68af

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment