nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 #! /bin/sh
2 #
3 # Carlos Alberto Lopez Perez <clopez@igalia.com>
4 # Thomas d'Otreppe <tdotreppe@aircrack-ng.org> - Support for sha1 and sh
5 TESTDIR="$(dirname $0)"
6 if [ "$(uname -s)" = 'OpenBSD' ]; then
7 tmpdir="$(mktemp -d -t acng.XXXXXX)"
8 else
9 tmpdir="$(mktemp -d -t acng.XXXX)"
10 fi
11  
12 compute_sha1() {
13 if type "sha1sum" > /dev/null 2>/dev/null ; then
14 sha1sum "${1}" | awk '{print $1}'
15 elif type "shasum" > /dev/null 2>/dev/null ; then
16 shasum "${1}" | awk '{print $1}'
17 elif type "sha1" > /dev/null 2>/dev/null ; then
18 sha1 -q "${1}"
19 else
20 echo "Unable to find something to compute sha1" 1>&2
21 exit 1
22 fi
23 }
24  
25  
26 # Clean on exit
27 if [ "$(uname -s)" = 'OpenBSD' ]; then
28 trap "rm -rf "${tmpdir}"" EXIT
29 else
30 trap "rm -fr "${tmpdir}"" SIGINT SIGKILL SIGQUIT SIGSEGV SIGPIPE SIGALRM SIGTERM EXIT
31 fi
32 # Test1
33 cp -f "${TESTDIR}/wpa.cap" "${tmpdir}"
34 ./airdecap-ng -e test -p biscotte "${tmpdir}/wpa.cap" | \
35 grep "Number of decrypted WPA packets 2" || exit 1
36 [ $? -ne 0 ] && exit 1
37 result=$(compute_sha1 "${tmpdir}/wpa-dec.cap")
38  
39 if [ "${result}" != "69f8557cf96a26060989e88adfb521a01fc9b122" ] &&
40 [ "${result}" != "fb1592b2c0dccef542c1f46297394ee2892f8ed3" ]; then
41 exit 1
42 fi
43  
44 # Test 2
45 cp -f "${TESTDIR}/wpa-psk-linksys.cap" "${tmpdir}"
46 ./airdecap-ng -e linksys -p dictionary "${tmpdir}/wpa-psk-linksys.cap" | \
47 grep "Number of decrypted WPA packets 53"
48 [ $? -ne 0 ] && exit 1
49 result=$(compute_sha1 "${tmpdir}/wpa-psk-linksys-dec.cap")
50  
51 if [ "${result}" != "1e75a9af0d9703c4ae4fc8ea454326aeb4abecc1" ] &&
52 [ "${result}" != "1c3c4123ba6718bd3db66de251a125ed65cd6ee6" ]; then
53 exit 1
54 fi
55  
56 # Test 3
57 cp -f "${TESTDIR}/wpa2-psk-linksys.cap" "${tmpdir}"
58 ./airdecap-ng -e linksys -p dictionary "${tmpdir}/wpa2-psk-linksys.cap" | \
59 grep "Number of decrypted WPA packets 25"
60 [ $? -ne 0 ] && exit 1
61 result=$(compute_sha1 "${tmpdir}/wpa2-psk-linksys-dec.cap")
62  
63 if [ "${result}" != "2da107b96fbe19d926020ffb0da72553b18a5775" ] &&
64 [ "${result}" != "dc7d033b9759838d57b74db04185c3586cbd8042" ]; then
65 exit 1
66 fi
67 exit 0