mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
new: implemented syn.scan module (closes #67)
This commit is contained in:
parent
d6fe8fc663
commit
ce76c7258d
8 changed files with 338 additions and 3 deletions
29
packets/tcp.go
Normal file
29
packets/tcp.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package packets
|
||||
|
||||
import (
|
||||
"github.com/google/gopacket/layers"
|
||||
"net"
|
||||
)
|
||||
|
||||
func NewTCPSyn(from net.IP, from_hw net.HardwareAddr, to net.IP, to_hw net.HardwareAddr, srcPort int, dstPort int) (error, []byte) {
|
||||
eth := layers.Ethernet{
|
||||
SrcMAC: from_hw,
|
||||
DstMAC: to_hw,
|
||||
EthernetType: layers.EthernetTypeIPv4,
|
||||
}
|
||||
ip4 := layers.IPv4{
|
||||
Protocol: layers.IPProtocolTCP,
|
||||
Version: 4,
|
||||
TTL: 64,
|
||||
SrcIP: from,
|
||||
DstIP: to,
|
||||
}
|
||||
tcp := layers.TCP{
|
||||
SrcPort: layers.TCPPort(srcPort),
|
||||
DstPort: layers.TCPPort(dstPort),
|
||||
SYN: true,
|
||||
}
|
||||
tcp.SetNetworkLayerForChecksum(&ip4)
|
||||
|
||||
return Serialize(ð, &ip4, &tcp)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue