Skip to content

Commit bc5b828

Browse files
authored
Merge pull request #81 from BloodHoundAD/BED-4599-configurable-collection-values
BED-4599 configurable collection values
2 parents 46e9bca + 4379121 commit bc5b828

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+225
-41
lines changed

client/rest/http.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ import (
2929
"strings"
3030
"time"
3131

32+
"github.com/bloodhoundad/azurehound/v2/config"
3233
"github.com/bloodhoundad/azurehound/v2/constants"
3334
)
3435

3536
func NewHTTPClient(proxyUrl string) (*http.Client, error) {
3637
transport := http.DefaultTransport.(*http.Transport).Clone()
37-
transport.MaxConnsPerHost = 200
38-
transport.MaxIdleConnsPerHost = 200
38+
transport.MaxConnsPerHost = config.ColMaxConnsPerHost.Value().(int)
39+
transport.MaxIdleConnsPerHost = config.ColMaxIdleConnsPerHost.Value().(int)
3940
transport.DisableKeepAlives = false
4041

4142
// defaults to TLS 1.0 which is not favorable

cmd/list-app-owners.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626

2727
"github.com/bloodhoundad/azurehound/v2/client"
2828
"github.com/bloodhoundad/azurehound/v2/client/query"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -62,7 +63,7 @@ func listAppOwnersCmdImpl(cmd *cobra.Command, args []string) {
6263
func listAppOwners(ctx context.Context, client client.AzureClient, apps <-chan azureWrapper[models.App]) <-chan azureWrapper[models.AppOwners] {
6364
var (
6465
out = make(chan azureWrapper[models.AppOwners])
65-
streams = pipeline.Demux(ctx.Done(), apps, 25)
66+
streams = pipeline.Demux(ctx.Done(), apps, config.ColStreamCount.Value().(int))
6667
wg sync.WaitGroup
6768
params = query.GraphParams{}
6869
)

cmd/list-app-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -65,7 +66,7 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv
6566
var (
6667
out = make(chan interface{})
6768
filteredSPs = make(chan models.ServicePrincipal)
68-
streams = pipeline.Demux(ctx.Done(), filteredSPs, 25)
69+
streams = pipeline.Demux(ctx.Done(), filteredSPs, config.ColStreamCount.Value().(int))
6970
wg sync.WaitGroup
7071
)
7172

cmd/list-automation-account-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
"github.com/bloodhoundad/azurehound/v2/client"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -65,7 +66,7 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu
6566
var (
6667
out = make(chan interface{})
6768
ids = make(chan string)
68-
streams = pipeline.Demux(ctx.Done(), ids, 25)
69+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6970
wg sync.WaitGroup
7071
)
7172

cmd/list-automation-accounts.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -63,7 +64,7 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs
6364
var (
6465
out = make(chan interface{})
6566
ids = make(chan string)
66-
streams = pipeline.Demux(ctx.Done(), ids, 25)
67+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6768
wg sync.WaitGroup
6869
)
6970

cmd/list-container-registries.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -68,7 +69,7 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub
6869
var (
6970
out = make(chan interface{})
7071
ids = make(chan string)
71-
streams = pipeline.Demux(ctx.Done(), ids, 25)
72+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7273
wg sync.WaitGroup
7374
)
7475

cmd/list-container-registry-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
"github.com/bloodhoundad/azurehound/v2/client"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -70,7 +71,7 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu
7071
var (
7172
out = make(chan interface{})
7273
ids = make(chan string)
73-
streams = pipeline.Demux(ctx.Done(), ids, 25)
74+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7475
wg sync.WaitGroup
7576
)
7677

cmd/list-device-owners.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -64,7 +65,7 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <-
6465
var (
6566
out = make(chan interface{})
6667
ids = make(chan string)
67-
streams = pipeline.Demux(ctx.Done(), ids, 25)
68+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6869
wg sync.WaitGroup
6970
)
7071

cmd/list-function-app-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
"github.com/bloodhoundad/azurehound/v2/client"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -65,7 +66,7 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie
6566
var (
6667
out = make(chan interface{})
6768
ids = make(chan string)
68-
streams = pipeline.Demux(ctx.Done(), ids, 25)
69+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6970
wg sync.WaitGroup
7071
)
7172

cmd/list-function-apps.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -63,7 +64,7 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti
6364
var (
6465
out = make(chan interface{})
6566
ids = make(chan string)
66-
streams = pipeline.Demux(ctx.Done(), ids, 25)
67+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6768
wg sync.WaitGroup
6869
)
6970

cmd/list-group-members.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -66,7 +67,7 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c
6667
var (
6768
out = make(chan interface{})
6869
ids = make(chan string)
69-
streams = pipeline.Demux(ctx.Done(), ids, 25)
70+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7071
wg sync.WaitGroup
7172
params = query.GraphParams{
7273
Select: unique(listGroupMembersSelect),

cmd/list-group-owners.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -63,7 +64,7 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch
6364
var (
6465
out = make(chan interface{})
6566
ids = make(chan string)
66-
streams = pipeline.Demux(ctx.Done(), ids, 25)
67+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6768
wg sync.WaitGroup
6869
params = query.GraphParams{}
6970
)

cmd/list-key-vault-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -64,7 +65,7 @@ func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient,
6465
var (
6566
out = make(chan azureWrapper[models.KeyVaultRoleAssignments])
6667
ids = make(chan string)
67-
streams = pipeline.Demux(ctx.Done(), ids, 25)
68+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6869
wg sync.WaitGroup
6970
)
7071

cmd/list-key-vaults.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -64,7 +65,7 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions
6465
var (
6566
out = make(chan interface{})
6667
ids = make(chan string)
67-
streams = pipeline.Demux(ctx.Done(), ids, 25)
68+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6869
wg sync.WaitGroup
6970
)
7071

cmd/list-logic-app-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
"github.com/bloodhoundad/azurehound/v2/client"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -70,7 +71,7 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient,
7071
var (
7172
out = make(chan interface{})
7273
ids = make(chan string)
73-
streams = pipeline.Demux(ctx.Done(), ids, 25)
74+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7475
wg sync.WaitGroup
7576
)
7677

cmd/list-logic-apps.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -68,7 +69,7 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions
6869
var (
6970
out = make(chan interface{})
7071
ids = make(chan string)
71-
streams = pipeline.Demux(ctx.Done(), ids, 25)
72+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7273
wg sync.WaitGroup
7374
)
7475

cmd/list-managed-cluster-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"time"
2828

2929
"github.com/bloodhoundad/azurehound/v2/client"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -70,7 +71,7 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC
7071
var (
7172
out = make(chan interface{})
7273
ids = make(chan string)
73-
streams = pipeline.Demux(ctx.Done(), ids, 25)
74+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7475
wg sync.WaitGroup
7576
)
7677

cmd/list-managed-clusters.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -68,7 +69,7 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri
6869
var (
6970
out = make(chan interface{})
7071
ids = make(chan string)
71-
streams = pipeline.Demux(ctx.Done(), ids, 25)
72+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
7273
wg sync.WaitGroup
7374
)
7475

cmd/list-management-group-descendants.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -63,7 +64,7 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie
6364
var (
6465
out = make(chan interface{})
6566
ids = make(chan string)
66-
streams = pipeline.Demux(ctx.Done(), ids, 25)
67+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6768
wg sync.WaitGroup
6869
)
6970

cmd/list-management-group-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -64,7 +65,7 @@ func listManagementGroupRoleAssignments(ctx context.Context, client client.Azure
6465
var (
6566
out = make(chan azureWrapper[models.ManagementGroupRoleAssignments])
6667
ids = make(chan string)
67-
streams = pipeline.Demux(ctx.Done(), ids, 25)
68+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6869
wg sync.WaitGroup
6970
)
7071

cmd/list-resource-group-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"time"
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
29+
"github.com/bloodhoundad/azurehound/v2/config"
2930
"github.com/bloodhoundad/azurehound/v2/enums"
3031
"github.com/bloodhoundad/azurehound/v2/models"
3132
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -65,7 +66,7 @@ func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureCl
6566
var (
6667
out = make(chan azureWrapper[models.ResourceGroupRoleAssignments])
6768
ids = make(chan string)
68-
streams = pipeline.Demux(ctx.Done(), ids, 25)
69+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6970
wg sync.WaitGroup
7071
)
7172

cmd/list-resource-groups.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -64,7 +65,7 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip
6465
var (
6566
out = make(chan interface{})
6667
ids = make(chan string)
67-
streams = pipeline.Demux(ctx.Done(), ids, 25)
68+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6869
wg sync.WaitGroup
6970
)
7071

@@ -98,7 +99,7 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip
9899
} else {
99100
resourceGroup := models.ResourceGroup{
100101
ResourceGroup: item.Ok,
101-
SubscriptionId: "/subscriptions/"+id,
102+
SubscriptionId: "/subscriptions/" + id,
102103
TenantId: client.TenantInfo().TenantId,
103104
}
104105
log.V(2).Info("found resource group", "resourceGroup", resourceGroup)

cmd/list-role-assignments.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727

2828
"github.com/bloodhoundad/azurehound/v2/client"
2929
"github.com/bloodhoundad/azurehound/v2/client/query"
30+
"github.com/bloodhoundad/azurehound/v2/config"
3031
"github.com/bloodhoundad/azurehound/v2/enums"
3132
"github.com/bloodhoundad/azurehound/v2/models"
3233
"github.com/bloodhoundad/azurehound/v2/panicrecovery"
@@ -65,7 +66,7 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles <
6566
var (
6667
out = make(chan interface{})
6768
ids = make(chan string)
68-
streams = pipeline.Demux(ctx.Done(), ids, 25)
69+
streams = pipeline.Demux(ctx.Done(), ids, config.ColStreamCount.Value().(int))
6970
wg sync.WaitGroup
7071
)
7172

0 commit comments

Comments
 (0)