Advertisement
Advertisement
| 08.27.2008 at 09:43AM PDT, ID: 23682644 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: |
#$language = "VBScript"
#$interface = "1.0"
Sub Main
Dim szPrompt, objTab, szHost, vServerList
szPrompt = "#$"
Set objTab = crt.GetScriptTab
objTab.Screen.Synchronous = True
objTab.Screen.IgnoreEscape = True
Do
szPassword = crt.dialog.prompt("Please enter your password: ", "Password: ", "", True)
If szPassword = "" then exit sub
szRootPassword = crt.dialog.Prompt("Please enter the current ROOT password: ", "Root Password", "", True)
If szRootPassword = "" then exit sub
szNewPassword = crt.dialog.prompt("Please enter the new ROOT password: ", "New Password", "", True)
If szNewPassword = "" then exit sub
szConfirmPassword = crt.dialog.prompt("Please confirm the new ROOT password: ", "Confirm Password", "", True)
If szConfirmPassword = "" then exit sub
if szNewPassword <> szConfirmPassword then
MsgBox "User did not provide matching passwords"
Else
Exit Do
End if
Loop
szCommand = "cat server_list.txt"
objTab.Screen.Send szCommand & vbcr
objTab.Screen.WaitForString szCommand & vbcr
vServerList = Split(objTab.Screen.ReadString(szPrompt), vbcr)
For Each szHost in vServerList
' Get rid of any carriage returns or line feeds that still may be
' remaining in szHost
szHost = Replace(szHost, "#$", "")
szHost = Replace(Replace(szHost, vblf, ""), vbcr, "")
objTab.Screen.Send "ssh " & szHost & vbcr
Do
Dim szResult
szResult = Crt.Screen.WaitforStrings("Are you sure you want to continue connecting (yes/no)? ", "Password:", 60)
If szResult = 1 Then
objTab.Screen.Send "yes" & vbcr
objTab.Screen.WaitforString "Password: "
objTab.Screen.Send szPassword & vbcr
exit do
End If
If szResult = 2 Then
objTab.Screen.Send szPassword & vbcr
exit do
End If
If szResult = 0 Then
MsgBox "We timed out"
Exit sub
End if
Loop
objTab.Screen.WaitforString "TERM = (xterm) "
objTab.Screen.Send "vt100" & vbcr
objTab.Screen.WaitforString " ]# "
objTab.Screen.Send "su -" & vbcr
objTab.Screen.WaitForString "Password:"
objTab.Screen.Send szRootPassword & vbcr
objTab.Screen.WaitforString "TERM = (xterm) "
objTab.Screen.Send "vt100" & vbcr
objTab.Screen.WaitforString " ]# "
objTab.Screen.Send "passwd root" & vbcr
ObjTab.Screen.WaitForString "New Password: "
objTab.screen.Send szNewPassword & vbcr
objTab.Screen.WaitForString "Re-enter new Password:"
objTab.Screen.Send szNewPassword & vbcr
objTab.Screen.WaitForString "passwd: password successfully changed for root"
objTab.Screen.Send "exit" & vbcr
objTab.screen.WaitForString "]#"
objTab.Screen.Send "exit" & vbcr
objTab.screen.WaitForString "]#"
Next
MsgBox "Script Completed."
End Sub
|