Skip to content

Instantly share code, notes, and snippets.

@ArtisanByteCrafter
Created April 26, 2019 05:08
Show Gist options
  • Save ArtisanByteCrafter/7956a0a76656beb1b58920c64a356d39 to your computer and use it in GitHub Desktop.
Save ArtisanByteCrafter/7956a0a76656beb1b58920c64a356d39 to your computer and use it in GitHub Desktop.
Function Get-OwnedPW {
param(
[string] $test
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$a, $b = (Get-FileHash -A 'SHA1' -I ([IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($test)))).Hash -split '(?<=^.{5})'
(((Invoke-RestMethod "https://api.pwnedpasswords.com/range/$a" -UseB) -split '\r\n' -like "$b*") -split ':')[-1] |
Foreach-Object {
Write-Host -ForegroundColor Green "This has been publically cracked $_ times according to api.pwnedpasswords.com"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment