From f173be8add261ebe12130412c42624c1cb522dab Mon Sep 17 00:00:00 2001 From: caffix Date: Fri, 6 Dec 2024 18:10:37 -0500 Subject: [PATCH] fixes related to associations --- engine/plugins/horizontals/contact.go | 28 ++------------------------- engine/sessions/scope/assoc.go | 2 +- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/engine/plugins/horizontals/contact.go b/engine/plugins/horizontals/contact.go index 4290d62e..a369953b 100644 --- a/engine/plugins/horizontals/contact.go +++ b/engine/plugins/horizontals/contact.go @@ -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 { @@ -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) } } @@ -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 -} diff --git a/engine/sessions/scope/assoc.go b/engine/sessions/scope/assoc.go index 3cecb82d..899485c2 100644 --- a/engine/sessions/scope/assoc.go +++ b/engine/sessions/scope/assoc.go @@ -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")