Commit 7772bba6 authored by Mati's avatar Mati

Imported Upstream version 1.2~svn2245

parent d0aabea4
=== Requirements ===
* OpenSSL development package
* OpenSSL development package or libgcrypt development package
* If you want to use airolib-ng and '-r' option in aircrack-ng,
SQLite development package >= 3.3.17 (3.6.X version or better is recommended):
- libsqlite3-devel
......@@ -38,14 +38,30 @@ to compile and install the suite:
* unstable: needed to compile tkiptun-ng, easside-ng (and buddy-ng) and
wesside-ng
* ext_scripts: needed to build airoscript-ng, versuck-ng, airgraph-ng and
airdrop-ng.
Note: Experimental. Each script has its own dependences.
Note: It's only required in install phase.
* gcrypt: Use libgcrypt crypto library instead of the default OpenSSL.
And also use internal fast sha1 implementation (borrowed from GIT)
* libnl: Add support for netlink (nl80211).
Example:
* Compiling:
make sqlite=true unstable=true
* Compiling with gcrypt
make gcrypt=true
* Installing:
make sqlite=true unstable=true install
* Installing, with external scripts:
make sqlite=true unstable=true ext_scripts=true
=== Using precompiled binaries ===
Linux/BSD:
......
......@@ -24,7 +24,7 @@ aircrack-ng-opt-prof_gen: all
aircrack-ng-opt-prof_use:
$(MAKE) -C src $(@)
install:
install: all
$(MAKE) -C src $(@)
$(MAKE) -C scripts $(@)
$(MAKE) -C manpages $(@)
......@@ -46,9 +46,11 @@ doc:
clean:
$(MAKE) -C src $(@)
$(MAKE) -C test/cryptounittest $(@)
distclean: clean
check:
$(MAKE) -C src $(@)
$(MAKE) -C test/cryptounittest $(@)
......@@ -124,6 +124,14 @@ ptw.cap (http://dl.aircrack-ng.org/ptw.cap):
This is a 64 bit WEP key file suitable for the PTW method.
The key is '1F:1F:1F:1F:1F'.
wpa-psk-linksys.cap:
This is a sample file with a WPA1 handshake along with some encrypted packets.
Useful for testing with airdecap-ng. The password is 'dictionary'.
wpa2-psk-linksys.cap:
This is a sample file with a WPA2 handshake along with some encrypted packets.
Useful for testing with airdecap-ng. The password is 'dictionary'.
password.lst
This is a sample wordlist for WPA key cracking. More wordlists can be found at
http://www.aircrack-ng.org/doku.php?id=faq#where_can_i_find_good_wordlists
......
PKG_CONFIG ?= pkg-config
ifndef TOOL_PREFIX
TOOL_PREFIX =
endif
ifndef OSNAME
OSNAME = $(shell uname -s | sed -e 's/.*CYGWIN.*/cygwin/g')
OSNAME = $(shell uname -s | sed -e 's/.*CYGWIN.*/cygwin/g' -e 's,/,-,g')
endif
ifndef SQLITE
SQLITE = false
......@@ -26,32 +28,61 @@ endif
COMMON_CFLAGS =
ifeq ($(OSNAME), cygwin)
COMMON_CFLAGS += -DCYGWIN
endif
ifeq ($(SQLITE), true)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
else
ifeq ($(sqlite), true)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
else
ifeq ($(SQLITE), TRUE)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
else
ifeq ($(sqlite), TRUE)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
endif
endif
endif
ifeq ($(subst TRUE,true,$(filter TRUE true,$(sqlite) $(SQLITE))),true)
COMMON_CFLAGS += -I/usr/local/include -DHAVE_SQLITE
endif
ifeq ($(airpcap), true)
AIRPCAP = true
ifeq ($(OSNAME), cygwin)
COMMON_CFLAGS += -DCYGWIN
else ifeq ($(libnl), true)
NL3xFOUND := $(shell $(PKG_CONFIG) --atleast-version=3.2 libnl-3.0 && echo Y)
ifneq ($(NL3xFOUND),Y)
NL31FOUND := $(shell $(PKG_CONFIG) --exact-version=3.1 libnl-3.1 && echo Y)
ifneq ($(NL31FOUND),Y)
NL3FOUND := $(shell $(PKG_CONFIG) --atleast-version=3 libnl-3.0 && echo Y)
ifneq ($(NL3FOUND),Y)
NL1FOUND := $(shell $(PKG_CONFIG) --atleast-version=1 libnl-1 && echo Y)
endif
endif
endif
ifeq ($(NL1FOUND),Y)
NLLIBNAME = libnl-1
endif
ifeq ($(NL3xFOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl-3
NLLIBNAME = libnl-3.0
endif
ifeq ($(NL3FOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl
NLLIBNAME = libnl-3.0
endif
# nl-3.1 has a broken libnl-gnl-3.1.pc file
# as show by pkg-config --debug --libs --cflags --exact-version=3.1 libnl-genl-3.1;echo $?
ifeq ($(NL31FOUND),Y)
COMMON_CFLAGS += -DCONFIG_LIBNL30
LIBS += -lnl-genl
NLLIBNAME = libnl-3.1
endif
ifeq ($(NLLIBNAME),)
$(error Cannot find development files for any supported version of libnl. install either libnl1 or libnl3.)
endif
LIBS += $(shell $(PKG_CONFIG) --libs $(NLLIBNAME))
COMMON_CFLAGS += -DCONFIG_LIBNL $(shell $(PKG_CONFIG) --cflags $(NLLIBNAME))
endif
ifeq ($(AIRPCAP), true)
LIBAIRPCAP = -DHAVE_AIRPCAP -I$(AC_ROOT)/../developers/Airpcap_Devpack/include
ifeq ($(subst TRUE,true,$(filter TRUE true,$(airpcap) $(AIRPCAP))),true)
LIBAIRPCAP = -DHAVE_AIRPCAP -I$(AC_ROOT)/../developers/Airpcap_Devpack/include
endif
ifeq ($(OSNAME), cygwin)
......@@ -64,17 +95,23 @@ RANLIB = $(TOOL_PREFIX)ranlib
AR = $(TOOL_PREFIX)ar
REVISION = $(shell $(AC_ROOT)/evalrev)
REVFLAGS = -D_REVISION=$(REVISION)
REVFLAGS ?= -D_REVISION=$(REVISION)
OPTFLAGS = -D_FILE_OFFSET_BITS=64
CFLAGS ?= -g -W -Wall -Werror -O3
CFLAGS ?= -g -W -Wall -O3
CFLAGS += $(OPTFLAGS) $(REVFLAGS) $(COMMON_CFLAGS)
prefix = /usr/local
bindir = $(prefix)/bin
sbindir = $(prefix)/sbin
mandir = $(prefix)/man/man1
mandir = $(prefix)/share/man/man1
smandir = $(prefix)/share/man/man8
datadir = $(prefix)/share
docdir = $(datadir)/doc/aircrack-ng
libdir = $(prefix)/lib
etcdir = $(prefix)/etc/aircrack-ng
\ No newline at end of file
etcdir = $(prefix)/etc/aircrack-ng
GCC_OVER45 = $(shell expr 45 \<= `$(CC) -dumpversion | awk -F. '{ print $1$2 }'`)
ifeq ($(GCC_OVER45), 1)
CFLAGS += -Wno-unused-but-set-variable -Wno-array-bounds
endif
ROOT = ../..
include $(ROOT)/common.mak
CFLAGS = -g -I$(ROOT)/../developers/Airpcap_Devpack/include -I$(ROOT)/src/osdep
#LIBS = -L $(ROOT)/../developers/Airpcap_Devpack/lib -lairpcap -L $(ROOT)/src/osdep -losdep
LIBS = -L $(ROOT)/../developers/Airpcap_Devpack/lib -lairpcap
CFLAGS += $(PIC)
OBJS = airpcap.o
DLL = airpcap.dll
all: $(DLL)
$(DLL): $(OBJS)
$(CC) ${CFLAGS} -shared -o $(DLL) $(OBJS) ${LIBS}
clean:
rm -f $(DLL) $(OBJS)
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#include <airpcap.h>
#include "osdep.h"
#include "tap-win32/common.h"
static const char * DEFAULT_ADAPT_NAME = "\\\\.\\airpcap00";
static const char * DEVICE_HEADER = "\\\\.\\";
//pcap_t *winpcap_adapter;
static PAirpcapHandle airpcap_handle;
// Use PPI later
#define PPH_PH_VERSION ((u_int8_t)0x00)
#define PPI_FIELD_TYPE_802_11_COMMON ((u_int16_t)0x02)
typedef struct _PPI_PACKET_HEADER
{
u_int8_t PphVersion;
u_int8_t PphFlags;
u_int16_t PphLength;
u_int32_t PphDlt;
}
PPI_PACKET_HEADER, *PPPI_PACKET_HEADER;
typedef struct _PPI_FIELD_HEADER
{
u_int16_t PfhType;
u_int16_t PfhLength;
}
PPI_FIELD_HEADER, *PPPI_FIELD_HEADER;
typedef struct _PPI_FIELD_802_11_COMMON
{
u_int64_t TsfTimer;
u_int16_t Flags;
u_int16_t Rate;
u_int16_t ChannelFrequency;
u_int16_t ChannelFlags;
u_int8_t FhssHopset;
u_int8_t FhssPattern;
int8_t DbmAntSignal;
int8_t DbmAntNoise;
}
PPI_FIELD_802_11_COMMON, *PPPI_FIELD_802_11_COMMON;
static int ppi_decode(const u_char *p, int caplen, int *hdrlen, int *power)
{
PPPI_PACKET_HEADER pPpiPacketHeader;
PPPI_FIELD_HEADER pFieldHeader;
ULONG position = 0;
// Sanity checks
if (caplen < sizeof(*pPpiPacketHeader))
{
// Packet smaller than the PPI fixed header
return( 1 );
}
pPpiPacketHeader = (PPPI_PACKET_HEADER)p;
*hdrlen = pPpiPacketHeader->PphLength;
if(caplen < *hdrlen)
{
// Packet smaller than the PPI fixed header
return( 1 );
}
position = sizeof(*pPpiPacketHeader);
if (pPpiPacketHeader->PphVersion != PPH_PH_VERSION)
{
fprintf( stderr, "Unknown PPI packet header version (%u)\n", pPpiPacketHeader->PphVersion);
return( 1 );
}
do
{
// now we suppose to have an 802.11-Common header
if (*hdrlen < sizeof(*pFieldHeader) + position)
{
break;
}
pFieldHeader = (PPPI_FIELD_HEADER)(p + position);
position += sizeof(*pFieldHeader);
switch(pFieldHeader->PfhType)
{
case PPI_FIELD_TYPE_802_11_COMMON:
if (pFieldHeader->PfhLength != sizeof(PPI_FIELD_802_11_COMMON) || caplen - position < sizeof(PPI_FIELD_802_11_COMMON))
{
// the header is bogus, just skip it
fprintf( stderr, "Bogus 802.11-Common Field. Skipping it.\n");
}
else
{
PPPI_FIELD_802_11_COMMON pField = (PPPI_FIELD_802_11_COMMON)(p + position);
if (pField->DbmAntSignal != -128)
{
*power = (int)pField->DbmAntSignal;
}
else
{
*power = 0;
}
}
break;
default:
// we do not know this field. Just print type and length and skip
break;
}
position += pFieldHeader->PfhLength;
}
while(TRUE);
return( 0 );
}
int cygwin_set_mac(unsigned char *mac)
{
if (*mac) {}
return 0;
}
void cygwin_close(void)
{
// By default, when plugged in, the adapter is set in monitor mode;
// Application may assume it's already in monitor mode and forget to set it
// So, do not remove monitor mode.
if (airpcap_handle != NULL)
{
AirpcapClose(airpcap_handle);
}
}
int cygwin_get_mac(unsigned char *mac)
{
// Don't use the function from Airpcap
if (*mac) {}
return 0;
}
// Use PPI headers to obtain the different information for ri
// Use AirpcapConvertFrequencyToChannel() to get channel
// Add an option to give frequency instead of channel
int cygwin_sniff(void *buf, int len, struct rx_info *ri)
{
UINT BytesReceived = 0;
// Wait for the next packet
// Maybe add an event packets to read
// WaitForSingleObject(ReadEvent, INFINITE);
// Read a packet
if(AirpcapRead(airpcap_handle, buf, len, &BytesReceived))
return (int)BytesReceived;
return -1;
}
int cygwin_inject(void *buf, int len, struct tx_info *ti)
{
if (AirpcapWrite (airpcap_handle, buf, len) != 1)
return -1;
return len;
}
static int printErrorCloseAndReturn(const char * err, int retValue)
{
if (err && airpcap_handle)
{
if (strlen(err))
{
if (airpcap_handle)
fprintf( stderr, err, AirpcapGetLastError(airpcap_handle));
else
fprintf( stderr, err);
}
}
cygwin_close();
return retValue;
}
int cygwin_init(char *param)
{
char * iface;
char errbuf[AIRPCAP_ERRBUF_SIZE ];
iface = (char *)calloc(1, strlen(param) + strlen(DEVICE_HEADER) +1);
strcpy (iface, DEFAULT_ADAPT_NAME);
if (param)
{
// if it's empty, use the default adapter
if (strlen(param) > 0)
{
// Make sure the adapter name contains the '\\.\' at its begining
memset(iface, 0, strlen(param) + strlen(DEVICE_HEADER) +1);
if (strstr(param, DEVICE_HEADER) == NULL)
{
// Not found, add it
strcpy(iface, DEVICE_HEADER);
strcat(iface, param);
}
else
{
// Already contains the adapter header
strcpy(iface, param);
}
}
}
airpcap_handle = AirpcapOpen(iface, errbuf);
if(airpcap_handle == NULL)
{
fprintf( stderr, "This adapter doesn't have wireless extensions. Quitting\n");
//pcap_close( winpcap_adapter );
return( -1 );
}
/* Tell the adapter that the packets we'll send and receive don't include the FCS */
if(!AirpcapSetFcsPresence(airpcap_handle, FALSE))
return printErrorCloseAndReturn("Error setting FCS presence: %s\n", -1);
/* Set the link layer to bare 802.11 */
if(!AirpcapSetLinkType(airpcap_handle, AIRPCAP_LT_802_11))
return printErrorCloseAndReturn("Error setting the link type: %s\n", -1);
/* Accept correct frames only */
if( !AirpcapSetFcsValidation(airpcap_handle, AIRPCAP_VT_ACCEPT_CORRECT_FRAMES) )
return printErrorCloseAndReturn("Error setting FCS validation: %s\n", -1);
/* Set a low mintocopy for better responsiveness */
if(!AirpcapSetMinToCopy(airpcap_handle, 1))
return printErrorCloseAndReturn("Error setting MinToCopy: %s\n", -1);
return 0;
}
int cygwin_set_chan(int chan)
{
// Make sure a valid channel is given
if (chan <= 0)
return -1;
if(!AirpcapSetDeviceChannel(airpcap_handle, chan))
{
printf("Error setting the channel to %d: %s\n", chan, AirpcapGetLastError(airpcap_handle));
return -1;
}
return 0;
}
ROOT = ../..
include $(ROOT)/common.mak
CFLAGS += $(PIC) -I$(ROOT)/src/osdep
OBJS = commview.o
DLL = commview.dll
LIBS = -liphlpapi -lsetupapi -luuid -lpthread
all: $(DLL)
$(DLL): $(OBJS)
$(CC) -shared -o $(DLL) $(OBJS) $(LIBS)
clean:
rm -f $(DLL) $(OBJS)
This diff is collapsed.
ROOT = ../..
include $(ROOT)/common.mak
CFLAGS += $(PIC) -I$(ROOT)/src/osdep
NAME = omnipeek
OBJS = $(NAME).o
DLL = $(NAME).dll
LIBS =
all: $(DLL)
$(DLL): $(OBJS)
$(CC) -shared -o $(DLL) $(OBJS) $(LIBS)
clean:
rm -f $(DLL) $(OBJS)
/* ripped from devine's windows airodump */
#include <string.h>
#include <dlfcn.h>
#include <windows.h>
#include <pthread.h>
#include <assert.h>
#include <err.h>
#include "osdep.h"
#include "cygwin.h"
#ifdef UNUSED
#elif defined(__GNUC__)
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
#elif defined(__LCLINT__)
# define UNUSED(x) /*@unused@*/ x
#else
# define UNUSED(x) x
#endif
#define MAGIC1 0x3E8000
#define MAGIC2 0x21
#define MAGICCHAN 0xFF636713
struct pstate
{
void *ps_lib;
HANDLE ps_adapter;
HANDLE ps_ctx;
pthread_cond_t ps_sem;
pthread_mutex_t ps_mtx;
unsigned char ps_data[4096];
int ps_len;
int (*ps_peek_initialize_library)(void);
HANDLE (*ps_peek_open_adapter)(LPSTR);
int (*ps_peek_start_capture)(HANDLE);
int (*ps_peek_request)(HANDLE, void*, void*);
int (*ps_peek_stop_capture)(HANDLE);
int (*ps_peek_close_adapter)(HANDLE);
int (*ps_peek_packet_send)(HANDLE, void*, int, int*, LPOVERLAPPED,
int);
HANDLE (*ps_peek_create_capture_context)(HANDLE, void*, int,
int, void*);
} _pstate;
static struct pstate *get_ps(void)
{
return &_pstate;
}
static int init_lib(struct pstate *ps)
{
char *libname = "Peek.dll";
void *lib;
if (!(lib = dlopen(libname, RTLD_LAZY)))
return -1;
ps->ps_lib = lib;
ps->ps_peek_open_adapter = dlsym(lib, "PeekOpenAdapter");
ps->ps_peek_start_capture = dlsym(lib, "PeekStartCapture");
ps->ps_peek_request = dlsym(lib, "PeekRequest");
ps->ps_peek_stop_capture = dlsym(lib, "PeekStopCapture");
ps->ps_peek_close_adapter = dlsym(lib, "PeekCloseAdapter");
ps->ps_peek_packet_send = dlsym(lib, "PeekPacketSend");
ps->ps_peek_create_capture_context =
dlsym(lib, "PeekCreateCaptureContext");
ps->ps_peek_initialize_library =
dlsym(lib, "PeekInitializeLibrary");
if (!(ps->ps_peek_open_adapter
&& ps->ps_peek_start_capture
&& ps->ps_peek_request
&& ps->ps_peek_stop_capture
&& ps->ps_peek_close_adapter
&& ps->ps_peek_packet_send
&& ps->ps_peek_create_capture_context
&& ps->ps_peek_initialize_library
))
return -1;
return 0;