misc

package
v0.0.0-...-c24ae90 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultPort

func AddDefaultPort(input string, defaultPort int) string

addDefaultPort adds a default port if none is present in IPv4 or IPv6 addresses

func ByteToMb

func ByteToMb(b uint64) string

func DumpMemProfile

func DumpMemProfile(outputDir string, name string)

func GetClientHello

func GetClientHello(name string) (ch *tls.ClientHelloPreset)

func GetMD5

func GetMD5(input []byte) []byte

func GetNtpLocalTimeDiff

func GetNtpLocalTimeDiff() (d time.Duration)

getNtpLocalTimeDiff returns the time difference between the system time and ntp.org

func GetSHA1

func GetSHA1(input []byte) []byte

getSHA1 returns the SHA1 hash of a string

func GetSHA256

func GetSHA256(input []byte) []byte

getSHA256 returns the SHA-256 hash of a string

func IsClosedConnErr

func IsClosedConnErr(err error) bool

func IsStdInPresent

func IsStdInPresent() bool

func LoadClientHellos

func LoadClientHellos(opts *Options)

func LoadCustomCH

func LoadCustomCH(filename string) (*tls.ClientHelloPreset, error)

func MaxInt64

func MaxInt64(a, b int64) int64

func MinInt

func MinInt(a, b int) int

func NewFalse

func NewFalse() *bool

func NewTrue

func NewTrue() *bool

func OpensslFormat

func OpensslFormat(input string, header string, trailer string) string

opensslFormat adds the PEM beginning and end markers and inserts newlines at the right position

func ParseAlerts

func ParseAlerts(alerts []tls.Alert) []string

func PrintStacktrace

func PrintStacktrace(all bool)

func RunCommandToLog

func RunCommandToLog(c *exec.Cmd, event *zerolog.Event)

func ToCompactBinary

func ToCompactBinary(input *bool) string

func ToJSONArray

func ToJSONArray(input []string) string

func ToJSONIntArray

func ToJSONIntArray(input []int) string

Types

type CertCache

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

Contains two relations

Certificate -> ID
Certificate -> Certificate is new

Later is used to write Certificates to a file only once. This class is a bit more complicated to save RAM and to enable concurrent use of the methods, e.g. CertRelationResult uses the ID of a certificate before CertResult actually writes it into a file

func NewCertCache

func NewCertCache(cacheFunc func([]byte) []byte) *CertCache

func (*CertCache) GetID

func (c *CertCache) GetID(cert *x509.Certificate) (certId SessionUID, certIsNew bool)

returns the ID for a cert and whether this cert was not marked as old by MarkOld yet

func (*CertCache) MarkOld

func (c *CertCache) MarkOld(cert *x509.Certificate)

type CertPool

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

CertPool is a set of certificates.

func NewCertPool

func NewCertPool(certs []*x509.Certificate, withSystemStore bool) *CertPool

NewCertPool returns a new, empty CertPool.

func (*CertPool) FindPotentialParents

func (s *CertPool) FindPotentialParents(cert *x509.Certificate) []int

findPotentialParents returns the indexes of certificates in s which might have signed cert. The caller must not modify the returned slice.

func (*CertPool) Get

func (s *CertPool) Get(i int) *x509.Certificate

func (*CertPool) IsFromSystemStore

func (s *CertPool) IsFromSystemStore(i int) bool

func (*CertPool) N

func (s *CertPool) N() int

type LogWriter

type LogWriter struct{}

func (LogWriter) Write

func (LogWriter) Write(p []byte) (n int, err error)

type Options

type Options struct {
	Config string `short:"C" long:"config" description:"Config file with options" no-ini:"true" value-name:"CONFIG-FILE"`

	Input     string `` /* 135-byte string literal not displayed */
	OutputDir string `` /* 140-byte string literal not displayed */
	LogFile   string `short:"l" long:"log-file" description:"Log to file LOG-FILE (JSON formatted) instead of stderr" value-name:"LOG-FILE"`
	HashCache string `` /* 223-byte string literal not displayed */

	Concurrency int   `` /* 154-byte string literal not displayed */
	QPS         int   `short:"q" long:"qps" description:"Number of queries per second" default:"100"`
	Timeout     int64 `short:"t" long:"timeout" description:"Timeout for each connection in milliseconds" default:"10000"`
	SynTimeout  int64 `long:"syn-timeout" description:"Timeout for the TCP connection setup in milliseconds." default:"0" default-mask:"timeout"`

	SourceIP string `long:"source" description:"Source IP address if host has multiple addresses or interfaces" value-name:"SOURCE-IP" default:""`

	Profile string `short:"p" long:"profile" description:"Output file for profiling"`

	SkipErrors bool   `long:"skip-errors" description:"Skip TCP errors like connection timeout and don't write them to output file"`
	Verbose    []bool `short:"v" long:"verbose" description:"Increase verbosity from warning to info or even debug"`
	Version    bool   `short:"V" long:"version" description:"Show version information"`

	HTTPHeaders  string   `` /* 142-byte string literal not displayed */
	HTTPRequests []string `` /* 186-byte string literal not displayed */
	SCSV         bool     `long:"scsv" description:"Send SCSV pseudo cipher suite"`

	CustomClientHello    string `long:"client-hello" description:"tls ClientHello Preset as binary gob file" value-name:"CustomClientHello"`
	CustomClientHelloDir string `` /* 188-byte string literal not displayed */

	SSH bool `long:"ssh" description:"Scan SSH instead of TLS"`

	Scans      []string `` /* 160-byte string literal not displayed */
	MemProfile bool     `long:"mem-profile" description:"Dump Mem Profile Files every 5 min to output directory"`

	TLSExtendedExport           bool `long:"tls-extended-output" description:"Save a more verbose output of the tls scan, including tls extensions and fingerprint"`
	HTTPExtendedExport          bool `long:"http-extended-output" description:"Save a verbose output for the http scan. This includes all HTTP headers."`
	TLSSaveStapledOcspResponses bool `long:"tls-save-stapled-ocsp" description:"Save stapled ocsp-responses in a separate file"`

	KeyLogFile bool `long:"keylog-file" description:"If set a keylog file will be written to the output"`

	CreateCHCommand             cmd.CreateCHCommand             `command:"create-ch" description:"Create Client Hellos"`
	CreateCHInputCommand        cmd.CreateCHInputCommand        `command:"create-ch-input" description:"Generate Cross Product between Client Hellos and input file"`
	GenerateFingerprintsCommand cmd.GenerateFingerprintsCommand `command:"generate-fingerprints" description:"Generate the Active TLS Stack Fingerprints from a Goscanner output"`

	DissecTLSMode        string  `long:"dissectls-mode" description:"Set the mode of the DeppTLSScan: 'recommended', 'go', 'all'" default:"all"`
	DissecTLSMaxCHs      int     `long:"dissectls-max-chs" description:"Max Number of CHS for the DeppTLSScan" default:"100"`
	DissecTLSQps         float64 `long:"dissectls-qps" description:"QPS to to scan the same target" default:"10"`
	DissecTLSLightweight bool    `long:"dissectls-light" description:"Use fewer requests, might not find as much details about the servers"`
}

type SessionUID

type SessionUID uint32

func GetSessionUID

func GetSessionUID() SessionUID

func (SessionUID) ToString

func (s SessionUID) ToString() string

Jump to

Keyboard shortcuts

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