Documentation ¶
Index ¶
- Constants
- func DeviceMatch(v storage.CLDevices) q.Matcher
- func Init(cfg storage.Config) (storage.Backend, error)
- func StringContains(field, contains string) q.Matcher
- type BoltBackend
- func (s *BoltBackend) ChangeTaskStatus(taskID string, status storage.TaskStatus, potentialError *string) error
- func (s *BoltBackend) CheckEntitlement(userUUID, entityID string, entType storage.EntitlementType) (bool, error)
- func (s *BoltBackend) Close() error
- func (s *BoltBackend) CreateUser(user *storage.User) (err error)
- func (s *BoltBackend) DeleteEngineFile(fileID string) error
- func (s *BoltBackend) DeleteTask(taskid string) error
- func (s *BoltBackend) DeleteTaskFile(fileID string) error
- func (s *BoltBackend) EditUser(userUUID string, req storage.UserModifyRequest) error
- func (s *BoltBackend) GetActivityLog(entityID string) ([]storage.ActivityLogEntry, error)
- func (s *BoltBackend) GetCrackedPasswords(taskid string) (*[]storage.CrackedHash, error)
- func (s *BoltBackend) GetEngineFileByID(storageID string) (*storage.EngineFile, error)
- func (s *BoltBackend) GetEngineFilesForUser(user storage.User) (sfs []storage.EngineFile, err error)
- func (s *BoltBackend) GetEntitlementsForTask(entityID string) ([]storage.EntitlementEntry, error)
- func (s *BoltBackend) GetPendingTasks(req storage.GetPendingTasksRequest) ([]storage.GetPendingTasksResponseItem, error)
- func (s *BoltBackend) GetTaskByID(taskID string) (task *storage.Task, err error)
- func (s *BoltBackend) GetTaskCheckpoint(taskid string) ([]byte, error)
- func (s *BoltBackend) GetTaskFileByID(storageID string) (*storage.TaskFile, error)
- func (s *BoltBackend) GetUserByID(userUUID string) (*storage.User, error)
- func (s *BoltBackend) GetUsers() ([]storage.User, error)
- func (s *BoltBackend) GrantEntitlement(user storage.User, entitledTo interface{}) (err error)
- func (s *BoltBackend) ListTasksForUser(user storage.User) ([]storage.TaskFile, error)
- func (s *BoltBackend) LogActivity(entry storage.ActivityLogEntry) error
- func (s *BoltBackend) NewEngineFileTransaction() (storage.EngineFileTxn, error)
- func (s *BoltBackend) NewTaskCreateTransaction() (storage.CreateTaskTxn, error)
- func (s *BoltBackend) NewTaskFileTransaction() (storage.TaskFileTxn, error)
- func (s *BoltBackend) RemoveActivityEntries(entityID string) error
- func (s *BoltBackend) RemoveEntitlements(entityID string, entType storage.EntitlementType) error
- func (s *BoltBackend) RevokeEntitlement(user storage.User, document interface{}) error
- func (s *BoltBackend) SaveCrackedHash(taskid, hash, value string, crackedAt time.Time) error
- func (s *BoltBackend) SaveTaskCheckpoint(checkpoint storage.CheckpointFile) error
- func (s *BoltBackend) SearchForUserByPassword(username string, checker storage.PasswordCheckFunc) (*storage.User, error)
- func (s *BoltBackend) TasksSearch(page, limit int, orderby, searchQuery string, isAscending bool, ...) (*storage.SearchResults, error)
- func (s *BoltBackend) UpdateTask(taskid string, modifiedFields storage.ModifiableTaskRequest) error
- type Driver
- type EngineFileTransaction
- type TaskCreateTransaction
- type TaskFileTransaction
Constants ¶
const CurrentStorageVersion = 1.0
CurrentStorageVersion describes what storage version we're on and can be used to determine if the underlying database structure needs to change
Variables ¶
This section is empty.
Functions ¶
func DeviceMatch ¶
DeviceMatch returns true if *any* element inside v is inside "AssignedToDevices" in a task document
func StringContains ¶
StringContains checks if the given field value contains any of the text in contains
Types ¶
type BoltBackend ¶
type BoltBackend struct {
// contains filtered or unexported fields
}
BoltBackend is a storage backend for GoCrack built ontop of Bolt/LMDB
func (*BoltBackend) ChangeTaskStatus ¶
func (s *BoltBackend) ChangeTaskStatus(taskID string, status storage.TaskStatus, potentialError *string) error
func (*BoltBackend) CheckEntitlement ¶
func (s *BoltBackend) CheckEntitlement(userUUID, entityID string, entType storage.EntitlementType) (bool, error)
CheckEntitlement implements storage.CheckEntitlement
func (*BoltBackend) CreateUser ¶
func (s *BoltBackend) CreateUser(user *storage.User) (err error)
CreateUser saves the record into the database
func (*BoltBackend) DeleteEngineFile ¶
func (s *BoltBackend) DeleteEngineFile(fileID string) error
DeleteEngineFile file implements storage.DeleteEngineFile
func (*BoltBackend) DeleteTask ¶
func (s *BoltBackend) DeleteTask(taskid string) error
DeleteTask implements storage.DeleteTask
func (*BoltBackend) DeleteTaskFile ¶
func (s *BoltBackend) DeleteTaskFile(fileID string) error
DeleteTaskFile implements storage.DeleteTaskFile
func (*BoltBackend) EditUser ¶
func (s *BoltBackend) EditUser(userUUID string, req storage.UserModifyRequest) error
func (*BoltBackend) GetActivityLog ¶
func (s *BoltBackend) GetActivityLog(entityID string) ([]storage.ActivityLogEntry, error)
GetActivityLog implements storage.GetActivityLog
func (*BoltBackend) GetCrackedPasswords ¶
func (s *BoltBackend) GetCrackedPasswords(taskid string) (*[]storage.CrackedHash, error)
func (*BoltBackend) GetEngineFileByID ¶
func (s *BoltBackend) GetEngineFileByID(storageID string) (*storage.EngineFile, error)
GetEngineFileByID returns the engine file given it's unique ID
func (*BoltBackend) GetEngineFilesForUser ¶
func (s *BoltBackend) GetEngineFilesForUser(user storage.User) (sfs []storage.EngineFile, err error)
GetEngineFilesForUser returns a list of engine files available to the user
func (*BoltBackend) GetEntitlementsForTask ¶
func (s *BoltBackend) GetEntitlementsForTask(entityID string) ([]storage.EntitlementEntry, error)
GetEntitlementsForTask implements storage.GetEntitlementsForTask
func (*BoltBackend) GetPendingTasks ¶
func (s *BoltBackend) GetPendingTasks(req storage.GetPendingTasksRequest) ([]storage.GetPendingTasksResponseItem, error)
func (*BoltBackend) GetTaskByID ¶
func (s *BoltBackend) GetTaskByID(taskID string) (task *storage.Task, err error)
GetTaskByID returns a task record based on it's ID
func (*BoltBackend) GetTaskCheckpoint ¶
func (s *BoltBackend) GetTaskCheckpoint(taskid string) ([]byte, error)
GetTaskCheckpoint implements storage.GetTaskCheckpoint
func (*BoltBackend) GetTaskFileByID ¶
func (s *BoltBackend) GetTaskFileByID(storageID string) (*storage.TaskFile, error)
GetTaskFileByID implements the storage.GetTaskFileByID API
func (*BoltBackend) GetUserByID ¶
func (s *BoltBackend) GetUserByID(userUUID string) (*storage.User, error)
GetUserByID returns a user record given the users unique uuid.
func (*BoltBackend) GetUsers ¶
func (s *BoltBackend) GetUsers() ([]storage.User, error)
GetUsers returns a list of all users within the GoCrack system
func (*BoltBackend) GrantEntitlement ¶
func (s *BoltBackend) GrantEntitlement(user storage.User, entitledTo interface{}) (err error)
GrantEntitlement implements storage.GrantEntitlement
func (*BoltBackend) ListTasksForUser ¶
ListTasksForUser implements the storage.ListTasksForUser API
func (*BoltBackend) LogActivity ¶
func (s *BoltBackend) LogActivity(entry storage.ActivityLogEntry) error
LogActivity implements storage.LogActivity
func (*BoltBackend) NewEngineFileTransaction ¶
func (s *BoltBackend) NewEngineFileTransaction() (storage.EngineFileTxn, error)
func (*BoltBackend) NewTaskCreateTransaction ¶
func (s *BoltBackend) NewTaskCreateTransaction() (storage.CreateTaskTxn, error)
NewTaskCreateTransaction creates a new transaction used by the task creation PUT API
func (*BoltBackend) NewTaskFileTransaction ¶
func (s *BoltBackend) NewTaskFileTransaction() (storage.TaskFileTxn, error)
NewTaskFileTransaction creates a new transaction used by the task file PUT APIs
func (*BoltBackend) RemoveActivityEntries ¶
func (s *BoltBackend) RemoveActivityEntries(entityID string) error
RemoveActivityEntries implements storage.RemoveActivityEntries
func (*BoltBackend) RemoveEntitlements ¶
func (s *BoltBackend) RemoveEntitlements(entityID string, entType storage.EntitlementType) error
RemoveEntitlements implements storage.RemoveEntitlements
func (*BoltBackend) RevokeEntitlement ¶
func (s *BoltBackend) RevokeEntitlement(user storage.User, document interface{}) error
RevokeEntitlement removes the users access to the document
func (*BoltBackend) SaveCrackedHash ¶
func (s *BoltBackend) SaveCrackedHash(taskid, hash, value string, crackedAt time.Time) error
func (*BoltBackend) SaveTaskCheckpoint ¶
func (s *BoltBackend) SaveTaskCheckpoint(checkpoint storage.CheckpointFile) error
SaveTaskCheckpoint implements storage.SaveTaskCheckpoint
func (*BoltBackend) SearchForUserByPassword ¶
func (s *BoltBackend) SearchForUserByPassword(username string, checker storage.PasswordCheckFunc) (*storage.User, error)
SearchForUserByPassword locates the user record by username. If a record is found, the checker function will be called to validate the password.
func (*BoltBackend) TasksSearch ¶
func (s *BoltBackend) TasksSearch(page, limit int, orderby, searchQuery string, isAscending bool, user storage.User) (*storage.SearchResults, error)
func (*BoltBackend) UpdateTask ¶
func (s *BoltBackend) UpdateTask(taskid string, modifiedFields storage.ModifiableTaskRequest) error
type EngineFileTransaction ¶
type EngineFileTransaction struct {
// contains filtered or unexported fields
}
func (*EngineFileTransaction) AddEntitlement ¶
func (s *EngineFileTransaction) AddEntitlement(sf storage.EngineFile, userid string) error
func (*EngineFileTransaction) Commit ¶
func (s *EngineFileTransaction) Commit() error
Commit the transaction
func (*EngineFileTransaction) Rollback ¶
func (s *EngineFileTransaction) Rollback() error
Rollback any writes to the database
func (*EngineFileTransaction) SaveEngineFile ¶
func (s *EngineFileTransaction) SaveEngineFile(sf storage.EngineFile) error
type TaskCreateTransaction ¶
type TaskCreateTransaction struct {
// contains filtered or unexported fields
}
func (*TaskCreateTransaction) Commit ¶
func (s *TaskCreateTransaction) Commit() error
Commit the transaction
func (*TaskCreateTransaction) CreateTask ¶
func (s *TaskCreateTransaction) CreateTask(t *storage.Task) error
CreateTask creates the task within the context of a database transaction
func (*TaskCreateTransaction) GrantEntitlement ¶
func (s *TaskCreateTransaction) GrantEntitlement(userUUID string, t storage.Task) error
GrantEntitlement grants additional users to the task within the context of a database transaction
func (*TaskCreateTransaction) Rollback ¶
func (s *TaskCreateTransaction) Rollback() error
Rollback any writes to the database
type TaskFileTransaction ¶
type TaskFileTransaction struct {
// contains filtered or unexported fields
}
TaskFileTransaction is used in the creation of a task file and all the APIs it defines are executed under a bolt transaction
func (*TaskFileTransaction) AddEntitlement ¶
func (s *TaskFileTransaction) AddEntitlement(tf storage.TaskFile, userid string) error
AddEntitlement creates a record giving the user access to the task file
func (*TaskFileTransaction) Commit ¶
func (s *TaskFileTransaction) Commit() error
Commit the transaction
func (*TaskFileTransaction) Rollback ¶
func (s *TaskFileTransaction) Rollback() error
Rollback any writes to the database
func (*TaskFileTransaction) SaveTaskFile ¶
func (s *TaskFileTransaction) SaveTaskFile(tf storage.TaskFile) error
SaveTaskFile saves metadata regarding a task file to the database