Skip to content

Instantly share code, notes, and snippets.

@dalehamel
Created June 11, 2016 02:19
Show Gist options
  • Save dalehamel/a5fa04c918b67f36aa75bb7a913416bd to your computer and use it in GitHub Desktop.
Save dalehamel/a5fa04c918b67f36aa75bb7a913416bd to your computer and use it in GitHub Desktop.
Supermicro iKVM preview scraper
USER=
PASS=
IPMI_HOST=
SESSION_ID=$(curl -d "name=${USER}&pwd=${PASS}" "https://${IPMI_HOST}/cgi/login.cgi" --silent --insecure -i | awk '/Set-Cookie/ && NR != 2 { print $2 }')
ipmi_scrape()
{
curl -H "Cookie: ${SESSION_ID}" --insecure "https://${IPMI_HOST}/$1"
}
time=$(ruby -e 'require "time"; require "uri"; puts URI.escape Time.now.httpdate.gsub(",", "")')
ipmi_scrape "/cgi/CapturePreview.cgi?IKVM_PREVIEW_XML=(0,0)&time_stamp=$time"
ipmi_scrape "/cgi/url_redirect.cgi?url_name=Snapshot&url_type=img&time_stamp=$time" > scrape.bmp
@dalehamel
Copy link
Author

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