public string GetUsernameFormatted(string emailAddress) { string returnVal = null; if (!string.IsNullOrEmpty(UsernameFormat) && !string.IsNullOrEmpty(emailAddress)) { string domain = string.Empty; string localPart = string.Empty; int atIndex = emailAddress.IndexOf(At); if (atIndex > 0) { domain = emailAddress.Substring(atIndex + 1); localPart = emailAddress.Substring(0, atIndex); } returnVal = UsernameFormat .Replace(EMAILADDRESS, emailAddress) .Replace(EMAILDOMAIN, domain) .Replace(EMAILLOCALPART, localPart); } else if (Authentication.Equals(AuthenticationType.None)) { returnVal = string.Empty; } else { returnVal = emailAddress; } return(returnVal); }
public void SprayUsers(PasswordSprayType method, string filepath, string passwordfilepath, string formatChoice, string password, string sleepInterval, UsernameFormat discoveredFormat) { if (service == MicrosoftService.ADFS && MSISSamlRequest == "") { UI.ThreadSafeAppendLog("[3]Awaiting SAML data..."); GetMSISSamlRequest(); } else if (service == MicrosoftService.ADFS) { UI.ThreadSafeAppendLog("[3]Using existing SAML data..."); } sprayer.SprayUsers(method, filepath, passwordfilepath, formatChoice, password, sleepInterval, UI, discoveredFormat, host, service, MSISSamlRequest); }