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