Skip to content

Commit

Permalink
added modules for service fabric, container groups, container apps, a…
Browse files Browse the repository at this point in the history
…nd openshift but not all have been tested
  • Loading branch information
timeforchang committed Jan 2, 2025
1 parent d87609c commit b0deaf4
Show file tree
Hide file tree
Showing 58 changed files with 2,789 additions and 79 deletions.
9 changes: 8 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,25 @@ type AzureResourceManagerClient interface {

ListRoleAssignmentsForResource(ctx context.Context, resourceId string, filter, tenantId string) <-chan AzureResult[azure.RoleAssignment]
ListAzureADTenants(ctx context.Context, includeAllTenantCategories bool) <-chan AzureResult[azure.Tenant]
ListAzureContainerApps(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ContainerApp]
ListAzureContainerGroups(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ContainerGroup]
ListAzureContainerRegistries(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ContainerRegistry]
ListAzureWebApps(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.WebApp]
ListAzureManagedClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ManagedCluster]
ListAzureVMScaleSets(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.VMScaleSet]
ListAzureKeyVaults(ctx context.Context, subscriptionId string, params query.RMParams) <-chan AzureResult[azure.KeyVault]
ListAzureManagementGroups(ctx context.Context, skipToken string) <-chan AzureResult[azure.ManagementGroup]
ListAzureManagementGroupDescendants(ctx context.Context, groupId string, top int32) <-chan AzureResult[azure.DescendantInfo]
ListAzureRedHatOpenShiftClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.RedHatOpenShiftCluster]
ListAzureResourceGroups(ctx context.Context, subscriptionId string, params query.RMParams) <-chan AzureResult[azure.ResourceGroup]
ListAzureRBACRoleDefinitions(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.RBACRoleDefinition]
ListAzureSubscriptions(ctx context.Context) <-chan AzureResult[azure.Subscription]
ListAzureVirtualMachines(ctx context.Context, subscriptionId string, params query.RMParams) <-chan AzureResult[azure.VirtualMachine]
ListAzureSpringApps(ctx context.Context, subscriptionId string, resourceGroupName string, serviceName string) <-chan AzureResult[azure.SpringApp]
ListAzureServiceFabricClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ServiceFabricCluster]
ListAzureServiceFabricClusterApps(ctx context.Context, subscriptionId string, resourceGroupName string, serviceFabricCluster string) <-chan AzureResult[azure.ServiceFabricClusterApp]
ListAzureServiceFabricManagedClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ServiceFabricManagedCluster]
ListAzureServiceFabricManagedClusterApps(ctx context.Context, subscriptionId string, resourceGroupName string, serviceFabricManagedCluster string) <-chan AzureResult[azure.ServiceFabricManagedClusterApp]
ListAzureSpringApps(ctx context.Context, subscriptionId string, resourceGroupName string, springAppServiceName string) <-chan AzureResult[azure.SpringApp]
ListAzureSpringAppServices(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.SpringAppService]
ListAzureStorageAccounts(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.StorageAccount]
ListAzureStorageContainers(ctx context.Context, subscriptionId string, resourceGroupName string, saName string, filter string, includeDeleted string, maxPageSize string) <-chan AzureResult[azure.StorageContainer]
Expand Down
22 changes: 22 additions & 0 deletions client/container_app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureContainerApps https://learn.microsoft.com/en-us/rest/api/resource-manager/containerapps/container-apps/list-by-subscription
func (s *azureClient) ListAzureContainerApps(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ContainerApp] {
var (
out = make(chan AzureResult[azure.ContainerApp])
path = fmt.Sprintf("/subscriptions/%s/providers/Microsoft.App/containerApps", subscriptionId)
params = query.RMParams{ApiVersion: "2024-03-01"}
)

go getAzureObjectList[azure.ContainerApp](s.resourceManager, ctx, path, params, out)

return out
}
22 changes: 22 additions & 0 deletions client/container_group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureContainerGroups https://learn.microsoft.com/en-us/rest/api/container-instances/container-groups/list?view=rest-container-instances-2023-05-01
func (s *azureClient) ListAzureContainerGroups(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ContainerGroup] {
var (
out = make(chan AzureResult[azure.ContainerGroup])
path = fmt.Sprintf("/subscriptions/%s/providers/Microsoft.ContainerInstance/containerGroups", subscriptionId)
params = query.RMParams{ApiVersion: "2023-05-01"}
)

go getAzureObjectList[azure.ContainerGroup](s.resourceManager, ctx, path, params, out)

return out
}
98 changes: 98 additions & 0 deletions client/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions client/red_hat_openshift_clusters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (C) 2022 Specter Ops, Inc.
//
// This file is part of AzureHound.
//
// AzureHound is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// AzureHound is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureRedHatOpenShiftCluster https://learn.microsoft.com/en-us/rest/api/openshift/open-shift-clusters/list?view=rest-openshift-2023-11-22
func (s *azureClient) ListAzureRedHatOpenShiftClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.RedHatOpenShiftCluster] {
var (
out = make(chan AzureResult[azure.RedHatOpenShiftCluster])
path = fmt.Sprintf("/subscriptions/%s/providers/Microsoft.RedHatOpenShift/openShiftClusters", subscriptionId)
params = query.RMParams{ApiVersion: "2023-11-22"}
)

go getAzureObjectList[azure.RedHatOpenShiftCluster](s.resourceManager, ctx, path, params, out)

return out
}
22 changes: 22 additions & 0 deletions client/service_fabric_cluster_apps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureServiceFabricClusterApps https://learn.microsoft.com/en-us/rest/api/servicefabric/application/applications/list?view=rest-servicefabric-application-2023-11-01-preview
func (s *azureClient) ListAzureServiceFabricClusterApps(ctx context.Context, subscriptionId string, resourceGroupName string, clusterName string) <-chan AzureResult[azure.ServiceFabricClusterApp] {
var (
out = make(chan AzureResult[azure.ServiceFabricClusterApp])
path = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/clusters/%s/applications", subscriptionId, resourceGroupName, clusterName)
params = query.RMParams{ApiVersion: "2023-11-01-preview"}
)

go getAzureObjectList[azure.ServiceFabricClusterApp](s.resourceManager, ctx, path, params, out)

return out
}
22 changes: 22 additions & 0 deletions client/service_fabric_clusters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureServiceFabricClusters https://learn.microsoft.com/en-us/rest/api/servicefabric/clusters/list?view=rest-servicefabric-2023-11-01-preview
func (s *azureClient) ListAzureServiceFabricClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ServiceFabricCluster] {
var (
out = make(chan AzureResult[azure.ServiceFabricCluster])
path = fmt.Sprintf("/subscriptions/%s/providers/Microsoft.ServiceFabric/clusters", subscriptionId)
params = query.RMParams{ApiVersion: "2023-11-01-preview"}
)

go getAzureObjectList[azure.ServiceFabricCluster](s.resourceManager, ctx, path, params, out)

return out
}
22 changes: 22 additions & 0 deletions client/service_fabric_managed_cluster_apps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureServiceFabricManagedClusterApps https://learn.microsoft.com/en-us/rest/api/servicefabric/managedclusters/applications/list
func (s *azureClient) ListAzureServiceFabricManagedClusterApps(ctx context.Context, subscriptionId string, resourceGroupName string, clusterName string) <-chan AzureResult[azure.ServiceFabricManagedClusterApp] {
var (
out = make(chan AzureResult[azure.ServiceFabricManagedClusterApp])
path = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ServiceFabric/managedclusters/%s/applications", subscriptionId, resourceGroupName, clusterName)
params = query.RMParams{ApiVersion: "2024-09-01-preview"}
)

go getAzureObjectList[azure.ServiceFabricManagedClusterApp](s.resourceManager, ctx, path, params, out)

return out
}
22 changes: 22 additions & 0 deletions client/service_fabric_managed_clusters.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package client

import (
"context"
"fmt"

"github.com/bloodhoundad/azurehound/v2/client/query"
"github.com/bloodhoundad/azurehound/v2/models/azure"
)

// ListAzureServiceFabricManagedClusters https://learn.microsoft.com/en-us/rest/api/servicefabric/managedclusters/managed-clusters/list-by-subscription
func (s *azureClient) ListAzureServiceFabricManagedClusters(ctx context.Context, subscriptionId string) <-chan AzureResult[azure.ServiceFabricManagedCluster] {
var (
out = make(chan AzureResult[azure.ServiceFabricManagedCluster])
path = fmt.Sprintf("/subscriptions/%s/providers/Microsoft.ServiceFabric/managedClusters", subscriptionId)
params = query.RMParams{ApiVersion: "2024-09-01-preview"}
)

go getAzureObjectList[azure.ServiceFabricManagedCluster](s.resourceManager, ctx, path, params, out)

return out
}
Loading

0 comments on commit b0deaf4

Please sign in to comment.