-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-OpenVasScans.ps1
42 lines (34 loc) · 1.29 KB
/
Get-OpenVasScans.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function Get-OpenVasScans
{
<#
.Synopsis
Return the GUIDs and Scan Names from an OpenVAS Server
.DESCRIPTION
Return the GUIDs and Scan Names from an OpenVAS Server
Built with infomation from http://docs.greenbone.net/GSM-Manual/gos-4/en/omp.html#access-with-omp
See http://myworldofit.net/?p=10436 for detailed usage examples
.EXAMPLE
Get-OpenVasScans -OmpPath "C:\Program Files (x86)\OpenVAS-OMP"
.EXAMPLE
Get-OpenVasScans -OmpPath "C:\Program Files (x86)\OpenVAS-OMP" | Out-GridView
#>
param(
[Parameter(Mandatory=$true,HelpMessage="Path to OMP.exe e.g. 'C:\Program Files (x86)\OpenVAS-OMP'")]
[String]$OmpPath
)
#Run the query against the OpenVAS Server
$Scans = & $OmpPath\omp.exe -g 2> $null
#Build a collection to store the results in
$OutputScans = New-Object System.Collections.ArrayList
foreach($line in $Scans){
#Extract the useful info from $Tasks
$item = New-Object -TypeName System.Object
$item | Add-Member -MemberType NoteProperty -Name "GUID" -Value $line.Substring(0,36)
$item | Add-Member -MemberType NoteProperty -Name "Name" -Value $line.Remove(0,38)
#Add it to the collection
$OutputScans.Add($item) | Out-Null
}
#Return the tasks
return $OutputScans
}