#1
|
|||
|
|||
![]()
Hello All,
Forgive me, I'm a little new to scripting with CRT. I'm trying to connect to a bunch of hosts and return only one line to a log file instead of printing the entire output from my command. I want to be able to return the line that says AP-51xx firmware version : 2.3.2.0-008R as I'm specifically looking for for the model, in this case "AP-51xx". We have a few more models than that, I'll be scanning a few hundred devices and would like to be able to say "IP 172.xx.yyy.14x has model APxxxx" if that makes sense. Here is the script.. #$language = "VBScript" #$interface = "1.0" crt.Screen.Synchronous = True on error resume next ' Make sure we are disconnected before attempting a connection If crt.Session.Connected Then crt.Session.Disconnect ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ crt.Session.Connect "/SSH2 /ACCEPTHOSTKEYS /L ****** /PASSWORD ******* 172.26.25.140" ' Do work on the remote machine. crt.session.logfilename="APType_Poll_Output.log" crt.session.log TRUE, TRUE crt.Screen.WaitForString "admin>" crt.Screen.Send "sum" & chr(13) crt.Screen.WaitForString "admin>" crt.Screen.Send "quit" & chr(13) crt.Session.Disconnect crt.session.log False ' Disconnect before moving on to the next host crt.Session.Disconnect crt.Session.Connect "/SSH2 /ACCEPTHOSTKEYS /L ****** /PASSWORD ****** 172.26.57.140" ' Do work on the remote machine. crt.session.logfilename="APType_Poll_Output.log" crt.session.log TRUE, TRUE crt.Screen.WaitForString "admin>" crt.Screen.Send "sum" & chr(13) crt.Screen.WaitForString "admin>" crt.Screen.Send "quit" & chr(13) crt.Session.Disconnect crt.session.log False Here is the messy output. Note: Irrelevant/Sensitive data has been scrubbed. admin>sum AP-51xx firmware version : 2.3.2.0-008R country code : ca ap-mode : independent serial number : ********** WLAN 1: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default WLAN 2: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default WLAN 3: WLAN name : ####### ESS ID : ####### Radio : 11b/g VLAN : ###### Security Policy : ####### QoS Policy : Default WLAN 4: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default LAN1 Name: LAN1 LAN1 Mode: enable LAN1 IP: 172.26.25.140 LAN1 Mask: 255.255.255.0 LAN1 DHCP Mode: static LAN2 Name: LAN2 LAN2 Mode: disable LAN2 IP: 192.168.1.1 LAN2 Mask: 255.255.255.0 LAN2 DHCP Mode: static WAN Interface IP Address Network Mask Default Gateway DHCP Client ------------------------------------------------------------------------------ disable 10.1.1.1 255.0.0.0 0.0.0.0 disable admin>sum AP-51xx firmware version : 2.3.2.0-008R country code : ca ap-mode : independent serial number : *************** WLAN 1: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default WLAN 2: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default WLAN 3: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default WLAN 4: WLAN name : ###### ESS ID : ###### Radio : 11b/g VLAN : ###### Security Policy : ###### QoS Policy : Default LAN1 Name: LAN1 LAN1 Mode: enable LAN1 IP: 172.26.57.140 LAN1 Mask: 255.255.255.0 LAN1 DHCP Mode: static LAN2 Name: LAN2 LAN2 Mode: disable LAN2 IP: 192.168.1.1 LAN2 Mask: 255.255.255.0 LAN2 DHCP Mode: static WAN Interface IP Address Network Mask Default Gateway DHCP Client ------------------------------------------------------------------------------ disable 10.1.1.1 255.0.0.0 0.0.0.0 disable Help is greatly appreciated |
Tags |
log file , output , ssh |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|