Advertisement
Guest User

gatherNetworkInfo.vbs

a guest
Nov 27th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 39.77 KB | None | 0 0
  1. Script I found on an infected computer.
  2. Location: \Microsoft\Windows\NetTrace\GatherNetworkInfo         c:\windows\system32\gathernetworkinfo.vbs   6/10/2009 4:19 PM
  3.  
  4. Script:
  5.  
  6. Dim FSO, shell, xslProcessor
  7.  
  8. Sub RunCmd(CommandString, OutputFile)
  9.     cmd = "cmd /c " + CommandString + " >> " + OutputFile
  10.     shell.Run cmd, 0, True
  11. End Sub
  12.  
  13. Sub GetOSInfo(outputFileName)
  14.     On Error Resume Next
  15.     strComputer = "."
  16.     HKEY_LOCAL_MACHINE = &H80000002
  17.  
  18.     Dim objReg, outputFile
  19.     Dim buildDetailNames, buildDetailRegValNames
  20.  
  21.     buildDetailNames = Array("Product Name", "Version", "Build Lab", "Type")
  22.     buildDetailRegValNames = Array("ProductName", "CurrentVersion", "BuildLabEx", "CurrentType")
  23.  
  24.     Set outputFile = FSO.OpenTextFile(outputFileName, 2, True)
  25.  
  26.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  27.                      strComputer & "\root\default:StdRegProv")
  28.  
  29.     outputFile.WriteLine("[Architecture/Processor Information]")
  30.     outputFile.WriteLine()
  31.     outputFile.Close
  32.     cmd = "cmd /c set processor >> " & outputFileName
  33.     shell.Run cmd, 0, True
  34.  
  35.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  36.  
  37.     outputFile.WriteLine()
  38.     outputFile.WriteLine("[Operating System Information]")
  39.     outputFile.WriteLine()
  40.  
  41.     strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
  42.     for I = 0 to UBound(buildDetailNames)
  43.         objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, buildDetailRegValNames(I), info
  44.         outputFile.WriteLine(buildDetailNames(I) + " = " + info)
  45.     Next
  46.  
  47.     outputFile.WriteLine()
  48.     strKeyPath = "SYSTEM\SETUP"
  49.     objReg.GetDWordValue HKEY_LOCAL_MACHINE, strKeyPath, "Upgrade", upgradeInfo
  50.     if IsNull(upgradeInfo) Then
  51.         outputFile.WriteLine("This is a clean installed system")
  52.     Else
  53.         outputFile.WriteLine("This is an upgraded system")
  54.     End If
  55.  
  56.     outputFile.WriteLine(buildDetailNames(I) + " = " + info)
  57.  
  58.     outputFile.WriteLine()
  59.     outputFile.WriteLine("[File versions]")
  60.     outputFile.WriteLine()
  61.  
  62.     Set shell = WScript.CreateObject( "WScript.Shell" )
  63.     windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  64.  
  65.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  66.  
  67.     Dim FileSet
  68.     FileSet = Array("onex.dll", "l2nacp.dll", "wlanapi.dll", "wlancfg.dll", "wlanconn.dll", "wlandlg.dll", "wlanext.exe", "wlangpui.dll", "wlanhc.dll", "wlanhlp.dll", "wlaninst.dll", "wlanmm.dll", "wlanmmhc.dll", "wlanmsm.dll", "wlanpref.dll", "wlansec.dll", "wlansvc.dll", "wlanui.dll")
  69.  
  70.     For Each file in FileSet
  71.         filename = windir + file
  72.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  73.         Set fileProp = objWMIService.ExecQuery _
  74.             (strQuery)
  75.  
  76.         For Each objFile in fileProp
  77.             outputFile.WriteLine(file + "    " + objFile.Version)
  78.         Next
  79.     Next
  80.  
  81.     Dim Dot3FileSet
  82.     Dot3FileSet = Array("onex.dll", "dot3api.dll", "dot3cfg.dll", "dot3dlg.dll", "dot3gpclnt.dll", "dot3gpui.dll", "dot3msm.dll", "dot3svc.dll", "dot3ui.dll")
  83.  
  84.     For Each file in Dot3FileSet
  85.         filename = windir + file
  86.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  87.         Set fileProp = objWMIService.ExecQuery _
  88.             (strQuery)
  89.  
  90.         For Each objFile in fileProp
  91.             outputFile.WriteLine(file + "    " + objFile.Version)
  92.         Next
  93.     Next
  94.  
  95.     call GetBatteryInfo(outputFile)
  96.     outputFile.Close
  97.  
  98.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  99.     outputFile.WriteLine("")
  100.     outputFile.WriteLine("[System Information]")
  101.     outputFile.WriteLine("")
  102.     outputFile.Close
  103.  
  104.     'Comments: Dumping System Information using "systeminfo" command
  105.  
  106.     cmd = "cmd /c systeminfo >> " & outputFileName
  107.     shell.Run cmd, 0, True
  108.  
  109.     Set outputFile = FSO.OpenTextFile(outputFileName, 8, True)
  110.     outputFile.WriteLine("")
  111.     outputFile.WriteLine("[User Information]")
  112.     outputFile.WriteLine("")
  113.     outputFile.Close
  114.  
  115.     cmd = "cmd /c set u >> " & outputFileName
  116.     shell.Run cmd, 0, True
  117.  
  118. End Sub
  119.  
  120. Sub GetBatteryInfo(outputFile)
  121.     On Error Resume Next
  122.     strComputer = "."
  123.     outputFile.WriteLine()
  124.     outputFile.WriteLine("[Power Information]")
  125.     outputFile.WriteLine()
  126.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  127.     Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")
  128.     if colItems.Count = 0 Then
  129.     outputFile.WriteLine("It is a Desktop running on AC")
  130.     Else
  131.     For Each objItem in colItems
  132.         if objItem.Availability = 2 Then
  133.         outputFile.WriteLine("Machine is running on AC Adapter")
  134.         Else
  135.         if objitem.Availability = 3 Then
  136.         outputFile.WriteLine("Machine is running on Battery")
  137.         End If
  138.         End If
  139.     Next
  140.     End If
  141. End Sub
  142.  
  143.  
  144.  
  145. Sub GetWcnInfo(outputFileName)
  146.     On Error Resume Next
  147.     Dim WcnInfoFile
  148.  
  149.     Set WcnInfoFile= FSO.OpenTextFile(outputFileName, 8, True)
  150.     WcnInfoFile.WriteLine("-------------------------------------")
  151.     WcnInfoFile.WriteLine("---------+ WCN Information +---------")    
  152.     WcnInfoFile.WriteLine("-------------------------------------")    
  153.     WcnInfoFile.WriteLine("")
  154.     WcnInfoFile.WriteLine("")
  155.     WcnInfoFile.WriteLine("-----------------")
  156.     WcnInfoFile.WriteLine("+ Services Status")
  157.     WcnInfoFile.WriteLine("-----------------")
  158.     WcnInfoFile.WriteLine("")
  159.     WcnInfoFile.Close
  160.  
  161.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  162.  
  163.     cmd = "cmd /c sc query wcncsvc  >> " & outputFileName
  164.     objShell.Run cmd, 0, True
  165.  
  166.     cmd = "cmd /c sc query wlansvc  >> " & outputFileName
  167.     objShell.Run cmd, 0, True
  168.  
  169.     cmd = "cmd /c sc query eaphost  >> " & outputFileName
  170.     objShell.Run cmd, 0, True
  171.  
  172.     cmd = "cmd /c sc query fdrespub  >> " & outputFileName
  173.     objShell.Run cmd, 0, True
  174.  
  175.     cmd = "cmd /c sc query upnphost   >> " & outputFileName
  176.     objShell.Run cmd, 0, True
  177.  
  178.     cmd = "cmd /c sc query eaphost  >> " & outputFileName
  179.     objShell.Run cmd, 0, True
  180.  
  181.  
  182.     Set WcnInfoFile= FSO.OpenTextFile(outputFileName, 8, True)
  183.     WcnInfoFile.WriteLine("")
  184.     WcnInfoFile.WriteLine("")
  185.     WcnInfoFile.WriteLine("-----------------------")
  186.     WcnInfoFile.WriteLine("+ WCN Files Information ")
  187.     WcnInfoFile.WriteLine("-----------------------")
  188.     WcnInfoFile.WriteLine("")
  189.  
  190.     strComputer = "."
  191.  
  192.     Set shell = WScript.CreateObject( "WScript.Shell" )
  193.     windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  194.  
  195.     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  196.  
  197.     Dim FileSet
  198.     FileSet = Array("wcncsvc.dll", "wcnapi.dll", "fdwcn.dll", "wcneapauthproxy.dll", "wcneappeerproxy.dll", "wcnwiz.dll", "wcnnetsh.dll", "wczdlg.dll")
  199.  
  200.     For Each file in FileSet
  201.         filename = windir + file
  202.         strQuery = "Select * from CIM_Datafile Where Name = '" + Replace(filename, "\", "\\") + "'"
  203.         Set fileProp = objWMIService.ExecQuery _
  204.             (strQuery)
  205.  
  206.         For Each objFile in fileProp
  207.         WcnInfoFile.WriteLine("")
  208.         WcnInfoFile.WriteLine("---------------------")
  209.         WcnInfoFile.WriteLine(file)
  210.         WcnInfoFile.WriteLine("---------------------")
  211.         WcnInfoFile.WriteLine(" - Version       :   " + objFile.Version )
  212.         WcnInfoFile.WriteLine(" - Creation Date     :   " + objFile.CreationDate  )
  213.         WcnInfoFile.WriteLine(" - Description       :   " + objFile.Description  )
  214.         WcnInfoFile.WriteLine(" - Installation Date :   " +  objFile.InstallDate )
  215.         WcnInfoFile.WriteLine(" - In Use Count      :   " + objFile.InUseCount   )
  216.         WcnInfoFile.WriteLine(" - Last Accessed     :   " + objFile.LastAccessed  )
  217.         WcnInfoFile.WriteLine(" - Last Modified     :   " + objFile.LastModified  )
  218.         WcnInfoFile.WriteLine(" - Status        :   " + objFile.Status  )
  219.         Next
  220.     Next
  221.  
  222.  
  223.  
  224.  
  225.     WcnInfoFile.WriteLine("")
  226.     WcnInfoFile.WriteLine("")
  227.     WcnInfoFile.WriteLine("-------------------------------")
  228.     WcnInfoFile.WriteLine("+ Network Adapters Information ")
  229.     WcnInfoFile.WriteLine("-------------------------------")
  230.     WcnInfoFile.WriteLine("")
  231.  
  232.     strQuery = "Select * from Win32_NetworkAdapter "
  233.    
  234.     Set AdapterProp = objWMIService.ExecQuery _
  235.             (strQuery)
  236.  
  237.  
  238.     For Each objFile in AdapterProp
  239.         WcnInfoFile.WriteLine("")
  240.     WcnInfoFile.WriteLine("---------------------")
  241.     WcnInfoFile.WriteLine("DeviceID  :  " + objFile.DeviceID   )
  242.     WcnInfoFile.WriteLine("---------------------")
  243.     WcnInfoFile.WriteLine(" - Adapter Type      :   " + objFile.AdapterType  )
  244.     WcnInfoFile.WriteLine(" - Auto Sense            :   " + objFile.AutoSense )
  245.     WcnInfoFile.WriteLine(" - Description       :   " + objFile.Description   )
  246.     WcnInfoFile.WriteLine(" - NetConnectionID   :   " + objFile.NetConnectionID   )
  247.     WcnInfoFile.WriteLine(" - GUID          :   " + objFile.GUID )
  248.     WcnInfoFile.WriteLine(" - MACAddress        :   " + objFile.MACAddress  )
  249.     WcnInfoFile.WriteLine(" - Manufacturer      :   " + objFile.Manufacturer   )
  250.     WcnInfoFile.WriteLine(" - MaxSpeed      :   " + objFile.MaxSpeed    )
  251.     WcnInfoFile.WriteLine(" - Speed             :   " +  objFile.Speed    )
  252.     WcnInfoFile.WriteLine(" - Name          :   " + objFile.Name     )
  253.    
  254.     Select Case objFile.NetConnectionStatus
  255.         Case 0    strAvail= "Disconnected"             
  256.         Case 1    strAvail= "Connecting"
  257.         Case 2  strAvail= "Connected"
  258.         Case 3  strAvail= "Disconnecting"
  259.         Case 4  strAvail= "Hardware not present"
  260.         Case 5  strAvail= "Hardware disabled"
  261.             Case 6  strAvail= "Hardware malfunction"               
  262.         Case 7  strAvail= "Media disconnected"
  263.             Case 8  strAvail= "Authenticating"
  264.             Case 9  strAvail= "Authentication succeeded"
  265.             Case 10     strAvail= "Authentication failed"
  266.             Case 11     strAvail= "Invalid address"            
  267.             Case 12 strAvail= "Credentials required"
  268.     End Select
  269.  
  270.  
  271.     WcnInfoFile.WriteLine(" - NetConnectionStatus   :   " + strAvail )
  272.     WcnInfoFile.WriteLine(" - NetEnabled    :   " +  objFile.NetEnabled  )
  273.     WcnInfoFile.WriteLine(" - NetworkAddresses      :   " +  objFile.NetworkAddresses  )
  274.     WcnInfoFile.WriteLine(" - PermanentAddress      :   " +  objFile.PermanentAddress   )
  275.     WcnInfoFile.WriteLine(" - PhysicalAdapter       :   " +  objFile.PhysicalAdapter   )
  276.     WcnInfoFile.WriteLine(" - PNPDeviceID       :   " +  objFile.PNPDeviceID    )
  277.     WcnInfoFile.WriteLine(" - ProductName       :   " +  objFile.ProductName     )
  278.     WcnInfoFile.WriteLine(" - ServiceName           :   " +  objFile.ServiceName      )
  279.  
  280.     WcnInfoFile.WriteLine(" - SystemName        :   " + objFile.SystemName       )
  281.     WcnInfoFile.WriteLine(" - TimeOfLastReset   :   " + objFile.TimeOfLastReset )
  282.     WcnInfoFile.WriteLine(" - Status        :   " + objFile.Status      )
  283.  
  284.     Select Case objFile.StatusInfo  
  285.         Case 1    strAvail= "Other"
  286.         Case 2  strAvail= "Unknown"
  287.         Case 3  strAvail= "Enabled"
  288.         Case 4  strAvail= "Disabled"
  289.         Case 5  strAvail= "Not Applicable"
  290.         End Select
  291.        
  292.     WcnInfoFile.WriteLine(" - StatusInfo        :   " + strAvail )
  293.        
  294.        Select Case objFile.Availability
  295.         Case 1    strAvail= "Other"
  296.         Case 2  strAvail= "Unknown"
  297.             Case 3  strAvail= "Running or Full Power"
  298.             Case 4  strAvail= "Warning"
  299.         Case 5  strAvail= "In test"
  300.             Case 6  strAvail= "Not Applicable"
  301.             Case 7  strAvail= "Power Off"
  302.             Case 8  strAvail= "Off Line"
  303.             Case 9  strAvail= "Off Duty"
  304.             Case 10     strAvail= "Degraded"
  305.             Case 11     strAvail= "Not Installed"
  306.             Case 12 strAvail= "Install Error"
  307.             Case 13     strAvail= "Power Save - Unknown"
  308.             Case 14     strAvail= "Power Save - Low Power Mode"
  309.             Case 15     strAvail= "Power Save - Standby"
  310.             Case 16     strAvail= "Power Cycle"
  311.             Case 17     strAvail= "Power Save - Warning"
  312.     End Select
  313.  
  314.     WcnInfoFile.WriteLine(" - Availability      :   " + strAvail ) 
  315.     WcnInfoFile.WriteLine(" - Caption       :   " +  objFile.Caption ) 
  316.  
  317.        Select Case objFile.ConfigManagerErrorCode
  318.             Case 0    strAvail= "Device is working properly"
  319.             Case 1  strAvail= "Device is not configured correctly"
  320.             Case 2  strAvail= "Windows cannot load the driver for this device"
  321.             Case 3  strAvail= "Driver for this device might be corrupted, or the system may be low on memory or other resources"       
  322.             Case 4  strAvail= "Device is not working properly. One of its drivers or the registry might be corrupted."
  323.             Case 5  strAvail= "Driver for the device requires a resource that Windows cannot manage."
  324.             Case 6  strAvail= "Boot configuration for the device conflicts with other devices"
  325.             Case 7  strAvail= "Cannot filter"
  326.             Case 8  strAvail= "Driver loader for the device is missing"
  327.             Case 9  strAvail= "Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device"
  328.             Case 10     strAvail= "Device cannot start"
  329.             Case 11  strAvail= "Device failed"
  330.             Case 12 strAvail= "Device cannot find enough free resources to use"
  331.             Case 13 strAvail= "Windows cannot verify the device's resources"
  332.             Case 14 strAvail= "Device cannot work properly until the computer is restarted"
  333.             Case 15 strAvail= "Device is not working properly due to a possible re-enumeration problem"
  334.             Case 16 strAvail= "Windows cannot identify all of the resources that the device uses"
  335.             Case 17 strAvail= "Device is requesting an unknown resource type."
  336.             Case 18 strAvail= "Device drivers must be reinstalled"
  337.             Case 19 strAvail= "Failure using the VxD loader"
  338.             Case 20 strAvail= "Registry might be corrupted."
  339.         Case 21 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device"
  340.         Case 22 strAvail= "Device is disabled"
  341.         Case 23 strAvail= "System failure. If changing the device driver is ineffective, see the hardware documentation"
  342.         Case 24 strAvail= "Device is not present, not working properly, or does not have all of its drivers installed."
  343.         Case 25 strAvail= "Windows is still setting up the device"
  344.         Case 27 strAvail= "Device does not have valid log configuration."
  345.         Case 28 strAvail= "Device drivers are not installed."
  346.         Case 29 strAvail= "Device is disabled. The device firmware did not provide the required resources."
  347.         Case 30 strAvail= "Device is using an IRQ resource that another device is using."
  348.         Case 31 strAvail= "Device is not working properly. Windows cannot load the required device drivers."           
  349.     End Select
  350.  
  351.     WcnInfoFile.WriteLine(" - ConfigManagerErrorCode:   " + strAvail )
  352.     WcnInfoFile.WriteLine(" - Error Cleared     :   " + objFile.ErrorCleared )
  353.     WcnInfoFile.WriteLine(" - Error Description     :   " + objFile.ErrorDescription)
  354.     WcnInfoFile.WriteLine(" - LastErrorCode     :   " + objFile.LastErrorCode)
  355.     WcnInfoFile.WriteLine(" - Index         :   " + objFile.Index)
  356.     WcnInfoFile.WriteLine(" - Installed     :   " + objFile.Installed  )
  357.     WcnInfoFile.WriteLine(" - Install Date      :   " + objFile.InstallDate   )            
  358.     WcnInfoFile.WriteLine(" - InterfaceIndex    :   " + objFile.InterfaceIndex )   
  359.     Next
  360.     WcnInfoFile.Close
  361.  
  362.  
  363.  
  364.  
  365.  
  366.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  367.     WcnInfoFile.WriteLine("")
  368.     WcnInfoFile.WriteLine("-----------------------")
  369.     WcnInfoFile.WriteLine("+ ipconfig information")
  370.     WcnInfoFile.WriteLine("-----------------------")
  371.     WcnInfoFile.WriteLine("")
  372.     WcnInfoFile.Close
  373.  
  374.  
  375.     cmd = "cmd /c ipconfig /all >> " & outputFileName
  376.     objShell.Run cmd, 0, True
  377.  
  378.  
  379.  
  380.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  381.     WcnInfoFile.WriteLine("")    
  382.     WcnInfoFile.WriteLine("----------------------")
  383.     WcnInfoFile.WriteLine("+ Softap Capabilities ")
  384.     WcnInfoFile.WriteLine("----------------------")
  385.     WcnInfoFile.WriteLine("")
  386.     WcnInfoFile.Close
  387.  
  388.     cmd = "cmd /c netsh wlan show device >> " & outputFileName
  389.     objShell.Run cmd, 0, True
  390.  
  391.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  392.     WcnInfoFile.WriteLine("")    
  393.     WcnInfoFile.WriteLine("----------------------")
  394.     WcnInfoFile.WriteLine("+ Dump wcncsvc RegKey ")
  395.     WcnInfoFile.WriteLine("----------------------")
  396.     WcnInfoFile.WriteLine("")
  397.     WcnInfoFile.Close
  398.  
  399.     cmd = "cmd /c reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wcncsvc\Parameters >> " & outputFileName
  400.     objShell.Run cmd, 0, True
  401.  
  402.  
  403.  
  404. '    Set shell = WScript.CreateObject( "WScript.Shell" )
  405. '    windir = shell.ExpandEnvironmentStrings("%windir%\system32\")
  406. '    filename = windir + "wcnwiz.dll"
  407. '    commandname = windir + "rundll32.exe"
  408.  
  409. '    cmd = "cmd /c "& commandname &" "& filename &" , RunDumpWcnCache >> " & outputFileName
  410. '    objShell.Run cmd, 0, True
  411.  
  412.  
  413.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  414.     WcnInfoFile.WriteLine("")    
  415.     WcnInfoFile.WriteLine("--------------------------------")
  416.     WcnInfoFile.WriteLine("+ Network Discovery Information.")
  417.     WcnInfoFile.WriteLine("--------------------------------")
  418.     WcnInfoFile.WriteLine("")
  419.     WcnInfoFile.WriteLine("")
  420.     WcnInfoFile.WriteLine("------------------------------")    
  421.     WcnInfoFile.WriteLine("- Current Profile information")
  422.     WcnInfoFile.WriteLine("------------------------------")    
  423.     WcnInfoFile.WriteLine("")
  424.  
  425.     ' Profile Type
  426.    Const NET_FW_PROFILE2_DOMAIN = 1
  427.     Const NET_FW_PROFILE2_PRIVATE = 2
  428.     Const NET_FW_PROFILE2_PUBLIC = 4
  429.  
  430.     ' Direction  
  431.    Const NET_FW_RULE_DIR_IN = 1
  432.     Const NET_FW_RULE_DIR_OUT = 2
  433.  
  434.  
  435.     ' Create the FwPolicy2 object.
  436.    Dim fwPolicy2    
  437.     Dim ProfileType
  438.     ProfileType = Array("Domain", "Private", "Public")
  439.  
  440.     Set fwPolicy2 = CreateObject("HNetCfg.FwPolicy2")
  441.  
  442.     CurrentProfile = fwPolicy2.CurrentProfileTypes
  443.  
  444.     WcnInfoFile.WriteLine ("Current firewall profile is: ")
  445.  
  446.     '// The returned 'CurrentProfiles' bitmask can have more than 1 bit set if multiple profiles
  447.    '//   are active or current at the same time
  448.  
  449.     if ( CurrentProfile AND NET_FW_PROFILE2_DOMAIN ) then
  450.         WcnInfoFile.WriteLine(ProfileType(0))
  451.     end if
  452.  
  453.     if ( CurrentProfile AND NET_FW_PROFILE2_PRIVATE ) then
  454.     WcnInfoFile.WriteLine(ProfileType(1))
  455.     end if
  456.  
  457.     if ( CurrentProfile AND NET_FW_PROFILE2_PUBLIC ) then
  458.     WcnInfoFile.WriteLine(ProfileType(2))
  459.     end if
  460.     WcnInfoFile.Close
  461.  
  462.  
  463.     cmd = "cmd /c netsh advfirewall show currentprofile >> " & outputFileName
  464.     objShell.Run cmd, 0, True
  465.  
  466.  
  467.     Set WcnInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  468.     WcnInfoFile.WriteLine("")
  469.     WcnInfoFile.WriteLine("----------------------------------------------")    
  470.     WcnInfoFile.WriteLine("- Network discovery status for current profile")
  471.     WcnInfoFile.WriteLine("----------------------------------------------")    
  472.     WcnInfoFile.WriteLine("")              
  473.  
  474.     Dim rule
  475.     ' Get the Rules object
  476.    Dim RulesObject
  477.     Set RulesObject = fwPolicy2.Rules
  478.  
  479.    
  480.     For Each rule In Rulesobject
  481.         if rule.Grouping = "@FirewallAPI.dll,-32752" then
  482.             WcnInfoFile.WriteLine("")
  483.             WcnInfoFile.WriteLine("  Rule Name:          " & rule.Name)
  484.             WcnInfoFile.WriteLine("   ----------------------------------------------")
  485.             WcnInfoFile.WriteLine("  Enabled:            " & rule.Enabled)
  486.             WcnInfoFile.WriteLine("  Description:        " & rule.Description)
  487.             WcnInfoFile.WriteLine("  Application Name:   " & rule.ApplicationName)
  488.             WcnInfoFile.WriteLine("  Service Name:       " & rule.ServiceName)
  489.  
  490.         Select Case rule.Direction
  491.                 Case NET_FW_RULE_DIR_IN  WcnInfoFile.WriteLine("  Direction:          In")
  492.              Case NET_FW_RULE_DIR_OUT WcnInfoFile.WriteLine("  Direction:          Out")
  493.             End Select
  494.    
  495.     end if
  496.     Next
  497.  
  498.     WcnInfoFile.Close
  499.  
  500.    
  501.    
  502. End Sub
  503.  
  504.  
  505.  
  506. Sub GetWirelessAdapterInfo(outputFile)
  507.     On Error Resume Next
  508.     Dim adapters, objReg
  509.     Dim adapterDetailNames, adapterDetailRegValNames
  510.  
  511.     adapterDetailNames = Array("Driver Description", "Adapter Guid", "Hardware ID", "Driver Date", "Driver Version", "Driver Provider")
  512.     adapterDetailRegValNames = Array("DriverDesc", "NetCfgInstanceId", "MatchingDeviceId", "DriverDate", "DriverVersion", "ProviderName")
  513.  
  514.     IHVDetailNames = Array("ExtensibilityDLL", "UIExtensibilityCLSID", "GroupName", "DiagnosticsID")
  515.     IHVDetailRegValNames = Array("ExtensibilityDLL", "UIExtensibilityCLSID", "GroupName", "DiagnosticsID")
  516.  
  517.     HKEY_LOCAL_MACHINE = &H80000002
  518.     strComputer = "."
  519.  
  520.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  521.                      strComputer & "\root\default:StdRegProv")
  522.  
  523.  
  524.     strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
  525.  
  526.     objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, adapterSet
  527.  
  528.     For Each adapter In adapterSet
  529.         If StrComp("Properties", adapter) Then
  530.             fullstrKeyPath = strKeyPath + adapter
  531.             objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
  532.             If ifType = 71 Then
  533.                 for I = 0 to UBound(adapterDetailNames)
  534.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
  535.                     outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
  536.                 Next
  537.  
  538.                 ihvKeyPath = fullstrKeyPath + "\Ndi\IHVExtensions"
  539.                 For J = 0 to UBound(IHVDetailNames)
  540.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, ihvKeyPath, IHVDetailRegValNames(J), ihvInfo
  541.                     outputFile.WriteLine(IHVDetailNames(J) + " = " + ihvInfo)
  542.                 Next
  543.                     objReg.GetDWordValue HKEY_LOCAL_MACHINE, ihvKeyPath, "AdapterOUI", ihvInfo
  544.                     outputFile.WriteLine("AdapterOUI = " + CSTR(ihvInfo))
  545.                 outputFile.WriteLine()
  546.             End If
  547.         End If
  548.     Next
  549.  
  550.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  551.  
  552.     tempFile = "tempfile.txt"
  553.     cmd = "cmd /c tasklist > " & tempFile
  554.     objShell.Run cmd, 0, True
  555.  
  556.     Set objTextFile = FSO.OpenTextFile(tempFile, 1)
  557.     strIHVOutput = objTextFile.ReadAll()
  558.  
  559.     Set regEx = New RegExp
  560.     regEx.Pattern = "^wlanext.exe[\s|a-z|A-Z|\d]*"
  561.     regEx.Multiline = True
  562.     regEx.IgnoreCase = True
  563.     regEx.Global = True
  564.  
  565.     Set Matches = regEx.Execute(strIHVOutput)
  566.  
  567.     For Each match in Matches
  568.         outputFile.WriteLine(match.Value)
  569.     Next
  570.  
  571. End Sub
  572.  
  573. Sub GetWirelessAutoconfigLog(logFileName)
  574.     On Error Resume Next
  575.  
  576.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  577.  
  578.     'Export the operational log
  579.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-WLAN-AutoConfig/Operational"" " & logFileName
  580.     objShell.Run cmd, 0, True  
  581.  
  582.     'Archive the log so that it can be read on different machines
  583.    cmd = "cmd /c wevtutil al " & logFileName
  584.     objShell.Run cmd, 0, True  
  585. End Sub
  586.  
  587. Sub GetWiredAdapterInfo(outputFile)
  588.     On Error Resume Next
  589.     Dim adapters, objReg
  590.     Dim adapterDetailNames, adapterDetailRegValNames
  591.  
  592.     adapterDetailNames = Array("Driver Description", "Adapter Guid", "Hardware ID", "Driver Date", "Driver Version", "Driver Provider")
  593.     adapterDetailRegValNames = Array("DriverDesc", "NetCfgInstanceId", "MatchingDeviceId", "DriverDate", "DriverVersion", "ProviderName")
  594.  
  595.  
  596.     HKEY_LOCAL_MACHINE = &H80000002
  597.     strComputer = "."
  598.  
  599.     Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
  600.                      strComputer & "\root\default:StdRegProv")
  601.  
  602.  
  603.     strKeyPath = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\"
  604.  
  605.     objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, adapterSet
  606.  
  607.     For Each adapter In adapterSet
  608.         If StrComp("Properties", adapter) Then
  609.             fullstrKeyPath = strKeyPath + adapter
  610.             objReg.GetDWORDValue HKEY_LOCAL_MACHINE, fullstrKeyPath, "*IfType", ifType
  611.             If ifType = 6 Then
  612.                 for I = 0 to UBound(adapterDetailNames)
  613.                     objReg.GetStringValue HKEY_LOCAL_MACHINE, fullstrKeyPath, adapterDetailRegValNames(I), info
  614.                     outputFile.WriteLine(adapterDetailNames(I) + " = " + info)
  615.                 Next
  616.                 outputFile.WriteLine()
  617.             End If
  618.         End If
  619.     Next
  620. End Sub
  621.  
  622.  
  623. Sub GetEnvironmentInfo(outputFileName)
  624.     On Error Resume Next
  625.     Dim envInfoFile
  626.  
  627.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  628.  
  629.     cmd = "cmd /c netsh wlan show all > " & outputFileName
  630.     objShell.Run cmd, 0, True
  631.  
  632.     cmd = "cmd /c netsh lan show interfaces >> " & outputFileName
  633.     objShell.Run cmd, 0, True
  634.  
  635.     cmd = "cmd /c netsh lan show settings >> " & outputFileName
  636.     objShell.Run cmd, 0, True
  637.  
  638.     cmd = "cmd /c netsh lan show profiles >> " & outputFileName
  639.     objShell.Run cmd, 0, True
  640.  
  641.     cmd = "cmd /c ipconfig /all >> " & outputFileName
  642.     objShell.Run cmd, 0, True
  643.  
  644.     RunCmd "echo.", outputFileName
  645.     RunCmd "echo ROUTE PRINT:", outputFileName
  646.     RunCmd "route print", outputFileName
  647.    
  648.     Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  649.     envInfoFile.WriteLine("")
  650.     envInfoFile.WriteLine("Machine certificates...")
  651.     envInfoFile.WriteLine("")
  652.     envInfoFile.Close
  653.  
  654.     cmd = "cmd /c certutil -v -store -silent My >> " & outputFileName
  655.     objShell.Run cmd, 0, True
  656.  
  657.     Set envInfoFile = FSO.OpenTextFile(outputFileName, 8, True)
  658.     envInfoFile.WriteLine("")
  659.     envInfoFile.WriteLine("User certificates...")
  660.     envInfoFile.WriteLine("")
  661.     envInfoFile.Close
  662.  
  663.     cmd = "cmd /c certutil -v -store -silent -user My >> " & outputFileName
  664.     objShell.Run cmd, 0, True
  665. End Sub
  666.  
  667. 'Comments: Function to dump a tree under a registry path into a file
  668. Sub DumpRegKey(outputFileName,regpath)
  669.     On Error Resume Next
  670.     Dim cmd
  671.  
  672.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  673.  
  674.     cmd = "cmd /c reg export " & regpath & "  " & outputFileName & " /y"
  675.     objShell.Run cmd, 0, True
  676.  
  677. End Sub
  678.  
  679. Sub DumpAllKeys
  680.     On Error Resume Next
  681.     Dim NotifRegFile, RegFolder, Key
  682.  
  683.     RegFolder = "Reg"
  684.  
  685.     if Not FSO.FolderExists(RegFolder) Then
  686.        FSO.CreateFolder RegFolder
  687.     End If
  688.  
  689.     ' Dump WLAN registry keys
  690.    AllCredRegFile = RegFolder + "\AllCred.reg.txt"
  691.     AllCredFilterFile = RegFolder + "\AllCredFilter.reg.txt"
  692.     CredRegFileA = RegFolder + "\{07AA0886-CC8D-4e19-A410-1C75AF686E62}.reg.txt"
  693.     CredRegFileB = RegFolder + "\{33c86cd6-705f-4ba1-9adb-67070b837775}.reg.txt"
  694.     CredRegFileC = RegFolder + "\{edd749de-2ef1-4a80-98d1-81f20e6df58e}.reg.txt"
  695.     APIPermRegFile = RegFolder + "\APIPerm.reg.txt"
  696.     NotifRegFile = RegFolder + "\Notif.reg.txt"
  697.     GPTRegFile = RegFolder + "\GPT.reg.txt"
  698.     CUWlanSvcRegFile = RegFolder + "\HKCUWlanSvc.reg.txt"
  699.     LMWlanSvcRegFile = RegFolder + "\HKLMWlanSvc.reg.txt"
  700.     NidRegFile = RegFolder + "\NetworkProfiles.reg.txt"
  701.  
  702.     call DumpRegKey(NotifRegFile ,"""HKLM\SYSTEM\CurrentControlSet\Control\Winlogon\Notifications""")
  703.     call DumpRegKey(AllCredRegFile ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers""")
  704.     call DumpRegKey(AllCredFilterFile,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters""")
  705.     call DumpRegKey(CredRegFileA ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{07AA0886-CC8D-4e19-A410-1C75AF686E62}""")
  706.     call DumpRegKey(CredRegFileB ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Providers\{33c86cd6-705f-4ba1-9adb-67070b837775}""")
  707.     call DumpRegKey(CredRegFileC ,"""HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\Credential Provider Filters\{edd749de-2ef1-4a80-98d1-81f20e6df58e}""")
  708.     call DumpRegKey(APIPermRegFile ,"""HKLM\SYSTEM\CurrentControlSet\Services\Wlansvc\Parameters\WlanAPIPermissions""")
  709.  
  710.     call DumpRegKey(GPTRegFile , """HKLM\SOFTWARE\Policies\Microsoft\Windows\Wireless\GPTWirelessPolicy""")
  711.     call DumpRegKey(CUWlanSvcRegFile ,"""HKCU\SOFTWARE\Microsoft\Wlansvc""")
  712.     call DumpRegKey(LMWlanSvcRegFile ,"""HKLM\SOFTWARE\Microsoft\Wlansvc""")
  713.  
  714.     ' Dump Dot3 registry keys
  715.    LMDot3SvcRegFile = RegFolder + "\HKLMDot3Svc.reg.txt"
  716.     CUDot3SvcRegFile = RegFolder + "\HKCUDot3Svc.reg.txt"
  717.     LGPPolicyFile  = RegFolder + "\L2GP.reg.txt"
  718.  
  719.     call DumpRegKey(LMDot3SvcRegFile ,"""HKLM\SOFTWARE\Microsoft\dot3svc""")
  720.     call DumpRegKey(CUDot3SvcRegFile ,"""HKCU\SOFTWARE\Microsoft\dot3svc""")
  721.     call DumpRegKey(LGPPolicyFile  ,"""HKLM\SOFTWARE\Policies\Microsoft\Windows\WiredL2\GP_Policy""")
  722.  
  723.     call DumpRegKey(NidRegFile  ,"""HKLM\SOFTWARE\MICROSOFT\Windows NT\CurrentVersion\NetworkList""")
  724.    
  725. End Sub
  726.  
  727. ' Dump Winsock LSP catalog
  728. Sub DumpWinsockCatalog(outputFileName)
  729.     On Error Resume Next
  730.     Dim envInfoFile
  731.  
  732.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  733.  
  734.     cmd = "cmd /c netsh winsock show catalog > " & outputFileName
  735.     objShell.Run cmd, 0, True
  736. End Sub
  737.  
  738. ' Dump the Windows Firewall Configuration
  739. Sub GetWindowsFirewallInfo(configFileName, logFileName, effectiveRulesFileName, consecLogFileName, logFileNameVerbose, consecLogFileNameVerbose)
  740.     On Error Resume Next
  741.     Dim envInfoFile
  742.  
  743.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  744.  
  745.     cmd = "cmd /c echo Current Profiles: > " & configFileName
  746.     objShell.Run cmd, 0, True
  747.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  748.     objShell.Run cmd, 0, True
  749.  
  750.     'Dump the current profiles 
  751.    cmd = "cmd /c netsh advfirewall monitor show currentprofile >> " & configFileName
  752.     objShell.Run cmd, 0, True
  753.  
  754.     cmd = "cmd /c echo Firewall Configuration: >> " & configFileName
  755.     objShell.Run cmd, 0, True
  756.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  757.     objShell.Run cmd, 0, True  
  758.  
  759.     ' Dump the firewall configuration
  760.    cmd = "cmd /c netsh advfirewall monitor show firewall >> " & configFileName
  761.     objShell.Run cmd, 0, True
  762.  
  763.     cmd = "cmd /c echo Connection Security  Configuration: >> " & configFileName
  764.     objShell.Run cmd, 0, True
  765.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  766.     objShell.Run cmd, 0, True      
  767.  
  768.     'Dump the connection security configuration
  769.    cmd = "cmd /c netsh advfirewall monitor show consec >> " & configFileName
  770.     objShell.Run cmd, 0, True
  771.  
  772.     cmd = "cmd /c echo Firewall Rules : >> " & configFileName
  773.     objShell.Run cmd, 0, True
  774.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  775.     objShell.Run cmd, 0, True      
  776.  
  777.     'Dump the firewall rules
  778.    cmd = "cmd /c netsh advfirewall firewall show rule name=all verbose >> " & configFileName
  779.     objShell.Run cmd, 0, True
  780.  
  781.     cmd = "cmd /c echo Connection Security  Rules : >> " & configFileName
  782.     objShell.Run cmd, 0, True
  783.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & configFileName
  784.     objShell.Run cmd, 0, True      
  785.    
  786.     'Dump the connection security rules
  787.    cmd = "cmd /c netsh advfirewall consec show rule name=all verbose >> " & configFileName
  788.     objShell.Run cmd, 0, True  
  789.    
  790.     'Dump the firewall rules from Dynamic Store
  791.    
  792.     cmd = "cmd /c echo Firewall Rules currently enforced : > " & effectiveRulesFileName
  793.     objShell.Run cmd, 0, True
  794.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & effectiveRulesFileName
  795.     objShell.Run cmd, 0, True          
  796.    
  797.     cmd = "cmd /c netsh advfirewall monitor show firewall rule name=all >> " & effectiveRulesFileName
  798.     objShell.Run cmd, 0, True
  799.    
  800.     'Dump the connection security rules from Dynamic Store
  801.    
  802.     cmd = "cmd /c echo Connection Security Rules currently enforced : >> " & effectiveRulesFileName
  803.     objShell.Run cmd, 0, True
  804.     cmd = "cmd /c echo ------------------------------------------------------------------------ >> " & effectiveRulesFileName
  805.     objShell.Run cmd, 0, True      
  806.    
  807.     cmd = "cmd /c netsh advfirewall monitor show consec rule name=all >> " & effectiveRulesFileName
  808.     objShell.Run cmd, 0, True  
  809.  
  810.    
  811.  
  812.     'Export the operational log
  813.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/Firewall"" " & logFileName
  814.     objShell.Run cmd, 0, True  
  815.  
  816.     'Archive the log so that it could be read on different machines
  817.    cmd = "cmd /c wevtutil al " & logFileName
  818.     objShell.Run cmd, 0, True  
  819.    
  820.       'Export the operational log
  821.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurity"" " & consecLogFileName
  822.     objShell.Run cmd, 0, True  
  823.  
  824.     'Archive the log so that it could be read on different machines
  825.    cmd = "cmd /c wevtutil al " & consecLogFileName
  826.     objShell.Run cmd, 0, True  
  827.  
  828.    
  829.     'Export the operational log
  830.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/FirewallVerbose"" " & logFileNameVerbose
  831.     objShell.Run cmd, 0, True  
  832.  
  833.     'Archive the log so that it could be read on different machines
  834.    cmd = "cmd /c wevtutil al " & logFileNameVerbose
  835.     objShell.Run cmd, 0, True  
  836.    
  837.       'Export the operational log
  838.    cmd = "cmd /c wevtutil epl ""Microsoft-Windows-Windows Firewall With Advanced Security/ConnectionSecurityVerbose"" " & consecLogFileNameVerbose
  839.     objShell.Run cmd, 0, True  
  840.  
  841.     'Archive the log so that it could be read on different machines
  842.    cmd = "cmd /c wevtutil al " & consecLogFileNameVerbose
  843.     objShell.Run cmd, 0, True  
  844.    
  845. End Sub
  846.  
  847. Sub GetWfpInfo(outputFileName, logFileName)
  848.     On Error Resume Next
  849.  
  850.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  851.  
  852.     cmd = "cmd /c netsh wfp show filters file=" & outputFileName & " > " & logFileName
  853.     objShell.Run cmd, 0, True
  854.  
  855. End Sub
  856.  
  857. ' Dump Netio State
  858. Sub GetNetioInfo(outputFileName)
  859.     On Error Resume Next
  860.  
  861.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  862.  
  863.     cmd = "cmd /c netsh interface teredo show state > " & outputFileName
  864.     objShell.Run cmd, 0, True
  865.  
  866.     cmd = "cmd /c netsh interface httpstunnel show interface >> " & outputFileName
  867.     objShell.Run cmd, 0, True
  868.  
  869.     cmd = "cmd /c netsh interface httpstunnel show statistics >> " & outputFileName
  870.     objShell.Run cmd, 0, True
  871.  
  872. End Sub
  873.  
  874. Sub GetDnsInfo(logFileName)
  875.     On Error Resume Next
  876.  
  877.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  878.  
  879.     RunCmd "echo IPCONFIG /DISPLAYDNS: ", logFileName  
  880.     RunCmd "ipconfig /displaydns", logFileName
  881.  
  882.     RunCmd "echo. ", logFileName
  883.     RunCmd "echo NETSH NAMESPACE SHOW EFFECTIVE:", logFileName
  884.     RunCmd "netsh namespace show effective", logFileName
  885.    
  886.     RunCmd "echo.", logFileName
  887.     RunCmd "echo NETSH NAMESPACE SHOW POLICY:", logFileName
  888.     RunCmd "netsh namespace show policy", logFileName
  889.  
  890. End Sub
  891.  
  892. Sub GetNeighborInfo(logFileName)
  893.     On Error Resume Next
  894.  
  895.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  896.  
  897.     RunCmd "echo ARP -A:", logFileName
  898.     RunCmd "arp -a", logFileName
  899.  
  900.     RunCmd "echo.", logFileName
  901.     RunCmd "echo NETSH INT IPV6 SHOW NEIGHBORS:", logFileName
  902.     RunCmd "netsh int ipv6 show neigh", logFileName
  903.  
  904. End Sub
  905.  
  906. Sub GetFileSharingInfo(logFileName)
  907.     On Error Resume Next
  908.  
  909.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  910.  
  911.     RunCmd "echo NBTSTAT -N:", logFileName
  912.     RunCmd "nbtstat -n", logFileName
  913.  
  914.     RunCmd "echo.", logFileName
  915.     RunCmd "echo NBTSTAT -C:", logFileName
  916.     RunCmd "nbtstat -c", logFileName
  917.  
  918.     RunCmd "echo.", logFileName
  919.     RunCmd "echo NET CONFIG RDR:", logFileName
  920.     RunCmd "net config rdr", logFileName
  921.  
  922.     RunCmd "echo.", logFileName
  923.     RunCmd "echo NET CONFIG SRV:", logFileName
  924.     RunCmd "net config srv", logFileName
  925.  
  926.     RunCmd "echo.", logFileName
  927.     RunCmd "echo NET SHARE:", logFileName
  928.     RunCmd "net share", logFileName
  929.  
  930. End Sub
  931.  
  932. Sub GetGPResultInfo(logFileName)
  933.     On Error Resume Next
  934.  
  935.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  936.  
  937.     cmd = "cmd /c gpresult /scope:computer /v 1> " & logFileName & " 2>&1"
  938.     objShell.Run cmd, 0, True
  939.  
  940. End Sub
  941.  
  942. Sub GetNetEventsInfo(outputFileName, logFileName)
  943.     On Error Resume Next
  944.  
  945.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  946.  
  947.     cmd = "cmd /c netsh wfp show netevents file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  948.     objShell.Run cmd, 0, True
  949.  
  950. End Sub
  951.  
  952. Sub GetShowStateInfo(outputFileName, logFileName)
  953.     On Error Resume Next
  954.  
  955.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  956.  
  957.     cmd = "cmd /c netsh wfp show state file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  958.     objShell.Run cmd, 0, True
  959.  
  960. End Sub
  961.  
  962. Sub GetSysPortsInfo(outputFileName, logFileName)
  963.     On Error Resume Next
  964.  
  965.     Set objShell = WScript.CreateObject( "WScript.Shell" )
  966.  
  967.     cmd = "cmd /c netsh wfp show sysports file=" & outputFileName & " 1> " & logFileName & " 2>&1"
  968.     objShell.Run cmd, 0, True
  969.  
  970. End Sub
  971.  
  972.  
  973. On Error Resume Next
  974.  
  975. Dim adapterInfoFile, netInfoFile, WcnInfoFile
  976.  
  977. Set FSO = CreateObject("Scripting.FileSystemObject")
  978. Set shell = WScript.CreateObject( "WScript.Shell" )
  979. sysdrive = shell.ExpandEnvironmentStrings("%SystemDrive%\")
  980.  
  981. configFolder = "config"
  982. osinfoFileName = configFolder + "\osinfo.txt"
  983. adapterinfoFileName = configFolder + "\adapterinfo.txt"
  984. envinfoFileName = configFolder + "\envinfo.txt"
  985. wirelessAutoconfigLogFileName = configFolder + "\WLANAutoConfigLog.evtx"
  986. wscatFileName = configFolder + "\WinsockCatalog.txt"
  987. wcnFileName = configFolder + "\WcnInfo.txt"
  988. wcncachedumpFile= sysdrive + "\wcncachedump.txt"
  989. windowsFirewallConfigFileName = configFolder + "\WindowsFirewallConfig.txt"
  990. windowsFirewallEffectiveRulesFileName = configFolder + "\WindowsFirewallEffectiveRules.txt"
  991. windowsFirewallLogFileName = configFolder + "\WindowsFirewallLog.evtx"
  992. windowsFirewallConsecLogFileName = configFolder + "\WindowsFirewallConsecLog.evtx"
  993. windowsFirewallVerboseLogFileName = configFolder + "\WindowsFirewallLogVerbose.evtx"
  994. windowsFirewallConsecVerboseLogFileName = configFolder + "\WindowsFirewallConsecLogVerbose.evtx"
  995. wfpfiltersfilename=configFolder + "\wfpfilters.xml"
  996. wfplogfilename=configFolder + "\wfplog.log"
  997. netioStateFilename=configFolder + "\netiostate.txt"
  998. dnsInfoFileName = configFolder + "\Dns.txt"
  999. neighborsFileName = configFolder + "\Neighbors.txt"
  1000. filesharingFileName = configFolder + "\FileSharing.txt"
  1001. gpresultFileName = configFolder + "\gpresult.txt"
  1002. neteventsFileName = configFolder + "\netevents.xml"
  1003. neteventsFileLog = configFolder + "\neteventslog.txt"
  1004. showstateFileName = configFolder + "\wfpstate.xml"
  1005. showstateFileLog = configFolder + "\wfpstatelog.txt"
  1006. sysportsFileName = configFolder + "\sysports.xml"
  1007. sysportsFileLog = configFolder + "\sysportslog.txt"
  1008.  
  1009.  
  1010. if Not FSO.FolderExists(configFolder) Then
  1011.     FSO.CreateFolder configFolder
  1012. End If
  1013.  
  1014. call DumpAllKeys
  1015.  
  1016. call GetOSInfo(osinfoFileName)
  1017.  
  1018. Set adapterInfoFile = FSO.OpenTextFile(adapterInfoFileName, 2, True)
  1019.  
  1020. call GetWirelessAdapterInfo(adapterInfoFile)
  1021. call GetWiredAdapterInfo(adapterInfoFile)
  1022.  
  1023. adapterInfoFile.Close
  1024.  
  1025. call GetWirelessAutoconfigLog(wirelessAutoConfigLogFileName)
  1026.  
  1027. call GetEnvironmentInfo(envinfoFileName)
  1028.  
  1029. call DumpWinsockCatalog(wscatFileName)
  1030.  
  1031. call  GetWindowsFirewallInfo(windowsFirewallConfigFileName, windowsFirewallLogFileName, windowsFirewallEffectiveRulesFileName,windowsFirewallConsecLogFileName, windowsFirewallVerboseLogFileName, windowsFirewallConsecVerboseLogFileName)
  1032.  
  1033. call GetWcnInfo(wcnFileName)
  1034.  
  1035. call GetWfpInfo(wfpfiltersfilename, wfplogfilename)
  1036.  
  1037. call GetNetioInfo(netioStateFilename)
  1038.  
  1039. call GetDnsInfo(dnsInfoFileName)
  1040.  
  1041. call GetNeighborInfo(neighborsFileName)
  1042.  
  1043. call GetFileSharingInfo(filesharingFileName)
  1044.  
  1045. call GetGPResultInfo(gpresultFileName)
  1046.  
  1047. call GetNetEventsInfo(neteventsFileName, neteventsFileLog)
  1048.  
  1049. call GetShowStateInfo(showstateFileName, showstateFileLog)
  1050.  
  1051. call GetSysPortsInfo(sysportsFileName, sysportsFileLog)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement