public/Connect-Nessus.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function Connect-Nessus() {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true, Position=0, valuefromPipeline=$true)]
        [string] $username,
        [Parameter(Mandatory=$true, Position=1, valuefromPipeline=$true)]
        [string] $password
    )
    $data = @{"username" = $username; "password" = $password}
    $resp = Send-NessusRequest "Post" "/session" $data 

    return $resp.token
}