Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #$language = "VBScript"
- #$interface = "1.0"
- Sub main
- Dim FSO, Shell, Windir, Runservice, oFile, oFile1, g_strError,nResult, strConnectInfo
- Const ForReading = 1
- Const ForWriting = 2
- Const ForAppending = 8
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- Set Shell = CreateObject("WScript.Shell")
- Set Nemonico = objFSO.opentextfile("C:\TEST\IP_Gestion.txt", ForReading, False)
- Set objDictionary = CreateObject("Scripting.Dictionary")
- Set objSc = crt.Screen
- Set objD = crt.Dialog
- Set objSe = crt.Session
- Set objW = crt.Window
- Dim strResult
- Set objStream = objFSO.OpenTextFile("C:\TEST\velocidades.txt",ForAppending, True)
- While Not Nemonico.atEndOfStream
- Nombre = Nemonico.Readline()
- crt.Screen.Send "clear" & VbCr
- crt.Screen.WaitForString "$",2
- objSc.Send "telnet " &Nombre& vbCr
- crt.Screen.WaitForString vbcr
- 'lee el resultado
- strConnectInfo = crt.Screen.ReadString (vbcr)
- ' buscamos si conecta
- pos=InStr(strconnectinfo,"Trying")
- if (pos <> 0) then
- objsc.Synchronous = True
- result = objSc.waitforstrings("Password:","Username:")
- crt.Screen.Send "dnx0000" & VbCr
- crt.Screen.Send "dnx0000" & VbCr
- crt.Screen.WaitForString "#",2
- crt.Screen.Send "terminal length 0" & VbCr
- crt.Screen.WaitForString "#",8
- 'Comando de Cisco para saber la velocidad de la linea
- crt.Screen.Send "sh dsl interf atm0 | in (Speed)" & vbcr
- crt.Screen.WaitForString vbcr
- 'lee el resultado
- strResult = crt.Screen.ReadString (vbcr)
- strResult = Replace(strResult," ", "")
- strResult =Replace(strResult," 0", "")
- strResult =Replace(strResult,"Speed (kbps):", "")
- 'strResult =Replace(strResult," ", vbTab)
- x=Len(strResult) - 1
- strResult =Right(strResult,x)
- strResult = Nombre&vbTab&strResult&VbCr
- objSc.Synchronous = False
- objStream.writeline strResult
- crt.Screen.Send "exit" & VbCr
- crt.Screen.WaitForString "$",6
- Else
- 'do nothing...
- crt.Screen.WaitForString "$",6
- End If
- Wend
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement