stuff
This commit is contained in:
parent
a9a48ffbd8
commit
9dcf6d9c6f
30
main.go
30
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -27,6 +28,7 @@ const SecondsUntilInactive = 120
|
|||
func main() {
|
||||
|
||||
clients := ParseCSVDump(CSVDump)
|
||||
//clients := GetClientsFromBytes()
|
||||
|
||||
var activeClients int64
|
||||
for _, c := range clients {
|
||||
|
@ -39,6 +41,34 @@ func main() {
|
|||
fmt.Println("Total Clients:", len(clients))
|
||||
}
|
||||
|
||||
func GetClientsFromBytes() (clients []*WifiClient) {
|
||||
|
||||
// Tooo much hassle, just output a csv dump and parse that and delete it afterwards should be good enough
|
||||
|
||||
// -u <secs> für delay
|
||||
argstr := []string{"-c", "airodump-ng wlp59s0 -u 9"}
|
||||
command := exec.Command("/bin/bash", argstr...)
|
||||
var buf bytes.Buffer
|
||||
command.Stdout = &buf
|
||||
|
||||
if err := command.Start(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
timer := time.AfterFunc(10 *time.Second, func() {
|
||||
err := command.Process.Kill()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
|
||||
command.Wait()
|
||||
timer.Stop()
|
||||
ioutil.WriteFile("dump", buf.Bytes(), 0644)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ParseCSVDump(pathToDump string) (clients []*WifiClient) {
|
||||
bs, err := ioutil.ReadFile(pathToDump)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue