-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSNessusAPI.psm1
More file actions
32 lines (29 loc) · 1.23 KB
/
PSNessusAPI.psm1
File metadata and controls
32 lines (29 loc) · 1.23 KB
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
$Public = @( Get-ChildItem -Recurse -Path "$PSScriptRoot\Public\" -File -Filter *.ps1 )
$Private = @( Get-ChildItem -Recurse -Path "$PSScriptRoot\Private\" -File -Filter *.ps1 )
@($Public + $Private) | ForEach-Object {
Try {
If ($_.Length -gt 0) {. $_.FullName}
} Catch {
Write-Error -Message "Failed to import function $($_.FullName): $_"
}
}
#check PS version for this, PS 6 and above use -SkipCertificateCheck for Invoke-RestMethod
if ($PSVersionTable.PSVersion.Major -lt 6)
{
#Ignore SSL errors
If ($Null -eq ([System.Management.Automation.PSTypeName]'TrustAllCertsPolicy').Type) {
Add-Type -Debug:$False @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
}
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
}
Export-ModuleMember -Function $Public.BaseName -Alias *