Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Fri, 22 Jul 2011 13:42:45 -0500
From: "jfoug" <jfoug@....net>
To: <john-dev@...ts.openwall.com>
Subject: Need HOW to help

I have wanted to add this to john for a while (the build rule being listed,
so you would know 'what' the executable is):

$ ../run/john
John the Ripper password cracker, version 1.7.8-jumbo-2
[win32-cygwin-x86-sse2]
Copyright (c) 1996-2011 by Solar Designer and others
Homepage: http://www.openwall.com/john
...

Notice the [win32-cygwin-x86-sse2]  That was the target I used when building
this john process.

Now, I tried to get this to work for a while, with no good way to do it (at
first).  I will explain some of the other trials later.  I did find a way to
get it working. However, this requires EVERY target to get changed.  Let me
explain what I have done, and see if others can think of a way to have this
done by some 'single' change in the makefile, and not a change to each rule.
Note, THE change, in each rule is exactly the same.

Within makefile.:

 win32-cygwin-x86-sse2:
 	$(CP) x86-sse.h arch.h
+	echo "#define JOHN_BLD" '"'$@'"' > john_build_rule.h
 	$(MAKE) $(PROJ_WIN32) \
 		JOHN_OBJS="$(JOHN_OBJS) x86.o x86-sse.o sha1-mmx.o
md5-mmx.o" \
 		CFLAGS="$(CFLAGS) -mpreferred-stack-boundary=4 -msse2 -m32"
\
 		ASFLAGS="$(ASFLAGS) -DUNDERSCORES"

(Note, only 1 rule shown, but I think they all need changed).

Then in the clean rule of Makefile, delete john_build_rule.h


Then in options.c, I change the 

 #define JOHN_COPYRIGHT \
 	"Solar Designer and others"
 
+#include "john_build_rule.h"
+
 #define JOHN_USAGE \
-"John the Ripper password cracker, version " JOHN_VERSION _MPI_VERSION "\n"
\
+"John the Ripper password cracker, version " JOHN_VERSION _MPI_VERSION "
[" JOHN_BLD "]\n" \
 "Copyright (c) 1996-2011 by " JOHN_COPYRIGHT "\n" \
 "Homepage: http://www.openwall.com/john/\n" \


That's it.  However, there are a bunch of lines in the Makefile to change.
I was wondering if there was some way to do this, possibly somehow
modification of the $(MAKE) which is the rule that  happens right after the
echo command?


This is all just experimental right now, but does seem to work well for me.


Here were some of the other things I tried.

I tried adding a -D with the $@ into the CFLAGS, but could not get that into
the #define string

So, I tried:
	CFLAGS="$(CFLAGS) -DJOHN_BLD=$@ ..."
	or 
	CFLAGS="$(CFLAGS) -DJOHN_BLD=\"$@\" ..."

etc, and this did not work.  I think this simply placed the literal
win32-cygwin-x86-sse2 and not the string, into the pre-processor.   However,
even if this 'could' work, could we preload CFLAGS with $@ at the top of the
file, and get them added?  If not, then this would gain nothing over
echo'ing out to an include file.


Oh well, I'm scratching my head.  Hopefully, there will be someone who knows
a better way to get the same end results, or knows of a package which does
this. I think gmp might do this, but I bet during the ./Configure run, it
outputs data just like I am doing here, and then simply outputs the
#define'd string when required to do so.

Jim.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.