示例查询:CVE 漏洞报告
SecurityControls 视图可提供对 Ivanti Security Controls 数据库的数据访问,但在预定义报告中不可用。 本部分提供示例查询,说明如何引用 SecurityControls 视图。
查询
此为 CVE 漏洞报告,其中显示 CVE 名称,以及最后一次修补程序扫描到的缺失修补程序会影响多少台计算机。
复制
SELECT
cve.[Name] AS [CVE Name],
cve.[Id] AS [CVE ID],
patch.[Bulletin] AS [Bulletin Id],
patch.[QNumber] AS QNumber,
COUNT( DISTINCT machine.[Id]) AS [Machines Missing Count]
FROM
[Reporting2].[Machine] AS machine
INNER JOIN
[Reporting2].[AssessedMachineState] AS latestAssessedMachineState ON
latestAssessedMachineState.[machineId] = machine.[Id] AND
latestAssessedMachineState.[Id] = machine.[LastAssessedMachineStateId]
INNER JOIN
[Reporting2].[DetectedPatchState] AS detectedPatchState ON
detectedPatchState.[AssessedMachineStateId] = latestAssessedMachineState.[Id]
INNER JOIN
[Reporting2].[InstallState] AS installState ON
installState.[Id] = detectedPatchState.[InstallStateId]
INNER JOIN
[Reporting2].[Patch] AS patch ON
patch.[Id] = detectedPatchState.[PatchId]
INNER JOIN
[Reporting2].[PatchAppliesTo] AS patchAppliesTo ON
patchAppliesTo.[PatchId] = patch.[Id]
INNER JOIN
[Reporting2].[Cve] AS cve ON
cve.[Id] = patchAppliesTo.[CveId]
WHERE
/* Id 4 indicates a missing patch */
installState.[Id] = 4
GROUP BY
cve.[Name],
cve.[Id],
patch.[Bulletin],
patch.[QNumber];