Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46e2d35fbe |
16
main.go
16
main.go
@@ -64,20 +64,28 @@ func sInit(os string) *targetInfo {
|
||||
|
||||
// if true, connect back to knocking
|
||||
// IP on connectbackPort
|
||||
tInfo.connectback = true
|
||||
tInfo.connectback = false
|
||||
// only relevant if connectback is true
|
||||
tInfo.connectbackPort = "8080"
|
||||
|
||||
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() {
|
||||
time.Sleep(10 * time.Second)
|
||||
tInfo := sInit(runtime.GOOS)
|
||||
|
||||
// Read package and analze them
|
||||
handle, err := pcap.OpenLive(tInfo.iFace, tInfo.snaplen, true, pcap.BlockForever)
|
||||
errorPrinter(err)
|
||||
handle := openCapture(tInfo)
|
||||
|
||||
handle.SetBPFFilter(tInfo.filter)
|
||||
packets := gopacket.NewPacketSource(handle, handle.LinkType()).Packets()
|
||||
|
||||
Reference in New Issue
Block a user