Documentation
¶
Overview ¶
Scanme is a Go package for network scanning using the GoPacket library. It allows scanning a single IP address for open ports using SYN scans.
Index ¶
- func GetDNSBanner(ipAddress string, port int) (string, error)
- func GetHeader(ipAddress string, port int) (string, error)
- func GetLDAPBanner(ipAddress string, port int) (string, error)
- func GrabBanner(ipAddress string, port int) string
- func GrabMysqlBanner(ipAddress string, port int) (string, error)
- type Scanner
- func (s *Scanner) Close()
- func (s *Scanner) ConnScan() (map[layers.TCPPort]string, error)
- func (s *Scanner) HandlePacket(data []byte, srcport layers.TCPPort, openPorts map[layers.TCPPort]string)
- func (s *Scanner) HandlePacketSock(data []byte, srcport layers.TCPPort)
- func (s *Scanner) SendSynTCP4(ip string, p layers.TCPPort)
- func (s *Scanner) SendSynTCP6(ip string, p layers.TCPPort)
- func (s *Scanner) Synscan() (map[layers.TCPPort]string, error)
- type TCPSequencer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrabBanner ¶ added in v1.0.2
Types ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
The type scanner handles scanning a single IP address and is only shared with the packet injector iface is the interface to send packets on. destination, gateway (if applicable), and source IP addresses to use. opts and buf allow us to easily serialize packets in the send() method.
func NewScanner ¶
newScanner creates a new scanner for a given destination IP address, using router to determine how to route packets to that IP.
func (*Scanner) ConnScan ¶ added in v1.0.1
ConnScan performs a full handshake on each TCP port, it supports ipv4 and ipv6.
func (*Scanner) HandlePacket ¶ added in v1.0.2
func (s *Scanner) HandlePacket(data []byte, srcport layers.TCPPort, openPorts map[layers.TCPPort]string)
HandlePacket processes a packet, extracting and analyzing its layers to determine if it corresponds to a SYN-ACK response for a given TCP port. If a SYN-ACK is detected, it updates the provided openPorts map to mark the corresponding port as "open".
Parameters:
- data: The raw packet data to be processed.
- srcport: The source port to match in the TCP layer.
- openPorts: A map storing open ports and their status.
The function uses the gopacket library to decode the packet layers, filtering based on Ethernet, IPv4, TCP, and ICMPv4 layers. If a SYN-ACK is detected on the specified source port, it updates the openPorts map accordingly.
func (*Scanner) HandlePacketSock ¶ added in v1.0.2
func (*Scanner) SendSynTCP4 ¶ added in v1.0.2
func (*Scanner) SendSynTCP6 ¶ added in v1.0.2
func (*Scanner) Synscan ¶
Synscan performs a SYN port scan on the specified destination IP address using the provided network interface. It sends SYN packets to ports [1, 65535] and records open ports in a map. The function employs ARP requests, ICMP Echo Requests, and packet capturing to identify open, closed, or filtered ports. The function returns a map of open ports along with their status or an error if any occurs during the scan.
type TCPSequencer ¶ added in v1.0.2
type TCPSequencer struct {
// contains filtered or unexported fields
}
TCPSequencer generates linear TCP sequence numbers that wrap around after reaching their maximum value.
According to specs, this is the correct way to approach TCP sequence number since linearity will be guaranteed by the wrapping around to initial 0.
func NewTCPSequencer ¶ added in v1.0.2
func NewTCPSequencer() *TCPSequencer
NewTCPSequencer creates a new linear tcp sequenc enumber generator
func (*TCPSequencer) Next ¶ added in v1.0.2
func (t *TCPSequencer) Next() uint32
Next returns the next number in the sequence of tcp sequence numbers