Esempio n. 1
0
        public void AddEnglishDictionaryToNewStoreAndValidate()
        {
            string file = @"D:\pwnedpwds\raw\english.txt";
            string path = Path.Combine(TestHelpers.TestStorePath, Guid.NewGuid().ToString());

            Directory.CreateDirectory(path);
            CancellationToken ct = new CancellationToken();

            try
            {
                var store = new V3Store(path);
                Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Word, file, ct);

                using (StreamReader reader = new StreamReader(file))
                {
                    while (!reader.EndOfStream)
                    {
                        string line = reader.ReadLine();

                        if (line == null || line.Length <= 0)
                        {
                            continue;
                        }

                        Assert.IsTrue(store.IsInStore(line, StoreType.Word));
                    }
                }
            }
            finally
            {
                try
                {
                    Directory.Delete(path, true);
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        public void BuildUsablev3Store()
        {
            return;

            string path = Path.Combine(TestHelpers.TestStorePath, "v3Build");

            Directory.CreateDirectory(path);
            V3Store store = new V3Store(path);

            CancellationTokenSource ct = new CancellationTokenSource();

            // Start with HIBP
            string file = @"D:\pwnedpwds\raw\pwned-passwords-ntlm-ordered-by-hash.txt";

            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportHexHashesFromSortedFile(store, StoreType.Password, file, ct.Token);

            // add english dictionary to word store
            file = @"D:\pwnedpwds\raw\english.txt";
            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Word, file, ct.Token);

            // add more english words to word store
            file = @"D:\pwnedpwds\raw\words.txt";
            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Word, file, ct.Token);

            // add rockyou breach
            file = @"D:\pwnedpwds\raw\rockyou.txt";
            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Password, file, ct.Token);

            // add top 100000
            file = @"D:\pwnedpwds\raw\top1000000.txt";
            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Password, file, ct.Token);

            // add breach compilation
            file = @"D:\pwnedpwds\raw\breachcompilationuniq.txt";
            Lithnet.ActiveDirectory.PasswordProtection.Store.ImportPasswordsFromFile(store, StoreType.Password, file, ct.Token);
        }
Esempio n. 3
0
        public void TestBadPassword2()
        {
            V3Store store = new V3Store(@"D:\pwnedpwds\store");

            Assert.IsTrue(store.IsInStore("Password345!", StoreType.Word));
        }