@@ -11,7 +11,8 @@ import (
1111 oam "github.com/owasp-amass/open-asset-model"
1212 oamcert "github.com/owasp-amass/open-asset-model/certificate"
1313 "github.com/owasp-amass/open-asset-model/contact"
14- "github.com/owasp-amass/open-asset-model/dns"
14+ oamdns "github.com/owasp-amass/open-asset-model/dns"
15+ "github.com/owasp-amass/open-asset-model/general"
1516 oamnet "github.com/owasp-amass/open-asset-model/network"
1617 "github.com/owasp-amass/open-asset-model/org"
1718 oamreg "github.com/owasp-amass/open-asset-model/registration"
@@ -22,10 +23,12 @@ func (s *Scope) Add(a oam.Asset) bool {
2223 var newentry bool
2324
2425 switch v := a .(type ) {
25- case * dns .FQDN :
26+ case * oamdns .FQDN :
2627 newentry = s .AddFQDN (v )
27- /*case *contact.EmailAddress:
28- newentry = s.AddFQDN(&domain.FQDN{Name: v.Domain})*/
28+ case * general.Identifier :
29+ if domain , found := getEmailDomain (v ); found {
30+ newentry = s .AddFQDN (& oamdns.FQDN {Name : domain })
31+ }
2932 case * oamnet.IPAddress :
3033 newentry = s .AddIPAddress (v )
3134 case * oamnet.Netblock :
@@ -62,18 +65,20 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
6265 var match oam.Asset
6366
6467 switch v := a .(type ) {
65- case * dns .FQDN :
68+ case * oamdns .FQDN :
6669 match , accuracy = s .matchesDomain (v )
67- /*case *contact.EmailAddress:
68- match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.Domain})*/
70+ case * general.Identifier :
71+ if domain , found := getEmailDomain (v ); found {
72+ match , accuracy = s .matchesDomain (& oamdns.FQDN {Name : domain })
73+ }
6974 case * oamnet.IPAddress :
7075 match , accuracy = s .addressInScope (v )
7176 case * oamnet.Netblock :
7277 match , accuracy = s .matchesNetblock (v )
7378 case * oamnet.AutonomousSystem :
7479 match , accuracy = s .matchesAutonomousSystem (v )
7580 case * oamreg.DomainRecord :
76- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .Domain })
81+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .Domain })
7782 if match == nil || accuracy == 0 {
7883 match , accuracy = s .matchesOrg (& org.Organization {Name : v .Name }, conf )
7984 }
@@ -85,9 +90,9 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
8590 match , accuracy = s .matchesOrg (& org.Organization {Name : v .Name }, conf )
8691 }
8792 case * oamcert.TLSCertificate :
88- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .SubjectCommonName })
93+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .SubjectCommonName })
8994 case * oamurl.URL :
90- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .Host })
95+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .Host })
9196 case * org.Organization :
9297 match , accuracy = s .matchesOrg (v , conf )
9398 case * contact.Location :
@@ -107,3 +112,17 @@ func (s *Scope) isBadField(field string) bool {
107112 }
108113 return false
109114}
115+
116+ func getEmailDomain (email * general.Identifier ) (string , bool ) {
117+ if email == nil || email .Type != general .EmailAddress {
118+ return "" , false
119+ }
120+
121+ parts := strings .Split (email .EntityID , "@" )
122+
123+ if len (parts ) != 2 {
124+ return "" , false
125+ }
126+
127+ return parts [1 ], true
128+ }
0 commit comments