Skip to content

Commit 21fb495

Browse files
committed
Merge branch 'interface-rewrite' of https://github.com/KelvinTegelaar/CIPP-API into interface-rewrite
2 parents a1a31e0 + 849335b commit 21fb495

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

Modules/CIPPCore/Public/Entrypoints/Invoke-ListBreachesAccount.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ Function Invoke-ListBreachesAccount {
1313
$APIName = $TriggerMetadata.FunctionName
1414
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
1515

16-
$Results = Get-HIBPRequest "breachedaccount/$($Request.query.account)?truncateResponse=false"
16+
if ($request.query.account -like '*@*') {
17+
$Results = Get-HIBPRequest "breachedaccount/$($Request.query.account)?truncateResponse=false"
18+
} else {
19+
$Results = Get-BreachInfo -Domain $Request.query.account
20+
}
21+
1722
# Associate values to output bindings by calling 'Push-OutputBinding'.
1823
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
1924
StatusCode = [HttpStatusCode]::OK

Modules/CippExtensions/Public/HIBP/Get-BreachInfo.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@ function Get-BreachInfo {
22
[CmdletBinding()]
33
param(
44
[Parameter()]
5-
$TenantFilter
5+
$TenantFilter,
6+
[Parameter()]$Domain
7+
68
)
7-
$Data = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $TenantFilter | ForEach-Object {
8-
Invoke-RestMethod -Uri "https://geoipdb.azurewebsites.net/api/Breach?func=domain&domain=$($_.id)"
9+
if ($TenantFilter) {
10+
$Data = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/domains' -tenantid $TenantFilter | ForEach-Object {
11+
Invoke-RestMethod -Uri "https://geoipdb.azurewebsites.net/api/Breach?func=domain&domain=$($_.id)"
12+
}
13+
return $Data
14+
} else {
15+
$data = Invoke-RestMethod -Uri "https://geoipdb.azurewebsites.net/api/Breach?func=domain&domain=$($domain)&format=breachlist"
16+
return $Data
917
}
10-
return $Data
18+
1119
}

0 commit comments

Comments
 (0)