-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetxml-go.go
40 lines (36 loc) · 940 Bytes
/
netxml-go.go
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
package main
import (
"flag"
"fmt"
"github.com/japkettu/netxml-go/netxml"
"io/ioutil"
"log"
)
func main() {
file := flag.String("f", "", "Kismet netxml file")
fPrint := flag.Bool("p", false, "Print network information and connected clients")
fInfo := flag.Bool("i", false, "Print netxml info")
clientSHP := flag.String("cs", "", "Write clients to shapefile")
nwSHP := flag.String("ns", "", "Write networks to shapefile")
flag.Parse()
data, err := ioutil.ReadFile(*file)
if err != nil {
log.Fatal(err)
}
root := netxml.Parse(data)
fmt.Printf("File: %s\n", *file)
if *fPrint {
netxml.Print(root)
}
if *fInfo {
netxml.FileInfo(root)
}
if *nwSHP != "" {
count := netxml.WriteNetworkSHP(root, *nwSHP)
fmt.Printf("Networks written to shapefile: %d\n", count)
}
if *clientSHP != "" {
clientCount := netxml.WriteClientSHP(root, *clientSHP)
fmt.Printf("Clients written to shapefile: %d\n", clientCount)
}
}