Skip to content

Commit c85d941

Browse files
committed
Allow to save the valid users to a file
1 parent 4acd89b commit c85d941

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

src/adfs/brute.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ func (options *Options) Brute() []string {
4545
if options.NoBruteforce {
4646
if options.brute(email, passwordList[j]) {
4747
mux.Lock()
48-
validusers = append(validusers, email)
48+
validusers = append(validusers, email+" / "+passwordList[j])
4949
mux.Unlock()
5050
}
5151

5252
} else {
5353
for _, password := range passwordList {
5454
if options.brute(email, password) {
5555
mux.Lock()
56-
validusers = append(validusers, email)
56+
validusers = append(validusers, email+" / "+password)
5757
mux.Unlock()
5858
break // No need to continue if password is valid
5959
}

src/cmd/brute/o365.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ By default, if one account is being lock, the all attack will be stopped.
3535
o365Options.Proxy = proxy
3636
o365Options.NoBruteforce = noBruteforce
3737
o365Options.Sleep = sleep
38-
o365Options.Brute()
38+
validUsers = o365Options.Brute()
3939
},
4040
}
4141

src/cmd/brute/owa.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ go run main.go bruteSpray owa -u [email protected] -p Automn2021! -t mail.con
2626
owaOptions.Proxy = proxy
2727
owaOptions.NoBruteforce = noBruteforce
2828
owaOptions.Sleep = sleep
29-
owaOptions.Brute()
29+
validUsers = owaOptions.Brute()
3030

3131
},
3232
}

src/o365/brute.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import (
1111
)
1212

1313
// Brute will bruteforce or spray passwords on the specified users.
14-
func (options *Options) Brute() {
14+
func (options *Options) Brute() []string {
1515
var emailList []string
1616
var wg sync.WaitGroup
17+
var validUsers []string
18+
mux := &sync.Mutex{}
1719
var nbLockout = 0
1820
if options.CheckIfValid {
1921
options.Log.Debug("Validating the users")
@@ -52,10 +54,17 @@ func (options *Options) Brute() {
5254
time.Sleep(time.Duration(options.Sleep) * time.Second)
5355
}
5456
if options.NoBruteforce {
55-
options.authenticate(email, passwordList[j], &nbLockout)
57+
if options.authenticate(email, passwordList[j], &nbLockout) {
58+
mux.Lock()
59+
validUsers = append(validUsers, email+" / "+passwordList[j])
60+
mux.Unlock()
61+
}
5662
} else {
5763
for _, password := range passwordList {
5864
if options.authenticate(email, password, &nbLockout) {
65+
mux.Lock()
66+
validUsers = append(validUsers, email+" / "+password)
67+
mux.Unlock()
5968
break // No need to continue if password is valid
6069
}
6170
}
@@ -75,6 +84,7 @@ func (options *Options) Brute() {
7584

7685
close(queue)
7786
wg.Wait()
87+
return validUsers
7888

7989
}
8090

src/owa/brute.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import (
1111
)
1212

1313
// Brute will bruteforce or spray passwords on the specified users.
14-
func (options *Options) Brute() {
14+
func (options *Options) Brute() []string {
1515
log = options.Log
1616
var emailList []string
1717
var wg sync.WaitGroup
18+
var validUsers []string
19+
mux := &sync.Mutex{}
1820
if options.CheckIfValid {
1921
optionsEnum := *options
2022
// Use office for enumeration
@@ -50,6 +52,9 @@ func (options *Options) Brute() {
5052
if options.NoBruteforce {
5153
if webRequestBasicAuth(urlToHarvest, internaldomain+"\\"+email, passwordList[j], tr) == 200 {
5254
log.Success(email + " / " + passwordList[j] + " matched")
55+
mux.Lock()
56+
validUsers = append(validUsers, email+" / "+passwordList[j])
57+
mux.Unlock()
5358

5459
} else {
5560
log.Fail(email + " / " + passwordList[j] + " does not matched")
@@ -59,6 +64,9 @@ func (options *Options) Brute() {
5964
for _, password := range passwordList {
6065
if webRequestBasicAuth(urlToHarvest, internaldomain+"\\"+email, password, tr) == 200 {
6166
log.Success(email + " / " + password + " matched")
67+
mux.Lock()
68+
validUsers = append(validUsers, email+" / "+password)
69+
mux.Unlock()
6270
break // No need to continue if password is valid
6371
}
6472
log.Fail(email + " / " + password + " does not matched")
@@ -81,5 +89,6 @@ func (options *Options) Brute() {
8189

8290
close(queue)
8391
wg.Wait()
92+
return validUsers
8493

8594
}

0 commit comments

Comments
 (0)