-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkismetv2.go
More file actions
38 lines (32 loc) · 801 Bytes
/
Copy pathkismetv2.go
File metadata and controls
38 lines (32 loc) · 801 Bytes
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
package main
import (
"database/sql"
"fmt"
_ "github.com/mattn/go-sqlite3"
)
//parseKismet parses the specified Kismet file and returns a Points array with all the values
func parseKismet(file *string, bssids []string, filter *int) (points Points) {
db, err := sql.Open("sqlite3", *file)
if err != nil {
panic("Ensure the Kismit file exists")
}
rows, err := db.Query("SELECT sourcemac,lat,lon,signal FROM packets")
if err != nil {
panic("Kismet database corrupt")
}
defer rows.Close()
for rows.Next() {
var (
mac string
lat, lon float64
sig int
)
if err := rows.Scan(&mac, &lat, &lon, &sig); err != nil {
fmt.Println(err)
}
points = append(points, Point{lon, lat, sig, mac})
}
rows.Close()
points = filterBSSID(points, bssids, filter)
return
}