Example #1
0
        static void Main(string[] args)
        {
            var emailList = new List <string>(args)
            {
                "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"
            };

            foreach (string email in emailList)
            {
                List <Pwned> AllBreaches = SendRequest(email);

                foreach (Pwned pwn in AllBreaches)
                {
                    Data.Breach breachObj     = Data.Breach.FromPwned(pwn);
                    Data.Breach breachedEmail = Data.Breach.CheckIfBreachExistsInDatabase(breachObj.Title);

                    if (breachedEmail != null)
                    {
                        Data.Breached_Emails breachedEmailsObj        = Data.Breached_Emails.FromBreach(breachedEmail, email);
                        Data.Breached_Emails doesEmailExistInDatabase = Data.Breached_Emails.CheckIfEmailExistsInDatabase(breachedEmailsObj);
                        if (doesEmailExistInDatabase == null)         //Check if the email and breach has already been saved
                        {
                            //save email with breach ID
                            breachedEmailsObj.SaveBreachedEmailToDatabase();
                        }
                    }
                    else
                    {
                        //create new entry of breach
                        breachObj.SaveBreachToDatabase();
                        Data.Breach          breachedEmail2    = Data.Breach.CheckIfBreachExistsInDatabase(breachObj.Title);
                        Data.Breached_Emails breachedEmailsObj = Data.Breached_Emails.FromBreach(breachedEmail2, email);
                        //save email with breach ID
                        breachedEmailsObj.SaveBreachedEmailToDatabase();
                    }
                }
            }
            Console.WriteLine("Done!");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            var users = Data.AD_GPO_Users.GetUsers();

            foreach (var emails in users)       //runs through list from database query
            {
                System.Threading.Thread.Sleep(1800);
                var          email       = emails.EmailAddress;
                List <Pwned> AllBreaches = SendRequest(email);
                foreach (Pwned pwn in AllBreaches)  //runs through breaches found
                {
                    Data.Breach breachObj     = Data.Breach.FromPwned(pwn);
                    Data.Breach breachedEmail = Data.Breach.CheckIfBreachExistsInDatabase(breachObj.Title);

                    if (breachedEmail != null)      //check if breach exists in database or not
                    {
                        Data.Breached_Emails breachedEmailsObj        = Data.Breached_Emails.FromBreach(breachedEmail, email);
                        Data.Breached_Emails doesEmailExistInDatabase = Data.Breached_Emails.CheckIfEmailExistsInDatabase(breachedEmailsObj);
                        if (doesEmailExistInDatabase == null)         //Check if the email and breach has already been saved, if so then skip the save
                        {
                            breachedEmailsObj.SaveBreachedEmailToDatabase();
                        }
                    }
                    else
                    {
                        breachObj.SaveBreachToDatabase();
                        Data.Breach          breachedEmail2    = Data.Breach.CheckIfBreachExistsInDatabase(breachObj.Title);
                        Data.Breached_Emails breachedEmailsObj = Data.Breached_Emails.FromBreach(breachedEmail2, email);
                        breachedEmailsObj.SaveBreachedEmailToDatabase();
                    }
                }
            }
            Console.WriteLine("Done!");
            Console.ReadKey();
            //comment test
        }