new: implemented syn.scan module (closes #67)

This commit is contained in:
evilsocket 2018-02-22 21:20:36 +01:00
parent d6fe8fc663
commit ce76c7258d
8 changed files with 338 additions and 3 deletions

29
packets/tcp.go Normal file
View 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(&eth, &ip4, &tcp)
}