Created
July 2, 2020 15:06
-
-
Save SegoCode/d3b2a5d83bc02b0f1531d45bae683613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[string]$list = "AdminList.txt", | |
[Parameter(Mandatory=$true)][string]$url | |
) | |
if(-NOT ([uri]$url).IsAbsoluteUri){ | |
Write-Host "URL IS INVALID " -ForegroundColor red | |
Write-Host "Example: AdminFinder.ps1 -url http://www.google.com " -ForegroundColor red | |
exit | |
} | |
if(-NOT (Test-Path $list)){ | |
Write-Host "LIST PATH NOT FOUND " -ForegroundColor red | |
Write-Host "Example: AdminFinder.ps1 -url http://www.google.com -list C:\AdminList.txt" -ForegroundColor red | |
exit | |
} | |
cls | |
$logo = @" | |
_____ _ _ _____ _ _ | |
| _ |_| |_____|_|___ | __|_|___ _| |___ ___ | |
| | . | | | | | __| | | . | -_| _| | |
|__|__|___|_|_|_|_|_|_| |__| |_|_|_|___|___|_| | |
[ github.com/SegoCode ] | |
"@ | |
Write-Host $logo -ForegroundColor red -BackgroundColor black | |
[Console]::CursorVisible = $false | |
$initLine = 7 | |
$counter = 0 | |
$frames = '|', '/', '-', '\' | |
function Get-WebResponse($link) { | |
try { | |
$HTTP_Request = [System.Net.WebRequest]::Create($link) | |
$HTTP_Response = $HTTP_Request.GetResponse() | |
$HTTP_Status = [int]$HTTP_Response.StatusCode | |
if ($HTTP_Status -eq "200") { | |
[Console]::SetCursorPosition(0, $initLine) | |
Write-Host " [" -NoNewline; Write-Host "+" -ForegroundColor Green -NoNewline; Write-Host "]" -NoNewline; Write-Host " FOUND: "-ForegroundColor Green -NoNewline; Write-Host "$link" -ForegroundColor Yellow -NoNewline; | |
Write-Host " (Code: $($HTTP_Response.StatusCode) - $([int] $HTTP_Response.StatusCode))" -NoNewline; | |
} | |
$HTTP_Response.Close() | |
} catch { | |
[Console]::SetCursorPosition(15, 6) | |
$testedLink = "URL $link Tested" | |
$testedLink =$testedLink.PadRight(90,[char]32) | |
Write-Host $testedLink -ForegroundColor red | |
return $true | |
} | |
} | |
foreach($line in Get-Content $list) { | |
$found = Get-WebResponse $url"/"$line | |
if($found){ | |
$frame = $frames[$counter % $frames.Length] | |
[Console]::SetCursorPosition(0, 6) | |
Write-Host " Searching [$frame] " -NoNewLine | |
$counter += 1 | |
} else { | |
$initLine += 1 | |
} | |
} | |
[Console]::SetCursorPosition(0, 6) | |
if($initLine -eq 7){ | |
$testedLink = " NOT FOUND! [$url] " | |
$testedLink =$testedLink.PadRight(90,[char]32) | |
Write-Host $testedLink -ForegroundColor red | |
}else{ | |
Write-Host ' [*] Finished [*]'.PadRight(90,[char]32) -ForegroundColor green | |
} | |
[Console]::SetCursorPosition(0, $initLine) | |
[Console]::CursorVisible = $true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment