Problem executing vbscript to detect new venerability (wmi)

Author Message
pmsimoes

  • Total Posts : 1
  • Joined: 10/3/2012
  • Status: offline
Problem executing vbscript to detect new venerability (wmi) Wednesday, October 03, 2012 9:56 AM (permalink)
When i execute the following vbscript to detect if any of the ip enabled network adapters has dhcp enabled, I get the expected result in script debbuger but nothing is detected when executed in the GFI scanner.
 
When executed against the localhost all went OK.
The test condition in the new vulnerability is: result not equal 0


-----Script -----
Function main
'declare the objects
Dim wmi As Object
Dim objswbemobject As Object
'declare variables
Dim strComputer As String
Dim cr As String
Dim msg01 As String
Dim msg02 As String
Dim testValue As String
 
'variables initialization
strComputer = getparameter("computerIP")
cr = Chr(13) + Chr(10) testValue="True"
main = false
 
'Script message definition
msg01="Verify, no production adapter is using DHCP assignments."+" Should be=FALSE"
msg02="The actual value is:"
 
'hook with the wmi object
Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
'Check that hook was successful
If wmi is Nothing Then echo ("error1") 'Return the services instance of the wmi
 
Set wmiinst=wmi.instancesof("Win32_NetworkAdapterConfiguration")
 
'Check to see that instance is available
If wmiinst is Nothing Then echo ("error2") 'Loop true each instance
 
For Each objswbemobject In wmiinst
           If objswbemobject.IPEnabled Then 
                If objswbemobject.DHCPEnabled Then
                    echo(msg01+cr+msg02+testValue+cr)
                    setdescription(msg01+cr+msg02+testValue+cr)
                    main = true
                End If
           End If
Next
End Function
-----Script End -----
Test Conditions:
GFI LanGuard 2012 (build 20120717) 
Authentication to wmi system apears to be OK (no error in log when executed)
 
Thanks,
Pedro Simões
 
#1
    ufgeorge

    • Total Posts : 435
    • Joined: 9/12/2003
    • Status: offline
    Re:Problem executing vbscript to detect new venerability (wmi) Friday, August 11, 2017 2:38 AM (permalink)
    I met the same situation with wmi vbscript too.
    The problem is 
    Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
     
    Everything fine in debug but in Languard, if strComputer is "localhost" or ".", no problem. Otherwise it seems script just stop running...
     
    Anyone has solution?
     
    George
     
    pmsimoes


    When i execute the following vbscript to detect if any of the ip enabled network adapters has dhcp enabled, I get the expected result in script debbuger but nothing is detected when executed in the GFI scanner.

    When executed against the localhost all went OK.
    The test condition in the new vulnerability is: result not equal 0


    -----Script -----
    Function main
    'declare the objects
    Dim wmi As Object
    Dim objswbemobject As Object
    'declare variables
    Dim strComputer As String
    Dim cr As String
    Dim msg01 As String
    Dim msg02 As String
    Dim testValue As String

    'variables initialization
    strComputer = getparameter("computerIP")
    cr = Chr(13) + Chr(10) testValue="True"
    main = false

    'Script message definition
    msg01="Verify, no production adapter is using DHCP assignments."+" Should be=FALSE"
    msg02="The actual value is:"

    'hook with the wmi object
    Set wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

    'Check that hook was successful
    If wmi is Nothing Then echo ("error1") 'Return the services instance of the wmi

    Set wmiinst=wmi.instancesof("Win32_NetworkAdapterConfiguration")

    'Check to see that instance is available
    If wmiinst is Nothing Then echo ("error2") 'Loop true each instance

    For Each objswbemobject In wmiinst
             If objswbemobject.IPEnabled Then 
                  If objswbemobject.DHCPEnabled Then
                      echo(msg01+cr+msg02+testValue+cr)
                      setdescription(msg01+cr+msg02+testValue+cr)
                      main = true
                  End If
             End If
    Next
    End Function
    -----Script End -----
    Test Conditions:
    GFI LanGuard 2012 (build 20120717) 
    Authentication to wmi system apears to be OK (no error in log when executed)

    Thanks,
    Pedro Simões


     
    #2
      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • New Messages
      • No New Messages
      • Hot Topic w/ New Messages
      • Hot Topic w/o New Messages
      • Locked w/ New Messages
      • Locked w/o New Messages
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2017 ASPPlayground.NET Forum Version 3.9