1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

Added WPA2Decrypter tests.

This commit is contained in:
Matias Fontanini
2013-05-31 14:11:12 -03:00
parent 908fcb56e8
commit eeb62add59
9 changed files with 456 additions and 203 deletions

View File

@@ -58,9 +58,8 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(libtins_include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/libtins.pc.in $(top_srcdir)/configure \
$(top_srcdir)/include/config.h.in AUTHORS COPYING INSTALL \
THANKS TODO config.guess config.sub depcomp install-sh \
ltmain.sh missing
$(top_srcdir)/include/config.h.in AUTHORS INSTALL THANKS \
config.guess config.sub depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \

View File

@@ -237,6 +237,7 @@ namespace Crypto {
std::make_pair(addr2, addr1);
}
addr_pair extract_addr_pair(const Dot11Data &dot11);
addr_pair extract_addr_pair_dst(const Dot11Data &dot11);
bssids_map::const_iterator find_ap(const Dot11Data &dot11);
void add_access_point(const std::string &ssid, const address_type &addr);

View File

@@ -26,7 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <iostream> // borrame
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/aes.h>
@@ -281,6 +282,15 @@ WPA2Decrypter::addr_pair WPA2Decrypter::extract_addr_pair(const Dot11Data &dot11
return make_addr_pair(dot11.addr2(), dot11.addr3());
}
WPA2Decrypter::addr_pair WPA2Decrypter::extract_addr_pair_dst(const Dot11Data &dot11) {
if(dot11.from_ds() && !dot11.to_ds())
return make_addr_pair(dot11.addr1(), dot11.addr2());
else if(!dot11.from_ds() && dot11.to_ds())
return make_addr_pair(dot11.addr1(), dot11.addr3());
else
return make_addr_pair(dot11.addr1(), dot11.addr3());
}
WPA2Decrypter::bssids_map::const_iterator WPA2Decrypter::find_ap(const Dot11Data &dot11) {
if(dot11.from_ds() && !dot11.to_ds())
return aps.find(dot11.addr2());
@@ -310,7 +320,12 @@ bool WPA2Decrypter::decrypt(PDU &pdu) {
Dot11Data *data = pdu.find_pdu<Dot11Data>();
RawPDU *raw = pdu.find_pdu<RawPDU>();
if(data && raw && data->wep()) {
// search for the tuple (bssid, src_addr)
keys_map::const_iterator it = keys.find(extract_addr_pair(*data));
// search for the tuple (bssid, dst_addr) if the above didn't work
if(it == keys.end())
it = keys.find(extract_addr_pair_dst(*data));
if(it != keys.end()) {
SNAP *snap = it->second.decrypt_unicast(*data, *raw);
if(snap) {

View File

@@ -1,6 +1,6 @@
CXX=@CXX@
CFLAGS=-c -Wall @CFLAGS@ -DTINS_VERSION=@PACKAGE_VERSION@
LDFLAGS=-lpcap -lgtest -lpthread
LDFLAGS=-lpcap -lgtest -lpthread -lcrypto
SOURCES=@SOURCE_FILES@
OBJECTS=$(SOURCES:.cpp=.o)

226
tests/configure vendored
View File

@@ -1,11 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for myconfig 0.1.
# Generated by GNU Autoconf 2.69 for myconfig 0.1.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
# Foundation, Inc.
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Use a proper internal environment variable to ensure we don't fall
# into an infinite loop, continuously re-executing ourselves.
if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
_as_can_reexec=no; export _as_can_reexec;
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
fi
# We don't want this to propagate to other subprocesses.
{ _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1"
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -212,21 +236,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
export CONFIG_SHELL
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
*v*x* | *x*v* ) as_opts=-vx ;;
*v* ) as_opts=-v ;;
*x* ) as_opts=-x ;;
* ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi
if test x$as_have_required = xno; then :
@@ -328,6 +356,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
# If we had to re-execute with $CONFIG_SHELL, we're ensured to have
# already done that, so ensure we don't try to do so again and fall
# in an infinite loop. This has already happened in practice.
_as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -504,28 +544,8 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -1120,8 +1140,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
$as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1355,9 +1373,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
myconfig configure 0.1
generated by GNU Autoconf 2.68
generated by GNU Autoconf 2.69
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1630,7 +1648,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1653,7 +1671,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by myconfig $as_me 0.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2029,7 +2047,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2073,7 +2091,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2677,7 +2695,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -2743,7 +2761,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
{ test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -2980,7 +2998,53 @@ else
as_fn_error $? "pcap library is needed!" "$LINENO" 5
fi
#AC_CHECK_LIB([gtest_main], [main], [], [AC_MSG_ERROR([gtest library is needed!])])
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PKCS5_PBKDF2_HMAC_SHA1 in -lcrypto" >&5
$as_echo_n "checking for PKCS5_PBKDF2_HMAC_SHA1 in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char PKCS5_PBKDF2_HMAC_SHA1 ();
int
main ()
{
return PKCS5_PBKDF2_HMAC_SHA1 ();
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1=yes
else
ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1" >&5
$as_echo "$ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1" >&6; }
if test "x$ac_cv_lib_crypto_PKCS5_PBKDF2_HMAC_SHA1" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS="-lcrypto $LIBS"
else
as_fn_error $? "crypto library is needed!" "$LINENO" 5
fi
ac_config_files="$ac_config_files Makefile"
@@ -3428,16 +3492,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -p'.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -p'
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -p'
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -3497,28 +3561,16 @@ else
as_mkdir_p=false
fi
if test -x / >/dev/null 2>&1; then
as_test_x='test -x'
else
if ls -dL / >/dev/null 2>&1; then
as_ls_L_option=L
else
as_ls_L_option=
fi
as_test_x='
eval sh -c '\''
if test -d "$1"; then
test -d "$1/.";
else
case $1 in #(
-*)set "./$1";;
esac;
case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
fi
as_executable_p=$as_test_x
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -3540,7 +3592,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by myconfig $as_me 0.1, which was
generated by GNU Autoconf 2.68. Invocation command line was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -3593,10 +3645,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
myconfig config.status 0.1
configured by $0, generated by GNU Autoconf 2.68,
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -3673,7 +3725,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'

View File

@@ -15,7 +15,7 @@ SOURCE_FILES=$(ls ../src/*cpp src/*cpp src/dot11/*cpp | tr '\n' ' ')
AC_CHECK_HEADERS([pcap.h gtest/gtest.h])
AC_CHECK_LIB(pcap, pcap_loop, [], [AC_MSG_ERROR([pcap library is needed!])])
#AC_CHECK_LIB([gtest_main], [main], [], [AC_MSG_ERROR([gtest library is needed!])])
AC_CHECK_LIB(crypto, PKCS5_PBKDF2_HMAC_SHA1, [], [AC_MSG_ERROR([crypto library is needed!])])
AC_SUBST(CFLAGS)
AC_SUBST(SOURCE_FILES)
AC_OUTPUT(Makefile)

View File

@@ -58,49 +58,56 @@
../include/hw_address.h:
../include/exceptions.h:
../src/crypto.o: ../src/crypto.cpp ../include/crypto.h ../include/dot11.h \
../include/macros.h ../include/pdu.h ../include/cxxstd.h \
../include/exceptions.h ../include/endianness.h ../include/hw_address.h \
../include/small_uint.h ../include/pdu_option.h \
../include/network_interface.h ../include/ip_address.h \
../include/utils.h ../include/ipv6_address.h ../include/internals.h \
../include/constants.h ../include/snap.h ../include/rawpdu.h
../src/crypto.o: ../src/crypto.cpp ../include/crypto.h ../include/utils.h \
../include/macros.h ../include/ip_address.h ../include/cxxstd.h \
../include/ipv6_address.h ../include/hw_address.h ../include/internals.h \
../include/constants.h ../include/pdu.h ../include/exceptions.h \
../include/snap.h ../include/endianness.h ../include/small_uint.h \
../include/rawpdu.h ../include/handshake_capturer.h ../include/eapol.h \
../include/config.h ../include/dot11.h ../include/pdu_option.h \
../include/network_interface.h
../include/crypto.h:
../include/dot11.h:
../include/utils.h:
../include/macros.h:
../include/pdu.h:
../include/ip_address.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/endianness.h:
../include/ipv6_address.h:
../include/hw_address.h:
../include/small_uint.h:
../include/pdu_option.h:
../include/network_interface.h:
../include/ip_address.h:
../include/utils.h:
../include/ipv6_address.h:
../include/internals.h:
../include/constants.h:
../include/pdu.h:
../include/exceptions.h:
../include/snap.h:
../include/endianness.h:
../include/small_uint.h:
../include/rawpdu.h:
../include/handshake_capturer.h:
../include/eapol.h:
../include/config.h:
../include/dot11.h:
../include/pdu_option.h:
../include/network_interface.h:
../src/dhcp.o: ../src/dhcp.cpp ../include/endianness.h \
../include/macros.h ../include/dhcp.h ../include/bootp.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
@@ -379,6 +386,38 @@
../include/constants.h:
../include/exceptions.h:
../src/handshake_capturer.o: ../src/handshake_capturer.cpp \
../include/handshake_capturer.h ../include/hw_address.h \
../include/cxxstd.h ../include/eapol.h ../include/pdu.h \
../include/macros.h ../include/exceptions.h ../include/small_uint.h \
../include/endianness.h ../include/dot11.h ../include/pdu_option.h \
../include/network_interface.h ../include/ip_address.h
../include/handshake_capturer.h:
../include/hw_address.h:
../include/cxxstd.h:
../include/eapol.h:
../include/pdu.h:
../include/macros.h:
../include/exceptions.h:
../include/small_uint.h:
../include/endianness.h:
../include/dot11.h:
../include/pdu_option.h:
../include/network_interface.h:
../include/ip_address.h:
../src/icmp.o: ../src/icmp.cpp ../include/icmp.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/rawpdu.h ../include/utils.h \
@@ -573,10 +612,12 @@
../include/exceptions.h:
../src/ip_address.o: ../src/ip_address.cpp ../include/ip_address.h \
../include/endianness.h ../include/macros.h
../include/cxxstd.h ../include/endianness.h ../include/macros.h
../include/ip_address.h:
../include/cxxstd.h:
../include/endianness.h:
../include/macros.h:
@@ -631,11 +672,13 @@
../include/exceptions.h:
../src/ipv6_address.o: ../src/ipv6_address.cpp ../include/macros.h \
../include/ipv6_address.h
../include/ipv6_address.h ../include/cxxstd.h
../include/macros.h:
../include/ipv6_address.h:
../include/cxxstd.h:
../src/llc.o: ../src/llc.cpp ../include/llc.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/stp.h ../include/hw_address.h \
@@ -703,9 +746,9 @@
../include/exceptions.h:
../src/network_interface.o: ../src/network_interface.cpp \
../include/macros.h ../include/network_interface.h \
../include/hw_address.h ../include/ip_address.h ../include/utils.h \
../include/macros.h ../include/ipv6_address.h ../include/internals.h \
../include/constants.h ../include/pdu.h ../include/cxxstd.h \
../include/hw_address.h ../include/cxxstd.h ../include/ip_address.h \
../include/utils.h ../include/macros.h ../include/ipv6_address.h \
../include/internals.h ../include/constants.h ../include/pdu.h \
../include/exceptions.h ../include/endianness.h
../include/macros.h:
@@ -714,6 +757,8 @@
../include/hw_address.h:
../include/cxxstd.h:
../include/ip_address.h:
../include/utils.h:
@@ -728,15 +773,13 @@
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/endianness.h:
../src/packet_sender.o: ../src/packet_sender.cpp \
../include/packet_sender.h ../include/network_interface.h \
../include/hw_address.h ../include/ip_address.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/hw_address.h ../include/cxxstd.h ../include/ip_address.h \
../include/macros.h ../include/pdu.h ../include/exceptions.h \
../include/macros.h ../include/network_interface.h \
../include/ethernetII.h ../include/pdu.h ../include/endianness.h \
../include/radiotap.h ../include/dot11.h ../include/small_uint.h \
@@ -749,14 +792,14 @@
../include/hw_address.h:
../include/cxxstd.h:
../include/ip_address.h:
../include/macros.h:
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/macros.h:
@@ -786,10 +829,9 @@
../include/constants.h:
../src/packet_writer.o: ../src/packet_writer.cpp \
../include/packet_writer.h ../include/utils.h ../include/macros.h \
../include/ip_address.h ../include/ipv6_address.h \
../include/ip_address.h ../include/cxxstd.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/pdu.h
../include/pdu.h ../include/exceptions.h ../include/pdu.h
../include/packet_writer.h:
@@ -799,6 +841,8 @@
../include/ip_address.h:
../include/cxxstd.h:
../include/ipv6_address.h:
../include/hw_address.h:
@@ -809,8 +853,6 @@
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/pdu.h:
@@ -1000,7 +1042,8 @@
../include/hw_address.h ../include/radiotap.h ../include/packet.h \
../include/timestamp.h ../include/loopback.h ../include/dot11.h \
../include/small_uint.h ../include/pdu_option.h \
../include/network_interface.h ../include/ip_address.h ../include/sll.h
../include/network_interface.h ../include/ip_address.h ../include/dot3.h \
../include/sll.h
../include/sniffer.h:
@@ -1036,6 +1079,8 @@
../include/ip_address.h:
../include/dot3.h:
../include/sll.h:
../src/stp.o: ../src/stp.cpp ../include/stp.h ../include/pdu.h \
../include/macros.h ../include/cxxstd.h ../include/exceptions.h \
@@ -1111,9 +1156,9 @@
../include/radiotap.h ../include/packet.h ../include/timestamp.h \
../include/loopback.h ../include/dot11.h ../include/small_uint.h \
../include/pdu_option.h ../include/network_interface.h \
../include/ip_address.h ../include/sll.h ../include/tcp.h \
../include/utils.h ../include/ipv6_address.h ../include/internals.h \
../include/constants.h ../include/ip.h
../include/ip_address.h ../include/dot3.h ../include/sll.h \
../include/tcp.h ../include/utils.h ../include/ipv6_address.h \
../include/internals.h ../include/constants.h ../include/ip.h
../include/rawpdu.h:
@@ -1153,6 +1198,8 @@
../include/ip_address.h:
../include/dot3.h:
../include/sll.h:
../include/tcp.h:
@@ -1172,7 +1219,7 @@
../include/ip_address.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/ip.h ../include/small_uint.h ../include/pdu_option.h \
../include/rawpdu.h ../include/exceptions.h
../include/ipv6.h ../include/rawpdu.h ../include/exceptions.h
../include/udp.h:
@@ -1206,17 +1253,19 @@
../include/pdu_option.h:
../include/ipv6.h:
../include/rawpdu.h:
../include/exceptions.h:
../src/utils.o: ../src/utils.cpp ../include/utils.h ../include/macros.h \
../include/ip_address.h ../include/ipv6_address.h \
../include/ip_address.h ../include/cxxstd.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/pdu.h ../include/arp.h ../include/endianness.h \
../include/ethernetII.h ../include/endianness.h \
../include/network_interface.h ../include/packet_sender.h \
../include/network_interface.h ../include/cxxstd.h
../include/pdu.h ../include/exceptions.h ../include/pdu.h \
../include/arp.h ../include/endianness.h ../include/ethernetII.h \
../include/endianness.h ../include/network_interface.h \
../include/packet_sender.h ../include/network_interface.h \
../include/cxxstd.h
../include/utils.h:
@@ -1224,6 +1273,8 @@
../include/ip_address.h:
../include/cxxstd.h:
../include/ipv6_address.h:
../include/hw_address.h:
@@ -1234,8 +1285,6 @@
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/pdu.h:
@@ -2036,9 +2085,12 @@ src/ethernetII.o: src/ethernetII.cpp ../include/ethernetII.h \
../include/pdu_option.h:
../include/ip.h:
src/hwaddress.o: src/hwaddress.cpp ../include/hw_address.h
src/hwaddress.o: src/hwaddress.cpp ../include/hw_address.h \
../include/cxxstd.h
../include/hw_address.h:
../include/cxxstd.h:
src/icmp.o: src/icmp.cpp ../include/icmp.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/utils.h ../include/ip_address.h \
@@ -2152,13 +2204,15 @@ src/ip.o: src/ip.cpp ../include/ip.h ../include/pdu.h ../include/macros.h \
../include/constants.h:
src/ipaddress.o: src/ipaddress.cpp ../include/ip_address.h \
../include/utils.h ../include/macros.h ../include/ip_address.h \
../include/ipv6_address.h ../include/hw_address.h ../include/internals.h \
../include/constants.h ../include/pdu.h ../include/cxxstd.h \
../include/exceptions.h
../include/cxxstd.h ../include/utils.h ../include/macros.h \
../include/ip_address.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/exceptions.h
../include/ip_address.h:
../include/cxxstd.h:
../include/utils.h:
../include/macros.h:
@@ -2175,8 +2229,6 @@ src/ipaddress.o: src/ipaddress.cpp ../include/ip_address.h \
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
src/ipv6.o: src/ipv6.cpp ../include/ipv6.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
@@ -2224,13 +2276,15 @@ src/ipv6.o: src/ipv6.cpp ../include/ipv6.h ../include/macros.h \
../include/constants.h:
src/ipv6address.o: src/ipv6address.cpp ../include/ipv6_address.h \
../include/utils.h ../include/macros.h ../include/ip_address.h \
../include/ipv6_address.h ../include/hw_address.h ../include/internals.h \
../include/constants.h ../include/pdu.h ../include/cxxstd.h \
../include/exceptions.h
../include/cxxstd.h ../include/utils.h ../include/macros.h \
../include/ip_address.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/exceptions.h
../include/ipv6_address.h:
../include/cxxstd.h:
../include/utils.h:
../include/macros.h:
@@ -2247,8 +2301,6 @@ src/ipv6address.o: src/ipv6address.cpp ../include/ipv6_address.h \
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
src/llc.o: src/llc.cpp ../include/llc.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
@@ -2306,15 +2358,17 @@ src/matches_response.o: src/matches_response.cpp ../include/ethernetII.h \
../include/ipv6_address.h:
src/network_interface.o: src/network_interface.cpp \
../include/network_interface.h ../include/hw_address.h \
../include/ip_address.h ../include/utils.h ../include/macros.h \
../include/ipv6_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/cxxstd.h ../include/ip_address.h ../include/utils.h \
../include/macros.h ../include/ipv6_address.h ../include/internals.h \
../include/constants.h ../include/pdu.h ../include/exceptions.h \
../include/macros.h
../include/network_interface.h:
../include/hw_address.h:
../include/cxxstd.h:
../include/ip_address.h:
../include/utils.h:
@@ -2329,8 +2383,6 @@ src/network_interface.o: src/network_interface.cpp \
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/macros.h:
@@ -2587,8 +2639,9 @@ src/stp.o: src/stp.cpp ../include/stp.h ../include/pdu.h \
src/tcp.o: src/tcp.cpp ../include/tcp.h ../include/pdu.h \
../include/macros.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/small_uint.h ../include/pdu_option.h \
../include/utils.h ../include/ip_address.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h
../include/ip.h ../include/ip_address.h ../include/utils.h \
../include/ipv6_address.h ../include/hw_address.h ../include/internals.h \
../include/constants.h
../include/tcp.h:
@@ -2606,10 +2659,12 @@ src/tcp.o: src/tcp.cpp ../include/tcp.h ../include/pdu.h \
../include/pdu_option.h:
../include/utils.h:
../include/ip.h:
../include/ip_address.h:
../include/utils.h:
../include/ipv6_address.h:
../include/hw_address.h:
@@ -2623,10 +2678,10 @@ src/tcp_stream.o: src/tcp_stream.cpp ../include/tcp_stream.h \
../include/endianness.h ../include/hw_address.h ../include/radiotap.h \
../include/packet.h ../include/timestamp.h ../include/loopback.h \
../include/dot11.h ../include/small_uint.h ../include/pdu_option.h \
../include/network_interface.h ../include/ip_address.h ../include/sll.h \
../include/tcp.h ../include/utils.h ../include/ipv6_address.h \
../include/internals.h ../include/constants.h ../include/ip.h \
../include/tcp.h ../include/utils.h
../include/network_interface.h ../include/ip_address.h ../include/dot3.h \
../include/sll.h ../include/tcp.h ../include/utils.h \
../include/ipv6_address.h ../include/internals.h ../include/constants.h \
../include/ip.h ../include/tcp.h ../include/utils.h
../include/tcp_stream.h:
@@ -2664,6 +2719,8 @@ src/tcp_stream.o: src/tcp_stream.cpp ../include/tcp_stream.h \
../include/ip_address.h:
../include/dot3.h:
../include/sll.h:
../include/tcp.h:
@@ -2683,7 +2740,8 @@ src/tcp_stream.o: src/tcp_stream.cpp ../include/tcp_stream.h \
../include/utils.h:
src/udp.o: src/udp.cpp ../include/udp.h ../include/macros.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/pdu.h
../include/endianness.h ../include/ip.h ../include/small_uint.h \
../include/ip_address.h ../include/pdu_option.h
../include/udp.h:
@@ -2697,13 +2755,18 @@ src/udp.o: src/udp.cpp ../include/udp.h ../include/macros.h \
../include/endianness.h:
../include/pdu.h:
../include/ip.h:
../include/small_uint.h:
../include/ip_address.h:
../include/pdu_option.h:
src/utils.o: src/utils.cpp ../include/utils.h ../include/macros.h \
../include/ip_address.h ../include/ipv6_address.h \
../include/ip_address.h ../include/cxxstd.h ../include/ipv6_address.h \
../include/hw_address.h ../include/internals.h ../include/constants.h \
../include/pdu.h ../include/cxxstd.h ../include/exceptions.h \
../include/endianness.h ../include/ip_address.h \
../include/ipv6_address.h
../include/pdu.h ../include/exceptions.h ../include/endianness.h \
../include/ip_address.h ../include/ipv6_address.h
../include/utils.h:
@@ -2711,6 +2774,8 @@ src/utils.o: src/utils.cpp ../include/utils.h ../include/macros.h \
../include/ip_address.h:
../include/cxxstd.h:
../include/ipv6_address.h:
../include/hw_address.h:
@@ -2721,8 +2786,6 @@ src/utils.o: src/utils.cpp ../include/utils.h ../include/macros.h \
../include/pdu.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/endianness.h:
@@ -2731,48 +2794,101 @@ src/utils.o: src/utils.cpp ../include/utils.h ../include/macros.h \
../include/ipv6_address.h:
src/wep_decrypt.o: src/wep_decrypt.cpp ../include/crypto.h \
../include/dot11.h ../include/macros.h ../include/pdu.h \
../include/cxxstd.h ../include/exceptions.h ../include/endianness.h \
../include/hw_address.h ../include/small_uint.h ../include/pdu_option.h \
../include/network_interface.h ../include/ip_address.h \
../include/utils.h ../include/ipv6_address.h ../include/internals.h \
../include/constants.h ../include/snap.h ../include/rawpdu.h \
../include/arp.h
../include/utils.h ../include/macros.h ../include/ip_address.h \
../include/cxxstd.h ../include/ipv6_address.h ../include/hw_address.h \
../include/internals.h ../include/constants.h ../include/pdu.h \
../include/exceptions.h ../include/snap.h ../include/endianness.h \
../include/small_uint.h ../include/rawpdu.h \
../include/handshake_capturer.h ../include/eapol.h ../include/config.h \
../include/arp.h ../include/dot11.h ../include/pdu_option.h \
../include/network_interface.h
../include/crypto.h:
../include/dot11.h:
../include/utils.h:
../include/macros.h:
../include/pdu.h:
../include/ip_address.h:
../include/cxxstd.h:
../include/exceptions.h:
../include/endianness.h:
../include/ipv6_address.h:
../include/hw_address.h:
../include/small_uint.h:
../include/pdu_option.h:
../include/network_interface.h:
../include/ip_address.h:
../include/utils.h:
../include/ipv6_address.h:
../include/internals.h:
../include/constants.h:
../include/pdu.h:
../include/exceptions.h:
../include/snap.h:
../include/endianness.h:
../include/small_uint.h:
../include/rawpdu.h:
../include/handshake_capturer.h:
../include/eapol.h:
../include/config.h:
../include/arp.h:
../include/dot11.h:
../include/pdu_option.h:
../include/network_interface.h:
src/wpa2_decrypt.o: src/wpa2_decrypt.cpp ../include/crypto.h \
../include/utils.h ../include/macros.h ../include/ip_address.h \
../include/cxxstd.h ../include/ipv6_address.h ../include/hw_address.h \
../include/internals.h ../include/constants.h ../include/pdu.h \
../include/exceptions.h ../include/snap.h ../include/endianness.h \
../include/small_uint.h ../include/rawpdu.h \
../include/handshake_capturer.h ../include/eapol.h ../include/config.h \
../include/radiotap.h
../include/crypto.h:
../include/utils.h:
../include/macros.h:
../include/ip_address.h:
../include/cxxstd.h:
../include/ipv6_address.h:
../include/hw_address.h:
../include/internals.h:
../include/constants.h:
../include/pdu.h:
../include/exceptions.h:
../include/snap.h:
../include/endianness.h:
../include/small_uint.h:
../include/rawpdu.h:
../include/handshake_capturer.h:
../include/eapol.h:
../include/config.h:
../include/radiotap.h:

View File

@@ -4,6 +4,7 @@
#include <stdint.h>
#include "crypto.h"
#include "arp.h"
#include "dot11.h"
using namespace Tins;

View File

@@ -0,0 +1,69 @@
#include <gtest/gtest.h>
#include <cstring>
#include <string>
#include <stdint.h>
#include "crypto.h"
#include "radiotap.h"
#include "udp.h"
using namespace Tins;
class WPA2DecryptTest : public testing::Test {
public:
static const uint8_t packets[7][652];
static const size_t packets_size[];
void check_packet5(const PDU &pdu);
void check_packet6(const PDU &pdu);
};
// packet taken from aircrack's site.
const uint8_t WPA2DecryptTest::packets[7][652] = {
// Beacon
{0, 0, 24, 0, 142, 88, 0, 0, 16, 2, 108, 9, 160, 0, 96, 0, 0, 42, 0, 0, 71, 123, 147, 9, 128, 0, 0, 0, 255, 255, 255, 255, 255, 255, 0, 12, 65, 130, 178, 85, 0, 12, 65, 130, 178, 85, 128, 252, 134, 225, 42, 28, 1, 0, 0, 0, 100, 0, 17, 4, 0, 7, 67, 111, 104, 101, 114, 101, 114, 1, 8, 130, 132, 139, 150, 36, 48, 72, 108, 3, 1, 1, 5, 4, 0, 1, 0, 0, 42, 1, 2, 47, 1, 2, 48, 24, 1, 0, 0, 15, 172, 2, 2, 0, 0, 15, 172, 4, 0, 15, 172, 2, 1, 0, 0, 15, 172, 2, 0, 0, 50, 4, 12, 18, 24, 96, 221, 6, 0, 16, 24, 2, 0, 4, 221, 28, 0, 80, 242, 1, 1, 0, 0, 80, 242, 2, 2, 0, 0, 80, 242, 4, 0, 80, 242, 2, 1, 0, 0, 80, 242, 2, 0, 0, 71, 123, 147, 9},
// EAPOL keys
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 39, 0, 0, 183, 8, 75, 112, 8, 2, 44, 0, 0, 13, 147, 130, 54, 58, 0, 12, 65, 130, 178, 85, 0, 12, 65, 130, 178, 85, 176, 252, 170, 170, 3, 0, 0, 0, 136, 142, 2, 3, 0, 117, 2, 0, 138, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 62, 142, 150, 125, 172, 217, 96, 50, 76, 172, 91, 106, 167, 33, 35, 91, 245, 123, 148, 151, 113, 200, 103, 152, 159, 73, 208, 78, 212, 124, 105, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 221, 20, 0, 15, 172, 4, 89, 45, 168, 128, 150, 196, 97, 218, 36, 108, 105, 0, 30, 135, 127, 61, 183, 8, 75, 112},
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 56, 0, 0, 138, 11, 46, 247, 8, 1, 44, 0, 0, 12, 65, 130, 178, 85, 0, 13, 147, 130, 54, 58, 0, 12, 65, 130, 178, 85, 144, 1, 170, 170, 3, 0, 0, 0, 136, 142, 2, 3, 0, 117, 2, 1, 10, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 205, 244, 5, 206, 185, 216, 137, 239, 61, 236, 66, 96, 152, 40, 250, 229, 70, 183, 173, 215, 186, 236, 187, 26, 57, 78, 172, 82, 20, 177, 211, 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 98, 167, 2, 154, 213, 186, 48, 182, 175, 13, 243, 145, 152, 142, 69, 0, 22, 48, 20, 1, 0, 0, 15, 172, 2, 1, 0, 0, 15, 172, 4, 1, 0, 0, 15, 172, 2, 0, 0, 138, 11, 46, 247},
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 40, 0, 0, 108, 57, 145, 12, 8, 2, 44, 0, 0, 13, 147, 130, 54, 58, 0, 12, 65, 130, 178, 85, 0, 12, 65, 130, 178, 85, 192, 252, 170, 170, 3, 0, 0, 0, 136, 142, 2, 3, 0, 175, 2, 19, 202, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 62, 142, 150, 125, 172, 217, 96, 50, 76, 172, 91, 106, 167, 33, 35, 91, 245, 123, 148, 151, 113, 200, 103, 152, 159, 73, 208, 78, 212, 124, 105, 51, 245, 123, 148, 151, 113, 200, 103, 152, 159, 73, 208, 78, 212, 124, 105, 52, 207, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 10, 246, 223, 81, 233, 156, 222, 122, 24, 116, 83, 240, 249, 53, 55, 0, 80, 207, 167, 44, 222, 53, 178, 193, 226, 49, 146, 85, 128, 106, 179, 100, 23, 159, 217, 103, 48, 65, 185, 165, 147, 159, 161, 162, 1, 13, 42, 199, 148, 226, 81, 104, 5, 95, 121, 77, 220, 31, 223, 174, 53, 33, 244, 68, 107, 253, 17, 218, 152, 52, 95, 84, 61, 246, 206, 25, 157, 248, 254, 72, 248, 205, 209, 122, 220, 168, 123, 244, 87, 17, 24, 60, 73, 109, 65, 170, 12, 108, 57, 145, 12},
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 56, 0, 0, 239, 69, 111, 112, 8, 1, 44, 0, 0, 12, 65, 130, 178, 85, 0, 13, 147, 130, 54, 58, 0, 12, 65, 130, 178, 85, 160, 1, 170, 170, 3, 0, 0, 0, 136, 142, 2, 3, 0, 95, 2, 3, 10, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 187, 163, 189, 251, 207, 222, 43, 197, 55, 80, 157, 113, 242, 236, 209, 0, 0, 239, 69, 111, 112},
// DHCP
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 57, 0, 0, 44, 168, 148, 39, 8, 65, 44, 0, 0, 12, 65, 130, 178, 85, 0, 13, 147, 130, 54, 58, 255, 255, 255, 255, 255, 255, 176, 1, 1, 0, 0, 32, 0, 0, 0, 0, 126, 204, 246, 10, 193, 221, 255, 176, 71, 150, 195, 11, 161, 156, 146, 198, 18, 30, 128, 3, 144, 245, 239, 74, 121, 190, 64, 178, 90, 240, 84, 27, 111, 77, 28, 231, 39, 8, 194, 149, 207, 88, 25, 69, 140, 24, 213, 31, 100, 86, 122, 124, 197, 255, 133, 231, 166, 139, 35, 138, 51, 94, 68, 68, 247, 222, 12, 94, 239, 114, 29, 159, 219, 13, 81, 68, 3, 209, 201, 6, 70, 21, 35, 62, 252, 226, 75, 65, 109, 83, 140, 136, 132, 94, 70, 13, 41, 99, 14, 218, 114, 151, 253, 219, 181, 102, 172, 10, 5, 249, 33, 31, 191, 36, 57, 154, 21, 169, 21, 17, 4, 57, 189, 12, 12, 81, 10, 8, 74, 136, 144, 80, 1, 252, 100, 204, 154, 79, 202, 210, 81, 214, 224, 241, 85, 0, 183, 19, 251, 66, 194, 68, 96, 88, 42, 104, 208, 165, 185, 156, 128, 142, 1, 44, 32, 10, 197, 39, 176, 235, 50, 15, 117, 125, 96, 234, 1, 250, 121, 246, 92, 47, 195, 85, 102, 144, 98, 217, 37, 227, 228, 76, 2, 145, 193, 167, 54, 213, 15, 11, 140, 108, 104, 222, 158, 83, 110, 217, 127, 235, 67, 147, 130, 128, 75, 115, 146, 58, 97, 127, 204, 239, 55, 96, 207, 101, 152, 247, 126, 57, 185, 144, 166, 209, 103, 171, 92, 166, 169, 87, 118, 56, 254, 168, 52, 44, 151, 171, 213, 84, 245, 111, 234, 72, 235, 72, 190, 82, 223, 200, 39, 102, 123, 28, 9, 8, 120, 88, 185, 150, 154, 116, 16, 45, 83, 227, 125, 53, 46, 228, 98, 68, 132, 61, 2, 245, 27, 4, 67, 100, 203, 38, 51, 253, 46, 140, 22, 10, 33, 49, 36, 86, 229, 116, 116, 137, 51, 224, 216, 73, 91, 232, 35, 151, 216, 156, 183, 57, 247, 171, 160, 232, 68, 194, 184, 220, 58, 61, 87, 209, 167, 176, 126, 169, 255, 151, 163, 215, 23, 255, 2, 131, 11, 88, 44, 168, 148, 39},
// DHCP
{0, 0, 24, 0, 142, 88, 0, 0, 16, 108, 108, 9, 192, 0, 100, 0, 0, 41, 0, 0, 190, 202, 53, 174, 8, 66, 44, 0, 0, 13, 147, 130, 54, 58, 0, 12, 65, 130, 178, 85, 0, 12, 65, 130, 178, 83, 240, 252, 1, 0, 0, 32, 0, 0, 0, 0, 119, 49, 71, 116, 105, 136, 85, 205, 132, 196, 180, 119, 142, 132, 254, 142, 107, 185, 34, 64, 127, 182, 129, 59, 98, 183, 207, 159, 167, 27, 149, 169, 74, 170, 255, 149, 57, 187, 223, 19, 162, 165, 18, 63, 50, 153, 100, 9, 247, 29, 231, 199, 141, 125, 148, 9, 183, 62, 244, 101, 50, 254, 146, 237, 122, 204, 152, 151, 197, 153, 31, 122, 219, 59, 230, 26, 123, 231, 100, 31, 201, 119, 175, 228, 12, 189, 233, 235, 65, 148, 46, 143, 49, 144, 44, 76, 79, 143, 126, 163, 219, 81, 122, 250, 102, 252, 179, 97, 116, 151, 128, 138, 29, 29, 171, 64, 93, 233, 245, 44, 35, 244, 249, 140, 160, 198, 188, 44, 120, 38, 104, 52, 107, 70, 115, 34, 239, 117, 195, 195, 20, 193, 85, 224, 22, 142, 205, 27, 155, 34, 62, 19, 32, 199, 200, 3, 59, 253, 188, 180, 177, 41, 150, 247, 98, 199, 127, 43, 239, 236, 116, 51, 19, 185, 188, 97, 156, 151, 64, 144, 20, 103, 61, 23, 210, 236, 235, 23, 216, 116, 121, 14, 191, 150, 210, 255, 195, 230, 167, 53, 254, 207, 35, 28, 18, 209, 240, 112, 156, 181, 151, 30, 81, 215, 6, 225, 106, 153, 48, 91, 102, 171, 115, 62, 46, 70, 255, 39, 183, 219, 199, 73, 97, 127, 92, 18, 153, 206, 150, 200, 7, 153, 82, 151, 34, 170, 177, 94, 178, 149, 202, 164, 210, 176, 112, 106, 73, 213, 101, 14, 195, 115, 168, 153, 217, 52, 76, 130, 116, 159, 226, 247, 234, 238, 6, 250, 141, 149, 133, 208, 40, 106, 172, 130, 187, 114, 216, 250, 124, 47, 4, 227, 198, 97, 125, 69, 2, 219, 87, 123, 79, 150, 116, 187, 239, 120, 236, 199, 185, 96, 30, 112, 233, 237, 179, 28, 46, 149, 102, 253, 150, 133, 179, 71, 7, 119, 201, 39, 196, 106, 251, 100, 195, 201, 47, 109, 227, 158, 27, 70, 207, 241, 222, 179, 225, 220, 189, 224, 97, 134, 11, 150, 127, 235, 224, 222, 110, 141, 224, 0, 167, 126, 72, 155, 185, 162, 128, 141, 120, 39, 165, 5, 211, 222, 20, 11, 129, 222, 142, 149, 130, 136, 106, 105, 118, 135, 9, 220, 180, 196, 117, 66, 82, 215, 186, 107, 252, 85, 41, 131, 238, 85, 233, 197, 228, 157, 49, 42, 57, 52, 40, 235, 240, 208, 248, 180, 26, 153, 227, 223, 33, 247, 236, 162, 226, 253, 63, 144, 199, 157, 164, 56, 185, 19, 8, 197, 210, 129, 90, 177, 16, 119, 165, 208, 244, 247, 253, 121, 10, 51, 15, 215, 140, 231, 51, 198, 168, 11, 54, 126, 135, 145, 13, 161, 192, 119, 16, 184, 30, 235, 23, 133, 20, 247, 139, 30, 235, 110, 211, 13, 39, 76, 4, 153, 83, 236, 215, 52, 107, 75, 188, 73, 74, 60, 203, 80, 194, 127, 7, 65, 225, 195, 139, 166, 176, 22, 151, 54, 204, 159, 5, 254, 82, 145, 230, 163, 254, 191, 206, 29, 198, 78, 198, 232, 238, 247, 104, 245, 100, 67, 108, 90, 88, 177, 136, 32, 28, 76, 108, 195, 172, 251, 121, 158, 23, 52, 33, 118, 205, 239, 50, 163, 118, 65, 150, 69, 109, 152, 70, 31, 235, 102, 126, 254, 209, 228, 148, 203, 137, 34, 20, 69, 141, 180, 177, 154, 155, 35, 101, 1, 78, 207, 67, 117, 29, 104, 9, 244, 3, 220, 131, 61, 190, 202, 53, 174}
};
const size_t WPA2DecryptTest::packets_size[] = {
168, 181, 181, 239, 159, 404, 652
};
void WPA2DecryptTest::check_packet5(const PDU &pdu) {
const UDP *udp = pdu.find_pdu<UDP>();
ASSERT_TRUE(udp);
EXPECT_EQ(udp->sport(), 68);
EXPECT_EQ(udp->dport(), 67);
}
void WPA2DecryptTest::check_packet6(const PDU &pdu) {
const UDP *udp = pdu.find_pdu<UDP>();
ASSERT_TRUE(udp);
EXPECT_EQ(udp->sport(), 67);
EXPECT_EQ(udp->dport(), 68);
}
TEST_F(WPA2DecryptTest, DecryptUsingBeacon) {
Crypto::WPA2Decrypter decrypter;
decrypter.add_supplicant_data("Induction", "Coherer");
for(size_t i = 0; i < 7; ++i) {
RadioTap radio(packets[i], packets_size[i]);
if(i > 4) {
ASSERT_TRUE(decrypter.decrypt(radio));
if(i == 5)
check_packet5(radio);
else
check_packet6(radio);
}
else
ASSERT_FALSE(decrypter.decrypt(radio));
}
}