Skip to content

Instantly share code, notes, and snippets.

@sdaaish
Created April 29, 2019 15:23
Show Gist options
  • Save sdaaish/91221c26193837cb4d0913b48294d903 to your computer and use it in GitHub Desktop.
Save sdaaish/91221c26193837cb4d0913b48294d903 to your computer and use it in GitHub Desktop.
#Requires -Version 3
[cmdletbinding()]
Param (
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
[string]$Path,
[string]$User,
[string]$Collection
)
$pawned = Get-Content $Path| ConvertFrom-Json
$users = $pawned.BreachSearchResults|Where-Object Alias -like "*$User*"
foreach($i in $users){
$email = $i.alias + "@" + $i.domainname
$var = $i.breaches|where-object Name -like "*$Collection*"
foreach($j in $var){
$date= $j.BreachDate
$title = $j.Title
"Emailaddress $email Breachdate $date in $title"
}
}
<#
"$user"
# Check pastes
foreach($i in $pawned.PasteSearchResults){
if ($i.Alias -like $User) {
$user = $i.Alias
$domain= $i.DomainName
$pastes = $i.Pastes
Write-Output "Pasted user-accounts"
foreach($j in $pastes){
$Source = $j.Source.substring(0, [System.Math]::Min(20, $str.Length))
$Title = $j.Title.substring(0, [System.Math]::Min(20, $str.Length))
$date = $j.Date
$email = "$user@$domain"
"User: {0,-35} Title: {1,-20} Date: {2,15} Source: {3}" -f $email,$Title,$date,$Source
}
}
}
# Check breaches
foreach($i in $pawned.BreachSearchResults){
if ($i.Alias -like $User) {
$user = $i.Alias
$domain= $i.DomainName
$breaches = $i.Breaches
Write-Output "Breached user accounts"
foreach($j in $breaches){
$Title = $j.Title
$date = $j.AddedDate
$email = "$user@$domain"
"User: {0,-35} Title:: {1,-20} Date: {2,15}" -f $email,$Title,$date
}
}
}
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment