diff --git a/engine/plugins/horizontals/contact.go b/engine/plugins/horizontals/contact.go index 61808794..a369953b 100644 --- a/engine/plugins/horizontals/contact.go +++ b/engine/plugins/horizontals/contact.go @@ -52,9 +52,8 @@ func (h *horContact) check(e *et.Event) error { if len(impacted) > 0 { h.plugin.process(e, impacted) + h.plugin.addAssociatedRelationship(e, assocs) } - - h.plugin.addAssociatedRelationship(e, assocs) } return nil } diff --git a/engine/plugins/rdap/autnum.go b/engine/plugins/rdap/autnum.go index f114317d..75aa4d1a 100644 --- a/engine/plugins/rdap/autnum.go +++ b/engine/plugins/rdap/autnum.go @@ -137,14 +137,14 @@ func (r *autnum) oneOfSources(e *et.Event, edge *dbt.Edge, src *et.Source, since return false } -func (r *autnum) store(e *et.Event, resp *rdap.Autnum, asset *dbt.Entity, m *config.Matches) []*support.Finding { +func (r *autnum) store(e *et.Event, resp *rdap.Autnum, entity *dbt.Entity, m *config.Matches) []*support.Finding { var findings []*support.Finding - autrec := asset.Asset.(*oamreg.AutnumRecord) + autrec := entity.Asset.(*oamreg.AutnumRecord) if u := r.plugin.getJSONLink(resp.Links); u != nil && m.IsMatch(string(oam.URL)) { if a, err := e.Session.Cache().CreateAsset(u); err == nil && a != nil { findings = append(findings, &support.Finding{ - From: asset, + From: entity, FromName: "AutnumRecord: " + autrec.Handle, To: a, ToName: u.Raw, @@ -155,10 +155,10 @@ func (r *autnum) store(e *et.Event, resp *rdap.Autnum, asset *dbt.Entity, m *con if name := autrec.WhoisServer; name != "" && m.IsMatch(string(oam.FQDN)) { fqdn := &domain.FQDN{Name: name} - if a, err := e.Session.Cache().CreateAsset(fqdn); err == nil && a != nil { - if _, conf := e.Session.Scope().IsAssetInScope(fqdn, 0); conf > 0 { + if _, conf := e.Session.Scope().IsAssetInScope(fqdn, 0); conf > 0 { + if a, err := e.Session.Cache().CreateAsset(fqdn); err == nil && a != nil { findings = append(findings, &support.Finding{ - From: asset, + From: entity, FromName: "AutnumRecord: " + autrec.Handle, To: a, ToName: name, @@ -169,8 +169,8 @@ func (r *autnum) store(e *et.Event, resp *rdap.Autnum, asset *dbt.Entity, m *con } if m.IsMatch(string(oam.ContactRecord)) { - for _, entity := range resp.Entities { - findings = append(findings, r.plugin.storeEntity(e, 1, &entity, asset, r.plugin.source, m)...) + for _, v := range resp.Entities { + findings = append(findings, r.plugin.storeEntity(e, 1, &v, entity, r.plugin.source, m)...) } } return findings diff --git a/engine/sessions/scope/assoc.go b/engine/sessions/scope/assoc.go index 899485c2..e3656d81 100644 --- a/engine/sessions/scope/assoc.go +++ b/engine/sessions/scope/assoc.go @@ -131,16 +131,14 @@ func (s *Scope) checkRelatedAssetsforAssoc(c *cache.Cache, req *Association, ass impacted = append(impacted, asset) } if match, conf := s.IsAssetInScope(asset.Asset, req.Confidence); conf > 0 { - if a, err := c.FindEntityByContent(match, c.StartTime()); err == nil && a != nil { - if conf > best { - best = conf - - aa := assoc.Asset - sa := req.Submission.Asset - msg = fmt.Sprintf("[%s: %s] is related to an asset with associative value [%s: %s], ", sa.AssetType(), sa.Key(), aa.AssetType(), aa.Key()) - msg += fmt.Sprintf("which has a related asset [%s: %s] that was determined associated with [%s: %s] at a confidence of %d out of 100", - asset.Asset.AssetType(), asset.Asset.Key(), match.AssetType(), match.Key(), conf) - } + if conf > best { + best = conf + + aa := assoc.Asset + sa := req.Submission.Asset + msg = fmt.Sprintf("[%s: %s] is related to an asset with associative value [%s: %s], ", sa.AssetType(), sa.Key(), aa.AssetType(), aa.Key()) + msg += fmt.Sprintf("which has a related asset [%s: %s] that was determined associated with [%s: %s] at a confidence of %d out of 100", + asset.Asset.AssetType(), asset.Asset.Key(), match.AssetType(), match.Key(), conf) } } }