database

package
v0.0.0-...-d4fad9c Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CassandraConnection

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

Structure that will hold the necessary fields and functions for interacting with Cassandra

func NewCassandraConnection

func NewCassandraConnection(logger logging.ILogger, configuration config.Configuration) *CassandraConnection

Creates a new instance of the CassandraConnection structure

func (*CassandraConnection) CheckExploitCodeExists

func (cassandra *CassandraConnection) CheckExploitCodeExists(log_uuid string) (bool, error)

Check if exploit code exists for a log

func (*CassandraConnection) CheckMachineExists

func (cassandra *CassandraConnection) CheckMachineExists(os string, hostname string) (string, error)

Check if the machine already exists

func (*CassandraConnection) DeleteMachine

func (cassandra *CassandraConnection) DeleteMachine(id string) error

Delete a specific machine based on the id

func (*CassandraConnection) GetAgent

func (cassandra *CassandraConnection) GetAgent(id string) (data.Agent, error)

Get a single agent from the database

func (*CassandraConnection) GetAgentLogs

func (cassandra *CassandraConnection) GetAgentLogs(uuid string) ([]data.LogData, error)

Get all logs of an agent

func (*CassandraConnection) GetAgentLogsShort

func (cassandra *CassandraConnection) GetAgentLogsShort(agent_id string) ([]data.LogDataShort, error)

Get all the logs of an agent in a short format

func (*CassandraConnection) GetAgents

func (cassandra *CassandraConnection) GetAgents() ([]data.Agent, error)

Get all the agents from the database

func (*CassandraConnection) GetLog

func (cassandra *CassandraConnection) GetLog(uuid string) (data.LogDataDatabase, error)

Get a specific log

func (*CassandraConnection) GetLogFindings

func (cassandra *CassandraConnection) GetLogFindings(log_id string) ([]data.FindingDatabase, error)

Get all the findings of the request

func (*CassandraConnection) GetLogFindingsCount

func (cassandra *CassandraConnection) GetLogFindingsCount(log_id string, finding_type int64) (int64, error)

Get number of request findings of a log

func (*CassandraConnection) GetLogRequest

func (cassandra *CassandraConnection) GetLogRequest(uuid string) (string, error)

Get log request

func (*CassandraConnection) GetLogRuleFindings

func (cassandra *CassandraConnection) GetLogRuleFindings(log_id string) ([]data.RuleFindingDatabase, error)

Get all the rule findings of the log

func (*CassandraConnection) GetLogRuleFindingsCount

func (cassandra *CassandraConnection) GetLogRuleFindingsCount(log_id string, finding_type int64) (int64, error)

Get number of findings of a certain type of a log

func (*CassandraConnection) GetMachine

func (cassandra *CassandraConnection) GetMachine(id string) (data.MachineInformation, error)

Get a specific machine based on the id

func (*CassandraConnection) GetMachines

func (cassandra *CassandraConnection) GetMachines() ([]data.MachineDatabase, error)

Get all the machines from the database

func (*CassandraConnection) GetNumberAgentsDeployed

func (cassandra *CassandraConnection) GetNumberAgentsDeployed(machineId string) (int64, error)

Get number of agents deployed on machine based on id

func (*CassandraConnection) Init

func (cassandra *CassandraConnection) Init() error

Function that will initialize the connection to cassandra server

func (*CassandraConnection) InsertAgent

func (cassandra *CassandraConnection) InsertAgent(protocol string, ip_address string, port string, webserver_protocol string, webserver_ip string, webserver_port string, machine_id string) (string, error)

Insert a new agent in the list of agents

func (*CassandraConnection) InsertFindings

func (cassandra *CassandraConnection) InsertFindings(log_id string, findings []data.Finding) (bool, error)

Insert the findings from an agent

func (*CassandraConnection) InsertLog

func (cassandra *CassandraConnection) InsertLog(logData data.LogData) (bool, error)

Insert a log from an agent

func (*CassandraConnection) InsertMachine

func (cassandra *CassandraConnection) InsertMachine(os string, hostname string, ip_addresses []string) (string, error)

Insert a new machine in the database

func (*CassandraConnection) InsertRuleFindings

func (cassandra *CassandraConnection) InsertRuleFindings(log_id string, ruleFindings []data.RuleFinding) (bool, error)

Insert the rule findings from an agent

func (*CassandraConnection) ModifyAgent

func (cassandra *CassandraConnection) ModifyAgent(id string, agent data.UpdateAgent) error

Modify the agent

type IConnection

type IConnection interface {
	Init() error
	CheckMachineExists(os string, hostname string) (string, error)
	InsertMachine(os string, hostname string, ip_addresses []string) (string, error)
	InsertAgent(protocol string, ip_address string, port string, webserver_protocol string, webserver_ip string, webserver_port string, machine_id string) (string, error)
	GetAgents() ([]data.Agent, error)
	GetAgent(id string) (data.Agent, error)
	ModifyAgent(id string, agent data.UpdateAgent) error
	GetMachines() ([]data.MachineDatabase, error)
	GetMachine(id string) (data.MachineInformation, error)
	DeleteMachine(id string) error
	GetAgentLogs(uuid string) ([]data.LogData, error)
	GetAgentLogsShort(agent_id string) ([]data.LogDataShort, error)
	InsertLog(logData data.LogData) (bool, error)
	GetLog(uuid string) (data.LogDataDatabase, error)
	GetLogRequest(uuid string) (string, error)
	GetLogFindings(log_uuid string) ([]data.FindingDatabase, error)
	GetLogRuleFindings(log_uuid string) ([]data.RuleFindingDatabase, error)
	CheckExploitCodeExists(log_uuid string) (bool, error)
}

Jump to

Keyboard shortcuts

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