Skip to content

Commit

Permalink
some updates
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Dec 9, 2024
1 parent 9480aec commit 93004f0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
3 changes: 1 addition & 2 deletions engine/plugins/horizontals/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
16 changes: 8 additions & 8 deletions engine/plugins/rdap/autnum.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
Expand Down
18 changes: 8 additions & 10 deletions engine/sessions/scope/assoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit 93004f0

Please sign in to comment.