sqlite

package
v0.0.0-...-b63ba6b Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CREATE_TABLE_ALIASES = `` /* 295-byte string literal not displayed */
View Source
var CREATE_TABLE_EXECUTIONS = `` /* 288-byte string literal not displayed */
View Source
var CREATE_TABLE_INJECTIONS = `` /* 248-byte string literal not displayed */
View Source
var CREATE_TABLE_LOOTS = `` /* 147-byte string literal not displayed */
View Source
var CREATE_TABLE_PAYLOADS = `` /* 294-byte string literal not displayed */
View Source
var CREATE_TABLE_USERS = `` /* 301-byte string literal not displayed */
View Source
var DELETE_ALIAS = `DELETE FROM aliases WHERE id = ?;`
View Source
var DELETE_EXECUTION = `DELETE FROM executions WHERE id = ?;`
View Source
var DELETE_INJECTION = `DELETE FROM injections WHERE id = ?;`
View Source
var DELETE_LOOT = `DELETE FROM loots WHERE id = ?;`
View Source
var DELETE_PAYLOAD = `DELETE FROM payloads WHERE id = ?;`

DELETE

View Source
var DELETE_USER = `DELETE FROM users WHERE id = ?;`
View Source
var INSERT_ALIAS = `INSERT INTO aliases (id, payload_id, alias) VALUES (?, ?, ?);`
View Source
var INSERT_EXECUTION = `INSERT INTO executions (id, payload_id, alias_id) VALUES (?, ?, ?);`
View Source
var INSERT_INJECTION = `INSERT INTO injections (id, name, content) VALUES (?, ?, ?);`
View Source
var INSERT_LOOT = `INSERT INTO loots (id, data) VALUES (?, ?);`
View Source
var INSERT_PAYLOAD = `INSERT INTO payloads (id, name, hash, content, content_type) VALUES (?, ?, ?, ?, ?);`

INSERT

View Source
var INSERT_USER = `INSERT INTO users (id, username, password) VALUES (?, ?, ?);`
View Source
var SELECT_ALIAS_BY_ID = `
SELECT *
FROM aliases
WHERE id = ?;
`
View Source
var SELECT_ALIAS_BY_PAYLOAD_ID = `` /* 185-byte string literal not displayed */
View Source
var SELECT_ALIAS_BY_SHORTNAME = `
SELECT *
FROM aliases
WHERE alias = ?;
`
View Source
var SELECT_ALL_ALIASES = `
SELECT id, payload_id, alias, created_at, modified_at
FROM aliases;
`
View Source
var SELECT_ALL_EXECUTIONS = `
SELECT id, payload_id, alias_id, triggered_at
FROM executions;
`
View Source
var SELECT_ALL_INJECTION = `
SELECT id, name, content, created_at, modified_at
FROM injections;
`
View Source
var SELECT_ALL_LOOT = `
SELECT id, data, created_at
FROM loots;
`
View Source
var SELECT_ALL_PAYLOADS = `` /* 149-byte string literal not displayed */
View Source
var SELECT_EXECUTION = `
SELECT id, payload_id, alias_id, triggered_at
FROM executions
WHERE id = ?;
`
View Source
var SELECT_INJECTION = `
SELECT id, name, content, created_at, modified_at
FROM injections
WHERE id = ?;
`
View Source
var SELECT_INJECTION_BY_NAME = `
SELECT id, name, content, created_at, modified_at
FROM injections
WHERE name = ?;
`
View Source
var SELECT_LOOT = `
SELECT id, data, created_at
FROM loots
WHERE id = ?;
`
View Source
var SELECT_PAYLOAD_BY_ALIAS = `` /* 211-byte string literal not displayed */
View Source
var SELECT_PAYLOAD_BY_ID = `
SELECT id, name, hash, content, content_type, created_at, modified_at
FROM payloads
WHERE id = ?;
`
View Source
var SELECT_PAYLOAD_BY_NAME = `
SELECT id, name, hash, content, content_type, created_at, modified_at
FROM payloads
WHERE name = ?;
`
View Source
var SELECT_USER = `
SELECT id, username, password, two_factor_enabled, totp_secret, created_at, modified_at
FROM users
WHERE id = ?;
`
View Source
var SELECT_USER_BY_NAME = `
SELECT id, username, password, two_factor_enabled, totp_secret, created_at, modified_at
FROM users
WHERE username = ?;
`
View Source
var UPDATE_ADD_TOTP = `
UPDATE users
SET two_factor_enabled = ?,
	totp_secret = ?
WHERE id = ?;`

UPDATE

Functions

This section is empty.

Types

type Sqlite

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

Sqlite struct represent the base Sqlite object It implements the storage.Storage interface

func New

func New() (*Sqlite, error)

New return a new Sqlite object

func (*Sqlite) CreateAlias

func (s *Sqlite) CreateAlias(alias models.Alias) (models.Alias, error)

CreateAlias create an alias token based on models.Alias It also returns it if sucessfuly stored

func (*Sqlite) CreateExecution

func (s *Sqlite) CreateExecution(execution models.Execution, payloadIDOrAlias string) (models.Execution, error)

CreateExecution create an execution token based on models.Execution It also returns it if sucessfuly stored

func (*Sqlite) CreateInjection

func (s *Sqlite) CreateInjection(injection models.Injection) (models.Injection, error)

CreateInjection create an injection token based on models.Injection It also returns it if sucessfuly stored

func (*Sqlite) CreateLoot

func (s *Sqlite) CreateLoot(loot models.Loot) (models.Loot, error)

CreateLoot create a loot token based on models.Loot It also returns it if sucessfuly stored

func (*Sqlite) CreateOTP

func (s *Sqlite) CreateOTP(user models.User, TOTPSecret string) (models.User, error)

CreateOTP create an OTP token It returns the User if sucessfuly stored

func (*Sqlite) CreatePayload

func (s *Sqlite) CreatePayload(payload models.Payload) (models.Payload, error)

CreatePayload create a payload based on models.Payload It also returns it if sucessfuly stored

func (*Sqlite) CreateUser

func (s *Sqlite) CreateUser(user models.User) (models.User, error)

CreateUser create a user based on models.User It also returns it if sucessfuly stored

func (*Sqlite) DeleteAlias

func (s *Sqlite) DeleteAlias(a models.Alias) error

DeleteAlias delete the provided Alias from the database

func (*Sqlite) DeleteExecution

func (s *Sqlite) DeleteExecution(e models.Execution) error

DeleteExecution delete the provided Execution from the database

func (*Sqlite) DeleteInjection

func (s *Sqlite) DeleteInjection(i models.Injection) error

DeleteInjection delete the provided Injection from the database

func (*Sqlite) DeleteLoot

func (s *Sqlite) DeleteLoot(c models.Loot) error

DeleteLoot delete the provided Loot from the database

func (*Sqlite) DeletePayload

func (s *Sqlite) DeletePayload(p models.Payload) error

DeletePayload delete the provided payload from the database

func (*Sqlite) DeleteUser

func (s *Sqlite) DeleteUser(u models.User) error

DeleteUser delete the provided User from the database

func (*Sqlite) GetAlias

func (s *Sqlite) GetAlias(alias string) (models.Alias, error)

GetAlias returns the selected alias by its short name

func (*Sqlite) GetAliasByID

func (s *Sqlite) GetAliasByID(id string) (models.Alias, error)

GetAliasByID returns the selected alias by its ID

func (*Sqlite) GetAliasByPayloadID

func (s *Sqlite) GetAliasByPayloadID(id string) (models.Alias, error)

GetAliasByPayloadID returns the selected alias by its payloadID

func (*Sqlite) GetAliases

func (s *Sqlite) GetAliases() ([]models.Alias, error)

GetAliases returns all the Aliases from the database

func (*Sqlite) GetExecution

func (s *Sqlite) GetExecution(id string) (models.Execution, error)

GetExecution returns the execution selected by its ID

func (*Sqlite) GetExecutions

func (s *Sqlite) GetExecutions() ([]models.Execution, error)

GetExecutions returns all the executions from the database

func (*Sqlite) GetInjection

func (s *Sqlite) GetInjection(id string) (models.Injection, error)

GetInjection returns the select Injection based on its ID

func (*Sqlite) GetInjectionByName

func (s *Sqlite) GetInjectionByName(name string) (models.Injection, error)

GetInjectionByName returns the select Injection based on its name

func (*Sqlite) GetInjections

func (s *Sqlite) GetInjections() ([]models.Injection, error)

GetInjections returns all injection from the database

func (*Sqlite) GetLoot

func (s *Sqlite) GetLoot(id string) (models.Loot, error)

GetLoot returns the selected loot based on its ID

func (*Sqlite) GetLoots

func (s *Sqlite) GetLoots() ([]models.Loot, error)

GetLoots returns all the loots from the database

func (*Sqlite) GetPayload

func (s *Sqlite) GetPayload(id string) (models.Payload, error)

GetPayload returns the select payload based on its ID

func (*Sqlite) GetPayloadByAlias

func (s *Sqlite) GetPayloadByAlias(short string) (models.Payload, error)

GetPayloadByAlias returns the select payload based on its alias

func (*Sqlite) GetPayloads

func (s *Sqlite) GetPayloads() ([]models.Payload, error)

GetPayloads returns all the payloads stored in the database

func (*Sqlite) GetUser

func (s *Sqlite) GetUser(id string) (models.User, error)

GetUser return a user based on its ID

func (*Sqlite) GetUserByName

func (s *Sqlite) GetUserByName(name string) (models.User, error)

GetUserByName return an user by its name

func (*Sqlite) Init

func (s *Sqlite) Init() error

Init open the SQLite3 database

func (*Sqlite) RemoveOTP

func (s *Sqlite) RemoveOTP(user models.User) (models.User, error)

RemoveOTP remove the OTP for the user provided

func (*Sqlite) Setup

func (s *Sqlite) Setup() error

Setup create all the tables for the database

func (*Sqlite) UpdatePayload

func (s *Sqlite) UpdatePayload(models.Payload) error

UpdatePayload Not Implemented Yet Update the payload based on the provided one. Only the ID field must be correct. All other field will be changed

func (*Sqlite) UpdateUser

func (s *Sqlite) UpdateUser(models.User) error

UpdateUser Not Implemented Yet Update the User based on the provided one. Only the ID field must be correct. All other field will be changed

Jump to

Keyboard shortcuts

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