Skip to content

Commit

Permalink
Allow to save the valid users to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
nodauf committed Jan 13, 2022
1 parent 4acd89b commit c85d941
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/adfs/brute.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ func (options *Options) Brute() []string {
if options.NoBruteforce {
if options.brute(email, passwordList[j]) {
mux.Lock()
validusers = append(validusers, email)
validusers = append(validusers, email+" / "+passwordList[j])
mux.Unlock()
}

} else {
for _, password := range passwordList {
if options.brute(email, password) {
mux.Lock()
validusers = append(validusers, email)
validusers = append(validusers, email+" / "+password)
mux.Unlock()
break // No need to continue if password is valid
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/brute/o365.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ By default, if one account is being lock, the all attack will be stopped.
o365Options.Proxy = proxy
o365Options.NoBruteforce = noBruteforce
o365Options.Sleep = sleep
o365Options.Brute()
validUsers = o365Options.Brute()
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/brute/owa.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ go run main.go bruteSpray owa -u [email protected] -p Automn2021! -t mail.con
owaOptions.Proxy = proxy
owaOptions.NoBruteforce = noBruteforce
owaOptions.Sleep = sleep
owaOptions.Brute()
validUsers = owaOptions.Brute()

},
}
Expand Down
14 changes: 12 additions & 2 deletions src/o365/brute.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
)

// Brute will bruteforce or spray passwords on the specified users.
func (options *Options) Brute() {
func (options *Options) Brute() []string {
var emailList []string
var wg sync.WaitGroup
var validUsers []string
mux := &sync.Mutex{}
var nbLockout = 0
if options.CheckIfValid {
options.Log.Debug("Validating the users")
Expand Down Expand Up @@ -52,10 +54,17 @@ func (options *Options) Brute() {
time.Sleep(time.Duration(options.Sleep) * time.Second)
}
if options.NoBruteforce {
options.authenticate(email, passwordList[j], &nbLockout)
if options.authenticate(email, passwordList[j], &nbLockout) {
mux.Lock()
validUsers = append(validUsers, email+" / "+passwordList[j])
mux.Unlock()
}
} else {
for _, password := range passwordList {
if options.authenticate(email, password, &nbLockout) {
mux.Lock()
validUsers = append(validUsers, email+" / "+password)
mux.Unlock()
break // No need to continue if password is valid
}
}
Expand All @@ -75,6 +84,7 @@ func (options *Options) Brute() {

close(queue)
wg.Wait()
return validUsers

}

Expand Down
11 changes: 10 additions & 1 deletion src/owa/brute.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import (
)

// Brute will bruteforce or spray passwords on the specified users.
func (options *Options) Brute() {
func (options *Options) Brute() []string {
log = options.Log
var emailList []string
var wg sync.WaitGroup
var validUsers []string
mux := &sync.Mutex{}
if options.CheckIfValid {
optionsEnum := *options
// Use office for enumeration
Expand Down Expand Up @@ -50,6 +52,9 @@ func (options *Options) Brute() {
if options.NoBruteforce {
if webRequestBasicAuth(urlToHarvest, internaldomain+"\\"+email, passwordList[j], tr) == 200 {
log.Success(email + " / " + passwordList[j] + " matched")
mux.Lock()
validUsers = append(validUsers, email+" / "+passwordList[j])
mux.Unlock()

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

close(queue)
wg.Wait()
return validUsers

}

0 comments on commit c85d941

Please sign in to comment.