parent

package
v0.0.0-...-0388672 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PIDUNKN = -1

PIDUNKN stands for PID Unknown and indicates the process has not started yet (or has exited)

Variables

This section is empty.

Functions

This section is empty.

Types

type PipeResponse

type PipeResponse struct {
	Data     string
	Pid      int
	IsStdErr bool
}

PipeResponse is the data returned from the pipe

type ProcessesByTask

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

ProcessesByTask is a mapping of current running processes stored by their taskid

func NewProcessesByTask

func NewProcessesByTask() ProcessesByTask

NewProcessesByTask creates a tracker for task processes

func (*ProcessesByTask) GetBeaconInfo

func (s *ProcessesByTask) GetBeaconInfo() map[string]shared.TaskProcess

GetBeaconInfo returns information about the current running processes on this worker

func (*ProcessesByTask) RegisterProcess

func (s *ProcessesByTask) RegisterProcess(rpm *RemoteProcessManager, taskid string, devices []int)

RegisterProcess registers the child process/worker which is performing the cracking session. This should be called before the process starts

func (*ProcessesByTask) StopTaskByID

func (s *ProcessesByTask) StopTaskByID(taskid string)

StopTaskByID sends a SIGTERM to a running child process being monitored by the parent. If the task does not exist, nothing happens.

func (*ProcessesByTask) UnregisterProcess

func (s *ProcessesByTask) UnregisterProcess(rpm *RemoteProcessManager, taskid string)

UnregisterProcess removes the child process/worker from the manager. This should be called when the process exits

type RemoteOutput

type RemoteOutput chan PipeResponse

RemoteOutput is a channel on which messages from child processes pipes are sent to

type RemoteProcessManager

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

RemoteProcessManager is a child process of the worker which does all the heavy lifting

func NewRemoteProcess

func NewRemoteProcess(ch RemoteOutput) *RemoteProcessManager

NewRemoteProcess creates a process wrapper that allows stderr/out to be recorded as well as administratively manage the process

func (*RemoteProcessManager) GetMemoryRSS

func (s *RemoteProcessManager) GetMemoryRSS() uint64

GetMemoryRSS returns the resident size of the remote process. If we are unable to retrieve it, we return 0

func (*RemoteProcessManager) GetReturnCode

func (s *RemoteProcessManager) GetReturnCode() int

GetReturnCode returns the return code of the process after it exits

func (*RemoteProcessManager) GetRunningPID

func (s *RemoteProcessManager) GetRunningPID() int

GetRunningPID returns the current PID of the process. If the process has not started yet, the value is -1.

func (*RemoteProcessManager) Start

func (s *RemoteProcessManager) Start(process string, args ...string) (err error)

Start the mule process up and wait for it to exit

func (*RemoteProcessManager) StopKill

func (s *RemoteProcessManager) StopKill()

StopKill stops the mule process by sending it a SIGKILL

func (*RemoteProcessManager) StopTerm

func (s *RemoteProcessManager) StopTerm()

StopTerm stops the mule process by sending it a SIGERM

func (*RemoteProcessManager) Wait

func (s *RemoteProcessManager) Wait()

Wait blocks until the process has completely exited

type Worker

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

Worker is a gocrack process that beacons to a server and accepts new processing requests

func New

func New(cfg *worker.Config) *Worker

New creates a new parent worker

func (*Worker) Start

func (s *Worker) Start() error

Start establishes a connection to the RPC server and starts the beaconing process. This blocks until Stop is called

func (*Worker) Stop

func (s *Worker) Stop() error

Stop the server by closing channels, waiting for goroutines to exit, and closing the connections out

Jump to

Keyboard shortcuts

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