scanme

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDNSBanner added in v1.0.2

func GetDNSBanner(ipAddress string, port int) (string, error)

func GetHeader added in v1.0.2

func GetHeader(ipAddress string, port int) (string, error)

func GetLDAPBanner added in v1.0.2

func GetLDAPBanner(ipAddress string, port int) (string, error)

func GrabBanner added in v1.0.2

func GrabBanner(ipAddress string, port int) string

func GrabMysqlBanner added in v1.0.2

func GrabMysqlBanner(ipAddress string, port int) (string, error)

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

func NewScanner(ip net.IP, router routing.Router) (*Scanner, error)

newScanner creates a new scanner for a given destination IP address, using router to determine how to route packets to that IP.

func (*Scanner) Close

func (s *Scanner) Close()

Closes the pcap handle

func (*Scanner) ConnScan added in v1.0.1

func (s *Scanner) ConnScan() (map[layers.TCPPort]string, error)

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 (s *Scanner) HandlePacketSock(data []byte, srcport layers.TCPPort)

func (*Scanner) SendSynTCP4 added in v1.0.2

func (s *Scanner) SendSynTCP4(ip string, p layers.TCPPort)

func (*Scanner) SendSynTCP6 added in v1.0.2

func (s *Scanner) SendSynTCP6(ip string, p layers.TCPPort)

func (*Scanner) Synscan

func (s *Scanner) Synscan() (map[layers.TCPPort]string, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL