public/Get-NessusExportFile.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function Get-NessusExportFile() {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true, Position=0, valuefromPipeline=$true)]
        [string] $sid,
        [Parameter(Mandatory=$true, Position=1, valuefromPipeline=$true)]
        [string] $fid
    )

    $resp = Send-NessusRequest "Get" "/scans/$sid/export/$fid/download"

    $file = "nessus-$sid-$fid.nessus"
    Write-Verbose "Saving report to $file"
    $resp.OuterXml | Out-File $file -Encoding ascii

    Get-ChildItem $file
}