Chapter 8 Using the CSS Scripting Language
Script Keepalive Examples
8-58
Cisco Content Services Switch Administration Guide
OL-5647-02
! Done
no set EXIT_MSG
socket disconnect ${SOCKET}
exit script 0
HTTP Authentication Keepalive
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-httpauth
! Parameters: HostName WebPage Username-Password
!
! Description:
! This will keepalive an authentication connection by building
! a get request with the Authentication field filled with the
! Username-Password string formatted like so: “bob:mypassword”
! This is critical to make the authentication base64 hash work
! correctly.
!
! Note: This script authentication is based on HTTP AUTHENTICATION
! RFC-2617. Currently only supported option is “Basic”
! authentication using base64 encoding. “Digest” Access is
! not supported at this time.
!
! Failure Upon:
! 1. Not establishing a connection with the host.
! 2. Not being able authenticated with the Username-Password
! (not being given a status code of “200 OK”
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] “NEQ” “3”
echo “Usage: ap-kal-httpauth \'Hostname WebPage
Username:Password\'”
echo “(Ie. ap-kal-httpauth \'192.168.1.1 /index.html
bob:mypassword\')”
exit script 1
endbranch
! Defines:
set HostName “${ARGS}[1]”
set WebPage “${ARGS}[2]”
set UserPass “${ARGS}[3]”
! Connect to the remote Host
set EXIT_MSG “Connection Failure”
socket connect host ${HostName} port 80 tcp