huserpwdhelp

Download HuserPWDhelp

If you can't read please download the document

Upload: nicksor-datutasik

Post on 05-Sep-2015

3 views

Category:

Documents


0 download

DESCRIPTION

scripy

TRANSCRIPT

#$language = "VBScript"#$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 = TruevUser = Array(_"user1",_"user2",_"user3",_"user4")vPass = Array(_"password1",_"password2",_"password3",_"password4")pCount = 0uCount = 0Sub Maincrt.Screen.Synchronous = TrueOn Error Resume Next'crt.Screen.Send VbCrif objCurrentTab.Session.Connected = False thencrt.Session.Connectend ifDo uprompt = crt.Screen.WaitForStrings(">", "ssword:", "#", "gin:", "name:")Select Case upromptCase 1 ' Found ">" (need to reissue 'enable' command).crt.Screen.Send "en" & VbCrCase 2 ' Found password prompt.crt.Screen.Send vPass(pCount) & vbcr' Increment counter so we send the next password if necessary.pCount = pCount + 1If pCount > UBound(vPass) Then' Sent all passwords in array and they all failed.bAuthSuccess = FalseExit DoEnd Ifif objCurrentTab.Session.Connected = False thencrt.Session.Connectend ifCase 3 ' Found "#" (password authentication was successful). bAuthSuccess = TrueExit DoCase 4 ' Found Login: prompt.crt.Screen.Send vUser(uCount) & vbcr' Increment counter so we send the next user if necessary.uCount = uCount + 1If uCount > UBound(vUser) Then' Sent all users and passwords in array and they all failed.bAuthSuccess = FalseExit DoEnd IfCase 5 ' Found Username: prompt.crt.Screen.Send vUser(uCount) & vbcr' Increment counter so we send the next user if necessary.' uCount = uCount + 1Do prompt = crt.Screen.WaitForStrings(">", "ssword:", "#", "gin:", "name:")Select Case promptCase 1 ' Found ">" (need to reissue 'enable' command).pwd = vPass(pCount)crt.Screen.Send "en" & VbCrCase 2 ' Found password prompt.' crt.Dialog.MessageBox "Here is the password I entered:" & vbcrlf &_' vUser(uCount) & " / " & vPass(pCount) & vbcrlfcrt.Screen.Send vPass(pCount) & vbcr' Increment counter so we send the next password if necessary.pCount = pCount + 1If pCount > UBound(vPass) Then' Sent all passwords in array and they all failed for that user.bAuthSuccess = FalseExit DoEnd Ifif objCurrentTab.Session.Connected = False thencrt.Session.Connectend ifCase 3 ' Found "#" (password authentication was successful). bAuthSuccess = Trueuser = vUser(uCount)Exit DoCase 4 ' Found Login: prompt.crt.Screen.Send vUser(uCount) & vbcrCase 5 ' Found Username: prompt.crt.Screen.Send vUser(uCount) & vbcrCase ElseEnd SelectLoopuCount = uCount + 1If uCount > UBound(vUser) Then' Sent all users and passwords in array and they all failed.bAuthSuccess = FalseExit DoEnd IfCase Elsecrt.Dialog.MessageBox "Unhandled MatchIndex." & vbcrlf &_"You probably added a timeout or an additional string " &_"parameter to the WaitForStrings() call, but forgot to " &_"add code to handle that new case. Check your code " &_"and revise accordingly."End SelectLoop' Lets check to see if we successfully entered 'enable' mode.If bAuthSuccess Then crt.Dialog.MessageBox "Authentication was successful. Used vUser (uCount) and vPass(pCount)"Else crt.Dialog.MessageBox "Authentication was a failure."End IfEnd Sub