Skip to content

Commit e0a6bc2

Browse files
committed
worked on the store method
1 parent 4966f19 commit e0a6bc2

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

engine/plugins/api/aviato/company_enrich.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"errors"
1111
"fmt"
1212
"log/slog"
13+
"strings"
1314
"time"
1415

1516
"github.com/owasp-amass/amass/v4/engine/plugins/support"
@@ -115,7 +116,34 @@ func (ce *companyEnrich) query(e *et.Event, ident *dbt.Entity, apikey []string)
115116
}
116117

117118
func (ce *companyEnrich) store(e *et.Event, orgent *dbt.Entity, data *companyEnrichResult) {
119+
o := orgent.Asset.(*org.Organization)
120+
121+
o.Active = false
122+
if strings.EqualFold(data.Status, "active") {
123+
o.Active = true
124+
}
125+
o.NonProfit = data.IsNonProfit
126+
o.Headcount = data.Headcount
118127

128+
// attempt to set the legal name
129+
if o.LegalName == "" && data.LegalName != "" {
130+
o.LegalName = data.LegalName
131+
132+
oamid := &general.Identifier{
133+
UniqueID: fmt.Sprintf("%s:%s", general.LegalName, o.LegalName),
134+
ID: o.LegalName,
135+
Type: general.LegalName,
136+
}
137+
138+
if ident, err := e.Session.Cache().CreateAsset(oamid); err == nil && ident != nil {
139+
_, _ = e.Session.Cache().CreateEntityProperty(ident, &general.SourceProperty{
140+
Source: ce.plugin.source.Name,
141+
Confidence: ce.plugin.source.Confidence,
142+
})
143+
144+
_ = ce.plugin.createRelation(e.Session, orgent, general.SimpleRelation{Name: "id"}, ident, ce.plugin.source.Confidence)
145+
}
146+
}
119147
}
120148

121149
func (ce *companyEnrich) process(e *et.Event, ident, orgent *dbt.Entity) {

0 commit comments

Comments
 (0)