Skip to content

Commit

Permalink
Changed RootDSE filename to omit server name
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Dec 1, 2021
1 parent a2483ff commit 10ac952
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions modules/integrations/activedirectory/collect/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ var (

authmodeString *string

authdomain = Command.Flags().String("authdomain", "", "domain for authentication, if using ntlm auth")
dumpquery = Command.Flags().String("query", "(objectClass=*)", "LDAP query for dump, defaults to everything")

authdomain = Command.Flags().String("authdomain", "", "domain for authentication, if using ntlm auth")
attributesparam = Command.Flags().String("attributes", "*", "Comma seperated list of attributes to get, * = all, or a comma seperated list of attribute names (expert)")

nosacl = Command.Flags().Bool("nosacl", true, "Request data with NO SACL flag, allows normal users to dump ntSecurityDescriptor field")
Expand Down Expand Up @@ -219,7 +217,6 @@ func Execute(cmd *cobra.Command, args []string) error {
SearchBase: "",
Scope: ldap.ScopeBaseObject,
ReturnObjects: true,
WriteToFile: filepath.Join(datapath, *server+"RootDSE.objects.msgp.lz4"),
})
if err != nil {
return fmt.Errorf("problem querying Active Directory RootDSE: %w", err)
Expand Down Expand Up @@ -250,6 +247,16 @@ func Execute(cmd *cobra.Command, args []string) error {
}
}

log.Info().Msg("Saving RootDSE ...")
_, err = ad.Dump(DumpOptions{
SearchBase: "",
Scope: ldap.ScopeBaseObject,
WriteToFile: filepath.Join(datapath, domainContext+".RootDSE.objects.msgp.lz4"),
})
if err != nil {
return fmt.Errorf("problem saving Active Directory RootDSE: %w", err)
}

do := DumpOptions{
Attributes: attributes,
Scope: ldap.ScopeWholeSubtree,
Expand Down

0 comments on commit 10ac952

Please sign in to comment.