mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Change modules inventory and add new plugins
This commit is contained in:
parent
7645ec0b48
commit
440ad8296f
@ -191,15 +191,72 @@ module_exec dir "%ProgramFiles%\Avira\AntiVir Desktop\aevdf.dat" | grep aevdf.da
|
|||||||
module_description Last update for Antivirus Signature file
|
module_description Last update for Antivirus Signature file
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
# Windows inventory module (This information will be displayed only in enterprise version)
|
# Windows inventory module (This information will be displayed only in enterprise version)^M
|
||||||
module_begin
|
module_begin
|
||||||
module_name Inventory
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cpuinfo.vbs"
|
||||||
module_interval 7
|
module_crontab * 12-15 * * 1
|
||||||
module_type generic_data_string
|
|
||||||
module_inventory CPU RAM CDROM Video HD Patches Services NIC
|
|
||||||
module_description Inventory
|
|
||||||
module_end
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\moboinfo.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\diskdrives.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\cdromdrives.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\videocardinfo.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\ifaces.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\monitors.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\printers.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\raminfo.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\software_installed.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\userslogged.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productkey.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
|
module_begin
|
||||||
|
module_plugin cscript.exe //B "%PROGRAMFILES%\Pandora_Agent\util\productID.vbs"
|
||||||
|
module_crontab * 12-15 * * 1
|
||||||
|
module_end
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------
|
||||||
# This samples below need to be reconfigured and uncommented. Please read documentation
|
# This samples below need to be reconfigured and uncommented. Please read documentation
|
||||||
# on how to setup pandora fms windows agent at http://wiki.pandorafms.com
|
# on how to setup pandora fms windows agent at http://wiki.pandorafms.com
|
||||||
|
25
pandora_agents/win32/bin/util/cdromdrives.vbs
Normal file
25
pandora_agents/win32/bin/util/cdromdrives.vbs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI CD_ROM_drives_info
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>CDROMs</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colCDROMDrives = objWMIService.ExecQuery("Select caption,description,drive,deviceid from win32_CDROMDrive")
|
||||||
|
|
||||||
|
For Each cdromd In colCDROMDrives
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & cdromd.caption _
|
||||||
|
& ";" & cdromd.description _
|
||||||
|
& ";" & cdromd.drive _
|
||||||
|
& ";" & cdromd.deviceid _
|
||||||
|
& "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
21
pandora_agents/win32/bin/util/cpuinfo.vbs
Normal file
21
pandora_agents/win32/bin/util/cpuinfo.vbs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI cpuinfo
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>CPU</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colCPUs = objWMIService.ExecQuery("Select name,maxclockspeed,caption from Win32_Processor")
|
||||||
|
|
||||||
|
For Each cpu In colCPUs
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & cpu.name & ";" & cpu.maxclockspeed & ";" & cpu.caption & "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
24
pandora_agents/win32/bin/util/diskdrives.vbs
Normal file
24
pandora_agents/win32/bin/util/diskdrives.vbs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI disksinfo
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>Disks</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colHDDs = objWMIService.ExecQuery("Select caption,size,serialnumber from win32_diskdrive")
|
||||||
|
|
||||||
|
For Each disco In colHDDs
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & disco.caption _
|
||||||
|
& ";" & (disco.size/(1024*1024)) _
|
||||||
|
& ";" & disco.serialnumber _
|
||||||
|
& "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
34
pandora_agents/win32/bin/util/ifaces.vbs
Normal file
34
pandora_agents/win32/bin/util/ifaces.vbs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI real interfaces info
|
||||||
|
' exlusions:
|
||||||
|
' VBox network interfaces
|
||||||
|
' VMWare network interfaces
|
||||||
|
'
|
||||||
|
'nic where "guid is not null and not PNPDeviceID like 'ROOT%'"
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>NIC</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter Where not PNPDeviceID like 'ROOT%%' and not PNPDeviceID like 'SW%%'")
|
||||||
|
|
||||||
|
For Each iface In colAdapters
|
||||||
|
' return model MACAddress IPAddress
|
||||||
|
|
||||||
|
set ifaces_cfg = objWMIService.ExecQuery("Select ipaddress from Win32_NetworkAdapterConfiguration Where Caption='" & iface.caption & "'")
|
||||||
|
Wscript.StdOut.Write "<data><![CDATA[" & iface.ProductName & ";" & iface.MACAddress & ";"
|
||||||
|
for each iface_cfg in ifaces_cfg
|
||||||
|
if ( iface_cfg.IPAddress(0) <> "" ) then
|
||||||
|
Wscript.StdOut.Write trim(iface_cfg.IPAddress(0))
|
||||||
|
end if
|
||||||
|
next
|
||||||
|
wscript.stdOut.WriteLine "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
22
pandora_agents/win32/bin/util/moboinfo.vbs
Normal file
22
pandora_agents/win32/bin/util/moboinfo.vbs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI mobo info
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>Motherboard</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
'Set colMobos = objWMIService.ExecQuery("Select name,product,manufacturer from Win32_baseboard")
|
||||||
|
Set colMobos2 = objWMIService.ExecQuery("Select manufacturer,model,OEMStringArray from Win32_computersystem")
|
||||||
|
|
||||||
|
For Each mobo In colMobos2
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & mobo.manufacturer & ";" & mobo.model & ";" & mobo.OEMStringArray(0) & "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
25
pandora_agents/win32/bin/util/monitors.vbs
Normal file
25
pandora_agents/win32/bin/util/monitors.vbs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI monitorsinfo
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>Monitors</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colDisplays = objWMIService.ExecQuery("Select caption,pnpdeviceid from win32_desktopmonitor")
|
||||||
|
|
||||||
|
For Each display In colDisplays
|
||||||
|
if (NOT isNull(display.pnpdeviceid)) then
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & display.caption _
|
||||||
|
& ";" & display.pnpdeviceid _
|
||||||
|
& "]]></data>"
|
||||||
|
end if
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
51
pandora_agents/win32/bin/util/printers.vbs
Normal file
51
pandora_agents/win32/bin/util/printers.vbs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
On Error Resume Next
|
||||||
|
|
||||||
|
'WMI printers attached
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>Printers</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
function validPort(port)
|
||||||
|
if strComp(port,"SHRFAX:") = 0 then
|
||||||
|
validPort = false
|
||||||
|
elseif strComp(port,"nul:") = 0 then
|
||||||
|
validPort = false
|
||||||
|
elseif strComp(port,"PORTPROMPT:") = 0 then
|
||||||
|
validPort = false
|
||||||
|
elseif strComp(port,"XPSPort:") = 0 then
|
||||||
|
validPort = false
|
||||||
|
elseif strComp(port,"PDF:") = 0 then
|
||||||
|
validPort = false
|
||||||
|
else
|
||||||
|
validPort = true
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
Set oWMI = GetObject("winmgmts:\\" & "." & "\root\cimv2")
|
||||||
|
Set colPrinters = oWMI.ExecQuery("Select * from Win32_Printer",,48)
|
||||||
|
|
||||||
|
For Each objPrinter in colPrinters
|
||||||
|
if validPort (objPrinter.PortName) then
|
||||||
|
set tcp_port_exists = 0
|
||||||
|
WScript.stdOut.Write "<data><![CDATA[" & _
|
||||||
|
objPrinter.DeviceID & ";" & _
|
||||||
|
objPrinter.DriverName & ";"
|
||||||
|
Set colPorts = oWMI.ExecQuery("Select HostAddress from Win32_TCPIPPrinterPort where Name like '" & objPrinter.PortName & "'",,48)
|
||||||
|
For Each objPort in colPorts
|
||||||
|
tcp_port_exists = 1
|
||||||
|
Wscript.stdOut.Write objPort.HostAddress
|
||||||
|
Next
|
||||||
|
If (tcp_port_exists = 0) Then
|
||||||
|
Wscript.stdOut.Write objPrinter.PortName
|
||||||
|
End If
|
||||||
|
wscript.stdOut.WriteLine "]]></data>"
|
||||||
|
end if
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
24
pandora_agents/win32/bin/util/productID.vbs
Normal file
24
pandora_agents/win32/bin/util/productID.vbs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
' windows_product_key.vbs
|
||||||
|
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||||
|
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||||
|
' This plugin extends agent inventory feature. Only enterprise version
|
||||||
|
' ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>product_ID</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
Set oShell = WScript.CreateObject ("WScript.Shell")
|
||||||
|
Set objExec = oShell.Exec("cmd.exe /C wmic os get ""SerialNumber"" | find /v ""SerialNumber"" ")
|
||||||
|
Do
|
||||||
|
line = objExec.StdOut.ReadLine()
|
||||||
|
s = s & line
|
||||||
|
Loop While Not objExec.Stdout.atEndOfStream
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & Replace(Replace(s, chr(013), ""), chr(010), "") & "]]></data>"
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
25
pandora_agents/win32/bin/util/productkey.vbs
Normal file
25
pandora_agents/win32/bin/util/productkey.vbs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
' windows_product_key.vbs
|
||||||
|
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
||||||
|
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||||
|
' This plugin extends agent inventory feature. Only enterprise version
|
||||||
|
' ----------------------------------------------------------------
|
||||||
|
|
||||||
|
on error resume next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>product_key</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colProducts = objWMIService.ExecQuery("Select OA3xOriginalProductKey from SoftwareLicensingService")
|
||||||
|
|
||||||
|
For Each product In colProducts
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & product.OA3xOriginalProductKey & "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
24
pandora_agents/win32/bin/util/raminfo.vbs
Normal file
24
pandora_agents/win32/bin/util/raminfo.vbs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI raminfo
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>RAM</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colRAMs = objWMIService.ExecQuery("Select deviceLocator,capacity,speed from Win32_PhysicalMemory")
|
||||||
|
|
||||||
|
For Each ram In colRAMs
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & ram.deviceLocator _
|
||||||
|
& ";" & (ram.capacity/(1024*1024)) _
|
||||||
|
& ";" & ram.speed _
|
||||||
|
& "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
@ -1,72 +1,143 @@
|
|||||||
' software_inventory.vbs
|
'
|
||||||
' Pandora FMS Agent Inventory Plugin for Microsoft Windows (All platfforms)
|
' Windows information retriever: Software Installed
|
||||||
' (c) 2014 Sancho Lerena <slerena@artica.es>
|
'
|
||||||
' This plugin extends agent inventory feature. Only enterprise version
|
' WMI/REGISTRY based
|
||||||
' ----------------------------------------------------------------
|
' (c) 2015 Sancho Lerena <slerena@artica.es>
|
||||||
' usage: cscript //B software_inventory.vbs
|
' (c) 2015 Borja Sanchez <fborja.sanchez@artica.es>
|
||||||
|
'--------------------------------------------------------
|
||||||
|
on error resume next
|
||||||
|
|
||||||
|
Class ObjectList
|
||||||
|
Public List
|
||||||
|
|
||||||
|
Sub Class_Initialize()
|
||||||
|
Set List = CreateObject("Scripting.Dictionary")
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Sub Class_Terminate()
|
||||||
|
Set List = Nothing
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Function Append(Anything)
|
||||||
|
List.Add CStr(List.Count + 1), Anything
|
||||||
|
Set Append = Anything
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function Item(id)
|
||||||
|
If List.Exists(CStr(id)) Then
|
||||||
|
Set Item = List(CStr(id))
|
||||||
|
Else
|
||||||
|
Set Item = Nothing
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
|
|
||||||
|
class AppClass
|
||||||
|
dim InstallDate,Caption,Version,Vendor
|
||||||
|
end class
|
||||||
|
|
||||||
|
' Print the XML structure
|
||||||
Wscript.StdOut.WriteLine "<inventory>"
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
Wscript.StdOut.WriteLine"<inventory_module>"
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
Wscript.StdOut.WriteLine "<name>software</name>"
|
Wscript.StdOut.WriteLine "<name>Software</name>"
|
||||||
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
Wscript.StdOut.WriteLine "<datalist>"
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
'------ Checks if an item exists on the main collection
|
||||||
|
function isItemInArray(objeto,coleccion)
|
||||||
|
for each id in coleccion.List
|
||||||
|
if (strComp(objeto,coleccion.List(id).caption) = 0) then
|
||||||
|
isItemInArray=true
|
||||||
|
exit function
|
||||||
|
end if
|
||||||
|
next
|
||||||
|
isItemInArray=false
|
||||||
|
end function
|
||||||
|
|
||||||
|
'------ main collection definition
|
||||||
|
dim colObjSW : set colObjSW = new ObjectList
|
||||||
|
strComputer = "."
|
||||||
|
|
||||||
|
'------ Retrieve the WMI registers first
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colSoftware = objWMIService.ExecQuery ("SELECT installstate,caption,installdate,Version,vendor FROM Win32_Product")
|
||||||
|
|
||||||
|
|
||||||
|
'------ Check all
|
||||||
|
'-- first) add all unique WMI (unique) entries to main collector
|
||||||
|
'-- second) add all unique REGISTRY items to main collector
|
||||||
|
|
||||||
|
for each objSoftware in colSoftware
|
||||||
|
if ( objSoftware.installstate = 5 ) then
|
||||||
|
if ( isItemInArray(objSoftware.caption, colObjSW) = false ) then
|
||||||
|
' It doesn't exists, added.
|
||||||
|
With colObjSW.Append(New AppClass)
|
||||||
|
.caption = objSoftware.caption
|
||||||
|
.InstallDate = objSoftware.InstallDate
|
||||||
|
.version = objSoftware.version
|
||||||
|
.vendor = objSoftware.vendor
|
||||||
|
End with
|
||||||
|
' Add to XML the verified ones
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" _
|
||||||
|
& objSoftware.caption & ";" _
|
||||||
|
& objSoftware.version _
|
||||||
|
& "]]></data>"
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
next
|
||||||
|
|
||||||
|
' ------ Getting the REGISTRY
|
||||||
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
|
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
|
||||||
strComputer = "."
|
|
||||||
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
|
strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
|
||||||
strEntry1a = "DisplayName"
|
strEntry1a = "DisplayName"
|
||||||
strEntry1b = "QuietDisplayName"
|
strEntry1b = "QuietDisplayName"
|
||||||
strEntry2 = "InstallDate"
|
strEntry2 = "InstallDate"
|
||||||
strEntry3 = "VersionMajor"
|
strEntry3 = "DisplayVersion"
|
||||||
strEntry4 = "VersionMinor"
|
|
||||||
strEntry5 = "EstimatedSize"
|
|
||||||
|
|
||||||
Set objReg = GetObject("winmgmts://" & strComputer & _
|
Set objReg = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
|
||||||
"/root/default:StdRegProv")
|
|
||||||
objReg.EnumKey HKLM, strKey, arrSubkeys
|
objReg.EnumKey HKLM, strKey, arrSubkeys
|
||||||
|
|
||||||
For Each strSubkey In arrSubkeys
|
For Each strSubkey In arrSubkeys
|
||||||
|
|
||||||
appname = ""
|
appname = ""
|
||||||
appsize = ""
|
appsize = ""
|
||||||
appversion = ""
|
appversion = ""
|
||||||
appdate = ""
|
appdate = ""
|
||||||
|
|
||||||
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
|
intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, strEntry1a, strValue1)
|
||||||
strEntry1a, strValue1)
|
|
||||||
If intRet1 <> 0 Then
|
If intRet1 <> 0 Then
|
||||||
objReg.GetStringValue HKLM, strKey & strSubkey, _
|
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry1b, strValue1
|
||||||
strEntry1b, strValue1
|
|
||||||
End If
|
End If
|
||||||
If strValue1 <> "" Then
|
If strValue1 <> "" Then
|
||||||
appname = strValue1
|
appname = strValue1
|
||||||
End If
|
End If
|
||||||
objReg.GetStringValue HKLM, strKey & strSubkey, _
|
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry2, strValue2
|
||||||
strEntry2, strValue2
|
|
||||||
If strValue2 <> "" Then
|
If strValue2 <> "" Then
|
||||||
appdate = strValue2
|
appdate = strValue2
|
||||||
End If
|
End If
|
||||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
|
||||||
strEntry3, intValue3
|
objReg.GetStringValue HKLM, strKey & strSubkey, strEntry3, intValue3
|
||||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
|
||||||
strEntry4, intValue4
|
|
||||||
If intValue3 <> "" Then
|
If intValue3 <> "" Then
|
||||||
appversion = intValue3 & "." & intValue4
|
appversion = intValue3
|
||||||
End If
|
End If
|
||||||
objReg.GetDWORDValue HKLM, strKey & strSubkey, _
|
|
||||||
strEntry5, intValue5
|
|
||||||
If intValue5 <> "" Then
|
|
||||||
appsize = Round(intValue5/1024, 3) & " megabytes"
|
|
||||||
End If
|
|
||||||
|
|
||||||
If appname <> "" Then
|
If appname <> "" Then
|
||||||
Wscript.StdOut.WriteLine "<data>" & appname & ";" & appversion & ";" & appdate & ";" & appsize & "</data>"
|
' foreach registry item, check if exists in the main collector
|
||||||
|
' it it exists, it doesn't be added.
|
||||||
|
if ( isItemInArray(appname, colObjSW) = false ) then
|
||||||
|
' as item doesn't exist, we add it to main collector and to XML
|
||||||
|
With colObjSW.Append(New AppClass)
|
||||||
|
.caption = appname
|
||||||
|
.version = appversion
|
||||||
|
End with
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & appname & ";" & appversion & "]]></data>"
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
next
|
||||||
Next
|
|
||||||
|
|
||||||
|
' Closing the XML structure
|
||||||
Wscript.StdOut.WriteLine "</datalist>"
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
Wscript.StdOut.WriteLine "</inventory_module>"
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
Wscript.StdOut.WriteLine "</inventory>"
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
||||||
|
|
||||||
|
69
pandora_agents/win32/bin/util/userslogged.vbs
Normal file
69
pandora_agents/win32/bin/util/userslogged.vbs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
on error resume next
|
||||||
|
' Lista todos los usuarios del equipo que han iniciado procesos
|
||||||
|
|
||||||
|
dim loggedUsers(),i
|
||||||
|
i=0
|
||||||
|
Sub insertIfNotExists(sDomain,sUser)
|
||||||
|
For Each lUser in loggedUsers
|
||||||
|
If StrComp(sDomain & "\" & sUser, lUser) = 0 Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
redim preserve loggedUsers(i)
|
||||||
|
i=i+1
|
||||||
|
loggedUsers (i-1)=sDomain & "\" & sUser
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Function CheckRealUser(sHost, sUser, sDomain)
|
||||||
|
Dim oWMI,realUsers
|
||||||
|
Set oWmi = GetObject("winmgmts:{impersonationLevel=impersonate,(debug)}!\\" _
|
||||||
|
& sHost & "\root\cimv2")
|
||||||
|
Set realUsers = oWmi.ExecQuery("SELECT * FROM Win32_UserAccount WHERE Domain='" & sDomain & "' OR Name='" & sUser & "'")
|
||||||
|
If (realUsers.count=0) Then
|
||||||
|
CheckRealUser = False
|
||||||
|
Else
|
||||||
|
CheckRealUser = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Function ConsoleUser(sHost)
|
||||||
|
Dim oWMI, colProc, oProcess, strUser, strDomain
|
||||||
|
Set oWmi = GetObject("winmgmts:" _
|
||||||
|
& "{impersonationLevel=impersonate,(debug)}!\\" _
|
||||||
|
& sHost & "\root\cimv2")
|
||||||
|
|
||||||
|
Set colProc = oWmi.ExecQuery("Select sessionID from Win32_Process")
|
||||||
|
|
||||||
|
ConsoleUser = ""
|
||||||
|
For Each oProcess In colProc
|
||||||
|
lRet = oProcess.getOwner(strOwner, strDomain)
|
||||||
|
If (lRet = 0) AND (CheckRealUser(sHost,strOwner,strDomain)) Then
|
||||||
|
insertIfNotExists strDomain,strOwner
|
||||||
|
ConsoleUser = sUser
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End Function
|
||||||
|
|
||||||
|
' MAIN
|
||||||
|
|
||||||
|
sUser = ConsoleUser(".") ' use "." for local computer
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>Users</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
|
||||||
|
For Each usuario in loggedUsers
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & usuario _
|
||||||
|
& "]]></data>"
|
||||||
|
next
|
||||||
|
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
||||||
|
|
24
pandora_agents/win32/bin/util/videocardinfo.vbs
Normal file
24
pandora_agents/win32/bin/util/videocardinfo.vbs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
on error resume next
|
||||||
|
'WMI video_card_info
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "<inventory>"
|
||||||
|
Wscript.StdOut.WriteLine "<inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "<name>VideoCards</name>"
|
||||||
|
Wscript.StdOut.WriteLine "<type><![CDATA[generic_data_string]]></type>"
|
||||||
|
Wscript.StdOut.WriteLine "<datalist>"
|
||||||
|
|
||||||
|
strComputer = "."
|
||||||
|
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
|
||||||
|
Set colVideoCards = objWMIService.ExecQuery("Select caption,AdapterRAM,PNPDeviceID from win32_videocontroller")
|
||||||
|
|
||||||
|
For Each vcard In colVideoCards
|
||||||
|
Wscript.StdOut.WriteLine "<data><![CDATA[" & vcard.caption _
|
||||||
|
& ";" & (vcard.AdapterRAM/(1024*1024)) _
|
||||||
|
& ";" & vcard.PNPDeviceID _
|
||||||
|
& "]]></data>"
|
||||||
|
Next
|
||||||
|
|
||||||
|
Wscript.StdOut.WriteLine "</datalist>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory_module>"
|
||||||
|
Wscript.StdOut.WriteLine "</inventory>"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user