modules

package
v0.0.0-...-f3a0897 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultScannerBufferSize = 64 * 1024 // 64 KB

DefaultScannerBufferSize is the initial buffer size for scanners

View Source
const FileChunkSize = 500 * 1024 * 1024

FileChunkSize defines the maximum size for password file chunks (in bytes) Default: 500 MB per chunk

View Source
const LargeFileThreshold = 1 * 1024 * 1024 * 1024

LargeFileThreshold defines the file size threshold for automatic chunking (in bytes) Default: 1 GB

View Source
const MaxLineLength = 1024 * 1024 // 1 MB

MaxLineLength is the maximum length of a single line in input files

Variables

View Source
var DisableFileChunking = false

DisableFileChunking is a global flag to disable automatic file chunking

View Source
var InsecureTLS bool

InsecureTLS controls whether HTTPS/TLS verification is disabled for HTTP(S) modules

View Source
var LogEvery int64 = 1

LogEvery controls attempt logging frequency; 1 = log every attempt

View Source
var NAME_MAP = map[string]string{
	"ms-sql-s":       "mssql",
	"microsoft-ds":   "smbnt",
	"cifs":           "smbnt",
	"postgresql":     "postgres",
	"smtps":          "smtp",
	"submission":     "smtp",
	"imaps":          "imap",
	"pop3s":          "pop3",
	"iss-realsecure": "vmauthd",
	"snmptrap":       "snmp",
	"mysql":          "mysql",
	"vnc":            "vnc",
	"mongod":         "mongodb",
	"textui":         "teamspeak",
	"xmpp-client":    "xmpp",
	"ms-wbt-server":  "rdp",
}
View Source
var NoColorMode bool

NoColorMode controls whether colored output is disabled

View Source
var Silent bool

Silent controls whether to suppress per-attempt logs (successes still printed)

View Source
var UseEmptyPassword bool

UseEmptyPassword instructs GetUsersAndPasswords to include a single empty string (blank password) when the password flag was explicitly provided as empty by the user (e.g., -p ”).

Functions

func CalcCombinations

func CalcCombinations(userCh []string, passCh []string) int

func CalcCombinationsCombo

func CalcCombinationsCombo(userCh []string, passCh []string) int

func CalcCombinationsPass

func CalcCombinationsPass(passCh []string) int

func Contains

func Contains(s []string, e string) bool

func CopyReaderToFile

func CopyReaderToFile(reader io.Reader, filePath string) error

CopyReaderToFile copies data from reader to file efficiently

func CountCredentials

func CountCredentials(h *Host, user, password, combo, version string, isPasswordOnly bool) int

CountCredentials counts total credentials without loading them all into memory

func CountLinesInChunkedFile

func CountLinesInChunkedFile(cf *ChunkedFile) (int, error)

CountLinesInChunkedFile counts total lines across all chunks

func GetIPv4Address

func GetIPv4Address(ifaceName string) (net.IP, error)

func GetPasswordsFromDefaultWordlist

func GetPasswordsFromDefaultWordlist(version string, serviceType string) []string

func GetUsersAndPasswords

func GetUsersAndPasswords(h *Host, user string, password string, version string) ([]string, []string)

func GetUsersAndPasswordsCombo

func GetUsersAndPasswordsCombo(h *Host, combo string, version string) ([]string, []string)

func GetUsersFromDefaultWordlist

func GetUsersFromDefaultWordlist(version string, serviceType string) []string

func IsFile

func IsFile(fileName string) bool

func MapService

func MapService(service string) string

func ParseFile

func ParseFile(filename string) (map[Host]int, error)

func ParseGNMAP

func ParseGNMAP(filename string) (map[Host]int, error)

func ParseJSON

func ParseJSON(filename string) (map[Host]int, error)

func ParseList

func ParseList(filename string) (map[Host]int, error)

func ParseNessus

func ParseNessus(filename string) (map[Host]int, error)

func ParseNexpose

func ParseNexpose(filename string) (map[Host]int, error)

func ParseXML

func ParseXML(filename string) (map[Host]int, error)

func PrintComprehensiveSummary

func PrintComprehensiveSummary(outputDir string)

PrintComprehensiveSummary prints a comprehensive summary report

func PrintResult

func PrintResult(service string, host string, port int, user string, pass string, result bool, con_result bool, progressCh chan<- int, retrying bool, output string, delayTime time.Duration)

PrintResult prints individual results (legacy format for compatibility)

func PrintSkipping

func PrintSkipping(host string, service string, retries int, maxRetries int)

PrintSkipping prints host skipping messages

func PrintSocksError

func PrintSocksError(service string, err string)

PrintSocksError prints SOCKS proxy errors

func PrintWarningBeta

func PrintWarningBeta(service string)

PrintWarningBeta prints beta service warnings

func PrintfColored

func PrintfColored(color pterm.Color, format string, args ...interface{})

PrintfColored prints a formatted colored message

func PrintlnColored

func PrintlnColored(color pterm.Color, msg string)

PrintlnColored prints a colored message with newline

func ReadLinesFromChunkedFile

func ReadLinesFromChunkedFile(cf *ChunkedFile, callback func(string) error) error

ReadLinesFromChunkedFile reads all lines from chunked file (memory efficient)

func ReadPasswordsFromFile

func ReadPasswordsFromFile(filename string) ([]string, error)

func ReadUsersFromFile

func ReadUsersFromFile(filename string) ([]string, error)

func RecordAttempt

func RecordAttempt(success bool)

RecordAttempt records any attempt (success or failure)

func RecordConnectionError

func RecordConnectionError(host string)

RecordConnectionError records a connection error for a specific host

func RecordError

func RecordError(isConnectionError bool)

RecordError records connection or authentication errors

func RecordSuccess

func RecordSuccess(service string, host string, port int, user string, password string, duration time.Duration)

RecordSuccess records a successful credential attempt

func SetTotalHostsAndServices

func SetTotalHostsAndServices(hosts int, services int)

SetTotalHostsAndServices sets the total counts for hosts and services

func UpdateConcurrency

func UpdateConcurrency(current int)

UpdateConcurrency updates concurrency metrics

func ValidateNetworkInterface

func ValidateNetworkInterface(iface string) (string, error)

func WriteToFile

func WriteToFile(service string, content string, port int, output string) error

WriteToFile writes success results to individual service files (legacy format)

Types

type ChunkIterator

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

ChunkIterator provides sequential access to file chunks

func NewChunkIterator

func NewChunkIterator(cf *ChunkedFile) *ChunkIterator

NewChunkIterator creates a new chunk iterator

func (*ChunkIterator) Close

func (ci *ChunkIterator) Close() error

Close closes the current file and performs cleanup

func (*ChunkIterator) NextChunk

func (ci *ChunkIterator) NextChunk() (*bufio.Scanner, bool)

NextChunk advances to the next chunk and returns a scanner for it

type ChunkedFile

type ChunkedFile struct {
	OriginalPath string
	ChunkPaths   []string
	TempDir      string
	ChunkSize    int64
	IsChunked    bool
	// contains filtered or unexported fields
}

ChunkedFile represents a large file that has been split into chunks

func NewChunkedFile

func NewChunkedFile(filePath string) (*ChunkedFile, error)

NewChunkedFile creates a chunked file manager

func (*ChunkedFile) Cleanup

func (cf *ChunkedFile) Cleanup() error

Cleanup removes temporary chunk files

func (*ChunkedFile) GetChunkPaths

func (cf *ChunkedFile) GetChunkPaths() []string

GetChunkPaths returns the list of chunk file paths

type ConnectionManager

type ConnectionManager struct {
	Socks5           string
	Timeout          time.Duration
	Iface            string
	LocalIP          net.IP
	Dialer           proxy.Dialer
	DialFunc         func(network, address string) (net.Conn, error)
	ConnPool         map[string]chan net.Conn
	PoolMutex        sync.RWMutex
	SharedHTTPClient *http.Client
}

func NewConnectionManager

func NewConnectionManager(socks5 string, timeout time.Duration, iface ...string) (*ConnectionManager, error)

func (*ConnectionManager) ClearPool

func (cm *ConnectionManager) ClearPool()

func (*ConnectionManager) Dial

func (cm *ConnectionManager) Dial(network, address string) (net.Conn, error)

func (*ConnectionManager) DialUDP

func (cm *ConnectionManager) DialUDP(network, address string) (*net.UDPConn, error)

func (*ConnectionManager) Release

func (cm *ConnectionManager) Release(conn net.Conn)

type CredentialIterator

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

CredentialIterator provides lazy/streaming credential generation to avoid loading entire wordlists into memory

func GetCredentialIterator

func GetCredentialIterator(h *Host, user, password, combo, version string, isPasswordOnly bool) (*CredentialIterator, error)

GetCredentialIterator creates an iterator for streaming credentials

func NewCredentialIterator

func NewCredentialIterator(host *Host, user, password, combo, version string, isPasswordOnly bool) (*CredentialIterator, error)

NewCredentialIterator creates a new credential iterator

func (*CredentialIterator) Close

func (ci *CredentialIterator) Close() error

Close cleans up file handles

func (*CredentialIterator) Next

func (ci *CredentialIterator) Next() (user, password string, ok bool)

Next returns the next credential, or false if done

type Host

type Host struct {
	Service string
	Host    string
	Port    int
}

func (*Host) Parse

func (h *Host) Parse(host string) ([]Host, error)

type NessusHost

type NessusHost struct {
	Name  string       `xml:"name,attr"`
	Items []NessusItem `xml:"ReportItem"`
}

type NessusItem

type NessusItem struct {
	Port    string `xml:"port,attr"`
	SvcName string `xml:"svc_name,attr"`
}

type NessusReport

type NessusReport struct {
	Hosts []NessusHost `xml:"Report>ReportHost"`
}

type NexposeEndpoint

type NexposeEndpoint struct {
	Port     string         `xml:"port,attr"`
	Status   string         `xml:"status,attr"`
	Protocol string         `xml:"protocol,attr"`
	Service  NexposeService `xml:"services>service"`
}

type NexposeNode

type NexposeNode struct {
	Address   string            `xml:"address,attr"`
	Endpoints []NexposeEndpoint `xml:"endpoints>endpoint"`
}

type NexposeService

type NexposeService struct {
	Name string `xml:"name,attr"`
}

type NmapAddress

type NmapAddress struct {
	Addr     string `xml:"addr,attr"`
	AddrType string `xml:"addrtype,attr"`
}

type NmapHost

type NmapHost struct {
	Addresses []NmapAddress `xml:"address"`
	Ports     []NmapPort    `xml:"ports>port"`
}

type NmapPort

type NmapPort struct {
	PortId    string      `xml:"portid,attr"`
	Protocol  string      `xml:"protocol,attr"`
	PortState NmapState   `xml:"state"`
	Service   NmapService `xml:"service"`
}

type NmapRun

type NmapRun struct {
	Hosts []NmapHost `xml:"host"`
}

type NmapService

type NmapService struct {
	Name string `xml:"name,attr"`
}

type NmapState

type NmapState struct {
	State string `xml:"state,attr"`
}

type OutputStats

type OutputStats struct {
	StartTime            time.Time       `json:"start_time"`
	EndTime              time.Time       `json:"end_time"`
	TotalAttempts        int64           `json:"total_attempts"`
	SuccessfulAttempts   int64           `json:"successful_attempts"`
	FailedAttempts       int64           `json:"failed_attempts"`
	ConnectionErrors     int64           `json:"connection_errors"`
	AuthenticationErrors int64           `json:"authentication_errors"`
	SuccessRate          float64         `json:"success_rate"`
	AttemptsPerSecond    float64         `json:"attempts_per_second"`
	AverageResponseTime  time.Duration   `json:"average_response_time"`
	PeakConcurrency      int             `json:"peak_concurrency"`
	TotalHosts           int             `json:"total_hosts"`
	TotalServices        int             `json:"total_services"`
	SuccessfulResults    []SuccessResult `json:"successful_results"`
	ServiceBreakdown     map[string]int  `json:"service_breakdown"`
	HostBreakdown        map[string]int  `json:"host_breakdown"`
	ConnectionErrorHosts map[string]int  `json:"connection_error_hosts"`
	// contains filtered or unexported fields
}

OutputStats tracks comprehensive statistics for the bruteforce session

type OutputStatsCopy

type OutputStatsCopy struct {
	StartTime            time.Time       `json:"start_time"`
	EndTime              time.Time       `json:"end_time"`
	TotalAttempts        int64           `json:"total_attempts"`
	SuccessfulAttempts   int64           `json:"successful_attempts"`
	FailedAttempts       int64           `json:"failed_attempts"`
	ConnectionErrors     int64           `json:"connection_errors"`
	AuthenticationErrors int64           `json:"authentication_errors"`
	SuccessRate          float64         `json:"success_rate"`
	AttemptsPerSecond    float64         `json:"attempts_per_second"`
	AverageResponseTime  time.Duration   `json:"average_response_time"`
	PeakConcurrency      int             `json:"peak_concurrency"`
	TotalHosts           int             `json:"total_hosts"`
	TotalServices        int             `json:"total_services"`
	SuccessfulResults    []SuccessResult `json:"successful_results"`
	ServiceBreakdown     map[string]int  `json:"service_breakdown"`
	HostBreakdown        map[string]int  `json:"host_breakdown"`
	ConnectionErrorHosts map[string]int  `json:"connection_error_hosts"`
}

OutputStatsCopy is a copy of OutputStats without the mutex for safe copying

func CalculateFinalStats

func CalculateFinalStats() OutputStatsCopy

CalculateFinalStats calculates final statistics

func GetStats

func GetStats() OutputStatsCopy

GetStats returns a copy of current statistics

type PerformanceMetrics deprecated

type PerformanceMetrics struct{}

Deprecated: PerformanceMetrics is superseded by OutputStats. Kept to avoid breaking imports. It now proxies to the OutputStats-based implementation.

func GetGlobalMetrics

func GetGlobalMetrics() *PerformanceMetrics

GetGlobalMetrics returns the legacy-compatible metrics object.

func (*PerformanceMetrics) GetAttemptsPerSecond

func (pm *PerformanceMetrics) GetAttemptsPerSecond() float64

func (*PerformanceMetrics) GetMetrics

func (pm *PerformanceMetrics) GetMetrics() PerformanceMetrics

GetMetrics returns a snapshot emulating the old struct using OutputStatsCopy.

func (*PerformanceMetrics) GetSuccessRate

func (pm *PerformanceMetrics) GetSuccessRate() float64

func (*PerformanceMetrics) PrintPerformanceReport

func (pm *PerformanceMetrics) PrintPerformanceReport()

func (*PerformanceMetrics) RecordAttempt

func (pm *PerformanceMetrics) RecordAttempt(success bool, responseTime time.Duration)

RecordAttempt proxies to the new stats system.

func (*PerformanceMetrics) RecordError

func (pm *PerformanceMetrics) RecordError(isConnectionError bool)

RecordError proxies to the new stats system.

func (*PerformanceMetrics) UpdateConcurrency

func (pm *PerformanceMetrics) UpdateConcurrency(current int)

UpdateConcurrency proxies to OutputStats peak concurrency tracking.

type PerformanceOptimizer

type PerformanceOptimizer struct{}

PerformanceOptimizer now reads from OutputStats.

func NewPerformanceOptimizer

func NewPerformanceOptimizer() *PerformanceOptimizer

func (*PerformanceOptimizer) GetOptimizationSuggestions

func (po *PerformanceOptimizer) GetOptimizationSuggestions() []string

type SuccessResult

type SuccessResult struct {
	Service  string    `json:"service"`
	Host     string    `json:"host"`
	Port     int       `json:"port"`
	User     string    `json:"user"`
	Password string    `json:"password"`
	Time     time.Time `json:"time"`
	Duration string    `json:"duration"`
}

SuccessResult represents a successful credential attempt

type WordlistCache

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

WordlistCache provides thread-safe caching of wordlists

func (*WordlistCache) Get

func (wc *WordlistCache) Get(key string) ([]string, bool)

func (*WordlistCache) Set

func (wc *WordlistCache) Set(key string, words []string)

Jump to

Keyboard shortcuts

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