@@ -11,7 +11,8 @@ import (
11
11
oam "github.com/owasp-amass/open-asset-model"
12
12
oamcert "github.com/owasp-amass/open-asset-model/certificate"
13
13
"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"
15
16
oamnet "github.com/owasp-amass/open-asset-model/network"
16
17
"github.com/owasp-amass/open-asset-model/org"
17
18
oamreg "github.com/owasp-amass/open-asset-model/registration"
@@ -22,10 +23,12 @@ func (s *Scope) Add(a oam.Asset) bool {
22
23
var newentry bool
23
24
24
25
switch v := a .(type ) {
25
- case * dns .FQDN :
26
+ case * oamdns .FQDN :
26
27
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
+ }
29
32
case * oamnet.IPAddress :
30
33
newentry = s .AddIPAddress (v )
31
34
case * oamnet.Netblock :
@@ -62,18 +65,20 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
62
65
var match oam.Asset
63
66
64
67
switch v := a .(type ) {
65
- case * dns .FQDN :
68
+ case * oamdns .FQDN :
66
69
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
+ }
69
74
case * oamnet.IPAddress :
70
75
match , accuracy = s .addressInScope (v )
71
76
case * oamnet.Netblock :
72
77
match , accuracy = s .matchesNetblock (v )
73
78
case * oamnet.AutonomousSystem :
74
79
match , accuracy = s .matchesAutonomousSystem (v )
75
80
case * oamreg.DomainRecord :
76
- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .Domain })
81
+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .Domain })
77
82
if match == nil || accuracy == 0 {
78
83
match , accuracy = s .matchesOrg (& org.Organization {Name : v .Name }, conf )
79
84
}
@@ -85,9 +90,9 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
85
90
match , accuracy = s .matchesOrg (& org.Organization {Name : v .Name }, conf )
86
91
}
87
92
case * oamcert.TLSCertificate :
88
- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .SubjectCommonName })
93
+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .SubjectCommonName })
89
94
case * oamurl.URL :
90
- match , accuracy = s .matchesDomain (& dns .FQDN {Name : v .Host })
95
+ match , accuracy = s .matchesDomain (& oamdns .FQDN {Name : v .Host })
91
96
case * org.Organization :
92
97
match , accuracy = s .matchesOrg (v , conf )
93
98
case * contact.Location :
@@ -107,3 +112,17 @@ func (s *Scope) isBadField(field string) bool {
107
112
}
108
113
return false
109
114
}
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