Access an APC AP5456 IP Gateway for Analog KVM in Linux

I recently wrote about running an ActiveX component without Internet Explorer. I used that technique to come up with a shell script front-end for downloading, unpacking and running an executable in Wine for accessing an APC IP KVM (model AP5456). Here is the results of that effort.

At a minimum the script requires Wine and curl, but to do everything without manually downloading and extracting the cabinet file yourself, you’ll also need cabextract. Some less exotic stuff from coreutils: basename and dirname are needed, but you probably have those already.

You can download the script here.


# A script to access an APC brand model AP5456 IP Gateway for Analog KVM
# In Linux, using Wine



while [ -z "$KVM_SERVER" ]
    echo -n "FQDN of KVM Server (not including https://): "
    read KVM_SERVER

while [ -z "$USERNAME" ]
        echo -n "Username: "
        read USERNAME

while [ -z "$PASSWORD" ]
        echo -n "Password: "
        tput invis
        read PASSWORD
        tput sgr0

get_cab_name () {
    while read line
        if [ "${line/’OBJECT CODEBASE’/}" != "$line" ]; then
            cab_name="${line##*'<OBJECT CODEBASE="’}"
            echo "$cab_name"

get_cmd_args () {
    while read line
        if [ "${line/PARAM/}" != "$line" ]; then
            ipaddr="${line##*'<PARAM NAME="ipaddr" VALUE="’}"

            sessionkey="${line##*'<PARAM NAME="sessionkey" VALUE="’}"

            encryptionkey="${line##*'<PARAM NAME="encryptionkey" VALUE="’}"
    if [ -n "$sessionkey" ] && [ -n "$encryptionkey" ] && [ -n "$ipaddr" ]; then
        echo "-k $sessionkey -e $encryptionkey $ipaddr"


wine="`which wine`"
if [ -z "$wine" ]; then
    echo "Wine was not found, but is required.  Can not continue without it." >&2
    exit 1

cd "`dirname $0`"
#If a path to vpclient.exe wasn’t specified, and we can’t find it, use /tmp
#as a place to download it to
if [ -z "$VIEWER_PATH" ] && ! [ -f "vpclient.exe" ]; then
    mkdir -p "/tmp/vpclient"

#If a full path wasn’t specified, prepend current working directory
if [ "${VIEWER_PATH:0:1}" != "/" ]; then

if ! [ -f "$VIEWER_PATH/vpclient.exe" ]; then

    cab_url="`curl -s –insecure –user "$USERNAME:$PASSWORD" "https://$KVM_SERVER/launch.asp" |get_cab_name`"

    cabextract="`which cabextract`"
    if [ -z "$cabextract" ]; then
        echo "vpclient.exe was not found in $VIEWER_PATH" >&2
        echo "cabextract was not found either, so we can’t download">&2
        echo -e "and extract vpclient.exe from it’s CAB archive.\n" >&2
        echo "Error: user intervention required." >&2
        echo "———————————-" >&2
        echo "Download $cab_url" >&2
        echo "Unpack `basename $cab_url` into $VIEWER_PATH" >&2
        echo " — OR — " >&2
        echo "Install cabextract" >&2
        exit 1

    if ! [ -d "$VIEWER_PATH" ]; then
        echo "WARNING: Viewer Path specified is not valid." >&2
        echo "Path: $VIEWER_PATH" >&2
        echo -e "——————————————-\n" >&2
        echo -n "Would you like me to create it? (y/N)?" >&2
        read answer
        shopt -s nocasematch
        if [ "$answer" = "y" ]; then
            mkdir -p "$VIEWER_PATH"
            if ! [ -d "$VIEWER_PATH" ]; then
                echo "Couldn’t create: $VIEWER_PATH" >&2
                exit 1
        shopt -u nocasematch

    cd "$VIEWER_PATH"
        curl -s –insecure –user "$USERNAME:$PASSWORD" "$cab_url" >"`basename $cab_url`"
        $cabextract -q "`basename $cab_url`" 2>/dev/null

cmd_args="`curl -s –insecure –user "$USERNAME:$PASSWORD" "https://$KVM_SERVER/launch.asp" |get_cmd_args`"


#Sanity check
if [ -f "./vpclient.exe" ]; then
    $wine "./vpclient.exe" $cmd_args
    echo "Failed, do it yourself: $wine vpclient.exe $cmd_args"



, ,




9 responses to “Access an APC AP5456 IP Gateway for Analog KVM in Linux”

  1. Jay Avatar

    I really, really appreciate your two articles on these APC IP KVMs — but can you provide an example of how this script is used? That’s the only thing missing!


    1. Chris Avatar

      Hi Jay, thanks for your interest. I’ll try to add some clarification. Sorry if any of this comes across as condescending, but I’ll just assume the least knowledge on your part to maximize the usefulness of this response to potential readers from the future. On a system with Wine and the other prerequisites covered the steps are:

      user@host:~$ wget

      Make the script executable:
      user@host:~$ chmod u+x

      Run the script:
      user@host:~$ ./

      Notice the proceeding ‘./’ before the script name, that lets the shell know we want to work with a file in the current directory. If you’re going to be using this script a lot, you might want to put it some place in your path. Example:

      user@host:~$ mv /usr/local/bin

      On most Linux systems /usr/local/bin is in your $PATH environment, so in the future you can just type “” like a normal system command without specifying the path (e.g. ‘./’)

      There are no command line arguments/switches. When ran the script is interactive, meaning it will ask you for the things it needs:

      user@host:~$ ./
      FQDN of KVM Server (not including https://):

      Here it’s asking for the IP address or the DNS name for the IP KVM. If you know the web address for the IP KVM, this will be the same thing, just take whatever is in between the URI and the first forward slash in the resource.

      Example: Say you could access an IP KVM at then your answer for this question would just be ‘’ (without the quotes of course)

      Next it will ask for the password you use to login to the KVM via the web interface for the ‘apc’ user.
      user@host:~$ ./
      FQDN of KVM Server (not including https://):

      If you have created a new user on the APC IP KVM and would like to use those credentials instead of the ‘apc’ user, edit the file and change the line that says:


      Replace the ‘apc’ with the username you’ve created (assuming you’ve created one). If you haven’t made a custom user, the default username and password is ‘apc’ with a password of ‘apc’.

      If you will be using the script with the same IP KVM all the time, you may want to modify the variables at the start of the script. By setting USERNAME, PASSWORD, and KVM_SERVER in the script you will prevent from asking you all these questions in the future. The KVM_SERVER variable is for setting the IP or DNS name as described above.

      That should be all there is to it.


      Make sure you don’t already have the IP KVM in a browser some place else. If you run into errors you can try to comment with them here. No guarantee I’ll be able to help (or even try for the matter), but generally the more detail the better.


      If you are accessing an APC IP KVM through an SSH tunnel, besides forwarding 443 for https you also need 5900 for the VNC-esque remote frame buffer data.

      I hope this helps.

  2. Jay Avatar

    Awesome. Thanks for the help. Turns out I have a different model of IP KVM, but everything you’ve documented here is great. I’ll be sure to submit anything I write up back here for others to benefit from.

    1. Chris Avatar

      The script scrapes some specific strings in the html served by the embedded web server of the AP5456, it may even break across firmware versions on that model. I believe the hardware of the AP5456 is similar to the StarTech SV1105IPEXT. I would bet that the script could be easily modified to work with the SV1105IPEXT, beyond that I have no idea. The information in my article leading up to this one describes the process I used for creating this script, it might be of benefit to you. Thanks for your feedback.

  3. Jay Avatar

    Okay, thanks to your msgbox.exe and your sample code, I’ve managed to get an APC 16-port IP KVM (AP5405) working with Ubuntu Linux. I had to write a long-ish script to get it working (in Perl) and once I tidy up the code and test it a little more, I’ll post the results. Thanks again.

  4. Janos Avatar

    Thanks for your post about this device.
    As it turns out, this device is basically the same as the Avocent SwitchView IP 1010, so your solution can be used with it, without any changes.

    1. JBevren Avatar

      As it also turns out, the IP modules in the Avocent KVM/NET+ series are pretty much SwitchView IP 1010 embedded cards, so some trickery can be done to access them with a modified version of Ethertubes’ script.

      I’ve been using my customized version with a KVM/NET+ 3204 for a couple years now and remembered its origins this evening. While not secure enough for a datacenter environment anymore, these venerable old KVM devices serve me well at home.

      Thanks Ethertubes!

      1. admin Avatar

        Thanks for the note! I always appreciate hearing when something I’ve posted was helpful.

  5. Brian Avatar

    Did anyone ever get this to work with the AP5405?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.