scanner

package
v0.0.0-...-c8b1436 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const UNKNOWN = "Unknown"

UNKNOWN default for unknown port

Variables

View Source
var KNOWNPORTS = map[int]string{
	27017: "mongodb [ http://www.mongodb.org/ ]",
	28017: "mongodb web admin [ http://www.mongodb.org/ ]",
	21:    "ftp",
	22:    "SSH",
	23:    "telnet",
	25:    "SMTP",
	66:    "Oracle SQL*NET?",
	69:    "tftp",
	80:    "http",
	88:    "kerberos",
	109:   "pop2",
	110:   "pop3",
	123:   "ntp",
	137:   "netbios",
	139:   "netbios",
	443:   "https",
	445:   "Samba",
	631:   "cups",
	5800:  "VNC remote desktop",
	194:   "IRC",
	118:   "SQL service?",
	150:   "SQL-net?",
	1433:  "Microsoft SQL server",
	1434:  "Microsoft SQL monitor",
	3306:  "MySQL",
	3396:  "Novell NDPS Printer Agent",
	3535:  "SMTP (alternate)",
	554:   "RTSP",
	9160:  "Cassandra [ http://cassandra.apache.org/ ]",
	8000:  "Nodejs",
	9200:  "Elasticsearch",
	5601:  "Kibana",
}

KNOWNPORTS are sample known ports

Functions

func GetIP

func GetIP(host string) string

GetIP return ips of hostname

Types

type Host

type Host struct {
	Addr         string  `json:"addr"`
	IP           string  `json:"ip"`
	IsUp         bool    `json:"isup"`
	Ports        []*Port `json:"ports"`
	Vendor       string  `json:"vendor"`
	OSInfo       string  `json:"osinfo"`
	Mac          string  `json:"mac"`
	TimeComplete float64 `json:"timecomplete"`
}

Host contains the scan results and information about a host.

func NewHost

func NewHost(host string) *Host

NewHost constructor

func (*Host) UpdateIP

func (h *Host) UpdateIP(ip string)

UpdateIP update ip result

func (*Host) UpdateInfo

func (h *Host) UpdateInfo(vendor string, osInfo string, mac string)

UpdateInfo update info about result

func (*Host) UpdatePort

func (h *Host) UpdatePort(port *Port)

UpdatePort add a port open to result

func (*Host) UpdateStatus

func (h *Host) UpdateStatus(isUp bool)

UpdateStatus update host up or down

func (*Host) UpdateTimeComplete

func (h *Host) UpdateTimeComplete(time float64)

UpdateTimeComplete update time scan complete

type Port

type Port struct {
	IsOpen      bool   `json:"isopen"`
	Number      int    `json:"number"`
	Service     string `json:"service"`
	Description string `json:"description"`
}

Port contains info about a port

func NewPort

func NewPort(isOpen bool, number int, service string, description string) *Port

NewPort constructor

type Scanner

type Scanner struct {
	Host       string
	Timeout    time.Duration
	Concurrent *semaphore.Weighted
	Protocol   string
	Result     *Host
}

Scanner is struct of scanner object

func NewScanner

func NewScanner(host string, timeout time.Duration, concurrent int64, protocol string) *Scanner

NewScanner constructor

func (*Scanner) Scan

func (s *Scanner) Scan(startPort int, endPort int)

Scan start scan with startPort and endPort numbers

func (*Scanner) SetConcurrent

func (s *Scanner) SetConcurrent(concurrent int64)

SetConcurrent set max goroutine for scanner

func (*Scanner) SetProtocol

func (s *Scanner) SetProtocol(protocol string)

SetProtocol set protocol for scanner

func (*Scanner) SetTimeout

func (s *Scanner) SetTimeout(timeout time.Duration)

SetTimeout set timeout for net.DialTimeout

Jump to

Keyboard shortcuts

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