Professional Documents
Culture Documents
#$interface = "1.0"
' Monte Tucker, 602-300-9665
' 10/30/2012
' This will run through all the passwords in the pwd array for each user in the
User array until one works or it runs out of passwords.
crt.Screen.Synchronous = True
vUser = Array(_
"user1",_
"user2",_
"user3",_
"user4")
vPass = Array(_
"password1",_
"password2",_
"password3",_
"password4")
pCount = 0
uCount = 0
Sub Main
crt.Screen.Synchronous = True
On Error Resume Next
'crt.Screen.Send VbCr
if objCurrentTab.Session.Connected = False then
crt.Session.Connect
end if
Do
uprompt = crt.Screen.WaitForStrings(">", "ssword:", "#", "gin:", "name:"
)
Select Case uprompt
Case 1 ' Found ">" (need to reissue 'enable' command).
crt.Screen.Send "en" & VbCr
Case 2 ' Found password prompt.
crt.Screen.Send vPass(pCount) & vbcr
' Increment counter so we send the next password if nece
ssary.
pCount = pCount + 1
If pCount > UBound(vPass) Then
' Sent all passwords in array and they all faile
d.
bAuthSuccess = False
Exit Do
End If
if objCurrentTab.Session.Connected = False then
crt.Session.Connect
end if
Case 3 ' Found "#" (password authentication was successful).
bAuthSuccess = True
Exit Do
Case 4 ' Found Login: prompt.
crt.Screen.Send vUser(uCount) & vbcr
' Increment counter so we send the next user if necessar
y.
uCount = uCount + 1
If uCount > UBound(vUser) Then
uCount = uCount + 1
Do
prompt = crt.Screen.WaitForStrings(">", "ssword:
vbcr
' Increment counter so we send t
he next password if necessary.
pCount = pCount + 1
If pCount > UBound(vPass) Then
' Sent all passwords in
array and they all failed for that user.
bAuthSuccess = False
Exit Do
End If
if objCurrentTab.Session.Connect
ed = False then
crt.Session.Connect
end if
Case 3 ' Found "#" (password authenticat
ion was successful).
bAuthSuccess = True
user = vUser(uCount)
Exit Do
Case 4 ' Found Login: prompt.
crt.Screen.Send vUser(uCount) &
vbcr
Case 5 ' Found Username: prompt.
crt.Screen.Send vUser(uCount) &
vbcr
Case Else
End Select
Loop
uCount = uCount + 1
If uCount > UBound(vUser) Then