Documentation
¶
Index ¶
- Variables
- type CallbackFunc
- type ChannelTopic
- type Config
- type ConnectedHost
- type CrackedPasswordBroadcast
- type TaskEngineStatusBroadcast
- type TaskStatusChangeBroadcast
- type TaskStatusFinalBroadcast
- type WorkerManager
- func (s *WorkerManager) BroadcastCrackedPassword(taskID, hash, value string, crackedAt time.Time) error
- func (s *WorkerManager) BroadcastEngineStatusUpdate(taskID string, payload interface{}) error
- func (s *WorkerManager) BroadcastFinalStatus(taskID string, payload interface{}) error
- func (s *WorkerManager) BroadcastTaskStatusChange(taskid string, status storage.TaskStatus) error
- func (s WorkerManager) GetCurrentHostRecord(hostname string) *ConnectedHost
- func (s WorkerManager) GetCurrentWorkers() map[string]ConnectedHost
- func (s *WorkerManager) HostCheckingIn(beacon shared.Beacon)
- func (s *WorkerManager) Stop()
- func (s *WorkerManager) Subscribe(topic ChannelTopic, f CallbackFunc) (uint, error)
- func (s *WorkerManager) Unsubscribe(hndl uint) error
Constants ¶
This section is empty.
Variables ¶
var ( // EngineStatusTopic is the topic for all engine statuses EngineStatusTopic = ChannelTopic("EngineStatusTopic") // TaskStatusTopic is the topic for all task status changes like Queued, Running, Error, etc. TaskStatusTopic = ChannelTopic("TaskStatusTopic") // CrackedTopic is the topic for all cracked passwords CrackedTopic = ChannelTopic("CrackedTopic") // LogTopic is the topic for all log messages from a worker LogTopic = ChannelTopic("LogTopic") // FinalStatusTopic is the topic that indicates when a task is finished on a worker and includes its final status payload FinalStatusTopic = ChannelTopic("FinalStatusTopic") )
Functions ¶
This section is empty.
Types ¶
type CallbackFunc ¶
type CallbackFunc func(payload interface{})
CallbackFunc defines the function called whenever we get a message from a subscription
type ChannelTopic ¶
ChannelTopic is a PUB/SUB topic that defines a type of event
type Config ¶
type Config struct { CheckForInactiveWorkers *shared.HumanDuration `yaml:"inactive_workers_check_interval,omitempty"` StopTasksAfter *shared.HumanDuration `yaml:"stop_tasks_after_interval,omitempty"` }
Config defines all the configuration settings for the Work/Job Manager
type ConnectedHost ¶
ConnectedHost is an active, connected host to the WorkManager
func (ConnectedHost) GetRunningTaskIDs ¶
func (s ConnectedHost) GetRunningTaskIDs() []string
GetRunningTaskIDs returns a list of running TaskIDs on a connected host
type CrackedPasswordBroadcast ¶
type CrackedPasswordBroadcast struct { TaskID string `json:"task_id"` Hash string `json:"hash"` Value string `json:"value"` CrackedAt time.Time `json:"cracked_at"` }
CrackedPasswordBroadcast contains information about a cracked password
type TaskEngineStatusBroadcast ¶
type TaskEngineStatusBroadcast struct { TaskID string `json:"task_id"` Status interface{} `json:"status"` }
TaskEngineStatusBroadcast contains the engine status of a task
type TaskStatusChangeBroadcast ¶
type TaskStatusChangeBroadcast struct { TaskID string `json:"task_id"` Status storage.TaskStatus `json:"status"` }
TaskStatusChangeBroadcast contains information about a recent task status change from a worker
type TaskStatusFinalBroadcast ¶
type TaskStatusFinalBroadcast TaskEngineStatusBroadcast
TaskStatusFinalBroadcast contains the final engine status of a task
type WorkerManager ¶
type WorkerManager struct {
// contains filtered or unexported fields
}
WorkerManager manages all connected hosts to the GoCrack server
func NewWorkerManager ¶
func NewWorkerManager() *WorkerManager
NewWorkerManager creates a new remote worker manager
func (*WorkerManager) BroadcastCrackedPassword ¶
func (s *WorkerManager) BroadcastCrackedPassword(taskID, hash, value string, crackedAt time.Time) error
BroadcastCrackedPassword notifies all subscribers that a cracked password event has just occurred
func (*WorkerManager) BroadcastEngineStatusUpdate ¶
func (s *WorkerManager) BroadcastEngineStatusUpdate(taskID string, payload interface{}) error
BroadcastEngineStatusUpdate notifies all subscribers that a task has just sent us a new status payload
func (*WorkerManager) BroadcastFinalStatus ¶
func (s *WorkerManager) BroadcastFinalStatus(taskID string, payload interface{}) error
BroadcastFinalStatus notifies all subscribers that a task has finished and sent its final task status message
func (*WorkerManager) BroadcastTaskStatusChange ¶
func (s *WorkerManager) BroadcastTaskStatusChange(taskid string, status storage.TaskStatus) error
BroadcastTaskStatusChange notifies all subscribers that the actual task status has changed
func (WorkerManager) GetCurrentHostRecord ¶
func (s WorkerManager) GetCurrentHostRecord(hostname string) *ConnectedHost
GetCurrentHostRecord returns the latest host record from a given hostname
func (WorkerManager) GetCurrentWorkers ¶
func (s WorkerManager) GetCurrentWorkers() map[string]ConnectedHost
GetCurrentWorkers returns a copy of the current workers
func (*WorkerManager) HostCheckingIn ¶
func (s *WorkerManager) HostCheckingIn(beacon shared.Beacon)
HostCheckingIn records a beacon from a connected worker
func (*WorkerManager) Stop ¶
func (s *WorkerManager) Stop()
Stop the worker manager and terminate all subscribers
func (*WorkerManager) Subscribe ¶
func (s *WorkerManager) Subscribe(topic ChannelTopic, f CallbackFunc) (uint, error)
Subscribe to a channel topic and get called asynchronously everytime a new event occurs. If successful, the handle is returned.
func (*WorkerManager) Unsubscribe ¶
func (s *WorkerManager) Unsubscribe(hndl uint) error
Unsubscribe given a function