diff --git a/src/Makefile b/src/Makefile index 60cd3e3..12d1f37 100644 --- a/src/Makefile +++ b/src/Makefile @@ -38,7 +38,7 @@ OMPFLAGS = -fopenmp #ICCOMPFLAGS = -openmp # NSS (and NSPR) flag, un-comment if installed (needed for mozilla format) -#HAVE_NSS = -DHAVE_NSS +HAVE_NSS = -DHAVE_NSS CFLAGS = -c -Wall -O2 -fomit-frame-pointer -I/usr/local/include $(HAVE_NSS) $(OMPFLAGS) $(JOHN_CFLAGS) `pkg-config --cflags nss` # -DHAVE_SKEY diff --git a/src/mozilla_fmt.c b/src/mozilla_fmt.c index a33dfe1..5061284 100644 --- a/src/mozilla_fmt.c +++ b/src/mozilla_fmt.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "arch.h" #include "misc.h" #include "common.h" @@ -33,8 +34,14 @@ static char saved_key[PLAINTEXT_LENGTH + 1]; static int cracked; static SHA_CTX pctx; static unsigned char encString[128]; -struct NSSPKCS5PBEParameter *paramPKCS5 = NULL; -struct KeyCrackData keyCrackData; +static struct NSSPKCS5PBEParameter *paramPKCS5 = NULL; +static struct KeyCrackData keyCrackData; + +static struct fmt_tests mozilla_tests[] = { + {"$mozilla$*dummy", "dummy"}, + {"$mozilla$*dummy", "dummy"}, + {NULL} +}; static int CheckMasterPassword(char *password) { @@ -49,11 +56,28 @@ static int CheckMasterPassword(char *password) static void init(struct fmt_main *pFmt) { + char path[4096]; + realpath(__FILE__, path); + puts(path); + char *basepath = dirname(path); + + static char ct0[4096]; + static char pt0[] = "openwall"; + sprintf(ct0, "$mozilla$*%s/unused/00-key3.db", basepath); + mozilla_tests[0].ciphertext = ct0; + mozilla_tests[0].plaintext = pt0; + + static char ct1[4096]; + static char pt1[] = "password"; + sprintf(ct1, "$mozilla$*%s/unused/01-key3.db", basepath); + mozilla_tests[1].ciphertext = ct1; + mozilla_tests[1].plaintext = pt1; } static int valid(char *ciphertext, struct fmt_main *pFmt) { + printf("valid : %s\n", ciphertext); return !strncmp(ciphertext, "$mozilla$", 9); } @@ -151,7 +175,7 @@ struct fmt_main mozilla_fmt = { MIN_KEYS_PER_CRYPT, MAX_KEYS_PER_CRYPT, FMT_CASE | FMT_8_BIT, - NULL + mozilla_tests }, { init, fmt_default_prepare,