Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke-WebRequest #62

Open
Fahad0x9d3 opened this issue May 15, 2018 · 1 comment
Open

Invoke-WebRequest #62

Fahad0x9d3 opened this issue May 15, 2018 · 1 comment
Labels

Comments

@Fahad0x9d3
Copy link

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"
@i128
Copy link

i128 commented Jun 27, 2018

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

@leebaird leebaird added the bug label Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants