File: test-airodump-ng-0001.sh

package info (click to toggle)
aircrack-ng 1%3A1.6%2Bgit20210130.91820bc-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,056 kB
  • sloc: ansic: 67,045; cs: 5,392; sh: 3,773; python: 2,565; pascal: 1,074; asm: 570; makefile: 253; cpp: 46
file content (87 lines) | stat: -rwxr-xr-x 1,826 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
# Airodump-ng: Check base files generated are good

if test ! -z "${CI}"; then exit 77; fi

# Load helper functions
. "${abs_builddir}/../test/int-test-common.sh"

# Check root
check_root

# Check all required tools are installed
check_airmon_ng_deps_present
is_tool_present screen

# Check for interfering processes
airmon_ng_check

# Cleanup
finish() {
	screen_cleanup
	[ -n "${TEMP_FILE}" ] && [ -f "${TEMP_FILE}-01.csv" ] && rm -f ${TEMP_FILE}*
	cleanup
}

trap  finish INT QUIT SEGV PIPE ALRM TERM EXIT

# Load mac80211_hwsim
load_module 1

# Check there are two radios
check_radios_present 1

# Get interfaces names
get_hwsim_interface_name 1
WI_IFACE=${IFACE}

CHANNEL=9

# Put interface in monitor mode
set_monitor_mode ${WI_IFACE}
[ $? -eq 1 ] && exit 1
set_interface_channel ${WI_IFACE} ${CHANNEL}
[ $? -eq 1 ] && exit 1

TEMP_FILE=$(mktemp -u)
screen -AmdS capture \
	timeout 3 \
		"${abs_builddir}/../airodump-ng" \
			${WI_IFACE} \
			-c  10 \
			-w ${TEMP_FILE} \
			--background 1

# Wait a few seconds for it to finish
sleep 5

# Basic checks
if [ $(ls -1 ${TEMP_FILE}-01.* | wc -l) -ne 5 ]; then
	echo "Failed creating files"
	exit 1
fi

if [ $(md5sum "${TEMP_FILE}-01.cap" | ${AWK} '{print $1}' ) != '50d6b6d03c0e582a1ae60986e5f53832' ]; then
	echo "Invalid PCAP file"
	exit 1
fi

if [ $(md5sum "${TEMP_FILE}-01.csv" | ${AWK} '{print $1}') != '7b5b92716e839e310d8edda8ec21a469' ]; then
	echo "Invalid CSV file"
	exit 1
fi

if [ $(md5sum "${TEMP_FILE}-01.kismet.csv" | ${AWK} '{print $1}') != '0f402e05f06f582a7931420075485369' ]; then
	echo "Invalid Kismet CSV file"
	exit 1
fi

if [ $(md5sum "${TEMP_FILE}-01.log.csv" | ${AWK} '{print $1}') != '6bdaf36ee12b14b2a5a80c3af8ae7160' ]; then
	echo "Invalid Log CSV"
	exit 1
fi

# TODO: Verify Kismet NetXML
echo 'Kismet NetXML is not verified'

exit 0