Skip to content

Instantly share code, notes, and snippets.

@0xbadjuju
Created August 22, 2018 21:10
Show Gist options
  • Save 0xbadjuju/648e6f5ef2b1dfc1aafc183f10ec5e96 to your computer and use it in GitHub Desktop.
Save 0xbadjuju/648e6f5ef2b1dfc1aafc183f10ec5e96 to your computer and use it in GitHub Desktop.
Check if a string exists in a response from a GET request
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;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
function Check-XssStatus
{
[CmdletBinding()]
Param(
[Parameter(Mandatory = $true,
HelpMessage = 'Input file.')]
[string]$file,
[Parameter(Mandatory = $true,
HelpMessage = 'XSS String.')]
[string]$xss,
[Parameter(Mandatory = $true,
HelpMessage = 'XSS String.')]
[string]$CheckString
)
$lines = Get-Content $file
foreach ($line in $lines)
{
$uri = "http://$line/$xss"
if ($line.Contains("443"))
{
$uri = "https://$line/$xss"
}
try
{
$request = Invoke-WebRequest -Uri $uri
}
catch
{
Write-Host -ForegroundColor Red "$line - Connect"
Out-File -Append "${file}_connect.txt" -InputObject $line
}
if ($request.RawContent.Contains($CheckString))
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment