Chapter 8
Using the CSS Scripting Language
NetBIOS Name Query (Microsoft Networking)
OL-5647-02
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-netbios
! Parameters: Hostname
!
! Description:
!
We will make a netbios name query that we know will be
!
a "negative" response.
!
value of:
!
0x81 Session Request
!
0x82 Positive Session Response
!
0x83 Negative Session Response
!
We will key off of 0x83 which states we failed, but which
!
also means that the service was stable enough to know that
!
we are not a valid machine on the network.
!
This script will send an encoded message for Session Request
!
(0x81) and will invent a CALLER and a CALLED machine name
!
(Caller = this script and CALLED = Server)
!
! Failure Upon:
!
1. Not establishing a connection with the host.
!
2. Not receiving a status code 0x83 (negative response)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] "NEQ" "1"
echo "Usage: ap-kal-pop3 \'Hostname\'"
exit script 1
endbranch
! Defines:
set HostName "${ARGS}[1]"
! Connect to the remote host (default timeout)
set EXIT_MSG "Connection failure"
socket connect host ${HostName} port 139 tcp
! Send a Netbios Session Request (0x81) and its required encoded
!values.
! This value will be sent in RAW Hex
set EXIT_MSG "Send: Failure"
socket send ${SOCKET}
810000442045454550454d454d464a4341434143414341434143414341434143414341
434100" raw
! Wait for a response code of 0x83
set EXIT_MSG "Waitfor: Failure"
socket waitfor ${SOCKET} "83" raw
RFC-1002 NETBIOS states that a hex
Cisco Content Services Switch Administration Guide
Script Keepalive Examples
8-49