Compare commits
13 Commits
dev2
...
d590b2c3e5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d590b2c3e5 | ||
|
|
cf70ae4f5b | ||
|
|
948a3aa0ab | ||
|
|
7b27f6aa82 | ||
|
|
07c9b15d5a | ||
|
|
929ba6b3e3 | ||
|
|
60b471be38 | ||
|
|
0904512d63 | ||
|
|
f57170b4d6 | ||
|
|
229692efc6 | ||
|
|
b4906e4d9b | ||
|
|
85b1a39899 | ||
|
|
3c04f89e01 |
14
main.go
14
main.go
@@ -9,7 +9,6 @@ import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"strconv"
|
||||
|
||||
@@ -71,21 +70,12 @@ func sInit(os string) *targetInfo {
|
||||
return &tInfo
|
||||
}
|
||||
|
||||
func openCapture(tInfo *targetInfo) *pcap.Handle {
|
||||
for {
|
||||
handle, err := pcap.OpenLive(tInfo.iFace, tInfo.snaplen, true, pcap.BlockForever)
|
||||
if err == nil {
|
||||
return handle
|
||||
}
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
tInfo := sInit(runtime.GOOS)
|
||||
|
||||
// Read package and analze them
|
||||
handle := openCapture(tInfo)
|
||||
handle, err := pcap.OpenLive(tInfo.iFace, tInfo.snaplen, true, pcap.BlockForever)
|
||||
errorPrinter(err)
|
||||
|
||||
handle.SetBPFFilter(tInfo.filter)
|
||||
packets := gopacket.NewPacketSource(handle, handle.LinkType()).Packets()
|
||||
|
||||
Reference in New Issue
Block a user