File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
CIPPCore/Public/Entrypoints
CippExtensions/Public/HIBP Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,12 @@ Function Invoke-ListBreachesAccount {
13
13
$APIName = $TriggerMetadata.FunctionName
14
14
Write-LogMessage - user $request.headers .' x-ms-client-principal' - API $APINAME - message ' Accessed this API' - Sev ' Debug'
15
15
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
+
17
22
# Associate values to output bindings by calling 'Push-OutputBinding'.
18
23
Push-OutputBinding - Name Response - Value ([HttpResponseContext ]@ {
19
24
StatusCode = [HttpStatusCode ]::OK
Original file line number Diff line number Diff line change @@ -2,10 +2,18 @@ function Get-BreachInfo {
2
2
[CmdletBinding ()]
3
3
param (
4
4
[Parameter ()]
5
- $TenantFilter
5
+ $TenantFilter ,
6
+ [Parameter ()]$Domain
7
+
6
8
)
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
9
17
}
10
- return $Data
18
+
11
19
}
You can’t perform that action at this time.
0 commit comments