sábado, 30 de outubro de 2010

Compiling aircrack-ng with CUDA support on Mac OS X

After struggling to compile aircrack-ng 1.0 rc3 on Mac OS X 10.6.4, I thought I should write some instructions down and maybe someone could benefit from my experience.

I'll try to do this quick and simple as possible.

Download the latest version from the SVN (at the time this post was written aircrack-ng was on revision 1788):
svn co http://trac.aircrack-ng.org/svn/branch/aircrack-ng-cuda aircrack-ng-cuda

When the checkout finishes, cd into the directory:
cd aircrack-ng-cuda

Create a new file named aircrack_osx_cuda.patch and paste the following content inside it, or download the file directly from here:
diff -ruN --exclude=.svn --exclude='*~' ./src/Makefile ../aircrack-ng-cuda_patched/src/Makefile
--- ./src/Makefile 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/Makefile 2010-10-30 16:39:56.000000000 -0200
@@ -4,7 +4,7 @@
TEST_DIR = $(AC_ROOT)/test
-CFLAGS += -Iinclude
+CFLAGS += -Iinclude -arch i386
iCC = $(shell find /opt/intel/cc/*/bin/icc)
iCFLAGS = -w -mcpu=pentiumpro -march=pentiumpro $(COMMON_CFLAGS)
@@ -145,7 +145,7 @@
aircrack-ng-opt-prof -lpthread $(LIBSQL)
aircrack-ng$(EXE): $(OBJS_AC)
- $(CC) $(CFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
+ $(CXX) $(CFLAGS) $(OBJS_AC) $(ASM_AC) -o $(@) -lpthread $(LIBSSL) $(LIBSQL)
airdecap-ng$(EXE): $(OBJS_AD)
$(CC) $(CFLAGS) $(OBJS_AD) -o $(@) $(LIBSSL)
diff -ruN --exclude=.svn --exclude='*~' ./src/include/radiotap-parser.h ../aircrack-ng-cuda_patched/src/include/radiotap-parser.h
--- ./src/include/radiotap-parser.h 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/include/radiotap-parser.h 2010-10-30 16:33:55.000000000 -0200
@@ -17,7 +17,7 @@
#define __user
-#include
+#include
#include
typedef uint64_t u64;
diff -ruN --exclude=.svn --exclude='*~' ./src/osdep/Makefile ../aircrack-ng-cuda_patched/src/osdep/Makefile
--- ./src/osdep/Makefile 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/osdep/Makefile 2010-10-30 16:25:39.000000000 -0200
@@ -2,7 +2,7 @@
include $(AC_ROOT)/common.mak
LIB = libosdep.a
-CFLAGS += $(PIC) -I.. $(LIBAIRPCAP)
+CFLAGS += $(PIC) -arch i386 -I.. $(LIBAIRPCAP)
OBJS_NET = network.o
OBJS = osdep.o $(OBJS_NET)
diff -ruN --exclude=.svn --exclude='*~' ./src/sha1-sse2.S ../aircrack-ng-cuda_patched/src/sha1-sse2.S
--- ./src/sha1-sse2.S 2010-10-30 17:00:19.000000000 -0200
+++ ../aircrack-ng-cuda_patched/src/sha1-sse2.S 2010-10-30 16:24:31.000000000 -0200
@@ -21,7 +21,7 @@
.globl _shasse2_cpuid;
.data
-.align(16)
+.align(12)
const_init_a:
.long 0x67452301
.long 0x67452301

Then apply this patch executing the command:
patch -p1 < aircrack_osx_cuda.patch

and start the compilation process with:
CXX=g++ CUDA=true make

when the compilation finishes you can install it on your system with the traditional:
sudo make install

Um comentário:

Unknown disse...

Thanks for the patch. Worked like a charm :)