storage

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storage implements a encrypted storage mechanism for interactsh external interaction data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheMetrics

type CacheMetrics struct {
	HitCount         uint64        `json:"hit-count"`
	MissCount        uint64        `json:"miss-count"`
	LoadSuccessCount uint64        `json:"load-success-count"`
	LoadErrorCount   uint64        `json:"load-error-count"`
	TotalLoadTime    time.Duration `json:"total-load-time"`
	EvictionCount    uint64        `json:"eviction-count"`
}

type CorrelationData

type CorrelationData struct {
	// data contains data for a correlation-id in AES encrypted json format.
	Data []string `json:"data"`

	// AESKey is the AES encryption key in encrypted format.
	AESKey string `json:"aes-key"`
	// contains filtered or unexported fields
}

CorrelationData is the data for a correlation-id.

func (*CorrelationData) GetInteractions

func (c *CorrelationData) GetInteractions() []string

GetInteractions returns the uncompressed interactions for a correlation-id

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

Storage is an storage for interactsh interaction data as well as correlation-id -> rsa-public-key data.

func New

func New(evictionTTL time.Duration) *Storage

New creates a new storage instance for interactsh data.

func (*Storage) AddInteraction

func (s *Storage) AddInteraction(correlationID string, data []byte) error

AddInteraction adds an interaction data to the correlation ID after encrypting it with Public Key for the provided correlation ID.

func (*Storage) AddInteractionWithId

func (s *Storage) AddInteractionWithId(id string, data []byte) error

AddInteractionWithId adds an interaction data to the id bucket

func (*Storage) GetCacheItem

func (s *Storage) GetCacheItem(token string) (*CorrelationData, error)

GetCacheItem returns an item as is

func (*Storage) GetCacheMetrics

func (s *Storage) GetCacheMetrics() *CacheMetrics

func (*Storage) GetInteractions

func (s *Storage) GetInteractions(correlationID, secret string) ([]string, string, error)

GetInteractions returns the interactions for a correlationID and removes it from the storage. It also returns AES Encrypted Key for the IDs.

func (*Storage) GetInteractionsWithId

func (s *Storage) GetInteractionsWithId(id string) ([]string, error)

GetInteractions returns the interactions for a id and empty the cache

func (*Storage) RemoveID

func (s *Storage) RemoveID(correlationID, secret string) error

RemoveID removes data for a correlation ID and data related to it.

func (*Storage) SetID

func (s *Storage) SetID(ID string) error

func (*Storage) SetIDPublicKey

func (s *Storage) SetIDPublicKey(correlationID, secretKey string, publicKey string) error

SetIDPublicKey sets the correlation ID and publicKey into the cache for further operations.

Jump to

Keyboard shortcuts

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