#Region "import"
'imports for project threading
Imports System.Threading
'imports for accessing internal programs
Imports snmpcertthread.My.Resources
'imports for threading
Imports System.Runtime.InteropServices
' imports for file system
Imports System.IO
'no idea
Imports System.Text
'for networking web client.
Imports System.Net
#End Region
Public Class Form1
Dim community_string As String
Dim t1_1 As Integer = 1
Dim tsharedata As Integer = 1
Dim octet3 As Integer = 0
Dim octet4 As Integer = 0
Dim track As Integer = 0
Dim total_modems As Integer = 0
Dim output As String
Dim t As Thread
Dim t1 As Thread
Dim t2 As Thread
Dim t3 As Thread
Dim t4 As Thread
Dim t5 As Thread
Dim t6 As Thread
Dim t7 As Thread
Dim t8 As Thread
Dim t9 As Thread
Dim allmodems As Integer = 0
Dim extracted As Integer = 0
Private Sub BackgroundProcess()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess1()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check1(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess2()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check2(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess3()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check3(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess4()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check4(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess5()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check5(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess6()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check6(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess7()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check7(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess8()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check8(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Private Sub BackgroundProcess9()
Do While True
Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
''Thread.Sleep(100)
If tsharedata = 255 AndAlso t1_1 = 255 Then
octet3 += 1
tsharedata = 0
If octet3 = 255 Then
Exit Sub
End If
End If
If t1_1 = 255 Then
tsharedata += 1
t1_1 = 0
Else : t1_1 += 1 : check9(octet3, tsharedata, t1_1)
End If
Loop
End Sub
Sub create_exe()
Dim tempPath As String = "C:\snmpcert\snmpget.exe"
Dim tempPath1 As String = "C:\snmpcert\netsnmp.dll"
Dim tempPath2 As String = "C:\snmpcert\snmpwalk.exe"
Dim tempPath3 As String = "C:\snmpcert\snmpset.exe"
If Directory.Exists("C:\snmpcert") Then
Else
Directory.CreateDirectory("C:\snmpcert")
End If
If extracted = 0 Then
extracted = 1
Dim currentAssembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
Dim currentAssembly1 As Reflection.Assembly = Reflection.Assembly.GetCallingAssembly()
Dim resource As String = String.Empty
Dim resource1 As String = String.Empty
Dim resource2 As String = String.Empty
Dim resource3 As String = String.Empty
Dim arrResources As String() = currentAssembly.GetManifestResourceNames()
Dim arrResources1 As String() = currentAssembly.GetManifestResourceNames()
Dim arrResources2 As String() = currentAssembly.GetManifestResourceNames()
Dim arrResources3 As String() = currentAssembly.GetManifestResourceNames
For Each resource In arrResources
If resource.IndexOf(".1.exe") > -1 Then _
Exit For
Next
For Each resource1 In arrResources1
If resource1.IndexOf(".dll") > -1 Then _
Exit For
Next
For Each resource2 In arrResources2
If resource2.IndexOf(".2.exe") > -1 Then _
Exit For
Next
For Each resource3 In arrResources3
If resource3.IndexOf(".3.exe") > -1 Then
Exit For
End If
Next
Dim resourceStream As IO.Stream = currentAssembly.GetManifestResourceStream(resource)
Dim resourceStream1 As IO.Stream = currentAssembly.GetManifestResourceStream(resource1)
Dim resourceStream2 As IO.Stream = currentAssembly.GetManifestResourceStream(resource2)
Dim resourceStream3 As IO.Stream = currentAssembly.GetManifestResourceStream(resource3)
Dim writer As New IO.FileStream(tempPath, IO.FileMode.Create, IO.FileAccess.Write)
Dim writer1 As New IO.FileStream(tempPath1, IO.FileMode.Create, IO.FileAccess.Write)
Dim writer2 As New IO.FileStream(tempPath2, IO.FileMode.Create, IO.FileAccess.Write)
Dim writer3 As New IO.FileStream(tempPath3, IO.FileMode.Create, IO.FileAccess.Write)
Const size As Int16 = 4096
Dim bytes(size) As Byte
Dim numBytes As Int32 = 0
Const size1 As Int16 = 4096
Dim bytes1(size1) As Byte
Dim numBytes1 As Int32 = 0
Const size2 As Int16 = 4096
Dim bytes2(size2) As Byte
Dim numBytes2 As Int32 = 0
Const size3 As Int16 = 4096
Dim bytes3(size3) As Byte
Dim numBytes3 As Int32 = 0
Do
numBytes = resourceStream.Read(bytes, 0, size)
writer.Write(bytes, 0, numBytes)
Loop While (numBytes > 0)
Do
numBytes1 = resourceStream1.Read(bytes1, 0, size1)
writer1.Write(bytes1, 0, numBytes1)
Loop While (numBytes1 > 0)
Do
numBytes2 = resourceStream2.Read(bytes2, 0, size2)
writer2.Write(bytes2, 0, numBytes2)
Loop While (numBytes2 > 0)
Do
numBytes3 = resourceStream3.Read(bytes3, 0, size3)
writer3.Write(bytes3, 0, numBytes3)
Loop While (numBytes3 > 0)
resourceStream.Close()
writer.Close()
resourceStream1.Close()
writer1.Close()
resourceStream2.Close()
writer2.Close()
End If
End Sub
Dim hasrun As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
community_string = txtcommunity.Text
Button1.Enabled = False
Button2.Enabled = True
create_exe()
Dim boxip() As String
boxip = Split(TextBox1.Text, ".")
If boxip.Length > 3 Then
boxip(1) = Replace(boxip(1), ".", Nothing)
boxip(2) = Replace(boxip(2), ".", Nothing)
boxip(3) = Replace(boxip(3), ".", Nothing)
boxip(0) = Replace(boxip(0), ".", Nothing)
octet4 = boxip(0)
octet3 = boxip(1)
tsharedata = boxip(2)
t1_1 = boxip(3)
Else : MsgBox("error please enter a vaild IP Address!") : Exit Sub
End If
If community_string = Nothing Then
MsgBox("Error I need a community string! ")
Exit Sub
End If
If hasrun = 0 Then
hasrun = 1
t = New Thread(AddressOf Me.BackgroundProcess)
t1 = New Thread(AddressOf Me.BackgroundProcess1)
t2 = New Thread(AddressOf Me.BackgroundProcess2)
t3 = New Thread(AddressOf Me.BackgroundProcess3)
t4 = New Thread(AddressOf Me.BackgroundProcess4)
t5 = New Thread(AddressOf Me.BackgroundProcess5)
t6 = New Thread(AddressOf Me.BackgroundProcess6)
t7 = New Thread(AddressOf Me.BackgroundProcess7)
t8 = New Thread(AddressOf Me.BackgroundProcess8)
t9 = New Thread(AddressOf Me.BackgroundProcess9)
Timer1.Enabled = True
t.Start()
Thread.Sleep(Val(TextBox2.Text))
t1.Start()
Thread.Sleep(Val(TextBox2.Text))
t2.Start()
Thread.Sleep(Val(TextBox2.Text))
t3.Start()
Thread.Sleep(Val(TextBox2.Text))
t4.Start()
Thread.Sleep(Val(TextBox2.Text))
t5.Start()
Thread.Sleep(Val(TextBox2.Text))
t6.Start()
Thread.Sleep(Val(TextBox2.Text))
t7.Start()
Thread.Sleep(Val(TextBox2.Text))
t8.Start()
Thread.Sleep(Val(TextBox2.Text))
t9.Start()
Else
t = New Thread(AddressOf Me.BackgroundProcess)
t1 = New Thread(AddressOf Me.BackgroundProcess1)
t2 = New Thread(AddressOf Me.BackgroundProcess2)
t3 = New Thread(AddressOf Me.BackgroundProcess3)
t4 = New Thread(AddressOf Me.BackgroundProcess4)
t5 = New Thread(AddressOf Me.BackgroundProcess5)
t6 = New Thread(AddressOf Me.BackgroundProcess6)
t7 = New Thread(AddressOf Me.BackgroundProcess7)
t8 = New Thread(AddressOf Me.BackgroundProcess8)
t9 = New Thread(AddressOf Me.BackgroundProcess9)
Timer1.Enabled = True
t.Start()
Thread.Sleep(Val(TextBox2.Text))
t1.Start()
Thread.Sleep(Val(TextBox2.Text))
t2.Start()
Thread.Sleep(Val(TextBox2.Text))
t3.Start()
Thread.Sleep(Val(TextBox2.Text))
t4.Start()
Thread.Sleep(Val(TextBox2.Text))
t5.Start()
Thread.Sleep(Val(TextBox2.Text))
t6.Start()
Thread.Sleep(Val(TextBox2.Text))
t7.Start()
Thread.Sleep(Val(TextBox2.Text))
t8.Start()
Thread.Sleep(Val(TextBox2.Text))
t9.Start()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = octet4 & "." & octet3 & "." & tsharedata & "." & t1_1
totalcount.Text = allmodems
numfound.Text = total_modems
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button2.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
txtdiag.Text = "Please Wait shutting down Scan...."
Try
t.Abort()
t1.Abort()
t2.Abort()
t3.Abort()
t4.Abort()
t5.Abort()
t6.Abort()
t7.Abort()
t8.Abort()
t9.Abort()
Button1.Enabled = True
Catch ex As Exception
Button1.Enabled = True
updates()
Exit Sub
End Try
End Sub
Sub updates()
Dim oWrite As System.IO.TextWriter = New StreamWriter("c:\snmpcert\settings.ini")
oWrite.WriteLine(TextBox1.Text)
oWrite.WriteLine(txtcommunity.Text)
oWrite.WriteLine(portsnmp.Text)
oWrite.Flush()
oWrite.Close()
oWrite = Nothing
End Sub
Sub check(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check1(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check2(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check3(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check4(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check5(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check6(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check7(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check8(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check9(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Sub check10(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
Dim x = "C:\snmpcert\snmpget.exe"
Dim myProcess As Process = New Process
Dim s As String = ""
myProcess.StartInfo.FileName = x
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.StartInfo.RedirectStandardError = True
myProcess.StartInfo.Arguments = "-v2c -O v -r 2 -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.1.0"
myProcess.Start()
Dim sIn As StreamWriter = myProcess.StandardInput
sIn.AutoFlush = True
Dim sOut As StreamReader = myProcess.StandardOutput
Dim sErr As StreamReader = myProcess.StandardError
s = sOut.ReadToEnd()
Dim e As String = sErr.ReadToEnd
Console.WriteLine(s)
output = e
output = s
If Not myProcess.HasExited Then
myProcess.Kill()
End If
sIn.Close()
sOut.Close()
sErr.Close()
myProcess.Close()
Dim temp As String = ""
temp = Replace(check_cannot_find_module(s), "STRING: ", "")
temp = Replace(temp, Chr(34), "")
If temp = Nothing Then
temp = ""
Else
If temp = "No Such Object available on this agent at this OID" Then
allmodems += 1
End If
temp = temp.ToString.ToUpper
Dim values As String
values = temp
Dim sites As String() = Nothing
sites = values.Split(" ")
Dim t As String
For Each t In sites
If t = "NO" Then
track = 1
End If
Next t
End If
If temp.ToString = "" Then
Timer1.Enabled = True
Exit Sub
ElseIf track = 1 Then
track = 0
Timer1.Enabled = True
Exit Sub
Else
total_modems += 1
Try
Dim mymac1 As Process = New Process
Dim sm As String
mymac1.StartInfo.FileName = x
mymac1.StartInfo.UseShellExecute = False
mymac1.StartInfo.CreateNoWindow = True
mymac1.StartInfo.RedirectStandardInput = True
mymac1.StartInfo.RedirectStandardOutput = True
mymac1.StartInfo.RedirectStandardError = True
mymac1.StartInfo.Arguments = "-v2c -O v -c " & community_string.ToString & " " & modem_ip.ToString & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.4.0"
mymac1.Start()
Dim sInm As StreamWriter = mymac1.StandardInput
sInm.AutoFlush = True
Dim sOutm As StreamReader = mymac1.StandardOutput
Dim sErrm As StreamReader = mymac1.StandardError
sm = sOutm.ReadToEnd()
If Not mymac1.HasExited Then
mymac1.Kill()
End If
sInm.Close()
sOutm.Close()
sErrm.Close()
mymac1.Close()
Dim tempm As String = ""
tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
tempm = Replace(tempm, "Hex-", Nothing)
tempm = Replace(tempm, Chr(34), Nothing)
tempm = Replace(tempm, ":", Nothing)
tempm = Replace(tempm, " ", Nothing)
temp = Replace(temp, vbCrLf, Nothing)
tempm = Replace(tempm, vbCrLf, Nothing)
Dim usbmac As Process = New Process
Dim sm1 As String
usbmac.StartInfo.FileName = x
usbmac.StartInfo.UseShellExecute = False
usbmac.StartInfo.CreateNoWindow = True
usbmac.StartInfo.RedirectStandardInput = True
usbmac.StartInfo.RedirectStandardOutput = True
usbmac.StartInfo.RedirectStandardError = True
usbmac.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.60.0"
usbmac.Start()
Dim sInm1 As StreamWriter = usbmac.StandardInput
sInm1.AutoFlush = True
Dim sOutm1 As StreamReader = usbmac.StandardOutput
Dim sErrm1 As StreamReader = usbmac.StandardError
sm1 = sOutm1.ReadToEnd()
If Not usbmac.HasExited Then
usbmac.Kill()
End If
sInm1.Close()
sOutm1.Close()
sErrm1.Close()
usbmac.Close()
Dim tempum As String = ""
tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
tempum = Replace(tempum, "Hex-", Nothing)
tempum = Replace(tempum, Chr(34), Nothing)
tempum = Replace(tempum, ":", Nothing)
tempum = Replace(tempum, " ", Nothing)
tempum = Replace(tempum, vbCrLf, Nothing)
Directory.CreateDirectory("C:\snmpcert\" & temp)
Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
'get SERIAL number
Dim myProcessSER As Process = New Process
Dim sSER As String
myProcessSER.StartInfo.FileName = x
myProcessSER.StartInfo.UseShellExecute = False
myProcessSER.StartInfo.CreateNoWindow = True
myProcessSER.StartInfo.RedirectStandardInput = True
myProcessSER.StartInfo.RedirectStandardOutput = True
myProcessSER.StartInfo.RedirectStandardError = True
myProcessSER.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.6.0"
myProcessSER.Start()
Dim sInSER As StreamWriter = myProcessSER.StandardInput
sInSER.AutoFlush = True
Dim sOutSER As StreamReader = myProcessSER.StandardOutput
Dim sErrSER As StreamReader = myProcessSER.StandardError
sSER = sOutSER.ReadToEnd()
If Not myProcessSER.HasExited Then
myProcessSER.Kill()
End If
sInSER.Close()
sOutSER.Close()
sErrSER.Close()
myProcessSER.Close()
Dim tempSER As String
tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
tempSER = Replace(tempSER, "Hex-", Nothing)
tempSER = Replace(tempSER, Chr(34), Nothing)
'get download speed
Dim myProcessspeedd As Process = New Process
Dim sspeedd As String
myProcessspeedd.StartInfo.FileName = x
myProcessspeedd.StartInfo.UseShellExecute = False
myProcessspeedd.StartInfo.CreateNoWindow = True
myProcessspeedd.StartInfo.RedirectStandardInput = True
myProcessspeedd.StartInfo.RedirectStandardOutput = True
myProcessspeedd.StartInfo.RedirectStandardError = True
myProcessspeedd.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16706.1"
myProcessspeedd.Start()
Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
sInSpeedd.AutoFlush = True
Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
sspeedd = sOutSpeedd.ReadToEnd()
If Not myProcessspeedd.HasExited Then
myProcessspeedd.Kill()
End If
sInSpeedd.Close()
sOutSpeedd.Close()
sErrSpeedd.Close()
myProcessspeedd.Close()
Dim tempSpeedd As String
tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
'get upload speed
Dim myProcessspeedu As Process = New Process
Dim sspeedu As String
myProcessspeedu.StartInfo.FileName = x
myProcessspeedu.StartInfo.UseShellExecute = False
myProcessspeedu.StartInfo.CreateNoWindow = True
myProcessspeedu.StartInfo.RedirectStandardInput = True
myProcessspeedu.StartInfo.RedirectStandardOutput = True
myProcessspeedu.StartInfo.RedirectStandardError = True
myProcessspeedu.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2.16717.1"
myProcessspeedu.Start()
Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
sInSpeedu.AutoFlush = True
Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
sspeedu = sOutSpeedu.ReadToEnd()
If Not myProcessspeedu.HasExited Then
myProcessspeedu.Kill()
End If
sInSpeedu.Close()
sOutSpeedu.Close()
sErrSpeedu.Close()
myProcessspeedu.Close()
Dim tempSpeedu As String
tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
If tempSpeedd = "No Such Instance currently exists at this OID" Then
'get download speed doccis 1.1 +
Dim myProcessspeedd1 As Process = New Process
Dim sspeedd1 As String
myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
myProcessspeedd1.StartInfo.UseShellExecute = False
myProcessspeedd1.StartInfo.CreateNoWindow = True
myProcessspeedd1.StartInfo.RedirectStandardInput = True
myProcessspeedd1.StartInfo.RedirectStandardOutput = True
myProcessspeedd1.StartInfo.RedirectStandardError = True
myProcessspeedd1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.10.127.7.1.2.2.6.2"
myProcessspeedd1.Start()
Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
sInSpeedd1.AutoFlush = True
Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
sspeedd1 = sOutSpeedd1.ReadToEnd()
If Not myProcessspeedd1.HasExited Then
myProcessspeedd1.Kill()
End If
sInSpeedd1.Close()
sOutSpeedd1.Close()
sErrSpeedd1.Close()
myProcessspeedd1.Close()
Dim tempSpeedd1 As String
tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
tempSpeedd = tempSpeedd1
Dim testing As String
testing = Replace(tempSpeedd1, vbCrLf, ",")
''MsgBox(testing)
Dim split As String()
split = testing.Split(",")
tempSpeedd = split(0).ToString
tempSpeedu = split(4).ToString
''MsgBox(tempSpeedd)
''MsgBox(tempSpeedu)
End If
Dim oFileSER As System.IO.File
Dim oWriteSER As System.IO.StreamWriter
Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
oWriteSER = oFileSER.CreateText(filedirSER)
oWriteSER.WriteLine("modem's ip was:" & modem_ip & vbCrLf & "mac was : " & tempm & vbCrLf & "usb mac was:" & tempum & vbCrLf & "modem's serial was: " & tempSER & "modem's upload speed was:" & tempSpeedd.ToString & vbCrLf & "modem's download speed was:" & tempSpeedu.ToString)
oWriteSER.Close()
Dim filetodelete As String
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
If System.IO.File.Exists(filetodelete) = True Then
System.IO.File.Delete(filetodelete)
End If
'get cmFactoryRSAPublicKey.txt
Dim myProcess1 As Process = New Process
Dim s1 As String
myProcess1.StartInfo.FileName = x
myProcess1.StartInfo.UseShellExecute = False
myProcess1.StartInfo.CreateNoWindow = True
myProcess1.StartInfo.RedirectStandardInput = True
myProcess1.StartInfo.RedirectStandardOutput = True
myProcess1.StartInfo.RedirectStandardError = True
myProcess1.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.50.0"
myProcess1.Start()
Dim sIn1 As StreamWriter = myProcess1.StandardInput
sIn1.AutoFlush = True
Dim sOut1 As StreamReader = myProcess1.StandardOutput
Dim sErr1 As StreamReader = myProcess1.StandardError
s1 = sOut1.ReadToEnd()
If Not myProcess1.HasExited Then
myProcess1.Kill()
End If
sIn1.Close()
sOut1.Close()
sErr1.Close()
myProcess1.Close()
Dim temp1 As String
temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
temp1 = Replace(temp1, "Hex-", Nothing)
temp1 = Replace(temp1, Chr(34), Nothing)
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
End If
Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp1)
oWrite.Close()
Dim bytelist1 As String()
Dim templist1 As String
templist1 = Replace(temp1, vbCrLf, " ")
templist1 = templist1.Remove(templist1.Length - 1, 1)
templist1 = Replace(templist1, " ", ",")
templist1 = Replace(templist1, ",,", ",")
bytelist1 = Split(templist1, ",")
Dim coutner1 As Integer
coutner1 = 2
Dim countback1 As Integer = bytelist1.Length - 2
Dim countup1 As Integer = 1
Dim watchvar1 As Integer = 0
While countback1 >= 0
If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
countup1 += 1
Else
watchvar1 = 1
End If
countback1 -= 1
End While
While coutner1 < bytelist1.Length - countup1
Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
Dim oFileStream1 As System.IO.FileStream
oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
oFileStream1.WriteByte(byteData)
oFileStream1.Close()
coutner1 += 1
End While
'get cmFactoryRSAPrivateKey.txt
Dim myProcess2 As Process = New Process
Dim s2 As String
myProcess2.StartInfo.FileName = x
myProcess2.StartInfo.UseShellExecute = False
myProcess2.StartInfo.CreateNoWindow = True
myProcess2.StartInfo.RedirectStandardInput = True
myProcess2.StartInfo.RedirectStandardOutput = True
myProcess2.StartInfo.RedirectStandardError = True
myProcess2.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.51.0"
myProcess2.Start()
Dim sIn2 As StreamWriter = myProcess2.StandardInput
sIn2.AutoFlush = True
Dim sOut2 As StreamReader = myProcess2.StandardOutput
Dim sErr2 As StreamReader = myProcess2.StandardError
s2 = sOut2.ReadToEnd()
If Not myProcess2.HasExited Then
myProcess2.Kill()
End If
sIn2.Close()
sOut2.Close()
sErr2.Close()
myProcess2.Close()
Dim temp2 As String
temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
temp2 = Replace(temp2, "Hex-", "")
temp2 = Replace(temp2, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp2)
oWrite.Close()
Dim bytelist2 As String()
Dim templist2 As String
templist2 = Replace(temp2, vbCrLf, " ")
templist2 = templist2.Remove(templist2.Length - 1, 1)
templist2 = Replace(templist2, " ", ",")
templist2 = Replace(templist2, ",,", ",")
bytelist2 = Split(templist2, ",")
Dim coutner2 As Integer
coutner2 = 2
Dim countback2 As Integer = bytelist2.Length - 2
Dim countup2 As Integer = 1
Dim watchvar2 As Integer = 0
While countback2 >= 0
If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
countup2 += 1
Else
watchvar2 = 1
End If
countback2 -= 1
End While
While coutner2 < bytelist2.Length - countup2
Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
Dim oFileStream2 As System.IO.FileStream
oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
oFileStream2.WriteByte(byteData2)
oFileStream2.Close()
coutner2 += 1
End While
'get cmFactoryCMCertificate.txt
Dim myProcess3 As Process = New Process
Dim s3 As String
myProcess3.StartInfo.FileName = x
myProcess3.StartInfo.UseShellExecute = False
myProcess3.StartInfo.CreateNoWindow = True
myProcess3.StartInfo.RedirectStandardInput = True
myProcess3.StartInfo.RedirectStandardOutput = True
myProcess3.StartInfo.RedirectStandardError = True
myProcess3.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.52.0"
myProcess3.Start()
Dim sIn3 As StreamWriter = myProcess3.StandardInput
sIn3.AutoFlush = True
Dim sOut3 As StreamReader = myProcess3.StandardOutput
Dim sErr3 As StreamReader = myProcess3.StandardError
s3 = sOut3.ReadToEnd()
If Not myProcess3.HasExited Then
myProcess3.Kill()
End If
sIn3.Close()
sOut3.Close()
sErr3.Close()
myProcess3.Close()
Dim temp3 As String
temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
temp3 = Replace(temp3, "Hex-", "")
temp3 = Replace(temp3, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp3)
oWrite.Close()
Dim bytelist3 As String()
Dim templist3 As String
templist3 = Replace(temp3, vbCrLf, " ")
templist3 = templist3.Remove(templist3.Length - 1, 1)
templist3 = Replace(templist3, " ", ",")
templist3 = Replace(templist3, ",,", ",")
bytelist3 = Split(templist3, ",")
Dim coutner3 As Integer
coutner3 = 2
Dim countback3 As Integer = bytelist3.Length - 2
Dim countup3 As Integer = 1
Dim watchvar3 As Integer = 0
While countback3 >= 0
If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
countup3 += 1
Else
watchvar3 = 1
End If
countback3 -= 1
End While
While coutner3 < bytelist3.Length - countup3
Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
Dim oFileStream3 As System.IO.FileStream
oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
oFileStream3.WriteByte(byteData3)
oFileStream3.Close()
coutner3 = coutner3 + 1
End While
'get cmFactoryCaCertificate.txt
Dim myProcess4 As Process = New Process
Dim s4 As String
myProcess4.StartInfo.FileName = x
myProcess4.StartInfo.UseShellExecute = False
myProcess4.StartInfo.CreateNoWindow = True
myProcess4.StartInfo.RedirectStandardInput = True
myProcess4.StartInfo.RedirectStandardOutput = True
myProcess4.StartInfo.RedirectStandardError = True
myProcess4.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.53.0"
myProcess4.Start()
Dim sIn4 As StreamWriter = myProcess4.StandardInput
sIn4.AutoFlush = True
Dim sOut4 As StreamReader = myProcess4.StandardOutput
Dim sErr4 As StreamReader = myProcess4.StandardError
s4 = sOut4.ReadToEnd()
If Not myProcess4.HasExited Then
myProcess4.Kill()
End If
sIn4.Close()
sOut4.Close()
sErr4.Close()
myProcess4.Close()
Dim temp4 As String
temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
temp4 = Replace(temp4, "Hex-", "")
temp4 = Replace(temp4, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp4)
oWrite.Close()
Dim bytelist4 As String()
Dim templist4 As String
templist4 = Replace(temp4, vbCrLf, " ")
templist4 = templist4.Remove(templist4.Length - 1, 1)
templist4 = Replace(templist4, " ", ",")
templist4 = Replace(templist4, ",,", ",")
bytelist4 = Split(templist4, ",")
Dim coutner4 As Integer
coutner4 = 2
Dim countback4 As Integer = bytelist4.Length - 2
Dim countup4 As Integer = 1
Dim watchvar4 As Integer = 0
While countback4 >= 0
If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
countup4 = countup4 + 1
Else
watchvar4 = 1
End If
countback4 = countback4 - 1
End While
While coutner4 < bytelist4.Length - countup4
Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
Dim oFileStream4 As System.IO.FileStream
oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
oFileStream4.WriteByte(byteData4)
oFileStream4.Close()
coutner4 = coutner4 + 1
End While
'get cmFactoryRootCertificate.txt
Dim myProcess5 As Process = New Process
Dim s5 As String
myProcess5.StartInfo.FileName = x
myProcess5.StartInfo.UseShellExecute = False
myProcess5.StartInfo.CreateNoWindow = True
myProcess5.StartInfo.RedirectStandardInput = True
myProcess5.StartInfo.RedirectStandardOutput = True
myProcess5.StartInfo.RedirectStandardError = True
myProcess5.StartInfo.Arguments = "-v2c -O v -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.54.0"
myProcess5.Start()
Dim sIn5 As StreamWriter = myProcess5.StandardInput
sIn5.AutoFlush = True
Dim sOut5 As StreamReader = myProcess5.StandardOutput
Dim sErr5 As StreamReader = myProcess5.StandardError
s5 = sOut5.ReadToEnd()
If Not myProcess5.HasExited Then
myProcess5.Kill()
End If
sIn5.Close()
sOut5.Close()
sErr5.Close()
myProcess5.Close()
Dim temp5 As String
temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
temp5 = Replace(temp5, "Hex-", "")
temp5 = Replace(temp5, Chr(34), "")
filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
oWrite = oFile.CreateText(filedir)
oWrite.WriteLine(temp5)
oWrite.Close()
Dim bytelist5 As String()
Dim templist5 As String
templist5 = Replace(temp5, vbCrLf, " ")
templist5 = templist5.Remove(templist5.Length - 1, 1)
templist5 = Replace(templist5, " ", ",")
templist5 = Replace(templist5, ",,", ",")
bytelist5 = Split(templist5, ",")
Dim coutner5 As Integer
coutner5 = 2
Dim countback5 As Integer = bytelist5.Length - 2
Dim countup5 As Integer = 1
Dim watchvar5 As Integer = 0
While countback5 >= 0
If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
countup5 = countup5 + 1
Else
watchvar5 = 1
End If
countback5 = countback5 - 1
End While
While coutner5 < bytelist5.Length - countup5
Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
Dim oFileStream5 As System.IO.FileStream
oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
oFileStream5.WriteByte(byteData5)
oFileStream5.Close()
coutner5 = coutner5 + 1
End While
x = "C:\snmpcert\snmpset.exe"
Dim myProcess6 As Process = New Process
Dim s6 As String
myProcess6.StartInfo.FileName = x
myProcess6.StartInfo.UseShellExecute = False
myProcess6.StartInfo.CreateNoWindow = True
myProcess6.StartInfo.RedirectStandardInput = True
myProcess6.StartInfo.RedirectStandardOutput = True
myProcess6.StartInfo.RedirectStandardError = True
myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
myProcess6.Start()
Dim sIn6 As StreamWriter = myProcess6.StandardInput
sIn6.AutoFlush = True
Dim sOut6 As StreamReader = myProcess6.StandardOutput
Dim sErr6 As StreamReader = myProcess6.StandardError
s6 = sOut6.ReadToEnd()
If Not myProcess6.HasExited Then
myProcess6.Kill()
End If
sIn6.Close()
sOut6.Close()
sErr6.Close()
myProcess6.Close()
Dim myProcess7 As Process = New Process
Dim s7 As String
myProcess7.StartInfo.FileName = x
myProcess7.StartInfo.UseShellExecute = False
myProcess7.StartInfo.CreateNoWindow = True
myProcess7.StartInfo.RedirectStandardInput = True
myProcess7.StartInfo.RedirectStandardOutput = True
myProcess7.StartInfo.RedirectStandardError = True
myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
myProcess7.Start()
Dim sIn7 As StreamWriter = myProcess7.StandardInput
sIn7.AutoFlush = True
Dim sOut7 As StreamReader = myProcess7.StandardOutput
Dim sErr7 As StreamReader = myProcess7.StandardError
s7 = sOut7.ReadToEnd()
If Not myProcess7.HasExited Then
myProcess7.Kill()
End If
sIn7.Close()
sOut7.Close()
sErr7.Close()
myProcess7.Close()
Timer1.Enabled = True
Catch ex As Exception
Exit Sub
End Try
End If
End Sub
Public Function check_cannot_find_module(ByVal check As String) As Object
check = Replace(check, "Cannot find module (IP-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (IF-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (TCP-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (UDP-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMPv2-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMPv2-SMI): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (UCD-SNMP-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (UCD-DEMO-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-MPD-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)", "")
check = Replace(check, "Cannot find module (SNMPv2-TM): At line 0 in (none)", "")
Return check
End Function
Private Sub DiagnosticToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiagnosticToolStripMenuItem.Click
txtdiag.Visible = True
Timer2.Start()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
txtdiag.Text = output
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
MsgBox("version 1.4")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
''WebBrowser1.Navigate("http://192.168.100.1/bpi.html")
Dim testMsg2 As Integer
If File.Exists("C:\snmpcert\settings.ini") Then
testMsg2 = MsgBox("Would you like me to try loading last session?", vbYesNoCancel + vbQuestion, "Cert Grabber")
If testMsg2 = 6 Then
Try
Dim readFile As System.IO.TextReader = New _
StreamReader("C:\snmpcert\settings.ini")
TextBox1.Text = readFile.ReadLine
txtcommunity.Text = readFile.ReadLine
portsnmp.Text = readFile.ReadLine
readFile.Close()
readFile = Nothing
Catch ex As IOException
'' MsgBox(ex.ToString)
Exit Sub
End Try
Else
Exit Sub
End If
End If
End Sub
Private Sub HaxorwareToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HaxorwareToolStripMenuItem.Click
ListBox1.Items.Clear()
ListBox1.Visible = True
ListBox1.Items.Add("Mac ip download upload")
Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
Dim total As Integer = 0
Dim x As Integer = 0
While x < directories.Length
Dim counter() As String = Directory.GetDirectories(directories(x))
total += counter.Length
Dim y As Integer = 0
While y < counter.Length
Dim linein As String
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
oRead = oFile.OpenText(counter(y) & "\cminfo.txt")
Dim temp1(10) As String
Dim counter1 As Integer = 0
While oRead.Peek <> -1
linein = oRead.ReadLine()
temp1(counter1) = linein
temp1(counter1) = Replace(temp1(counter1), "modem's ip was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem ip was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem's download speed was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem's upload speed was:", Nothing)
If temp1(counter1) = Nothing Then
temp1(counter1) = "not avilable"
End If
counter1 += 1
End While
If temp1(5) = Nothing Then
temp1(5) = "not avilable"
End If
oRead.Close()
Dim temp As String = counter(y).Substring(counter(y).Length - 12) & " " & temp1(0).ToString & " " & temp1(4).ToString & " " & temp1(5).ToString
ListBox1.Items.Add(temp)
y += 1
End While
x += 1
End While
End Sub
Private Sub TotalModemsFoundToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalModemsFoundToolStripMenuItem.Click
Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
Dim total As Integer = 0
Dim x As Integer = 0
While x < directories.Length
Dim counter() As String = Directory.GetDirectories(directories(x))
total += counter.Length
x += 1
End While
MsgBox(total)
End Sub
Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
''WebBrowser1.Visible = True
ListBox1.Items.Clear()
ListBox1.Visible = True
ListBox1.Items.Add("Mac ip download upload")
Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
Dim total As Integer = 0
Dim x As Integer = 0
While x < directories.Length
Dim counter() As String = Directory.GetDirectories(directories(x))
total += counter.Length
Dim y As Integer = 0
While y < counter.Length
Dim linein As String
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
oRead = oFile.OpenText(counter(y) & "\cminfo.txt")
Dim temp1(10) As String
Dim counter1 As Integer = 0
While oRead.Peek <> -1
linein = oRead.ReadLine()
temp1(counter1) = linein
temp1(counter1) = Replace(temp1(counter1), "modem's ip was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem ip was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem's download speed was:", Nothing)
temp1(counter1) = Replace(temp1(counter1), "modem's upload speed was:", Nothing)
If temp1(counter1) = Nothing Then
temp1(counter1) = "not avilable"
End If
counter1 += 1
End While
If temp1(5) = Nothing Then
temp1(5) = "not avilable"
End If
oRead.Close()
Dim temp As String = counter(y).Substring(counter(y).Length - 12) & " " & temp1(0).ToString & " " & temp1(4).ToString & " " & temp1(5).ToString
ListBox1.Items.Add(temp)
y += 1
End While
x += 1
End While
End Sub
Public Shared Sub Upload(ByVal address As String, ByVal fileName As String)
Dim client As WebClient = New WebClient()
Dim uri As Uri = New Uri(address)
client.UploadFileAsync(uri, "POST", fileName)
Console.WriteLine("File upload started.")
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedIndex.ToString = Nothing Or ListBox1.SelectedIndex.ToString = -1 Or ListBox1.SelectedIndex.ToString = 0 Then
ListBox1.Visible = False
Exit Sub
End If
Dim temp As String
temp = ListBox1.SelectedItem.ToString.Substring(0, 12)
Dim filepath As String = ""
Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
Dim total As Integer = 0
Dim x As Integer = 0
While x < directories.Length
Dim counter() As String = Directory.GetDirectories(directories(x))
total += counter.Length
Dim y As Integer = 0
While y < counter.Length
If temp = counter(y).Substring(counter(y).Length - 12) Then
filepath = counter(y).ToString
If MessageBox.Show("Are you sure you want to upload " & temp & "to modem? ", "Comfirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
ListBox1.Items.Clear()
ListBox1.Visible = False
Exit Sub
ElseIf (Windows.Forms.DialogResult.Yes) Then
Try
Upload("http://192.168.100.1/bpi_public.cgi", filepath.ToString & "\Public.Key")
Upload("http://192.168.100.1/bpi_private.cgi", filepath.ToString & "\private.Key")
Upload("http://192.168.100.1/plus_root.cgi", filepath.ToString & "\root.Key")
Upload("http://192.168.100.1/plus_cm.cgi", filepath.ToString & "\CM.cer")
Upload("http://192.168.100.1/plus_ca.cgi", filepath.ToString & "\ca.cer")
MsgBox("done please goto http://192.168.100.1/addresses.html" & vbCrLf & " hit copy from cert then hit save and reboot." & vbCrLf & "also please make shure bpi+ is enable under http://192.168.100.1/bpi.html")
ListBox1.Items.Clear()
ListBox1.Visible = False
Catch ex As Exception
MsgBox("Something went wrong" & vbCrLf & ex.ToString)
ListBox1.Items.Clear()
ListBox1.Visible = False
End Try
End If
End If
y += 1
End While
x += 1
End While
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
MsgBox("you found me")
End Sub
End Class