Skip to content

Commit 4e58daa

Browse files
committed
Use log from options
1 parent 5239c1c commit 4e58daa

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/modules/adfs/brute.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ func CheckTarget(optionsInterface *interface{}) {
1010
log.Error("The ADFS URL was not found")
1111
return
1212
}
13-
log.Verbose("An ADFS instance has been found on " + options.Target)
13+
options.Log.Verbose("An ADFS instance has been found on " + options.Target)
1414
}
1515
}
1616

src/modules/adfs/utils.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var ADFS_URL = "https://%s/adfs/ls/idpinitiatedsignon.aspx?client-request-id=%s&
2020

2121
func (options *Options) brute(username, password string) bool {
2222
if len(strings.Split(username, "\\")) == 1 && len(strings.Split(username, "@")) == 1 {
23-
log.Error("Only email format or Domain\\user are supported, skipping " + username)
23+
options.Log.Error("Only email format or Domain\\user are supported, skipping " + username)
2424
return false
2525
}
2626
uuid, _ := utils.NewUUID()
@@ -47,7 +47,7 @@ func (options *Options) brute(username, password string) bool {
4747
req.Header.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
4848
resp, err := client.Do(req)
4949
if err != nil {
50-
log.Fatal("Error while sending the request: " + err.Error())
50+
options.Log.Fatal("Error while sending the request: " + err.Error())
5151
}
5252

5353
// Authenticate
@@ -64,18 +64,18 @@ func (options *Options) brute(username, password string) bool {
6464
resp, err = client.Do(req)
6565
body, _ := ioutil.ReadAll(resp.Body)
6666
if err != nil {
67-
log.Fatal("Error while sending the request: " + err.Error())
67+
options.Log.Fatal("Error while sending the request: " + err.Error())
6868
}
69-
log.Debug("Status code: " + strconv.Itoa(resp.StatusCode))
69+
options.Log.Debug("Status code: " + strconv.Itoa(resp.StatusCode))
7070
// Parse the response to know if the password match
7171
if resp.StatusCode == 302 {
72-
log.Success(username + " and " + password + " matched")
72+
options.Log.Success(username + " and " + password + " matched")
7373
return true
7474
} else if strings.Contains(string(body), "Your password has expired") {
75-
log.Success(username + " and " + password + " matched but the password is expired")
75+
options.Log.Success(username + " and " + password + " matched but the password is expired")
7676
return true
7777
} else {
78-
log.Fail(username + " and " + password + " does not matched")
78+
options.Log.Fail(username + " and " + password + " does not matched")
7979
return false
8080
}
8181

@@ -87,17 +87,17 @@ func (options *Options) findTarget(domain string) string {
8787
url := fmt.Sprintf(FIND_ADFS_URL, domain)
8888
body, _, err := utils.GetBodyInWebsite(url, options.Proxy, nil)
8989
if err != nil {
90-
log.Error(err.Error())
90+
options.Log.Error(err.Error())
9191
return ""
9292
}
9393
// Parse the response
9494
var userRealmResponse userRealm
9595
json.Unmarshal([]byte(body), &userRealmResponse)
9696
if userRealmResponse.NameSpaceType == "Unknown" {
97-
log.Error("Tenant " + domain + " not found")
97+
options.Log.Error("Tenant " + domain + " not found")
9898
return ""
9999
} else if userRealmResponse.NameSpaceType == "Managed" {
100-
log.Error("Not ADFS found for " + domain)
100+
options.Log.Error("Not ADFS found for " + domain)
101101
return ""
102102
}
103103
target = strings.Split(userRealmResponse.AuthURL, "/")[2]

0 commit comments

Comments
 (0)