{"id":245,"date":"2010-09-26T04:36:36","date_gmt":"2010-09-26T09:36:36","guid":{"rendered":"http:\/\/www.rajatswarup.com\/blog\/?p=245"},"modified":"2010-10-03T16:46:38","modified_gmt":"2010-10-03T21:46:38","slug":"compiling-wepattack-on-backtrack4","status":"publish","type":"post","link":"https:\/\/www.rajatswarup.com\/blog\/2010\/09\/26\/compiling-wepattack-on-backtrack4\/","title":{"rendered":"Compiling wepattack on backtrack4"},"content":{"rendered":"<p>I encountered various errors when compiling <a href=\"http:\/\/sourceforge.net\/projects\/wepattack\/files\/WepAttack\/0.1.3\/WepAttack-0.1.3.tar.gz\/download\">wepattack<\/a>. This download does not come with a makefile that is compatible with the ubuntu distro that backtrack uses.  First of all make sure that the wlan directory that you get when untarring the .tar.gz archive has execute permissions set to it.<br \/>\n<code><br \/>\n$ cd WepAttack-0.1.3\/src<br \/>\n$ chmod +x wlan<br \/>\n<\/code><br \/>\nOnce this is done &#8220;permission denied&#8221; errors should go.<br \/>\n<code><br \/>\n\/Desktop\/WepAttack-0.1.3\/src$ make<br \/>\ngcc -fno-for-scope -c -D__LINUX_WLAN__ -D__I386__ -o wepattack.o wepattack.c<br \/>\ncc1: warning: command line option \"-fno-for-scope\" is valid for C++\/ObjC++ but not for C<br \/>\nwepattack.c: In function \u2018loop_packets\u2019:<br \/>\nwepattack.c:141: warning: incompatible implicit declaration of built-in function \u2018strlen\u2019<br \/>\nwepattack.c:146: warning: incompatible implicit declaration of built-in function \u2018strlen\u2019<br \/>\nwepattack.c:151: warning: incompatible implicit declaration of built-in function \u2018strlen\u2019<br \/>\nwepattack.c:156: warning: incompatible implicit declaration of built-in function \u2018strlen\u2019<br \/>\nwepattack.c: In function \u2018clean_up\u2019:<br \/>\nwepattack.c:184: warning: format \u2018%d\u2019 expects type \u2018int\u2019, but argument 3 has type \u2018long int\u2019<br \/>\nwepattack.c: In function \u2018main\u2019:<br \/>\nwepattack.c:309: warning: format \u2018%d\u2019 expects type \u2018int\u2019, but argument 2 has type \u2018long int\u2019<br \/>\ngcc -fno-for-scope -c -D__LINUX_WLAN__ -D__I386__ -o rc4.o rc4.c<br \/>\ncc1: warning: command line option \"-fno-for-scope\" is valid for C++\/ObjC++ but not for C<br \/>\ngcc -fno-for-scope -c -D__LINUX_WLAN__ -D__I386__ -o wepfilter.o wepfilter.c<br \/>\ncc1: warning: command line option \"-fno-for-scope\" is valid for C++\/ObjC++ but not for C<br \/>\ngcc -fno-for-scope -c -D__LINUX_WLAN__ -D__I386__ -o log.o log.c<br \/>\ncc1: warning: command line option \"-fno-for-scope\" is valid for C++\/ObjC++ but not for C<br \/>\ngcc -fno-for-scope -c -D__LINUX_WLAN__ -D__I386__ -o modes.o modes.c<br \/>\ncc1: warning: command line option \"-fno-for-scope\" is valid for C++\/ObjC++ but not for C<br \/>\nmodes.c:25:30: error: wlan\/wlan_compat.h: Permission denied<br \/>\nmodes.c:26:28: error: wlan\/p80211hdr.h: Permission denied<br \/>\nmodes.c: In function \u2018generate_rc4_key\u2019:<br \/>\nmodes.c:51: warning: incompatible implicit declaration of built-in function \u2018memcpy\u2019<br \/>\nmodes.c: In function \u2018process_rc4_key\u2019:<br \/>\nmodes.c:68: warning: incompatible implicit declaration of built-in function \u2018memcpy\u2019<br \/>\nmodes.c: In function \u2018mode_keygen\u2019:<br \/>\nmodes.c:125: warning: incompatible implicit declaration of built-in function \u2018memcpy\u2019<br \/>\nmodes.c:127: warning: incompatible implicit declaration of built-in function \u2018strcpy\u2019<br \/>\nmodes.c: In function \u2018mode_wep\u2019:<br \/>\nmodes.c:145: warning: incompatible implicit declaration of built-in function \u2018memcpy\u2019<br \/>\nmake: *** [modes.o] Error 1<br \/>\n<\/code><br \/>\nThe following patch file will take care of most errors and you should be able to get Wepattack compiled properly:<br \/>\n<code><br \/>\ndiff -aur WepAttack-0.1.3\/src\/Makefile WepAttack-patched\/src\/Makefile<br \/>\n--- WepAttack-0.1.3\/src\/Makefile        2002-10-23 09:11:36.000000000 -0400<br \/>\n+++ WepAttack-patched\/src\/Makefile      2010-09-26 04:54:20.000000000 -0400<br \/>\n@@ -6,23 +6,23 @@<br \/>\n LD=gcc<br \/>\n #<br \/>\n # CFLAGS<br \/>\n-CFLAGS=-fno-for-scope -c -D__LINUX_WLAN__ -D__I386__<br \/>\n+CFLAGS= -c -D__LINUX_WLAN__ -D__I386__<br \/>\n #<br \/>\n #<br \/>\n # LDFLAGS<br \/>\n-#LDFLAGS=<br \/>\n+LDFLAGS=-L..\/run<br \/>\n #<br \/>\n #<br \/>\n # Libraries to link against<br \/>\n-LIBS= -lpcap -lz -lcrypto<br \/>\n+LIBS= -lpcap -lz -lcrypto<br \/>\n #<br \/>\n #<br \/>\n # Install path for wepattack<br \/>\n INSTDIR=\/usr\/bin<\/p>\n<p>+INCLUDEDIR=-Isrc\/<br \/>\n wepattack:     wepattack.o rc4.o wepfilter.o log.o modes.o misc.o verify.o keygen.o<br \/>\n-       $(LD) $(LDFLAGS) -o $@ wepattack.o rc4.o wepfilter.o log.o\\<br \/>\n-       modes.o misc.o verify.o keygen.o $(LIBS)<br \/>\n+       $(LD) $(LDFLAGS) $(INCLUDEDIR) -o $@ wepattack.o rc4.o wepfilter.o log.o modes.o misc.o verify.o keygen.o $(LIBS)<\/p>\n<p> wepattack.o:   wepattack.c wepattack.h<br \/>\n        $(CC) $(CFLAGS) -o $@ wepattack.c<br \/>\n@@ -46,7 +46,7 @@<br \/>\n        $(CC) $(CFLAGS) -o $@ keygen.c<\/p>\n<p> modes.o:       modes.c modes.h<br \/>\n-       $(CC) $(CFLAGS) -o $@ modes.c<br \/>\n+       $(CC) $(CFLAGS) $(INCLUDEDIR) -o $@ modes.c<\/p>\n<p> misc.o:                misc.c misc.h<br \/>\n        $(CC) $(CFLAGS) -o $@ misc.c<br \/>\ndiff -aur WepAttack-0.1.3\/src\/modes.c WepAttack-patched\/src\/modes.c<br \/>\n--- WepAttack-0.1.3\/src\/modes.c 2002-10-24 09:15:19.000000000 -0400<br \/>\n+++ WepAttack-patched\/src\/modes.c       2010-09-26 04:55:22.000000000 -0400<br \/>\n@@ -29,6 +29,7 @@<br \/>\n #include \"wepattack.h\"<br \/>\n #include \"wepfilter.h\"<br \/>\n #include \"verify.h\"<br \/>\n+#include \"string.h\"<\/p>\n<p> static rc4_key                 gen_key;<br \/>\n static unsigned char   decrypted_stream[2400];<br \/>\nOnly in WepAttack-patched\/src: wepattack<br \/>\ndiff -aur WepAttack-0.1.3\/src\/wepattack.c WepAttack-patched\/src\/wepattack.c<br \/>\n--- WepAttack-0.1.3\/src\/wepattack.c     2002-10-24 09:14:29.000000000 -0400<br \/>\n+++ WepAttack-patched\/src\/wepattack.c   2010-09-26 04:41:18.000000000 -0400<br \/>\n@@ -36,7 +36,7 @@<br \/>\n #include \"config.h\"<br \/>\n #include \"modes.h\"<br \/>\n #include \"misc.h\"<br \/>\n-<br \/>\n+#include <string.h><\/p>\n<p> wlan_packet_list* current_packet;<\/p>\n<p>@@ -181,7 +181,7 @@<\/p>\n<p>        \/\/ calculate elapsed time<br \/>\n        duration = difftime_us(&#038;t_val_start, &#038;t_val_end);<br \/>\n-       printf(\"\\ntime: %f sec\\twords: %d\\n\\n\", duration, word_count);<br \/>\n+       printf(\"\\ntime: %f sec\\twords: %ld\\n\\n\", duration, word_count);<\/p>\n<p>        \/\/ write ucracked packets to logfile<br \/>\n        log_uncracked(list_packet_to_crack);<br \/>\n@@ -306,7 +306,7 @@<\/p>\n<p>                \/\/ print out each 10'000 key<br \/>\n                if ((word_count % 10000) == 0)<br \/>\n-                       printf(\"key no. %d: %s\\n\", word_count, key);<br \/>\n+                       printf(\"key no. %ld: %s\\n\", word_count, key);<br \/>\n                word_count++;<\/p>\n<p>                \/\/ main loop to process key in modes on every packet<br \/>\n<\/code><br \/>\nCopy the above patch in to a file called wepattack.patch. Copy wepattack.patch into the WepAttack-0.1.3 directory and patch it as follows:<br \/>\n<code><br \/>\n$ patch -p1 &lt;wepattack.patch<br \/>\n$ cd src<br \/>\nmake<br \/>\nsudo make install<br \/>\n<\/code><br \/>\nYou should be able to get wepattack installed!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I encountered various errors when compiling wepattack. This download does not come with a makefile that is compatible with the ubuntu distro that backtrack uses. First of all make sure that the wlan directory that you get when untarring the .tar.gz archive has execute permissions set to it. $ cd WepAttack-0.1.3\/src $ chmod +x wlan [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[230],"tags":[234,285,229,264,416,468],"class_list":["post-245","post","type-post","status-publish","format-standard","hentry","category-howto","tag-backtrack","tag-compilation","tag-error","tag-wep","tag-wepattack","tag-wireless"],"_links":{"self":[{"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/posts\/245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/comments?post=245"}],"version-history":[{"count":4,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/posts\/245\/revisions"}],"predecessor-version":[{"id":256,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/posts\/245\/revisions\/256"}],"wp:attachment":[{"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/media?parent=245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/categories?post=245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rajatswarup.com\/blog\/wp-json\/wp\/v2\/tags?post=245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}