Skip to content

Commit

Permalink
fixes related to associations
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Dec 6, 2024
1 parent 23b9d76 commit f173be8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
28 changes: 2 additions & 26 deletions engine/plugins/horizontals/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
dbt "github.com/owasp-amass/asset-db/types"
oam "github.com/owasp-amass/open-asset-model"
"github.com/owasp-amass/open-asset-model/contact"
"github.com/owasp-amass/open-asset-model/property"
)

type horContact struct {
Expand Down Expand Up @@ -51,18 +50,8 @@ func (h *horContact) check(e *et.Event) error {
}
}

var assets []*dbt.Entity
for _, im := range impacted {
if a, err := e.Session.Cache().FindEntityByContent(im.Asset,
e.Session.Cache().StartTime()); err == nil && len(a) == 1 {
assets = append(assets, a[0])
} else if n := h.store(e, im.Asset); n != nil {
assets = append(assets, n)
}
}

if len(assets) > 0 {
h.plugin.process(e, assets)
if len(impacted) > 0 {
h.plugin.process(e, impacted)
h.plugin.addAssociatedRelationship(e, assocs)
}
}
Expand Down Expand Up @@ -92,16 +81,3 @@ func (h *horContact) lookup(e *et.Event, asset *dbt.Entity, conf int) []*scope.A
}
return results
}

func (h *horContact) store(e *et.Event, asset oam.Asset) *dbt.Entity {
a, err := e.Session.Cache().CreateAsset(asset)
if err != nil || a == nil {
return nil
}

_, _ = e.Session.Cache().CreateEntityProperty(a, &property.SourceProperty{
Source: h.plugin.source.Name,
Confidence: h.plugin.source.Confidence,
})
return a
}
2 changes: 1 addition & 1 deletion engine/sessions/scope/assoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (s *Scope) awayFromAssetsWithAssociation(c *cache.Cache, assoc *dbt.Entity)
out = true
outRels = append(outRels, "port")
in = true
inRels = append(inRels, "a_record", "aaaa_record")
inRels = append(inRels, "dns_record")
case oam.Netblock:
out = true
outRels = append(outRels, "contains")
Expand Down

0 comments on commit f173be8

Please sign in to comment.