예제 #1
0
        /// <summary>
        /// Find any exposed personal information
        /// </summary>
        /// <param name="oSession"></param>
        /// <param name="bodyAsString"></param>
        /// <returns>List<PersonalInformation> List of PersonalInformation</returns>
        private static List <PersonalInformation> FindExposedPersonalInformation(Session oSession, string bodyAsString)
        {
            List <PersonalInformation> personalInformationList = new List <PersonalInformation>();

            // check if contains personal information P.I
            if (bodyAsString != "")
            {
                MatchCollection mc = Regex.Matches(bodyAsString, "password\":\"([^\"]+)");
                foreach (Match m in mc)
                {
                    Console.WriteLine(m);
                    string passwordValue = m.Groups[1].Value;
                    bool   isEncrypted   = PasswordAdvisor.IsEncrypted(passwordValue);
                    // if not encrypted, password may be plain text so that we highlight the session
                    if (!isEncrypted)
                    {
                        PersonalInformation personalInformation = new PersonalInformation("password", passwordValue);
                        personalInformationList.Add(personalInformation);
                    }
                }
            }

            return(personalInformationList);
        }