sqldb

package
v0.0.0-...-9d62925 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAgent

func AddAgent(agentkey string, agentname string, os string, osType string, osVers string, av []byte, hostname string, username string, localip string, externalip string, path string, shell1 string, shell2 string, shell3 string, pid int, isAdmin bool, isElevated bool, active int, listenerkey string)

AddAgent adds an agent to the database Might want to change this so it just passes a struct but i dont think it really matters from a performance standpoint.. This can be applied to all of the add functions within this package

func AddComment

func AddComment(agentKey string, comment string, username string) (bool, string, string)

AddComment will add the user comment per the agent they are commenting on

func AddDropper

func AddDropper(name string, dtype string, userid string, lkey string, timegen time.Time)

AddDropper adds a dropper to the db

func AddListener

func AddListener(key string, name string, ltype string, host string, bindport string, pubkey []byte, privkey []byte, advanced string, agentdelay string, agentjitter string, agenteol string, agentlivehours string, userid string)

AddListener adds a listener to the db

func AddLoot

func AddLoot(agentkey string, user string, password string, hash string, credtype string, ssp string, host string, domain string, isWebShell bool)

AddLoot adds loot to the db

func AddUser

func AddUser(username string, clearPassword string, admin int) (bool, string)

AddUser adds a user for the front end

func AddWebshell

func AddWebshell(url string, authToken string, webkey string, os string, hostname string, username string, localIP string, domain string)

AddWebshell will add an initalized webshell into the database

func AgentByListener

func AgentByListener() string

AgentByListener returns the listener for all agents in the DB

func AgentCheckin

func AgentCheckin(agentName string)

AgentCheckin updates the last checkin time for the agent

func AgentOSTypes

func AgentOSTypes() string

AgentOSTypes returns the os for all agents in the DB

func AgentTimeline

func AgentTimeline() []string

AgentTimeline returns the time for all agents in the DB

func ChangeUserPassword

func ChangeUserPassword(userid string, newdata string, oldpass string) (bool, string)

ChangeUserPassword will force the user to change their password and update lastlogin

func CheckBackup

func CheckBackup() (bool, string, string)

CheckBackup checks the schedule of when a backup should run

func CheckListener

func CheckListener(lName string) (bool, string)

CheckListener checks to ensure listener exists for moving laterally

func CheckMFA

func CheckMFA(userID string) bool

CheckMFA checks to see if a user already has a secret generated and stored

func CheckPassword

func CheckPassword(password string, hashedPassword string) bool

CheckPassword verifies that the password is correct

func CloseDB

func CloseDB() bool

CloseDB closes the db to ensure we can archive it in a zip folder

func DeleteAgent

func DeleteAgent(agentkey string)

DeleteAgent switches the active bit from 1 to 0 when called

func EditListener

func EditListener(key string, name string, ltype string, host string, bindport string, pubkey []byte, privkey []byte, advanced string, agentdelay string, agentjitter string, agenteol string, agentlivehours string, userid string)

EditListener changes the listener's settings to the new user supplied ones

func EditPassLoot

func EditPassLoot(password string, hash string) (bool, int)

EditPassLoot edits loot entry to add a password

func FirstUser

func FirstUser(username string, clearPassword string) bool

FirstUser adds the first admin when server is started for the first time

func GetAgentData

func GetAgentData() *sql.Rows

GetAgentData returns the data needed to reinit agents into memory

func GetAgentPivotData

func GetAgentPivotData() *sql.Rows

GetAgentPivotData returns some data about the agents for the pivot graph

func GetListenerKeys

func GetListenerKeys() ([]string, map[string]string, map[string]string, map[string]string)

GetListenerKeys returns a slice of all listeners

func GetListenerPrivateKey

func GetListenerPrivateKey(key string) string

GetListenerPrivateKey returns the private key for the listener

func GetListeners

func GetListeners() *sql.Rows

GetListeners gets everything on listeners out of the database and returns it

func GetMFASecret

func GetMFASecret(userID string) string

GetMFASecret gets the MFA secret for the requesting user

func InitAppSettings

func InitAppSettings(mfa bool, passLegnth int) bool

InitAppSettings sets up the requirements for the users on the web app

func Initalize

func Initalize(filename string)

Initalize is run when the server spins up, it's used to verify the sqlite db or create it

func ListAllLoot

func ListAllLoot() string

ListAllLoot will return all loot from the database

func ListComments

func ListComments(agentKey string) (string, string)

ListComments will get all comments for that specific agent

func ListLoot

func ListLoot(agentkey string) string

ListLoot will return all loot from the database

func ListWebShell

func ListWebShell() *sql.Rows

ListWebShell will list all the webshells existing in the database

func ListenerExists

func ListenerExists(name string) bool

ListenerExists returns true if the listener exists

func Login

func Login(user string, pass string) (bool, string, bool, bool, bool, bool)

Login checks the username and password, if they are correct then it returns true

func OpenDB

func OpenDB(filename string)

OpenDB is just to open the database and put it into the global variable

func ParseSocket

func ParseSocket(fname string, data interface{}, ws *websocket.Conn, admin bool, userid string)

ParseSocket parses calls to make DB edits from the frontend

func RemoveListener

func RemoveListener(lName string)

RemoveListener changes to active

func SetAgentName

func SetAgentName(agentKey string, agentName string) (string, string)

SetAgentName sets the agent name in the DB

func SetSchedule

func SetSchedule(hour string, days []byte, status bool) bool

SetSchedule sets the schedule for when a backup should run

func SetupMFA

func SetupMFA(userID string, secret string) bool

SetupMFA updates the users mfa and mfasecret fields for MFA authentication

func WebShellDeactivate

func WebShellDeactivate(name string)

WebShellDeactivate will flip the active bit from 1 to 0 when delete WebShell is called

Types

This section is empty.

Jump to

Keyboard shortcuts

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