Commit 040113a 1 parent b689510 commit 040113a Copy full SHA for 040113a
File tree 2 files changed +29
-4
lines changed
2 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ func (options *Options) UserEnum() []string {
13
13
emailList := strings .Split (options .Users , "\n " )
14
14
var wg sync.WaitGroup
15
15
var validusers []string
16
+ domainValidated := make (map [string ]bool )
16
17
queue := make (chan string )
17
18
18
19
for i := 0 ; i < options .Thread ; i ++ {
@@ -22,11 +23,26 @@ func (options *Options) UserEnum() []string {
22
23
defer wg .Done ()
23
24
for email := range queue {
24
25
domain := strings .Split (email , "@" )[1 ]
25
- if ! options .validTenant (domain ) {
26
- options .Log .Error ("Tenant " + domain + " is not valid" )
27
- return
26
+ // If we didn't already checked the domain
27
+ mux .Lock ()
28
+ if domainValid , ok := domainValidated [domain ]; ! ok {
29
+ if ! options .validTenant (domain ) {
30
+ options .Log .Error ("Tenant " + domain + " is not valid" )
31
+ domainValidated [domain ] = false
32
+ mux .Unlock ()
33
+ continue
34
+ }
35
+ options .Log .Info ("Tenant " + domain + " is valid" )
36
+ domainValidated [domain ] = true
37
+ } else {
38
+ // If the domain was not valid, skip the email
39
+ if ! domainValid {
40
+ options .Log .Debug ("Tenant " + domain + " already checked and was not valid" )
41
+ mux .Unlock ()
42
+ continue
43
+ }
28
44
}
29
- options . Log . Verbose ( "Tenant " + domain + " is valid" )
45
+ mux . Unlock ( )
30
46
31
47
switch options .Mode {
32
48
case "office" :
Original file line number Diff line number Diff line change @@ -161,3 +161,12 @@ func GetKeysMap(m map[string]string) []string {
161
161
}
162
162
return keys
163
163
}
164
+
165
+ func StringInSlice (item string , slice []string ) bool {
166
+ for _ , elementOfSlice := range slice {
167
+ if item == elementOfSlice {
168
+ return true
169
+ }
170
+ }
171
+ return false
172
+ }
You can’t perform that action at this time.
0 commit comments