memcached

package
v1.0.0-RC2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: Apache-2.0, ISC Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanBinary

func CleanBinary(results []byte) []string

This function cleans binary results

func FirstInteger

func FirstInteger(str string) int

This function gets the first occurence of an integer in a string

func ParseResponse

func ParseResponse(result []byte) statResponse

Parse header according to:

https://docs.memcached.org/protocols/binary/#example-10

func RegisterModule

func RegisterModule()

RegisterModule registers the zgrab2 module.

func SnakeToCamel

func SnakeToCamel(original string) (result string)

SnakeToCamel turns a snake case string to a camel case string

Types

type Flags

type Flags struct {
	zgrab2.BaseFlags `group:"Basic Options"`
}

Flags holds the command-line configuration for the memcached scan module. Populated by the framework.

func (*Flags) Help

func (flags *Flags) Help() string

Help returns the module's help string.

func (*Flags) Validate

func (flags *Flags) Validate([]string) error

Validate checks that the flags are valid. On success, returns nil. On failure, returns an error instance describing the error.

type MemcachedResult

type MemcachedResult struct {
	Version         string               `json:"version"`
	LibeventVersion string               `json:"libevent_version"`
	SupportsAscii   bool                 `json:"supports_ascii"`  // true if the server supports plain-text ASCII protocol
	SupportsBinary  bool                 `json:"supports_binary"` // true if the server supports binary protocol
	Stats           MemcachedResultStats `json:"stats"`
}

func PopulateResults

func PopulateResults(trimmedResults []string) (resultStruct MemcachedResult)

This function populates the MemcachedResult struct

func ScanAscii

func ScanAscii(ctx context.Context, dialGroup *zgrab2.DialerGroup, target *zgrab2.ScanTarget) (zgrab2.ScanStatus, *MemcachedResult, error)

This function scans a memcached database using the ascii protocol

func ScanBinary

func ScanBinary(ctx context.Context, dialGroup *zgrab2.DialerGroup, target *zgrab2.ScanTarget) (zgrab2.ScanStatus, *MemcachedResult, error)

Find server that doesn't support ASCII but supports binary

type MemcachedResultStats

type MemcachedResultStats struct {
	Pid                       uint32  `json:"pid"`
	Uptime                    uint32  `json:"uptime"`
	Time                      uint32  `json:"time"`
	PointerSize               int32   `json:"pointer_size"`
	RusageUser                float64 `json:"rusage_user"`
	RusageSystem              float64 `json:"rusage_system"`
	CurrItems                 uint64  `json:"curr_items"`
	TotalItems                uint64  `json:"total_items"`
	Bytes                     uint64  `json:"bytes"`
	MaxConnections            uint32  `json:"max_connections"`
	CurrConnections           uint32  `json:"curr_connections"`
	TotalConnections          uint32  `json:"total_connections"`
	RejectedConnections       uint64  `json:"rejected_connections"`
	ConnectionStructures      uint32  `json:"connected_structures"`
	ResponseObjOom            uint64  `json:"response_obj_oom"`
	ResponseObjCount          uint64  `json:"response_obj_count"`
	ResponseObjBytes          uint64  `json:"response_obj_bytes"`
	ReadBufCount              uint64  `json:"read_buf_count"`
	ReadBufBytes              uint64  `json:"read_buf_bytes"`
	ReadBufBytesFree          uint64  `json:"read_buf_bytes_free"`
	ReadBufOom                uint64  `json:"read_buf_oom"`
	ReservedFds               uint32  `json:"reserved_fds"`
	ProxyConnRequests         uint64  `json:"proxy_conn_requests"`
	ProxyConnErrors           uint64  `json:"proxy_conn_errors"`
	ProxyConnOom              uint64  `json:"proxy_conn_oom"`
	ProxyReqActive            uint64  `json:"proxy_req_active"`
	ProxyReqAwait             uint64  `json:"proxy_req_await"`
	CmdGet                    uint64  `json:"cmd_get"`
	CmdSet                    uint64  `json:"cmd_set"`
	CmdFlush                  uint64  `json:"cmd_flush"`
	CmdTouch                  uint64  `json:"cmd_touch"`
	GetHits                   uint64  `json:"get_hits"`
	GetMisses                 uint64  `json:"get_misses"`
	GetExpired                uint64  `json:"get_expired"`
	GetFlushed                uint64  `json:"get_flushed"`
	DeleteMisses              uint64  `json:"delete_misses"`
	DeleteHits                uint64  `json:"delete_hits"`
	IncrMisses                uint64  `json:"incr_misses"`
	IncrHits                  uint64  `json:"incr_hits"`
	DecrMisses                uint64  `json:"decr_misses"`
	DecrHits                  uint64  `json:"decr_hits"`
	CasMisses                 uint64  `json:"cas_misses"`
	CasHits                   uint64  `json:"cas_hits"`
	CasBadval                 uint64  `json:"cas_badval"`
	TouchHits                 uint64  `json:"touch_hits"`
	TouchMisses               uint64  `json:"touch_misses"`
	StoreTooLarge             uint64  `json:"store_too_large"`
	StoreNoMemory             uint64  `json:"store_no_memory"`
	AuthCmds                  uint64  `json:"auth_cmds"`
	AuthErrors                uint64  `json:"auth_errors"`
	IdleKicks                 uint64  `json:"idle_kicks"`
	Evictions                 uint64  `json:"evictions"`
	Reclaimed                 uint64  `json:"reclaimed"`
	BytesRead                 uint64  `json:"bytes_read"`
	BytesWritten              uint64  `json:"bytes_written"`
	LimitMaxbytes             uint64  `json:"limit_maxbytes"`
	AcceptingConns            bool    `json:"accepting_conns"`
	ListenDisabledNum         uint64  `json:"listen_disabled_num"`
	TimeInListenDisabledUs    uint64  `json:"time_in_listen_disabled_us"`
	Threads                   uint32  `json:"threads"`
	ConnYields                uint64  `json:"conn_yields"`
	HashPowerLevel            uint32  `json:"hash_power_level"`
	HashBytes                 uint64  `json:"hash_bytes"`
	HashIsExpanding           bool    `json:"hash_is_expanding"`
	ExpiredUnfetched          uint64  `json:"expired_unfetched"`
	EvictedUnfetched          uint64  `json:"evicted_unfetched"`
	EvictedActive             uint64  `json:"evicted_active"`
	SlabReassignRunning       bool    `json:"slab_reassign_running"`
	SlabsMoved                uint64  `json:"slabs_moved"`
	CrawlerReclaimed          uint64  `json:"crawler_reclaimed"`
	CrawlerItemsChecked       uint64  `json:"crawler_items_checked"`
	LrutailReflocked          uint64  `json:"lrutail_reflocked"`
	MovesToCold               uint64  `json:"moves_to_cold"`
	MovesToWarm               uint64  `json:"moves_to_warm"`
	MovesWithinLru            uint64  `json:"moves_within_lru"`
	DirectReclaims            uint64  `json:"direct_reclaims"`
	LruCrawlerStarts          uint64  `json:"lru_crawler_starts"`
	LruMaintainerJuggles      uint64  `json:"lru_maintainer_juggles"`
	SlabGlobalPagePool        uint32  `json:"slab_global_page_pool"`
	SlabReassignRescues       uint64  `json:"slab_reassign_rescues"`
	SlabReassignChunkRescues  uint64  `json:"slab_reassign_chunk_rescues"`
	SlabReassignInlineReclaim uint64  `json:"slab_reassign_inline_reclaim"`
	SlabReassignBusyItems     uint64  `json:"slab_reassign_busy_items"`
	SlabReassignBusyNomem     uint64  `json:"slab_reassign_busy_nomem"`
	SlabReassignBusyDeletes   uint64  `json:"slab_reassign_busy_deletes"`
	LogWorkerDropped          uint64  `json:"log_worker_dropped"`
	LogWorkerWritten          uint64  `json:"log_worker_written"`
	LogWatcherSkipped         uint64  `json:"log_watcher_skipped"`
	LogWatcherSent            uint64  `json:"log_watcher_sent"`
	LogWatchers               uint64  `json:"log_watchers"`
	UnexpectedNapiIds         uint64  `json:"unexpected_napi_ids"`
	RoundRobinFallback        uint64  `json:"round_robin_fallback"`
}

type Module

type Module struct {
}

Module implements the zgrab2.Module interface.

func (*Module) Description

func (module *Module) Description() string

Description returns an overview of this module.

func (*Module) NewFlags

func (module *Module) NewFlags() any

NewFlags returns a default Flags object.

func (*Module) NewScanner

func (module *Module) NewScanner() zgrab2.Scanner

NewScanner returns a new Scanner instance.

type Scanner

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

Scanner implements the zgrab2.Scanner interface.

func (*Scanner) GetDialerGroupConfig

func (scanner *Scanner) GetDialerGroupConfig() *zgrab2.DialerGroupConfig

func (*Scanner) GetName

func (scanner *Scanner) GetName() string

GetName returns the Scanner name defined in the Flags.

func (*Scanner) GetScanMetadata

func (scanner *Scanner) GetScanMetadata() any

GetScanMetadata returns any metadata on the scan itself from this module.

func (*Scanner) GetTrigger

func (scanner *Scanner) GetTrigger() string

GetTrigger returns the Trigger defined in the Flags.

func (*Scanner) Init

func (scanner *Scanner) Init(flags zgrab2.ScanFlags) error

Init initializes the Scanner.

func (*Scanner) InitPerSender

func (scanner *Scanner) InitPerSender(senderID int) error

InitPerSender initializes the scanner for a given sender.

func (*Scanner) Protocol

func (scanner *Scanner) Protocol() string

Protocol returns the protocol identifier of the scan.

func (*Scanner) Scan

func (scanner *Scanner) Scan(ctx context.Context, dialGroup *zgrab2.DialerGroup, target *zgrab2.ScanTarget) (zgrab2.ScanStatus, any, error)

Scan probes for a memcached service.

Jump to

Keyboard shortcuts

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