Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 10 Sep 2011 21:30:04 +0200
From: magnum <rawsmooth@...dband.net>
To: john-dev@...ts.openwall.com
Subject: Re: Rewrite of the pkzip format posted (on the wiki).

The enclosed patch includes the below fixes plus a fix for zip2john -co 
option (it broke the line with an extra \n before the end tag). However, 
2011-CrackMeIfYouCan_part1.zip does not get cracked using -co either. I 
have no idea why.

magnum


On 2011-09-10 12:50, magnum wrote:
> The enclosed patch fixes everything I mentioned except the problem with
> not cracking 2011-CrackMeIfYouCan_part1.zip
>
> magnum

diff --git a/src/pkzip_fmt_plug.c b/src/pkzip_fmt_plug.c
index 915a537..6ee66d9 100644
--- a/src/pkzip_fmt_plug.c
+++ b/src/pkzip_fmt_plug.c
@@ -1085,7 +1085,7 @@ __inline__
 /* return a failure.  We have 24 bytes of inflate data, and this almost always is more than enough   */
 /* to turn up an error.  If we find we need more, we will do more than 24                            */
 static int check_inflate_CODE1(u8 *next, int left) {
-	u32 whave, op, bits, hold,len;
+	u32 whave = 0, op, bits, hold,len;
 	code here;
 
 #if (ARCH_LITTLE_ENDIAN==1) && (ARCH_ALLOWS_UNALIGNED==1)
diff --git a/src/zip2john.c b/src/zip2john.c
index 9ba1140..29c56fb 100644
--- a/src/zip2john.c
+++ b/src/zip2john.c
@@ -209,7 +209,7 @@ static void process_file(const char *fname)
 				process_old_zip(fname);
 				return;
 			} else {
-				printf("%s->%s is not encrypted!\n", fname,
+				fprintf(stderr, "%s->%s is not encrypted!\n", fname,
 				    filename);
 				fseek(fp, extrafield_length, SEEK_CUR);
 				fseek(fp, compressed_size, SEEK_CUR);
@@ -457,7 +457,7 @@ static void process_old_zip(const char *fname)
 print_and_cleanup:;
 	if (count_of_hashes) {
 		int i=1;
-		printf ("$pkzip$%x*%x*", count_of_hashes, zfp.two_byte_check?2:1);
+		printf ("%s:$pkzip$%x*%x*", fname, count_of_hashes, zfp.two_byte_check?2:1);
 		if (checksum_only)
 			i = 0;
 		for (; i < count_of_hashes; ++i) {
@@ -469,14 +469,12 @@ print_and_cleanup:;
 			printf("1*%x*%x*%x*%s*%s*", hashes[i].magic_type, hashes[i].cmptype, len, hashes[i].chksum, toHex((unsigned char*)hashes[i].hash_data, len));
 		}
 		// Ok, now output the 'little' one (the first).
-		if (checksum_only)
-			printf ("\n");
-		else {
+		if (!checksum_only) {
 			printf("%x*%x*%x*%x*%x*%x*%x*%x*", hashes[0].cmp_len<1500?2:3, hashes[0].magic_type, hashes[0].cmp_len, hashes[0].decomp_len, hashes[0].crc, hashes[0].offset, hashes[0].offex, hashes[0].cmptype);
 			if (hashes[0].cmp_len<1500)
 				printf("%x*%s*%s*", hashes[0].cmp_len, hashes[0].chksum, toHex((unsigned char*)hashes[0].hash_data, hashes[0].cmp_len));
 			else
-				printf("%x*%s*%s*", strlen(fname), hashes[0].chksum, fname);
+				printf("%x*%s*%s*", (unsigned int)strlen(fname), hashes[0].chksum, fname);
 		}
 		printf("$/pkzip$\n");
 	}

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ