zlib

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0, ISC Imports: 33 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 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
	NoSNI                         bool
	TLSExtendedRandom             bool
	GatherSessionTicket           bool
	ExtendedMasterSecret          bool
	TLSVerbose                    bool
	SignedCertificateTimestampExt bool
	ExternalClientHello           []byte
	TLSInvalidDHKeyExchange       string

	// SSH
	SSH SSHScanConfig

	// 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
}

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 added in v0.0.2

func (c *Conn) BACNetVendorQuery() error

func (*Conn) BasicBanner added in v0.0.2

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 added in v0.0.2

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 added in v0.0.2

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 added in v0.0.2

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 added in v0.0.2

func (c *Conn) SMTPQuit() error

func (*Conn) SMTPStartTLSHandshake

func (c *Conn) SMTPStartTLSHandshake() error

Do a STARTTLS handshake

func (*Conn) SSHHandshake

func (c *Conn) SSHHandshake() error

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 added in v0.0.2

func (c *Conn) SetExtendedRandom()

func (*Conn) SetExternalClientHello added in v0.0.2

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

func (*Conn) SetGatherSessionTicket added in v0.0.2

func (c *Conn) SetGatherSessionTicket()

func (*Conn) SetNoSNI

func (c *Conn) SetNoSNI()

func (*Conn) SetOfferExtendedMasterSecret added in v0.0.2

func (c *Conn) SetOfferExtendedMasterSecret()

func (*Conn) SetReadDeadline

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

func (*Conn) SetSignedCertificateTimestampExt added in v0.0.2

func (c *Conn) SetSignedCertificateTimestampExt()

func (*Conn) SetTLSVerbose added in v0.0.2

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
}

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
}

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 added in v0.0.2

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 *ztls.ServerHandshake `json:"tls,omitempty"`
	HTTP         *HTTP                 `json:"http,omitempty"`
	Heartbleed   *ztls.Heartbleed      `json:"heartbleed,omitempty"`
	Modbus       *ModbusEvent          `json:"modbus,omitempty"`
	SSH          *ssh.HandshakeLog     `json:"ssh,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
}

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(id uint) 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 added in v0.0.2

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 added in v0.0.2

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

type HTTPHeaders added in v0.0.2

type HTTPHeaders map[string]interface{}

func HeadersFromGolangHeaders added in v0.0.2

func HeadersFromGolangHeaders(h http.Header) HTTPHeaders

type HTTPRequest added in v0.0.2

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 HTTPRequestResponse added in v0.0.2

type HTTPRequestResponse struct {
	Request  *HTTPRequest  `json:"request,omitempty"`
	Response *HTTPResponse `json:"response,omitempty"`
}

type HTTPResponse added in v0.0.2

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 SMTPHelpEvent

type SMTPHelpEvent struct {
	Response string
}

An SMTPHelpEvent represents sending a "HELP" message over SMTP

type SSHScanConfig

type SSHScanConfig struct {
	SSH               bool
	Client            string
	KexAlgorithms     string
	HostKeyAlgorithms string
	FixedKexValue     string
	FixedKexBytes     []byte
	NegativeOne       bool
}

func (*SSHScanConfig) GetClientImplementation

func (sc *SSHScanConfig) GetClientImplementation() (*ssh.ClientImplementation, bool)

func (*SSHScanConfig) MakeConfig

func (sc *SSHScanConfig) MakeConfig() *ssh.Config

func (*SSHScanConfig) MakeHostKeyNameList

func (sc *SSHScanConfig) MakeHostKeyNameList() (ssh.NameList, error)

func (*SSHScanConfig) MakeKexNameList

func (sc *SSHScanConfig) MakeKexNameList() (ssh.NameList, error)

type UnknownHeader added in v0.0.2

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

type XSSHScanConfig added in v0.0.2

type XSSHScanConfig struct {
	XSSH bool
}

Jump to

Keyboard shortcuts

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