]> eyrie.org Git - kerberos/krb5-strength.git/blobdiff - tests/tools/cdbmake-wordlist-t
Add wordlist filter mode to cdbmake-wordlist
[kerberos/krb5-strength.git] / tests / tools / cdbmake-wordlist-t
index ca4b53df9a5e142625e8a4f3e96f49969056b5eb..08d8d91eaddb62aa63f3826f13f48e016544ebfa 100755 (executable)
@@ -17,7 +17,7 @@ if ! command -v cdb >/dev/null 2>&1 ; then
 fi
 
 # Output the test plan.
-plan 18
+plan 20
 
 # Create a temporary directory and wordlist and ensure it's writable.
 tmpdir=`test_tmpdir`
@@ -79,6 +79,14 @@ ok_program 'Database still contains happenstance' 0 '1' \
 ok_program 'Database does not contain password' 100 '' \
     cdb -q "$tmpdir/wordlist.cdb" password
 
+# Try filtering the wordlist into a new wordlist.
+ok_program 'Wordlist filtering' 0 '' \
+    "$cdbmake" -a -x '.*d' -l 8 -o "$tmpdir/wordlist.new" "$tmpdir/wordlist"
+( echo 'bitterbane'; echo 'happenstance' ) > "$tmpdir/wordlist.expected"
+ok_program 'Filtered wordlist is correct' 0 '' \
+    cmp "$tmpdir/wordlist.expected" "$tmpdir/wordlist.new"
+rm -f "$tmpdir/wordlist.expected" "$tmpdir/wordlist.new"
+
 # Clean up.
 rm -f "$tmpdir/wordlist.cdb"
 rm -f "$tmpdir/wordlist"