MailSniper
MailSniper copied to clipboard
Invoke-WebRequest
here is the command i typed : " Invoke-DomainHarvestOWA -ExchHostname "mail.****.com" -DomainList .\domainlist.txt -OutFile potential-domains.txt -Brute" i have tried without " -Brute " also the same error message
here is the error i got : " Invoke-WebRequest : The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. At C:\Users\fm2\Desktop\MailSniper-master\MailSniper.ps1:2166 char:21
- ... $owalogin = Invoke-WebRequest -Uri $OWAURL -Method POST -Body $POSTpa ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand"
Webrequets within the Get-BaseLineResponseTime are configured to validate certificates. All of the other functions ignore self signed certs, but not this function. Adding the following code ~ line 2619 fixed my issue:
add-type @"
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;
}
}
"@
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy