zlib

package
v0.0.0-...-9842712 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0, ISC, MIT Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMTP_COMMAND = "STARTTLS\r\n"
	POP3_COMMAND = "STLS\r\n"
	IMAP_COMMAND = "a001 STARTTLS\r\n"
)
View Source
const (
	FunctionCodeMEI = FunctionCode(0x2B)
)

Variables

View Source
var ErrRedirLocalhost = errors.New("Redirecting to Localhost")
View Source
var ModbusFunctionEncapsulatedInterface = FunctionCode(0x2B)
View Source
var ModbusHeaderBytes = []byte{
	0x13, 0x37,
	0x00, 0x00,
}

Functions

func NewGrabMarshaler

func NewGrabMarshaler() processing.Marshaler

func NewGrabTargetDecoder

func NewGrabTargetDecoder(reader io.Reader, domainOnly bool) processing.Decoder

func NewGrabWorker

func NewGrabWorker(config *Config) processing.Worker

func WriteOutput

func WriteOutput(grabChan chan Grab, doneChan chan int, config *OutputConfig)

Types

type Config

type Config struct {
	// Connection
	Port               uint16
	Timeout            time.Duration
	Senders            uint
	ConnectionsPerHost uint

	// DNS
	LookupDomain bool

	// TLS
	TLS                           bool
	TLSVersion                    uint16
	Heartbleed                    bool
	RootCAPool                    *x509.CertPool
	DHEOnly                       bool
	ECDHEOnly                     bool
	ExportsOnly                   bool
	ExportsDHOnly                 bool
	FirefoxOnly                   bool
	FirefoxNoDHE                  bool
	ChromeOnly                    bool
	ChromeNoDHE                   bool
	SafariOnly                    bool
	SafariNoDHE                   bool
	TLS13Measurements             bool
	NoSNI                         bool
	TLSExtendedRandom             bool
	GatherSessionTicket           bool
	ExtendedMasterSecret          bool
	TLSVerbose                    bool
	SignedCertificateTimestampExt bool
	ExternalClientHello           []byte

	// Banners and Data
	Banners  bool
	SendData bool
	Data     []byte
	Raw      bool

	// Mail
	SMTP       bool
	IMAP       bool
	POP3       bool
	SMTPHelp   bool
	EHLODomain string
	EHLO       bool
	StartTLS   bool

	// FTP
	FTP        bool
	FTPAuthTLS bool

	// Telnet
	Telnet        bool
	TelnetMaxSize int

	// Modbus
	Modbus bool

	// BACNet
	BACNet bool

	// Niagara Fox
	Fox bool

	// DNP3
	DNP3 bool

	// S7
	S7 bool

	// HTTP
	HTTP HTTPConfig

	// Error handling
	ErrorLog *zlog.Logger

	// Go Runtime Config
	GOMAXPROCS int

	// x/crypto SSH
	XSSH XSSHScanConfig

	// SMB
	SMB SMBScanConfig

	KeylogFile *bufio.Writer

	BlacklistIP string

	BlacklistDom string

	TraceRoute bool

	Proxy string
}

type Conn

type Conn struct {
	CipherSuites []uint16
	ForceSuites  bool

	ExternalClientHello []byte

	SignedCertificateTimestampExt bool
	// contains filtered or unexported fields
}

Implements the net.Conn interface

func (*Conn) BACNetVendorQuery

func (c *Conn) BACNetVendorQuery() error

func (*Conn) BasicBanner

func (c *Conn) BasicBanner() (string, error)

func (*Conn) CheckHeartbleed

func (c *Conn) CheckHeartbleed(b []byte) (int, error)

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) EHLO

func (c *Conn) EHLO(domain string) error

func (*Conn) GetFTPSCertificates

func (c *Conn) GetFTPSCertificates() error

func (*Conn) GetModbusResponse

func (c *Conn) GetModbusResponse() (res ModbusResponse, err error)

func (*Conn) IMAPBanner

func (c *Conn) IMAPBanner(b []byte) (int, error)

func (*Conn) IMAPQuit

func (c *Conn) IMAPQuit() error

func (*Conn) IMAPStartTLSHandshake

func (c *Conn) IMAPStartTLSHandshake() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

Layer in the regular conn methods

func (*Conn) POP3Banner

func (c *Conn) POP3Banner(b []byte) (int, error)

func (*Conn) POP3Quit

func (c *Conn) POP3Quit() error

func (*Conn) POP3StartTLSHandshake

func (c *Conn) POP3StartTLSHandshake() error

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) ReadMin

func (c *Conn) ReadMin(res []byte, bytes int) (cnt int, err error)

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SMTPBanner

func (c *Conn) SMTPBanner(b []byte) (int, error)

func (*Conn) SMTPHelp

func (c *Conn) SMTPHelp() error

func (*Conn) SMTPQuit

func (c *Conn) SMTPQuit() error

func (*Conn) SMTPStartTLSHandshake

func (c *Conn) SMTPStartTLSHandshake() error

Do a STARTTLS handshake

func (*Conn) SendModbusEcho

func (c *Conn) SendModbusEcho() (int, error)

func (*Conn) SetCAPool

func (c *Conn) SetCAPool(pool *x509.CertPool)

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetDomain

func (c *Conn) SetDomain(domain string)

func (*Conn) SetExtendedRandom

func (c *Conn) SetExtendedRandom()

func (*Conn) SetExternalClientHello

func (c *Conn) SetExternalClientHello(clientHello []byte)

func (*Conn) SetGatherSessionTicket

func (c *Conn) SetGatherSessionTicket()

func (*Conn) SetNoSNI

func (c *Conn) SetNoSNI()

func (*Conn) SetOfferExtendedMasterSecret

func (c *Conn) SetOfferExtendedMasterSecret()

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetSignedCertificateTimestampExt

func (c *Conn) SetSignedCertificateTimestampExt()

func (*Conn) SetTLSVerbose

func (c *Conn) SetTLSVerbose()

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) TLSHandshake

func (c *Conn) TLSHandshake() error

Extra method - Do a TLS Handshake and record progress

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Delegate here, but record all the things

type Dialer

type Dialer struct {
	Deadline  time.Time
	Timeout   time.Duration
	LocalAddr net.Addr
	DualStack bool
	KeepAlive time.Duration
	Proxy     string
}

func (*Dialer) Dial

func (d *Dialer) Dial(network, address string) (*Conn, error)

type ExceptionCode

type ExceptionCode byte

type ExceptionFunctionCode

type ExceptionFunctionCode byte

func (ExceptionFunctionCode) FunctionCode

func (e ExceptionFunctionCode) FunctionCode() FunctionCode

type ExceptionResponse

type ExceptionResponse struct {
	ExceptionFunction FunctionCode `json:"exception_function"`
	ExceptionType     byte         `json:"exception_type"`
}

type FunctionCode

type FunctionCode byte

func (FunctionCode) ExceptionFunctionCode

func (c FunctionCode) ExceptionFunctionCode() ExceptionFunctionCode

func (FunctionCode) IsException

func (c FunctionCode) IsException() bool

type Grab

type Grab struct {
	IP             net.IP
	Domain         string
	Time           time.Time
	Data           GrabData
	Error          error
	ErrorComponent string
	ComsysSource   string
	ComsysDate     string
	ComsysInput    string
	Route          map[int]string
}

func GrabBanner

func GrabBanner(config *Config, target *GrabTarget) *Grab

func (*Grab) MarshalJSON

func (g *Grab) MarshalJSON() ([]byte, error)

func (*Grab) UnmarshalJSON

func (g *Grab) UnmarshalJSON(b []byte) error

type GrabData

type GrabData struct {
	Banner       string               `json:"banner,omitempty"`
	Read         string               `json:"read,omitempty"`
	Write        string               `json:"write,omitempty"`
	EHLO         string               `json:"ehlo,omitempty"`
	SMTPHelp     *SMTPHelpEvent       `json:"smtp_help,omitempty"`
	StartTLS     string               `json:"starttls,omitempty"`
	TLSHandshake *tls.ServerHandshake `json:"tls,omitempty"`
	HTTP         *HTTP                `json:"http,omitempty"`
	Heartbleed   *tls.Heartbleed      `json:"heartbleed,omitempty"`
	Modbus       *ModbusEvent         `json:"modbus,omitempty"`
	SMB          *smb.SMBLog          `json:"smb,omitempty"`
	XSSH         *xssh.HandshakeLog   `json:"xssh,omitempty"`
	FTP          *ftp.FTPLog          `json:"ftp,omitempty"`
	BACNet       *bacnet.Log          `json:"bacnet,omitempty"`
	Fox          *fox.FoxLog          `json:"fox,omitempty"`
	DNP3         *dnp3.DNP3Log        `json:"dnp3,omitempty"`
	S7           *siemens.S7Log       `json:"s7,omitempty"`
	Telnet       *telnet.TelnetLog    `json:"telnet,omitempty"`
}

type GrabTarget

type GrabTarget struct {
	Addr         net.IP
	Domain       string
	ComsysSource string
	ComsysDate   string
	ComsysInput  string
}

type GrabWorker

type GrabWorker struct {
	// contains filtered or unexported fields
}

GrabWorker implements ztools.processing.Worker

func (*GrabWorker) Done

func (g *GrabWorker) Done()

func (*GrabWorker) Failure

func (g *GrabWorker) Failure() uint

func (*GrabWorker) MakeHandler

func (g *GrabWorker) MakeHandler() processing.Handler

func (*GrabWorker) RunCount

func (g *GrabWorker) RunCount() uint

func (*GrabWorker) Success

func (g *GrabWorker) Success() uint

func (*GrabWorker) Total

func (g *GrabWorker) Total() uint

type HTTP

type HTTP struct {
	ProxyRequest          *HTTPRequest     `json:"connect_request,omitempty"`
	ProxyResponse         *HTTPResponse    `json:"connect_response,omitempty"`
	Response              *http.Response   `json:"response,omitempty"`
	RedirectResponseChain []*http.Response `json:"redirect_response_chain,omitempty"`
}

type HTTPConfig

type HTTPConfig struct {
	Method                   string
	Endpoint                 string
	UserAgent                string
	ProxyDomain              string
	MaxSize                  int
	MaxRedirects             int
	FollowLocalhostRedirects bool
}

type HTTPHeaders

type HTTPHeaders map[string]interface{}

func HeadersFromGolangHeaders

func HeadersFromGolangHeaders(h http.Header) HTTPHeaders

type HTTPRequest

type HTTPRequest struct {
	Method    string `json:"method,omitempty"`
	Endpoint  string `json:"endpoint,omitempty"`
	UserAgent string `json:"user_agent,omitempty"`
	Body      string `json:"body,omitempty"`
}

type HTTPResponse

type HTTPResponse struct {
	VersionMajor int         `json:"version_major,omitempty"`
	VersionMinor int         `json:"version_minor,omitempty"`
	StatusCode   int         `json:"status_code,omitempty"`
	StatusLine   string      `json:"status_line,omitempty"`
	Headers      HTTPHeaders `json:"headers,omitempty"`
	Body         string      `json:"body,omitempty"`
	BodySHA256   []byte      `json:"body_sha256,omitempty"`
}

type MEIObject

type MEIObject struct {
	OID   MEIObjectID
	Value string
}

func (*MEIObject) MarshalJSON

func (m *MEIObject) MarshalJSON() ([]byte, error)

type MEIObjectID

type MEIObjectID int
const (
	OIDVendor              MEIObjectID = 0
	OIDProductCode         MEIObjectID = 1
	OIDRevision            MEIObjectID = 2
	OIDVendorURL           MEIObjectID = 3
	OIDProductName         MEIObjectID = 4
	OIDModelName           MEIObjectID = 5
	OIDUserApplicationName MEIObjectID = 6
)

func (*MEIObjectID) Name

func (m *MEIObjectID) Name() string

type MEIObjectSet

type MEIObjectSet []MEIObject

func (*MEIObjectSet) MarshalJSON

func (ms *MEIObjectSet) MarshalJSON() ([]byte, error)

type MEIResponse

type MEIResponse struct {
	ConformityLevel int          `json:"conformity_level"`
	MoreFollows     bool         `json:"more_follows"`
	ObjectCount     int          `json:"object_count"`
	Objects         MEIObjectSet `json:"objects,omitempty"`
}

type ModbusEvent

type ModbusEvent struct {
	Length           int                `json:"length"`
	UnitID           int                `json:"unit_id"`
	Function         FunctionCode       `json:"function_code"`
	Response         []byte             `json:"raw_response,omitempty"`
	MEIResponse      *MEIResponse       `json:"mei_response,omitempty"`
	ExceptionReponse *ExceptionResponse `json:"exception_response,omitempty"`
}

func (*ModbusEvent) IsException

func (m *ModbusEvent) IsException() bool

func (*ModbusEvent) ParseSelf

func (m *ModbusEvent) ParseSelf()

type ModbusException

type ModbusException struct {
	Function      ExceptionFunctionCode
	ExceptionType ExceptionCode
}

type ModbusRequest

type ModbusRequest struct {
	Function FunctionCode
	Data     []byte
}

func (*ModbusRequest) MarshalBinary

func (r *ModbusRequest) MarshalBinary() (data []byte, err error)

type ModbusResponse

type ModbusResponse struct {
	Length   int
	UnitID   int
	Function FunctionCode
	Data     []byte
}

type OutputConfig

type OutputConfig struct {
	OutputFile *os.File
	ErrorLog   *log.Logger
}

type SMBScanConfig

type SMBScanConfig struct {
	SMB      bool
	Protocol int
}

type SMTPHelpEvent

type SMTPHelpEvent struct {
	Response string
}

An SMTPHelpEvent represents sending a "HELP" message over SMTP

type UnknownHeader

type UnknownHeader struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type XSSHScanConfig

type XSSHScanConfig struct {
	XSSH bool
}

Jump to

Keyboard shortcuts

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