core

package
v0.0.0-...-e25afdc Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteArrayToHex

func ByteArrayToHex(payload []byte) string

ByteArrayToHex converts a set of bytes to a hex encoded string.

func ChangePermissions

func ChangePermissions(name string) (uint32, uint32, error)

ChangePermissions : Change the permissions to a specific user.

func ConnectDB

func ConnectDB(verbose bool) (*gorm.DB, error)

ConnectDB connects to the database and returns the db object.

func GetPasswd

func GetPasswd(name string) (*C.struct_passwd, error)

GetPasswd : Gets the passwd of a specific user.

func GetSHA3256Hash

func GetSHA3256Hash(str []byte) ([]byte, error)

GetSHA3256Hash returns the SHA3-256 hash of a given string.

func SockAddrToIP

func SockAddrToIP(sock *syscall.Sockaddr) (ip net.IP, port int, success bool)

SockAddrToIP : Return the IP address of a sockaddr

Types

type Encryption

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

Encryption : This is the object that defines an encryption key class.

func (*Encryption) GenerateKey

func (enc *Encryption) GenerateKey() bool

GenerateKey : Generate a set of keys.

func (*Encryption) GetPrivateKey

func (enc *Encryption) GetPrivateKey() string

GetPrivateKey : Get the PEM private key string.

func (*Encryption) GetPublicKey

func (enc *Encryption) GetPublicKey() string

GetPublicKey : Get the public PEM key string.

type KeyConnection

type KeyConnection struct {
	gorm.Model
	ID        uint64    `gorm:"primaryKey; autoIncrement; not_null;"` // type:bigint for MySQL
	IPAddress string    `gorm:"index; type:mediumtext not null; unique_index:uidx_key_ip"`
	Username  string    `gorm:"index; not null"`
	Key       string    `gorm:"index; not null"`
	KeyHash   string    `gorm:"index; not null; unique_index:uidx_key_ip"`
	Type      string    `gorm:"not null"`
	CreatedAt time.Time `gorm:"autoCreateTime:milli"`
	UpdatedAt time.Time `gorm:"autoCreateTime:milli"`
}

KeyConnection defines the model that describes the table in which all the usernames and public key that any peer attempts to access the system with will be stored.

type Logman

type Logman struct {
	*log.Logger
	// contains filtered or unexported fields
}

Logman is a struct that handles logging to a file.

func CreateLogmanLogger

func CreateLogmanLogger(fname string) *Logman

CreateLogmanLogger : Create a logger.

func GetLogmanInstance

func GetLogmanInstance() *Logman

GetLogmanInstance : Get (or create) the instance of the logger.

type PasswordConnection

type PasswordConnection struct {
	gorm.Model
	ID        uint64    `gorm:"primaryKey; autoIncrement; not_null;"` // type:bigint for MySQL
	IPAddress string    `gorm:"index; type:mediumtext not null"`
	Username  string    `gorm:"index; not null"`
	Password  string    `gorm:"index; not null"`
	CreatedAt time.Time `gorm:"autoCreateTime:milli"`
	UpdatedAt time.Time `gorm:"autoCreateTime:milli"`
}

PasswordConnection defines the model that describes the table in which all the usernames and passwords that any peer attempts to access the system with will be stored.

type SSHServer

type SSHServer struct {
	Logger *Logman

	Port    int
	Address string
	Key     string
	Banner  string

	PluginManager *plugin.PluginManager
	// contains filtered or unexported fields
}

SSHServer : This is the object that defines an SSH server.

func (*SSHServer) HandleSSHAuth

func (server *SSHServer) HandleSSHAuth(connection *net.Conn) bool

HandleSSHAuth Handles the authentication process.

func (*SSHServer) Init

func (server *SSHServer) Init() bool

Init Initialize the SSH server.

func (*SSHServer) ListenLoop

func (server *SSHServer) ListenLoop()

ListenLoop : Run the listener for our server.

func (*SSHServer) SetDB

func (server *SSHServer) SetDB(db *gorm.DB)

SetDB sets the database. For some reason this can't be passed in the constructor / initializer, because this error happens: "panic: runtime error: cgo argument has Go pointer to Go pointer".

func (*SSHServer) Stop

func (server *SSHServer) Stop()

Stop will stop the SSH server from running.

Jump to

Keyboard shortcuts

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