hashcat

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AttackModeDictionary = 0 // AttackModeDictionary is the attack mode for dictionary attacks
	AttackModeCombinator = 1 // AttackModeCombinator is the attack mode for combinator attacks
	AttackModeMask       = 3 // AttackModeMask is the attack mode for mask attacks
	AttackModeHybridDM   = 6 // AttackModeHybridDM is the attack mode for hybrid dictionary + mask attacks
	AttackModeHybridMD   = 7 // AttackModeHybridMD is the attack mode for hybrid mask + dictionary 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

	WordlistFilenames []string `json:"wordlist_filenames"` // Wordlists to use for dictionary and combinator attacks
	RulesFilenames    []string `json:"rules_filenames"`    // Rules to use for dictionary 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
}

func (Params) Validate added in v0.1.2

func (params Params) Validate() error

Validate checks if the parameters for the attack mode are valid. It returns an error if the parameters are invalid, or nil if they are valid.

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
}

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
	// contains filtered or unexported fields
}

func NewHashcatSession

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

func (*Session) Cleanup added in v0.1.2

func (sess *Session) Cleanup()

Cleanup removes any temporary files associated with the session. It deletes the hash file, output file, charset files, and sharded charset file (if present).

func (*Session) CmdLine added in v0.1.2

func (sess *Session) CmdLine() string

CmdLine returns the command line string used to start the session.

func (*Session) Kill added in v0.1.2

func (sess *Session) Kill() error

Kill terminates the running process associated with the session. If the session process is already terminated or not started, it returns nil. If an error occurs while terminating the process, it returns the error.

func (*Session) Start added in v0.1.2

func (sess *Session) Start() error

Start starts the hashcat session by attaching the stdout and stderr pipes, starting the hashcat process, and setting up goroutines to handle the output. It returns an error if any of the steps fail.

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
}

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
}

type StatusGuess added in v0.1.2

type StatusGuess struct {
	GuessBase        string  `json:"guess_base"`         // The base wordlist used for the attack
	GuessBaseCount   int64   `json:"guess_base_count"`   // The number of words in the base wordlist
	GuessBaseOffset  int64   `json:"guess_base_offset"`  // The offset into the base wordlist
	GuessBasePercent float64 `json:"guess_base_percent"` // The percentage of the base wordlist that has been processed
	GuessMod         string  `json:"guess_mod"`          // The modifier wordlist used for the attack
	GuessModCount    int64   `json:"guess_mod_count"`    // The number of words in the modifier wordlist
	GuessModOffset   int64   `json:"guess_mod_offset"`   // The offset into the modifier wordlist
	GuessModPercent  float64 `json:"guess_mod_percent"`  // The percentage of the modifier wordlist that has been processed
	GuessMode        int64   `json:"guess_mode"`         // The attack mode
}

Jump to

Keyboard shortcuts

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