core

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 31 Imported by: 4

Documentation

Overview

core - the "core" package is used to organize all primary libraries and utilities that are made use of across several aspects of the application.

This can include anything from custom data structures, to colors for text output.

Index

Constants

This section is empty.

Variables

View Source
var ActiveSession = -1
View Source
var DidDisplayPsk = false

DidDisplayPsk - a boolean to check if the pre-generated PSK was already given to the user so it is not printed each time

View Source
var ErrorColorBold = color.New(color.FgRed).Add(color.Bold)

ErrorColorBold - bold red color useful for error messages

View Source
var ErrorColorBoldIns = color.New(color.FgRed).Add(color.Bold).SprintFunc()

ErrorColorBoldIns - insert variant for variables, bold red color useful for error messages

View Source
var ErrorColorUnderline = color.New(color.FgRed).Add(color.Underline)

ErrorColorUnderline - underlined bold red color useful for strong error messages

View Source
var FileTransfers = make(map[int]*FileTransferState)
View Source
var FileTransfersMutex = sync.RWMutex{}
View Source
var GreenColor = color.New(color.FgGreen)

GreenColor - green color for text output

View Source
var GreenColorIns = color.New(color.FgGreen).SprintFunc()

GreenColorIns - insert variant for variables, green color for text output

View Source
var Listeners = make(map[int]Listener)

Listeners - a map of Listeners. This is used to manage listeners that are created by the user. The map structure makes it easy to search, add, modify, and delete a large amount of Listeners.

View Source
var MagentaColor = color.New(color.FgMagenta)

MagentaColor - magenta color for text output

View Source
var MagentaColorBold = color.New(color.FgMagenta).Add(color.Bold)

MagentaColorBold - bold magenta color for text output

PSK - global PSK for listeners to manage and set the server PSK

View Source
var PersistenceMode bool

PersistenceMode - a boolean to check to see if persistence mode is enabled/disabled

View Source
var RedColor = color.New(color.FgRed)

RedColor - red color for text output

View Source
var RedColorIns = color.New(color.FgRed).SprintFunc()

RedColorIns - insert variant for variables, red color for text output

View Source
var ResponseChunks = make(map[int]ResponseChunk)
View Source
var ResponseChunksMutex = sync.RWMutex{}
View Source
var SessionID int = 0
View Source
var Sessions sync.Map
View Source
var Stagers = make(map[int]Stager)

Stagers - a map of Stagers. This is used to manage stagers that are created by the user.

View Source
var SuccessColorBold = color.New(color.FgGreen).Add(color.Bold)

SuccessColorBold - bold green color useful for success messages

View Source
var WarningColorBold = color.New(color.FgYellow).Add(color.Bold)

WarningColorBold - bold yellow color useful for warning messages

View Source
var Wolves = make(map[string]Wolf)

Wolves - map of all operators (wolves). This is used to manage wolf pack server users that have been generated. The map structure makes it easy to search, add, modify, and delete a large amount of Wolves.

View Source
var ZeroedUUID, _ = uuid.Parse("00000000-0000-0000-0000-000000000000")

ZeroedUUID - zeroed global used to clear UUIDs wherever applicable

Functions

func AckFileChunk added in v1.3.0

func AckFileChunk(sessionID int, chunkIndex int) bool

AckFileChunk marks a chunk as received

func AssignWolfBroadcast

func AssignWolfBroadcast(username string, rhost string, response string)

AssignWolfBroadcast - this function takes in a username and rhost to keep track of the user being assigned the broadcast message. The response parameter is then updated and linked to a wolf which will be returned by the WolfPack Server.

func AssignWolfResponse

func AssignWolfResponse(username string, rhost string, response string)

AssignWolfResponse - this function takes in a username and rhost to keep track of the user being assigned the response. The response parameter is then updated and linked to a wolf which will be returned by the WolfPack Server.

func BroadcastSession

func BroadcastSession(session string)

func BroadcastSessionData added in v1.3.1

func BroadcastSessionData(sessionID string, data string)

BroadcastSessionData broadcasts session output data to all connected wolfpack operators. data should already be URL-decoded and have backslashes escaped.

func BroadcastWolfPackChat

func BroadcastWolfPackChat(response string)

BroadcastWolfPackChat - this function takes in a chat message response and broadcasts it to all wolves, they will only receive it if making a request from the Chat CLI. The response parameter is then updated and linked to each wolf which will be returned by the WolfPack Server.

func ChatLog

func ChatLog(data string) error

func ClientLoadExtendedFunctions

func ClientLoadExtendedFunctions(activeSession int) []byte

func CmdExec added in v1.2.0

func CmdExec(activeSession int, cmdString string, operator string) error

func CompleteFileTransfer added in v1.3.0

func CompleteFileTransfer(sessionID int)

CompleteFileTransfer marks transfer as done and cleans up

func DownloadFile

func DownloadFile(filename string, fileb64 string)

DownloadFile - Reads a base64 encoded string and writes it out to a local file

func ExecuteConnection

func ExecuteConnection(rhost string, rport int, protocol string, path string, commandQuery string, command string, query string, requestType string, filename string, file string) (string, error)

func GeneratePSK

func GeneratePSK() string

GeneratePSK - Generates a random 32 character string, encodes it with SHA256 as a PSK that is set by default on startup unless the user specifies a static PSK

func GenerateSelfSignedCert added in v1.1.0

func GenerateSelfSignedCert(ip, host string, days int) error

func GetFileTransferProgress added in v1.3.0

func GetFileTransferProgress(sessionID int) int

GetFileTransferProgress returns the current progress percentage and logs if it crosses 10% threshold

func GetFirstUsePSK

func GetFirstUsePSK() (response string, psk string, instructions string, help string)

func GetNextFileChunk added in v1.3.0

func GetNextFileChunk(sessionID int) (string, int, int, bool)

GetNextFileChunk retrieves the next chunk to send, or a missing chunk if one was lost

func KillListener

func KillListener(id int) (responseSuccess string, responseFail string)

KillListener - kills a listener with the specified id and returns the response

func KillStager added in v1.3.1

func KillStager(id int) (responseSuccess string, responseFail string)

KillStager - kills a stager with the specified id and returns the response

func LoadExtendedFunctions

func LoadExtendedFunctions(sessionApp *grumble.App, activeSession int)

func LogData

func LogData(data string) error

LogData - wrapper function to use golang's built in logger and append all operational data to a central log file

func ManagePSK

func ManagePSK(psk string, isRandom bool, operator string) (response string, currentPSK string, instruction string)

func QueueImplantCommand

func QueueImplantCommand(sessionID int, cmd string, operator string)

QueueImplantCommand - adds a command to the implant’s queue

func RegisterSession

func RegisterSession(sessionID int, protocol string, implant Implant, rhost string, rport int, command string, query string, requestType string, shellpath string)

func SessionCheckIn

func SessionCheckIn(sessionID int, protocol string)

func SessionExists

func SessionExists(session int) bool

func SessionStatusUpdate

func SessionStatusUpdate(sessionID int, status string)

func ShowListeners

func ShowListeners() map[string]ListenerStrings

ShowListeners - returns a string map of Listeners and their details

func ShowSessions

func ShowSessions() map[string]SessionStrings

func ShowStagers added in v1.3.1

func ShowStagers() map[string]StagerStrings

ShowStagers - returns a string map of Stagers and their details

func StartConnector

func StartConnector(id int, rhost string, rport int, protocol string, requestType string, command string, query string, connectString string, shellpath string) (string, error)

func StartFileTransfer added in v1.3.0

func StartFileTransfer(sessionID int, fileData string, chunkSize int) int

StartFileTransfer initializes a file transfer session, breaking the file into chunks

func UpdateImplant

func UpdateImplant(sessionID int, updateInterval float64, arch string, functions map[string]interface{})

UpdateImplant - updates fields of an implant during check-in

func UpdateWolf

func UpdateWolf(username string, rhost string)

UpdateWolf - updates the properties of an individual wolfpack user for processing elsewhere in the application. Updates the current command in the queue and the remote host connection value.

func UploadFile

func UploadFile(file string) string

UploadFile - Reads a file to be uploaded and converts it to base64 to pass to the server as a response for the session

func WebShellStatus

func WebShellStatus(id int, rhost string, rport int, protocol string, requestType string, command string, query string, connectString string, shellpath string) (bool, error)

Types

type Commands

type Commands struct {
	Command  string
	Operator string
}

Commands - defines the structure of Commands

type DNSData added in v1.3.0

type DNSData struct {
	PSK                 string
	SessionID           int
	UUID                uuid.UUID
	ImplantArch         string
	Update              float64
	Data                string
	AdditionalFunctions string
	Username            string
	Register            bool
	FileName            string
	File                string
	Mutex               sync.Mutex
}

type FileTransferState added in v1.3.0

type FileTransferState struct {
	SessionID     int
	Chunks        []string // All chunks of the file
	TotalChunks   int
	CurrentChunk  int          // Next chunk to send
	AckedChunks   map[int]bool // Which chunks have been acknowledged
	Timestamp     time.Time
	LastChunkTime time.Time
	LastProgress  int // Last reported progress percentage (0-100)
}

FileTransferState - tracks ongoing file transfers to implants Key: sessionID, Value: file transfer metadata

type Implant

type Implant struct {
	ID       uuid.UUID
	Arch     string
	Commands []Commands
	Update   float64

	Functions map[string]interface{}
	// contains filtered or unexported fields
}

Implant - defines an implant structure composed of:

func RegisterImplant

func RegisterImplant(arch string, updateInterval float64, functions map[string]interface{}, oldUUID string) Implant

RegisterImplant - function to register a new implant and increment the ImplantID

type Listener

type Listener struct {
	ID           int
	Lhost        string
	Lport        int
	Protocol     string
	HTTPInstance *http.Server
	TCPInstance  net.Listener
	DNSInstance  *dns.Server
	CryptoPSK    string
}

Listener - defines a listener structure composed of:

id - unique identifier that is autoincremented on creation of a new listener

lhost - the "listening" host address. This tells a listener what interface to listen on based on the address it is tied to.

lport - the "listening" port. This tells a listener what port the lhost of the listener should open to receive connections on.

protocol - the protocol to use when listening for incoming connections. Currenlty supports HTTP(S) and TCP.

httpInstance - a pointer to an instance of the http.Server struct. This is used to reference the core HTTP Server itself when conducting operations such as starting/stopping a listener.

tcpInstance - a copy of the net.Listener struct. This is used to interact with the core TCP Server itself when conducting operations such as starting/stopping a listener.

type ListenerStrings

type ListenerStrings struct {
	ID       string
	Lhost    string
	Lport    string
	Protocol string
}

ListenerStrings - more loose structure for handling listener data, primarily used to hand off as JSON to the lupo client. Contains all the same fields as a Listener structure but as string data types and omits the HTTP/TCPInstance values.

type ManageResponse

type ManageResponse struct {
	Response        string
	CurrentPSK      string
	Instruction     string
	PersistenceMode bool
}

type ResponseChunk added in v1.3.0

type ResponseChunk struct {
	Chunks      []string
	TotalChunks int
	Timestamp   time.Time
}

ResponseChunkBuffer - stores chunked DNS responses temporarily for implants to retrieve Format: map[sessionID] -> { "chunks": []string, "timestamp": time.Time, "totalChunks": int }

type Session

type Session struct {
	ID                 int
	Protocol           string
	Implant            Implant
	Rhost              string
	RawCheckin         time.Time
	Checkin            string
	Status             string
	Rport              int
	CommandQuery       string
	Query              string
	RequestType        string
	ShellPath          string
	SubDomainFragments []string
}

type SessionStrings

type SessionStrings struct {
	ID                 string
	Protocol           string
	ImplantArch        string
	ImplantUpdate      string
	Rhost              string
	RawCheckin         string
	Checkin            string
	Status             string
	Rport              string
	CommandQuery       string
	Query              string
	RequestType        string
	ShellPath          string
	SubDomainFragments string
}

type Stager added in v1.3.1

type Stager struct {
	ID           int
	Lhost        string
	Lport        int
	Protocol     string
	Dir          string
	HTTPInstance *http.Server
}

Stager - defines a stager structure composed of:

ID - unique identifier that is autoincremented on creation of a new stager

Lhost - the "listening" host address. This tells the stager what interface to listen on.

Lport - the "listening" port.

Protocol - the protocol to use when serving files. Supports HTTP and HTTPS.

Dir - the directory path to serve files from. Created on startup if it does not exist.

HTTPInstance - a pointer to the underlying http.Server used to start/stop the stager.

type StagerStrings added in v1.3.1

type StagerStrings struct {
	ID       string
	Lhost    string
	Lport    string
	Protocol string
	Dir      string
}

StagerStrings - more loose structure for handling stager data, primarily used to hand off as JSON to the lupo client. Contains all the same fields as a Stager structure but as string data types and omits the HTTPInstance value.

type StartResponse

type StartResponse struct {
	Response    string
	CurrentPSK  string
	Instruction string
	Help        string
	Status      string
}

type TCPData

type TCPData struct {
	PSK                 string
	SessionID           int
	UUID                uuid.UUID
	ImplantArch         string
	Update              float64
	Data                string
	AdditionalFunctions string
	Username            string
	Register            bool
	FileName            string
	File                string
}

type Wolf

type Wolf struct {
	WolfPSK   string
	Username  string
	Rhost     string
	Response  string
	Broadcast string
	Checkin   string
}

Wolf - defines a user structure known as a "wolf" composed of:

WolfPSK - unique PSK randomly generated and seeded into the compilation of the wolfpack client binary on creation of a new user for authentication to the wolfpack server

Username - a username to identify the user connecting to the wolfpack server

Rhost - the "remote" host address. This contains a value of the external IP where a wolpack user is connecting from.

Response - a response to transmit to the wolfpack user (may not be necessary if the server handler loop takes care of this once implemented)

Jump to

Keyboard shortcuts

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