-
Notifications
You must be signed in to change notification settings - Fork 1
/
kismet2sqlite.sh
73 lines (66 loc) · 1.22 KB
/
kismet2sqlite.sh
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
#!/bin/bash
# This script converts *.kismet.csv files produced by airodump-ng into a sqlite database
# Usage: ./kismet2sqlite.sh myfile-01.kismet.csv
#
# Visit my website <hackherz.com> for more.
# © 2016 Daniel Stein <[email protected]>
if [[ $# > 0 ]]
then
# Create temporary copy
cp "$1" "$1.tmp"
# Change line endings
sed -i 's/\r//g' "$1.tmp"
sed -i 's/\;$//g' "$1.tmp"
# Remove first line
sed -i 1d "$1.tmp"
# Import to sqlite
cat <<EOF | sqlite3 "$1.db"
CREATE TABLE IF NOT EXISTS 'dump' (
Network INTEGER PRIMARY KEY,
NetType TEXT,
ESSID TEXT,
BSSID TEXT,
Info TEXT,
Channel INTEGER,
Cloaked TEXT,
Encryption TEXT,
Decrypted TEXT,
MaxRate TEXT,
MaxSeenRate TEXT,
Beacon TEXT,
LLC TEXT,
Data TEXT,
Crypt TEXT,
Weak TEXT,
Total TEXT,
Carrier TEXT,
Encoding TEXT,
FirstTime TEXT,
LastTime TEXT,
BestQuality TEXT,
BestSignal TEXT,
BestNoise TEXT,
GPSMinLat TEXT,
GPSMinLon TEXT,
GPSMinAlt TEXT,
GPSMinSpd TEXT,
GPSMaxLat TEXT,
GPSMaxLon TEXT,
GPSMaxAlt TEXT,
GPSMaxSpd TEXT,
GPSBestLat TEXT,
GPSBestLon TEXT,
GPSBestAlt TEXT,
DataSize TEXT,
IPType TEXT,
IP TEXT);
.mode csv
.separator ";"
.import '$1.tmp' 'dump'
EOF
# Remove copy
rm -f "$1.tmp"
else
# You need to specify the kismet.csv file
echo "Argument is missing."
fi