From ef093d815d01550ada7224085608774d5cd7a9bd Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 21 Jul 2020 17:33:19 +0200 Subject: [PATCH] drac: Open virtual console on iDRAC6. --- Makefile | 28 ++++++------ drac/drac | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+), 14 deletions(-) create mode 100755 drac/drac diff --git a/Makefile b/Makefile index e012e58..06a7b79 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,19 @@ -CMD = blink 2grep 2search burncpu duplicate-packets em encdir field \ - forever fxkill G gitnext gitundo goodpasswd histogram mtrr \ - mirrorpdf neno off parsort pdfman pidcmd pidtree plotpipe \ - puniq ramusage rand rclean rina rn rrm seekmaniac shython \ - sound-reload splitvideo stdout swapout T timestamp tracefile \ - transpose upsidedown vid w4it-for-port-open whitehash \ - wifi-reload wssh ytv yyyymmdd +CMD = blink 2grep 2search burncpu drac duplicate-packets em encdir \ + field forever fxkill G gitnext gitundo goodpasswd histogram \ + mtrr mirrorpdf neno off parsort pdfman pidcmd pidtree \ + plotpipe puniq ramusage rand rclean rina rn rrm seekmaniac \ + shython sound-reload splitvideo stdout swapout T timestamp \ + tracefile transpose upsidedown vid w4it-for-port-open \ + whitehash wifi-reload wssh ytv yyyymmdd all: blink/blink.1 2search/2grep.1 2search/2search.1 \ - burncpu/burncpu.1 encdir/encdir.1 field/field.1 G/G.1 \ - gitnext/gitnext.1 gitundo/gitundo.1 goodpasswd/goodpasswd.1 \ - histogram/histogram.1 mirrorpdf/mirrorpdf.1 neno/neno.1 \ - off/off.1 parsort/parsort.1 pdfman/pdfman.1 pidcmd/pidcmd.1 \ - pidtree/pidtree.1 plotpipe/plotpipe.1 puniq/puniq.1 \ - rand/rand.1 rina/rina.1 rn/rn.1 rrm/rrm.1 \ - seekmaniac/seekmaniac.1 shython/shython.1 \ + burncpu/burncpu.1 drac/drac.1 encdir/encdir.1 field/field.1 \ + G/G.1 gitnext/gitnext.1 gitundo/gitundo.1 \ + goodpasswd/goodpasswd.1 histogram/histogram.1 \ + mirrorpdf/mirrorpdf.1 neno/neno.1 off/off.1 parsort/parsort.1 \ + pdfman/pdfman.1 pidcmd/pidcmd.1 pidtree/pidtree.1 \ + plotpipe/plotpipe.1 puniq/puniq.1 rand/rand.1 rina/rina.1 \ + rn/rn.1 rrm/rrm.1 seekmaniac/seekmaniac.1 shython/shython.1 \ sound-reload/sound-reload.1 splitvideo/splitvideo.1 \ stdout/stdout.1 timestamp/timestamp.1 tracefile/tracefile.1 \ transpose/transpose.1 T/T.1 upsidedown/upsidedown.1 vid/vid.1 \ diff --git a/drac/drac b/drac/drac new file mode 100755 index 0000000..313a44e --- /dev/null +++ b/drac/drac @@ -0,0 +1,132 @@ +#!/bin/bash +: <<=cut +=pod + +=head1 NAME + +drac - Connect to iDRAC6 virtual console + + +=head1 SYNOPSIS + +B I + +B [[I[:I]@]I] + + +=head1 DESCRIPTION + +B downloads the .jar file from the iDRAC6 and runs it with Java. + + +=head1 OPTIONS + +=over 12 + +=item I + +I defaults to $DRAC_HOST, which defaults to 'drac'. + + +=item I + +I defaults to $DRAC_USER, which defaults to 'root'. + +=item I + +I defaults to $DRAC_PASSWD, which defaults to calvin. + + +=back + + +=head1 EXAMPLES + +Connect to the drac server 'drac' using 'root/calvin': + + drac + +Connect to the drac server 'mydrac' using 'myroot/joe': + + drac myroot:joe@mydrac + +Connect to the drac server 'mydrac' using 'myroot/joe': + + DRAC_HOST=mydrac + DRAC_USER=myroot + DRAC_PASSWD=joe + drac + + +=head1 AUTHOR + +Copyright (C) 2020 Ole Tange, +http://ole.tange.dk and Free Software Foundation, Inc. + + +=head1 LICENSE + +Copyright (C) 2012 Free Software Foundation, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +at your option any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +=head1 DEPENDENCIES + +B uses B and B. + + +=head1 SEE ALSO + +B + + +=cut + +read host user passwd < <(echo "$1" | + perl -pe 's/^(?:(.*?)(?::(.*?))?@)?(.*?)$/$3 $1 $2/') + +if [ "$user" = "" ] ; then + DRAC_USER=${DRAC_USER:-root} +else + DRAC_USER="$user" +fi +if [ "$passwd" = "" ] ; then + DRAC_PASSWD=${DRAC_PASSWD:-calvin} +else + DRAC_PASSWD="$passwd" +fi +if [ "$host" = "" ] ; then + DRAC_HOST=${DRAC_HOST:-drac} +else + DRAC_HOST="$host" +fi + +tmp=`tempfile` + +get=$( + (lynx -source /dev/null && echo lynx -source) || + (fetch -o /dev/null file:///bin/sh && echo fetch -o -) || + (curl -h >/dev/null && echo curl -L) || + (wget -h >/dev/null && echo wget -qO -) || + echo 'No lynx, wget, curl, fetch: Please file a bug report with which tool you use for downloading URLs' >&2 + ) + +$get http://"$DRAC_HOST"/software/avctKVM.jar > "$tmp" +(sleep 3; rm "$tmp") & + +java -cp "$tmp" com.avocent.idrac.kvm.Main \ + user="$DRAC_USER" passwd="$DRAC_PASSWD" ip="$DRAC_HOST" \ + kmport=5900 vport=5900 apcp=1 version=2 vmprivilege=true \ + "helpurl=https://$DRAC_HOST:443/help/contents.html"