Skip to content

Commit

Permalink
MAX_IMPORTED is broken, so it's been disabled for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkarlslund committed Nov 5, 2021
1 parent 4a17008 commit 66b8180
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
3 changes: 2 additions & 1 deletion modules/engine/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ type Attribute uint16
var attributemutex sync.RWMutex

func NewAttribute(name string) Attribute {
if pos := strings.Index(name, ";"); pos != -1 {
if name[len(name)-1] >= '0' && name[len(name)-1] <= '9' && strings.Index(name, ";") != -1 {
if !strings.HasPrefix(name, "member;") {
log.Debug().Msgf("Incomplete data detected in attribute %v", name)
}
pos := strings.Index(name, ";")
name = name[pos+1:]
}

Expand Down
32 changes: 18 additions & 14 deletions modules/engine/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,27 @@ func (o *Object) Absorb(source *Object) {
delete(pwner.CanPwn, source)
}

members := make(map[*Object]struct{})
for _, member := range target.members {
members[member] = struct{}{}
}
for _, newmember := range source.members {
if _, found := members[newmember]; !found {
target.members = append(target.members, newmember)
if len(source.members) > 0 {
members := make(map[*Object]struct{})
for _, member := range target.members {
members[member] = struct{}{}
}
for _, newmember := range source.members {
if _, found := members[newmember]; !found {
target.members = append(target.members, newmember)
}
}
}

memberofgroups := make(map[*Object]struct{})
for _, memberof := range target.memberof {
memberofgroups[memberof] = struct{}{}
}
for _, newmemberof := range source.memberof {
if _, found := memberofgroups[newmemberof]; !found {
target.memberof = append(target.memberof, newmemberof)
if len(source.memberof) > 0 {
memberofgroups := make(map[*Object]struct{})
for _, memberof := range target.memberof {
memberofgroups[memberof] = struct{}{}
}
for _, newmemberof := range source.memberof {
if _, found := memberofgroups[newmemberof]; !found {
target.memberof = append(target.memberof, newmemberof)
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion modules/integrations/activedirectory/analyze/adloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import (
)

var (
importall = analyze.Command.Flags().Bool("importall", false, "Load all attributes from dump (expands search options, but at the cost of memory")
// FIXME - NEEDS TO ME TRUE AT THE MOMENT AS MAX_IMPORT IS BROKEN4
importall = analyze.Command.Flags().Bool("importall", true, "Load all attributes from dump (expands search options, but at the cost of memory")

adsource = engine.AttributeValueString("Active Directory loader")

Expand Down
5 changes: 1 addition & 4 deletions modules/integrations/activedirectory/collect/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,8 @@ func Execute(cmd *cobra.Command, args []string) error {

var attributes []string
switch *attributesparam {
// case "":
// return errors.New("I don't know how to interpret attributes (blank?)")
case "*":

// case "needed":
// don't do anything
default:
attributes = strings.Split(*attributesparam, ",")
}
Expand Down

0 comments on commit 66b8180

Please sign in to comment.