Documentation ¶
Index ¶
- func WrapAPIForError(f WebAPI) gin.HandlerFunc
- type APIEngine
- type APIValidationErrors
- type ActivityLogEntry
- type ChangeTaskStatusRequest
- type Config
- type CreateTaskRequest
- type CreateTaskResponse
- type CreateUserRequest
- type DeleteFileResponse
- type EditUserRequest
- type EditUserResponse
- type EngineFileItem
- type EngineFileMetadataUpdateRequest
- type EntitlementResponseEntries
- type EntitlementResponseEntry
- type FileType
- type HashcatEnginePayload
- type HashcatTaskPayload
- type LoginRequest
- type ModifyTaskRequest
- type PasswordListResponse
- type PasswordResponseItem
- type RealtimeServer
- type Server
- type TaskCrackEngineFancy
- type TaskFileItem
- type TaskFileLintError
- type TaskInfoResponseItem
- type TaskListingResponse
- type TaskListingResponseItem
- type TaskPriorityFancy
- type UploadEngineFileResponse
- type UploadedFileResponse
- type UserDetailedItem
- type UserListingItem
- type WebAPI
- type WebAPIError
- type WorkerDevice
- type WorkerDeviceType
- type WorkerItem
- type WorkerProcess
- type WorkerResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapAPIForError ¶
func WrapAPIForError(f WebAPI) gin.HandlerFunc
WrapAPIForError is a wrapper around Gin handlers to reduce error handling code
Types ¶
type APIValidationErrors ¶
type APIValidationErrors struct { Valid bool `json:"valid"` Errors []string `json:"validation_errors"` }
APIValidationErrors describes errors that occured in the validation of a request
type ActivityLogEntry ¶
type ActivityLogEntry struct { OccuredAt time.Time `json:"occurred_at"` UserUUID string `json:"user_id"` Username string `json:"username"` StatusCode string `json:"status_code"` Type storActivityTypeString `json:"type"` IPAddress string `json:"ip_address"` }
ActivityLogEntry should mimick storage.ActivityLogEntry
type ChangeTaskStatusRequest ¶
type ChangeTaskStatusRequest struct {
Status string `json:"state"`
}
type Config ¶
type Config struct { Listener listener `yaml:"listener"` CORS corsSettings `yaml:"cors"` UserInterface uiSettings `yaml:"ui"` }
Config describes the various options available to the API server
type CreateTaskRequest ¶
type CreateTaskRequest struct { TaskName string `json:"task_name"` Engine storage.WorkerCrackEngine `json:"engine"` FileID string `json:"file_id"` // FileID is a reference to TaskFile via TaskFile.FileID CaseCode *string `json:"case_code,omitempty"` AssignedToHost *string `json:"assigned_host,omitempty"` AssignedToDevices *storage.CLDevices `json:"assigned_devices,omitempty"` Comment *string `json:"comment,omitempty"` EnginePayload json.RawMessage `json:"payload"` // The structure of EnginePayload differs based on Engine Priority *storage.WorkerPriority `json:"priority,omitempty"` AdditionalUsers *[]string `json:"additional_users,omitempty"` }
CreateTaskRequest defines the request for a new task creation event
type CreateTaskResponse ¶
type CreateTaskResponse struct { TaskID string `json:"taskid"` CreatedAt time.Time `json:"created_at"` Status storage.TaskStatus `json:"status"` }
CreateTaskResponse defines response on a successful task creation event
type CreateUserRequest ¶
type CreateUserRequest struct { Username string `json:"username"` Password string `json:"password"` Email string `json:"email"` }
CreateUserRequest describes the payload sent by the user to create a new user
func (CreateUserRequest) Validate ¶
func (s CreateUserRequest) Validate() error
Validate returns any errors that are associated with the user input of CreateUserRequest
type DeleteFileResponse ¶
DeleteFileResponse is returned whenever the user deletes a file successfully
type EditUserRequest ¶
type EditUserRequest struct { CurrentPassword *string `json:"current_password"` Password *string `json:"new_password"` UserIsAdmin *bool `json:"user_is_admin"` Email *string `json:"email"` }
EditUserRequest must match `storage.UserModifyRequest`
type EditUserResponse ¶
type EditUserResponse struct { Modified bool `json:"modified"` EditUserRequest }
EditUserResponse is returned on a successful update
type EngineFileItem ¶
type EngineFileItem struct { FileID string `json:"file_id"` FileName string `json:"filename"` FileSize int64 `json:"file_sz"` Description *string `json:"description,omitempty"` UploadedAt time.Time `json:"uploaded_at"` UploadedBy string `json:"uploaded_by"` LastUpdatedAt time.Time `json:"last_modified"` FileType FileType `json:"file_type"` NumberOfEntries int64 `json:"num_entries"` SHA1Hash string `json:"sha1"` }
EngineFileItem is returned to the user on a shared file listing should mimic storage.EngineFile
type EngineFileMetadataUpdateRequest ¶
type EngineFileMetadataUpdateRequest struct { FileName *string `json:"file_name,omitempty"` Description *string `json:"description,omitempty"` }
EngineFileMetadataUpdateRequest defines the structure of the metadata update request of an engine file
type EntitlementResponseEntries ¶
type EntitlementResponseEntries []EntitlementResponseEntry
type HashcatEnginePayload ¶
type HashcatEnginePayload struct { HashType string `json:"hash_type"` AttackMode string `json:"attack_mode"` Masks *EngineFileItem `json:"masks,omitempty"` DictionaryFile *EngineFileItem `json:"dictionary_file,omitempty"` ManglingRuleFile *EngineFileItem `json:"mangling_file,omitempty"` }
HashcatEnginePayload defines the structure of task.EnginePayload for jobs created for the hashcat engine
type HashcatTaskPayload ¶
type HashcatTaskPayload shared.HashcatUserOptions
HashcatTaskPayload defines the structure of a Task request which should be executed in a worker with the hashcat engine
type LoginRequest ¶
type LoginRequest struct { Username string `json:"username"` Password string `json:"password"` IsAPI bool `json:"api_only"` }
LoginRequest defines the structure of a login request
type ModifyTaskRequest ¶
type ModifyTaskRequest struct { AssignedToHost *string `json:"assigned_host,omitempty"` AssignedToDevices *storage.CLDevices `json:"assigned_devices,omitempty"` Status *storage.TaskStatus `json:"task_status,omitempty"` }
type PasswordListResponse ¶
type PasswordListResponse struct { Data []PasswordResponseItem `json:"data"` Count int `json:"count"` }
type PasswordResponseItem ¶
type RealtimeServer ¶
type RealtimeServer struct {
// contains filtered or unexported fields
}
func NewRealtimeServer ¶
func NewRealtimeServer(wmgr *workmgr.WorkerManager, stor storage.Backend) *RealtimeServer
func (*RealtimeServer) ServeStream ¶
func (s *RealtimeServer) ServeStream(c *gin.Context)
func (*RealtimeServer) Stop ¶
func (s *RealtimeServer) Stop()
Stop the Realtime Server by disconnecting all active clients
type Server ¶
func NewServer ¶
func NewServer(cfg Config, stor storage.Backend, wmgr *workmgr.WorkerManager, auth *authentication.AuthWrapper, fm *filemanager.Context) (*Server, error)
NewServer creates an HTTP API server
type TaskCrackEngineFancy ¶
type TaskCrackEngineFancy storage.WorkerCrackEngine
func (TaskCrackEngineFancy) MarshalJSON ¶
func (s TaskCrackEngineFancy) MarshalJSON() ([]byte, error)
type TaskFileItem ¶
type TaskFileItem struct { FileID string `json:"file_id"` UploadedAt time.Time `json:"uploaded_at"` UploadedBy string `json:"uploaded_by"` UploadedByUUID string `json:"uploaded_by_uuid"` FileSize int64 `json:"file_size"` FileName string `json:"filename"` SHA1Hash string `json:"sha1"` ForEngine APIEngine `json:"use_in_engine"` NumberOfPasswords int `json:"num_passwords"` NumberOfSalts int `json:"num_salts"` }
TaskFileItem describes a file that is used for tasks
type TaskFileLintError ¶
type TaskInfoResponseItem ¶
type TaskInfoResponseItem struct { TaskID string `json:"task_id"` TaskName string `json:"task_name"` CaseCode *string `json:"case_code,omitempty"` Comment *string `json:"comment,omitempty"` AssignedToHost string `json:"assigned_host,omitempty"` AssignedToDevices *storage.CLDevices `json:"assigned_devices,omitempty"` Status storage.TaskStatus `json:"status"` CreatedBy string `json:"created_by"` CreatedByUUID string `json:"created_by_uuid"` CreatedAt time.Time `json:"created_at"` Engine TaskCrackEngineFancy `json:"engine"` FileID string `json:"-"` // FileID is a reference to TaskFile via TaskFile.FileID Priority TaskPriorityFancy `json:"priority"` EnginePayload interface{} `json:"engine_options"` FileInfo *TaskFileItem `json:"password_file"` Error *string `json:"error,omitempty"` }
TaskInfoResponseItem defines the response for all the information possible about a given task
type TaskListingResponse ¶
type TaskListingResponse struct { Data []TaskListingResponseItem `json:"data"` Count int `json:"count"` }
type TaskListingResponseItem ¶
type TaskListingResponseItem struct { TaskID string `json:"task_id"` TaskName string `json:"task_name"` CaseCode string `json:"case_code"` Status storage.TaskStatus `json:"status"` CreatedAt time.Time `json:"created_at"` CreatedBy string `json:"created_by"` PasswordsTotal int `json:"passwords_total"` CrackedTotal int `json:"cracked_total"` }
TaskListingResponseItem includes the "bare minimum" information about a task for listing purposes
type TaskPriorityFancy ¶
type TaskPriorityFancy storage.WorkerPriority
func (TaskPriorityFancy) MarshalJSON ¶
func (s TaskPriorityFancy) MarshalJSON() ([]byte, error)
type UploadEngineFileResponse ¶
type UploadEngineFileResponse struct { FileID string `json:"file_id"` FileSize int64 `json:"file_sz"` NumberOfEntries int64 `json:"num_of_lines"` SHA1 string `json:"sha1"` }
UploadEngineFileResponse is returned to the user on a successful shared file upload
type UploadedFileResponse ¶
type UploadedFileResponse struct { SHA1 string `json:"sha1"` FileUUID string `json:"file_uuid"` FileSize int64 `json:"file_size"` UploadedAt time.Time `json:"uploaded_at"` }
UploadedFileResponse is returned on a successful upload
type UserDetailedItem ¶
type UserDetailedItem struct { UserUUID string `json:"user_uuid"` Username string `json:"username"` Password string `json:"-"` Enabled *bool `json:"enabled,omitempty"` EmailAddress string `json:"email_address"` IsSuperUser bool `json:"is_admin"` CreatedAt time.Time `json:"created_at"` }
UserDetailedItem returns all information about a user, minus sensitive information. This should mimick storage.User
type UserListingItem ¶
type UserListingItem struct { UserUUID string `json:"user_uuid"` Username string `json:"username"` CreatedAt time.Time `json:"created_at"` }
UserListingItem is an item returned in a user listing API and should mimick storage.User
type WebAPI ¶
type WebAPI func(c *gin.Context) *WebAPIError
WebAPI defines the type of most gocrack API's.
type WebAPIError ¶
func (WebAPIError) Error ¶
func (e WebAPIError) Error() string
func (*WebAPIError) MarshalJSON ¶
func (e *WebAPIError) MarshalJSON() ([]byte, error)
MarshalJSON builds a JSON version of WebAPIError and modifies the error message based on the struct
type WorkerDevice ¶
type WorkerDevice struct { ID int `json:"id"` Name string `json:"name"` Type WorkerDeviceType `json:"type"` IsBusy bool `json:"-"` }
WorkerDevice contains information about a device attached to a worker. Note: this should mirror shared.Device
type WorkerDeviceType ¶
type WorkerDeviceType struct {
opencl.DeviceType
}
WorkerDeviceType is the type of hardware device this is. GPU, CPU, FPGA, etc.
func (*WorkerDeviceType) MarshalJSON ¶
func (s *WorkerDeviceType) MarshalJSON() ([]byte, error)
MarshalJSON returns a JSON string of the Device Type
type WorkerItem ¶
type WorkerItem struct { Hostname string `json:"hostname"` LastCheckin time.Time `json:"last_seen"` Devices []WorkerDevice `json:"devices"` Processes []WorkerProcess `json:"running_tasks"` }
WorkerItem describes a connected worker to the system
type WorkerProcess ¶
type WorkerProcess struct { TaskID string `json:"task_id"` PID int `json:"pid"` MemoryUsage uint64 `json:"memory_usage"` RunningFor string `json:"running_for"` UsingDevices []int `json:"using_devices"` CreatedBy string `json:"created_by"` }
WorkerProcess describes a cracking process and basic metadata about it
type WorkerResponse ¶
type WorkerResponse []WorkerItem
WorkerResponse contains a list of workers along with information about them
Source Files ¶
- api.go
- audit_log.go
- auth.go
- config.go
- engine_specific_hashcat.go
- file_management_delete.go
- file_management_engine.go
- file_management_task.go
- metrics.go
- middlewares.go
- server.go
- sse_endpoint.go
- task_management.go
- task_management_delete.go
- task_management_entitlements.go
- task_management_helpers.go
- users.go
- workers.go