@@ -18,18 +18,18 @@ import (
1818 "github.com/owasp-amass/amass/v5/engine/plugins/support"
1919 "github.com/owasp-amass/amass/v5/engine/plugins/support/org"
2020 et "github.com/owasp-amass/amass/v5/engine/types"
21- "github.com/owasp-amass/amass/v5/internal/net/http"
21+ amasshttp "github.com/owasp-amass/amass/v5/internal/net/http"
2222 dbt "github.com/owasp-amass/asset-db/types"
2323 oam "github.com/owasp-amass/open-asset-model"
24- "github.com/owasp-amass/open-asset-model/account"
25- "github.com/owasp-amass/open-asset-model/financial"
26- "github.com/owasp-amass/open-asset-model/general"
24+ oamacct "github.com/owasp-amass/open-asset-model/account"
25+ oamfin "github.com/owasp-amass/open-asset-model/financial"
26+ oamgen "github.com/owasp-amass/open-asset-model/general"
2727 oamorg "github.com/owasp-amass/open-asset-model/org"
28- "github.com/owasp-amass/open-asset-model/people"
28+ oampeop "github.com/owasp-amass/open-asset-model/people"
2929)
3030
3131func (cr * companyRounds ) check (e * et.Event ) error {
32- oamid , ok := e .Entity .Asset .(* general .Identifier )
32+ oamid , ok := e .Entity .Asset .(* oamgen .Identifier )
3333 if ! ok {
3434 return errors .New ("failed to extract the Identifier asset" )
3535 } else if oamid .Type != AviatoCompanyID {
@@ -107,7 +107,7 @@ func (cr *companyRounds) lookup(e *et.Event, ident *dbt.Entity, since time.Time)
107107 continue
108108 }
109109 if a , err := e .Session .DB ().FindEntityById (ctx , edge .ToEntity .ID ); err == nil && a != nil {
110- if acc , ok := a .Asset .(* account .Account ); ok && acc .Type == account .Checking && acc .Number == "default" {
110+ if acc , ok := a .Asset .(* oamacct .Account ); ok && acc .Type == oamacct .Checking && acc .Number == "default" {
111111 accountents = append (accountents , a )
112112 }
113113 }
@@ -121,7 +121,7 @@ func (cr *companyRounds) lookup(e *et.Event, ident *dbt.Entity, since time.Time)
121121 continue
122122 }
123123 if a , err := e .Session .DB ().FindEntityById (ctx , edge .FromEntity .ID ); err == nil && a != nil {
124- if _ , ok := a .Asset .(* financial .FundsTransfer ); ok {
124+ if _ , ok := a .Asset .(* oamfin .FundsTransfer ); ok {
125125 fundents = append (fundents , a )
126126 }
127127 }
@@ -133,7 +133,7 @@ func (cr *companyRounds) lookup(e *et.Event, ident *dbt.Entity, since time.Time)
133133}
134134
135135func (cr * companyRounds ) query (e * et.Event , ident * dbt.Entity , apikey []string ) []* dbt.Entity {
136- oamid := e .Entity .Asset .(* general .Identifier )
136+ oamid := e .Entity .Asset .(* oamgen .Identifier )
137137
138138 orgent := cr .getAssociatedOrg (e , ident )
139139 if orgent == nil {
@@ -149,15 +149,18 @@ func (cr *companyRounds) query(e *et.Event, ident *dbt.Entity, apikey []string)
149149loop:
150150 for _ , key := range apikey {
151151 for ; page < total ; page ++ {
152- headers := http .Header {"Content-Type" : []string {"application/json" }}
152+ headers := amasshttp .Header {"Content-Type" : []string {"application/json" }}
153153 headers ["Authorization" ] = []string {"Bearer " + key }
154154
155155 _ = cr .plugin .rlimit .Wait (e .Session .Ctx ())
156+ e .Session .NetSem ().Acquire ()
157+
156158 ctx , cancel := context .WithTimeout (e .Session .Ctx (), 20 * time .Second )
157159 defer cancel ()
158160
159161 u := fmt .Sprintf ("https://data.api.aviato.co/company/%s/funding-rounds?perPage=%d&page=%d" , url .QueryEscape (oamid .ID ), perPage , page )
160- resp , err := http .RequestWebPage (ctx , & http.Request {URL : u , Header : headers })
162+ resp , err := amasshttp .RequestWebPage (ctx , e .Session .Clients ().General , & amasshttp.Request {URL : u , Header : headers })
163+ e .Session .NetSem ().Release ()
161164 if err != nil {
162165 msg := fmt .Sprintf ("failed to obtain the funding rounds for %s: %s" , oamid .ID , err )
163166 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
@@ -247,7 +250,7 @@ func (cr *companyRounds) store(e *et.Event, ident, orgent *dbt.Entity, funds *co
247250 continue
248251 }
249252
250- f := & financial .FundsTransfer {
253+ f := & oamfin .FundsTransfer {
251254 ID : fmt .Sprintf ("%s:%s" , round .Name , round .Stage ),
252255 Amount : float64 (round .MoneyRaised ),
253256 Currency : "USD" ,
@@ -261,7 +264,7 @@ func (cr *companyRounds) store(e *et.Event, ident, orgent *dbt.Entity, funds *co
261264 continue
262265 }
263266
264- _ , err = e .Session .DB ().CreateEntityProperty (ctx , fundent , & general .SourceProperty {
267+ _ , err = e .Session .DB ().CreateEntityProperty (ctx , fundent , & oamgen .SourceProperty {
265268 Source : cr .plugin .source .Name ,
266269 Confidence : cr .plugin .source .Confidence ,
267270 })
@@ -272,14 +275,14 @@ func (cr *companyRounds) store(e *et.Event, ident, orgent *dbt.Entity, funds *co
272275 }
273276
274277 if err := cr .plugin .createRelation (ctx , e .Session , fundent ,
275- general .SimpleRelation {Name : "recipient" }, orgacc , cr .plugin .source .Confidence ); err != nil {
278+ oamgen .SimpleRelation {Name : "recipient" }, orgacc , cr .plugin .source .Confidence ); err != nil {
276279 msg := fmt .Sprintf ("failed to create the recipient relation for %s: %s" , f .ID , err )
277280 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
278281 continue
279282 }
280283
281284 if err := cr .plugin .createRelation (ctx , e .Session , fundent ,
282- general .SimpleRelation {Name : "sender" }, seedacc , cr .plugin .source .Confidence ); err != nil {
285+ oamgen .SimpleRelation {Name : "sender" }, seedacc , cr .plugin .source .Confidence ); err != nil {
283286 msg := fmt .Sprintf ("failed to create the sender relation for %s: %s" , f .ID , err )
284287 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
285288 continue
@@ -301,7 +304,7 @@ func (cr *companyRounds) orgCheckingAccount(e *et.Event, orgent *dbt.Entity) *db
301304 if edges , err := e .Session .DB ().OutgoingEdges (ctx , orgent , time.Time {}, "account" ); err == nil {
302305 for _ , edge := range edges {
303306 if a , err := e .Session .DB ().FindEntityById (ctx , edge .ToEntity .ID ); err == nil && a != nil {
304- if acc , ok := a .Asset .(* account .Account ); ok && acc .Type == account .Checking && acc .Number == "default" {
307+ if acc , ok := a .Asset .(* oamacct .Account ); ok && acc .Type == oamacct .Checking && acc .Number == "default" {
305308 accountent = a
306309 break
307310 }
@@ -310,9 +313,9 @@ func (cr *companyRounds) orgCheckingAccount(e *et.Event, orgent *dbt.Entity) *db
310313 }
311314
312315 if accountent == nil {
313- ent , err := e .Session .DB ().CreateAsset (ctx , & account .Account {
316+ ent , err := e .Session .DB ().CreateAsset (ctx , & oamacct .Account {
314317 ID : uuid .New ().String (),
315- Type : account .Checking ,
318+ Type : oamacct .Checking ,
316319 Number : "default" ,
317320 Balance : 0 ,
318321 Active : o .Active ,
@@ -326,7 +329,7 @@ func (cr *companyRounds) orgCheckingAccount(e *et.Event, orgent *dbt.Entity) *db
326329 accountent = ent
327330 }
328331
329- _ , err := e .Session .DB ().CreateEntityProperty (ctx , accountent , & general .SourceProperty {
332+ _ , err := e .Session .DB ().CreateEntityProperty (ctx , accountent , & oamgen .SourceProperty {
330333 Source : cr .plugin .source .Name ,
331334 Confidence : cr .plugin .source .Confidence ,
332335 })
@@ -337,7 +340,7 @@ func (cr *companyRounds) orgCheckingAccount(e *et.Event, orgent *dbt.Entity) *db
337340 }
338341
339342 if err := cr .plugin .createRelation (ctx , e .Session , orgent ,
340- general .SimpleRelation {Name : "account" }, accountent , cr .plugin .source .Confidence ); err != nil {
343+ oamgen .SimpleRelation {Name : "account" }, accountent , cr .plugin .source .Confidence ); err != nil {
341344 msg := fmt .Sprintf ("failed to create the account relation for %s: %s" , o .Name , err )
342345 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
343346 }
@@ -350,9 +353,9 @@ func (cr *companyRounds) createSeedAccount(e *et.Event, round *companyFundingRou
350353 defer cancel ()
351354
352355 name := fmt .Sprintf ("%s:%s" , round .Name , round .Stage )
353- accountent , err := e .Session .DB ().CreateAsset (ctx , & account .Account {
356+ accountent , err := e .Session .DB ().CreateAsset (ctx , & oamacct .Account {
354357 ID : name ,
355- Type : account .Checking ,
358+ Type : oamacct .Checking ,
356359 Number : "default" ,
357360 Balance : float64 (round .MoneyRaised ),
358361 Active : false ,
@@ -363,7 +366,7 @@ func (cr *companyRounds) createSeedAccount(e *et.Event, round *companyFundingRou
363366 return nil
364367 }
365368
366- _ , err = e .Session .DB ().CreateEntityProperty (ctx , accountent , & general .SourceProperty {
369+ _ , err = e .Session .DB ().CreateEntityProperty (ctx , accountent , & oamgen .SourceProperty {
367370 Source : cr .plugin .source .Name ,
368371 Confidence : cr .plugin .source .Confidence ,
369372 })
@@ -380,7 +383,7 @@ func (cr *companyRounds) createSeedAccount(e *et.Event, round *companyFundingRou
380383
381384 for _ , investor := range investors {
382385 if err := cr .plugin .createRelation (ctx , e .Session , investor ,
383- general .SimpleRelation {Name : "account" }, accountent , cr .plugin .source .Confidence ); err != nil {
386+ oamgen .SimpleRelation {Name : "account" }, accountent , cr .plugin .source .Confidence ); err != nil {
384387 msg := fmt .Sprintf ("failed to create the account relation for %s: %s" , investor .ID , err )
385388 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
386389 }
@@ -400,7 +403,7 @@ func (cr *companyRounds) createOrgInvestors(e *et.Event, round *companyFundingRo
400403 defer cancel ()
401404
402405 for _ , investor := range round .CompanyInvestors {
403- oamid := & general .Identifier {
406+ oamid := & oamgen .Identifier {
404407 UniqueID : fmt .Sprintf ("%s:%s" , AviatoCompanyID , investor .CompanyID ),
405408 ID : investor .CompanyID ,
406409 Type : AviatoCompanyID ,
@@ -442,7 +445,7 @@ func (cr *companyRounds) createOrgInvestors(e *et.Event, round *companyFundingRo
442445 continue
443446 }
444447
445- _ , err = e .Session .DB ().CreateEntityProperty (ctx , orgent , & general .SourceProperty {
448+ _ , err = e .Session .DB ().CreateEntityProperty (ctx , orgent , & oamgen .SourceProperty {
446449 Source : cr .plugin .source .Name ,
447450 Confidence : cr .plugin .source .Confidence ,
448451 })
@@ -453,7 +456,7 @@ func (cr *companyRounds) createOrgInvestors(e *et.Event, round *companyFundingRo
453456 }
454457
455458 if err := cr .plugin .createRelation (ctx , e .Session , orgent ,
456- general .SimpleRelation {Name : "id" }, ident , cr .plugin .source .Confidence ); err != nil {
459+ oamgen .SimpleRelation {Name : "id" }, ident , cr .plugin .source .Confidence ); err != nil {
457460 msg := fmt .Sprintf ("failed to create the id relation for %s: %s" , oamid .UniqueID , err )
458461 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
459462 }
@@ -480,7 +483,7 @@ func (cr *companyRounds) createPersonInvestors(e *et.Event, round *companyFundin
480483 defer cancel ()
481484
482485 for _ , investor := range round .PersonInvestors {
483- oamid := & general .Identifier {
486+ oamid := & oamgen .Identifier {
484487 UniqueID : fmt .Sprintf ("%s:%s" , AviatoPersonID , investor .PersonID ),
485488 ID : investor .PersonID ,
486489 Type : AviatoPersonID ,
@@ -501,7 +504,7 @@ func (cr *companyRounds) createPersonInvestors(e *et.Event, round *companyFundin
501504 continue
502505 }
503506 if a , err := e .Session .DB ().FindEntityById (ctx , edge .FromEntity .ID ); err == nil && a != nil {
504- if _ , ok := a .Asset .(* people .Person ); ok {
507+ if _ , ok := a .Asset .(* oampeop .Person ); ok {
505508 personent = a
506509 break
507510 }
@@ -526,7 +529,7 @@ func (cr *companyRounds) createPersonInvestors(e *et.Event, round *companyFundin
526529 continue
527530 }
528531
529- _ , err = e .Session .DB ().CreateEntityProperty (ctx , personent , & general .SourceProperty {
532+ _ , err = e .Session .DB ().CreateEntityProperty (ctx , personent , & oamgen .SourceProperty {
530533 Source : cr .plugin .source .Name ,
531534 Confidence : cr .plugin .source .Confidence ,
532535 })
@@ -537,7 +540,7 @@ func (cr *companyRounds) createPersonInvestors(e *et.Event, round *companyFundin
537540 }
538541
539542 if err := cr .plugin .createRelation (ctx , e .Session , personent ,
540- general .SimpleRelation {Name : "id" }, ident , cr .plugin .source .Confidence ); err != nil {
543+ oamgen .SimpleRelation {Name : "id" }, ident , cr .plugin .source .Confidence ); err != nil {
541544 msg := fmt .Sprintf ("failed to create the id relation for %s: %s" , oamid .UniqueID , err )
542545 e .Session .Log ().Error (msg , slog .Group ("plugin" , "name" , cr .plugin .name , "handler" , cr .name ))
543546 }
@@ -555,7 +558,7 @@ func (cr *companyRounds) createPersonInvestors(e *et.Event, round *companyFundin
555558
556559func (cr * companyRounds ) process (e * et.Event , fundents []* dbt.Entity ) {
557560 for _ , fund := range fundents {
558- f := fund .Asset .(* financial .FundsTransfer )
561+ f := fund .Asset .(* oamfin .FundsTransfer )
559562
560563 _ = e .Dispatcher .DispatchEvent (& et.Event {
561564 Name : fmt .Sprintf ("%f:%s" , f .Amount , f .ID ),
0 commit comments