hashcat

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttackModeMask = 3 // AttackModeMask is the attack mode for mask attacks

	AttackBenchmark = 9 // AttackBenchmark is the attack mode for benchmarking
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Params added in v0.1.2

type Params struct {
	AttackMode                int64    `json:"attack_mode"`                  // Attack mode to use
	HashType                  int64    `json:"hash_type"`                    // Hash type to crack
	HashFile                  string   `json:"hash_file"`                    // Path to the file containing the hashes to crack
	Mask                      string   `json:"mask,omitempty"`               // Mask to use for mask attack
	MaskIncrement             bool     `json:"mask_increment,omitempty"`     // Whether to use mask increment
	MaskIncrementMin          int64    `json:"mask_increment_min"`           // Min mask length for increment
	MaskIncrementMax          int64    `json:"mask_increment_max"`           // Max mask length for increment
	MaskCustomCharsets        []string `json:"mask_custom_charsets"`         // Custom charsets for mask attack
	WordListFilename          string   `json:"wordlist_filename"`            // Wordlist to use for dictionary and hybrid attacks
	RuleListFilename          string   `json:"rules_filename"`               // Rule list to use for dictionary attack
	MaskListFilename          string   `json:"mask_list_filename"`           // Mask list to use for mask attack
	AdditionalArgs            []string `json:"additional_args"`              // Additional arguments to pass to hashcat
	OptimizedKernels          bool     `json:"optimized_kernels"`            // Whether to use optimized kernels
	SlowCandidates            bool     `json:"slow_candidates"`              // Whether to use slow candidates
	Skip                      int64    `json:"skip,omitempty"`               // Keyspace offset to start at
	Limit                     int64    `json:"limit,omitempty"`              // Maximum keyspace to process
	BackendDevices            string   `json:"backend_devices,omitempty"`    // Devices to use for the backend, comma-separated
	OpenCLDevices             string   `json:"opencl_devices,omitempty"`     // OpenCL devices to use, comma-separated
	EnableAdditionalHashTypes bool     `json:"enable_additional_hash_types"` // Whether to enable additional hash types when benchmarking
	RestoreFilePath           string   `json:"restore_file_path,omitempty"`  // Path to the restore file
}

Params represents the configuration parameters for running a hash cracking attack using Hashcat.

func (Params) Validate added in v0.1.2

func (params Params) Validate() error

Validate checks the attack mode specified in the Params and calls corresponding validation methods. It returns an error if the validation fails or if an unsupported attack mode is provided.

type Result added in v0.1.2

type Result struct {
	Timestamp time.Time `json:"timestamp"` // The time the result was received
	Hash      string    `json:"hash"`      // The hash
	Plaintext string    `json:"plaintext"` // The plaintext
}

Result represents the outcome of a hashcat operation, including the timestamp, hash, and plaintext result.

type Session added in v0.1.2

type Session struct {
	CrackedHashes     chan Result // Channel to send cracked hashes to
	StatusUpdates     chan Status // Channel to send status updates to
	StderrMessages    chan string // Channel to send stderr messages to
	StdoutLines       chan string // Channel to send stdout lines to
	DoneChan          chan error  // Channel to send the done signal to
	SkipStatusUpdates bool        // Whether to skip sending status updates
	RestoreFilePath   string      // Path to the restore file
	// contains filtered or unexported fields
}

Session represents a hashcat session that manages the execution, I/O, and communication with the hashcat process.

func NewHashcatSession

func NewHashcatSession(id string, params Params) (*Session, error)

NewHashcatSession creates a new Hashcat session with given id and parameters, initializes the necessary files, arguments, and channels, and returns the session.

func (*Session) Cleanup added in v0.1.2

func (sess *Session) Cleanup()

Cleanup removes session-related temporary files and directories. It first attempts to remove output and charset files. If zaps should not be retained, it deletes the zaps' directory. Finally, it clears the hashFile property.

func (*Session) CmdLine added in v0.1.2

func (sess *Session) CmdLine() string

CmdLine returns the command line string used to start the hashcat process.

func (*Session) Kill added in v0.1.2

func (sess *Session) Kill() error

Kill terminates the hashcat process associated with the session if it is running. Returns nil if no process is running or if the process was already terminated successfully.

func (*Session) Start added in v0.1.2

func (sess *Session) Start() error

Start initializes the session by attaching the necessary pipes and starting the hashcat process. It also starts the tailer and handles the output from stdout and stderr concurrently.

type Status added in v0.1.2

type Status struct {
	OriginalLine    string         `json:"original_line"`    // The original line from hashcat
	Time            time.Time      `json:"time"`             // The time the status was received
	Session         string         `json:"session"`          // The session ID
	Guess           statusGuess    `json:"guess"`            // The current guess
	Status          int64          `json:"status"`           // The status of the attack
	Target          string         `json:"target"`           // The target hash
	Progress        []int64        `json:"progress"`         // The progress of the attack
	RestorePoint    int64          `json:"restore_point"`    // The restore point
	RecoveredHashes []int64        `json:"recovered_hashes"` // The number of recovered hashes
	RecoveredSalts  []int64        `json:"recovered_salts"`  // The number of recovered salts
	Rejected        int64          `json:"rejected"`         // The number of rejected hashes
	Devices         []StatusDevice `json:"devices"`          // The devices used for the attack
	TimeStart       int64          `json:"time_start"`       // The start time of the attack
	EstimatedStop   int64          `json:"estimated_stop"`   // The estimated stop time of the attack
}

Status represents the current status of a hashcat operation.

type StatusDevice added in v0.1.2

type StatusDevice struct {
	DeviceID   int64  `json:"device_id"`   // The device ID
	DeviceName string `json:"device_name"` // The device name
	DeviceType string `json:"device_type"` // The device type
	Speed      int64  `json:"speed"`       // The speed of the device
	Util       int64  `json:"util"`        // The utilization of the device
	Temp       int64  `json:"temp"`        // The temperature of the device
}

StatusDevice represents the state and statistics of a device involved in an operation. It contains information such as the device ID, name, type, speed, utilization, and temperature.

Jump to

Keyboard shortcuts

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