Documentation ¶
Overview ¶
Package c2 is the primary Command & Control (C2) endpoint for creating and managing a C2 Session or spinning up a C2 service.
Index ¶
- Constants
- Variables
- func Shoot(p cfg.Profile, n *com.Packet) error
- func ShootContext(x context.Context, p cfg.Profile, n *com.Packet) error
- type Job
- type Listener
- func (l *Listener) Address() string
- func (l *Listener) Close() error
- func (l *Listener) Done() <-chan struct{}
- func (l *Listener) IsActive() bool
- func (l *Listener) JSON(w io.Writer) error
- func (l *Listener) MarshalJSON() ([]byte, error)
- func (l *Listener) Replace(addr string, p cfg.Profile) error
- func (l *Listener) String() string
- func (l *Listener) Wait()
- type Proxy
- type Server
- func (s *Server) Close() error
- func (s *Server) Done() <-chan struct{}
- func (s *Server) IsActive() bool
- func (s *Server) JSON(w io.Writer) error
- func (s *Server) Listen(name, addr string, p cfg.Profile) (*Listener, error)
- func (s *Server) ListenContext(x context.Context, name, addr string, p cfg.Profile) (*Listener, error)
- func (s *Server) Listener(n string) *Listener
- func (s *Server) Listeners() []*Listener
- func (s *Server) MarshalJSON() ([]byte, error)
- func (s *Server) Remove(i device.ID, shutdown bool)
- func (s *Server) Session(i device.ID) *Session
- func (s *Server) Sessions() []*Session
- func (s *Server) SetLog(l logx.Log)
- func (s *Server) Wait()
- type Session
- func Connect(l logx.Log, p cfg.Profile) (*Session, error)
- func ConnectContext(x context.Context, l logx.Log, p cfg.Profile) (*Session, error)
- func Load(l logx.Log, n string, t time.Duration) (*Session, error)
- func LoadContext(x context.Context, l logx.Log, n string, t time.Duration) (*Session, error)
- func LoadOrConnect(x context.Context, l logx.Log, n string, t time.Duration, p cfg.Profile) (*Session, error)
- func (s *Session) Close() error
- func (s *Session) Done() <-chan struct{}
- func (s *Session) InChannel() bool
- func (s *Session) IsActive() bool
- func (s *Session) IsClient() bool
- func (s *Session) IsClosed() bool
- func (s *Session) IsProxy() bool
- func (s *Session) JSON(w io.Writer) error
- func (s *Session) Jitter() uint8
- func (s *Session) Job(i uint16) *Job
- func (s *Session) Jobs() []*Job
- func (s *Session) KillDate() time.Time
- func (s *Session) Listener() *Listener
- func (s *Session) MarshalJSON() ([]byte, error)
- func (s *Session) Migrate(wait bool, n string, job uint16, r runnable) (uint32, error)
- func (s *Session) MigrateProfile(wait bool, n string, b []byte, job uint16, t time.Duration, e runnable) (uint32, error)
- func (s *Session) NewProxy(name, addr string, p cfg.Profile) (*Proxy, error)
- func (s *Session) Packets() <-chan *com.Packet
- func (s *Session) Proxy(_ string) *Proxy
- func (s *Session) Read() *com.Packet
- func (s *Session) RemoteAddr() string
- func (s *Session) Send(p *com.Packet)
- func (s *Session) SetChannel(c bool)
- func (s *Session) SetDuration(t time.Duration, j int) (*Job, error)
- func (s *Session) SetJitter(j int) (*Job, error)
- func (s *Session) SetKillDate(t time.Time) (*Job, error)
- func (s *Session) SetProfile(p cfg.Profile) (*Job, error)
- func (s *Session) SetProfileBytes(b []byte) (*Job, error)
- func (s *Session) SetSleep(t time.Duration) (*Job, error)
- func (s *Session) SetWorkHours(w *cfg.WorkHours) (*Job, error)
- func (s *Session) Spawn(n string, r runnable) (uint32, error)
- func (s *Session) SpawnProfile(n string, b []byte, t time.Duration, e runnable) (uint32, error)
- func (s *Session) String() string
- func (s *Session) Task(n *com.Packet) (*Job, error)
- func (s *Session) Tasklet(t task.Tasklet) (*Job, error)
- func (s *Session) Time() time.Duration
- func (s *Session) Wait()
- func (s *Session) Wake()
- func (s *Session) WorkHours() *cfg.WorkHours
- func (s *Session) Write(p *com.Packet) error
- Bugs
Constants ¶
const ( StatusWaiting status = 0 StatusAccepted status = iota StatusReceiving StatusCompleted StatusError StatusCanceled )
These are status values that indicate the general status of the Job.
const ( SvResync uint8 = 0x1 SvHello uint8 = 0x2 SvRegister uint8 = 0x3 // Considered a MvDrop. SvComplete uint8 = 0x4 SvShutdown uint8 = 0x5 SvDrop uint8 = 0x6 )
ID entries that start with 'Sv*' will be handed directly by the underlying Session instead of being forwarded to the authoritative Mux.
These Packet ID values are used for network congestion and flow control and should not be used in standard Packet entries.
const RvResult uint8 = 0x14
RvResult is the generic value for indicating a result value. Packets that have this as their ID value will be forwarded to the authoritative Mux and will be discarded if it does not match an active Job ID.
Variables ¶
var ( // ErrNoHost is an error returned by the Connect and Listen functions when // the provided Profile does not provide a host string. ErrNoHost = xerr.Sub("empty or nil Host", 0x3F) // ErrNoConn is an error returned by the Load* functions when an attempt to // discover the parent host failed due to a timeout. ErrNoConn = xerr.Sub("other side did not come up", 0x40) // ErrInvalidProfile is an error returned by c2 functions when the Profile // given is nil. ErrInvalidProfile = xerr.Sub("empty or nil Profile", 0x41) )
var ( // ErrFullBuffer is returned from the WritePacket function when the send // buffer for the Session is full. // // This error also indicates that a call to 'Send' would block. ErrFullBuffer = xerr.Sub("send buffer is full", 0x4C) // ErrInvalidPacketCount is returned when attempting to read a packet marked // as multi or frag and the total count returned is zero. ErrInvalidPacketCount = xerr.Sub("frag/multi total is zero on a frag/multi packet", 0x4D) )
var ErrMalformedPacket = xerr.Sub("empty or nil Packet", 0x46)
ErrMalformedPacket is an error returned by various Packet reading functions when a Packet is attempted to be passed that is nil or invalid.
Invalid Packets are packets that do not have a proper ID value or contain an empty device ID.
var ErrNoTask = xerr.Sub("no Job created for client Session", 0x58)
ErrNoTask is returned from some functions that return Jobs. This will be returned when the Job object will be nil due to the fact the function was called on the client-side instead of the server-side.
This is more of an informational message than an error, as this does NOT indicate that the function failed, but that the Job object should NOT be used as it is nil. (In case the Job object is not checked.)
var ErrTooManyPackets = xerr.Sub("frag/multi count is larger than 0xFFFF", 0x56)
ErrTooManyPackets is an error returned by many of the Packet writing functions when attempts to combine Packets would create a Packet grouping size larger than the maximum size (65535/0xFFFF).
var ProfileParser func(b []byte) (cfg.Profile, error)
ProfileParser is a package level constant to be used when performing Profile loads from a raw binary source. This function will take the resulting byte array and Marshal it into a working Profile interface.
This function starts out as nil, which in case the "c2/cfg" binary profile parser will be used.
This is used to apply custom profiles to be used. Custom profiles can be Marshaled by exposing the 'MarshalBinary() ([]byte, error)' function.
Functions ¶
func Shoot ¶ added in v0.1.0
Shoot sends the packet with the specified data to the server and does NOT register the device with the Server.
This is used for spending specific data segments in single use connections.
func ShootContext ¶ added in v0.2.0
ShootContext sends the packet with the specified data to the server and does NOT register the device with the Server.
This is used for spending specific data segments in single use connections.
This function version allows for setting the Context used.
Types ¶
type Job ¶
type Job struct {
Start, Complete time.Time
Update func(*Job)
Result *com.Packet
Error string
ID, Frags, Current uint16
Type uint8
Status status
// contains filtered or unexported fields
}
Job is a struct that is used to track and manage Tasks given to Session Clients.
This struct has function callbacks that can be used to watch for completion and offers a Wait function to pause execution until a response is received.
This struct is always empty for implants.
func (*Job) Cancel ¶ added in v0.3.3
func (j *Job) Cancel()
Cancel will stop the current Job in-flight and will remove it from the Task queue. Any threads waiting on this Job will return once this function completes.
This does NOT prevent the client Session from running it, but will close out all receiving channels and any received data will be marked as an un-tracked Job.
This is the only method that results in a Status of Canceled.
func (*Job) IsDone ¶
IsDone returns true when the Job has received a response, has error out or was canceled. Use the Status field to determine the state of the Job.
func (*Job) IsError ¶
IsError returns true when the Job has received a response, but the response is an error.
func (*Job) MarshalJSON ¶ added in v0.0.6
MarshalJSON fulfils the JSON Marshaler interface.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is a struct that is passed back when a C2 Listener is added to the Server.
The Listener struct allows for controlling the Listener and setting callback functions to be used when a client connects, registers or disconnects.
func (*Listener) Address ¶ added in v0.0.6
Address returns the string representation of the address the Listener is bound to.
func (*Listener) Close ¶
Close stops the operation of the Listener and any Sessions that may be connected.
Resources used with this Listener will be freed up for reuse. This function blocks until the listener socket is closed.
func (*Listener) Done ¶ added in v0.2.0
func (l *Listener) Done() <-chan struct{}
Done returns a channel that's closed when this Listener is closed.
This can be used to monitor a Listener's status using a select statement.
func (*Listener) IsActive ¶
IsActive returns true if the Listener is still able to send and receive Packets.
func (*Listener) MarshalJSON ¶
MarshalJSON fulfils the JSON Marshaler interface.
func (*Listener) Replace ¶ added in v0.2.6
Replace allows for rebinding this Listener to another address or using another Profile without closing the Listener.
If the provided Profile is nil, the Listener will not change its profile.
The listening socket will be closed and the Listener will be paused and cannot accept any more connections before being reopened.
If the replacement fails, the Listener will be closed.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a struct that controls a Proxied connection between a client and a server and allows for packets to be routed through a current established Session.
func (*Proxy) Address ¶ added in v0.1.0
Address returns the string representation of the address the Listener is bound to.
func (*Proxy) Close ¶
Close stops the operation of the Proxy and any Sessions that may be connected.
Resources used with this Proxy will be freed up for reuse.
func (*Proxy) Done ¶ added in v0.2.0
func (p *Proxy) Done() <-chan struct{}
Done returns a channel that's closed when this Proxy is closed.
This can be used to monitor a Proxy's status using a select statement.
func (*Proxy) IsActive ¶
IsActive returns true if the Proxy is still able to send and receive Packets.
func (*Proxy) Replace ¶ added in v0.2.6
Replace allows for rebinding this Proxy to another address or using another Profile without closing the Proxy.
The listening socket will be closed and the Proxy will be paused and cannot accept any more connections before being reopened.
If the replacement fails, the Proxy will be closed.
type Server ¶
type Server struct { Oneshot func(*com.Packet) New func(*Session) Shutdown func(*Session) Keys data.KeyPair // contains filtered or unexported fields }
Server is the manager for all C2 Listener and Sessions connection and states. This struct also manages all events and connection changes.
func NewServer ¶
NewServer creates a new Server instance for managing C2 Listeners and Sessions.
If the supplied Log is nil, the 'logx.NOP' log will be used.
func NewServerContext ¶
NewServerContext creates a new Server instance for managing C2 Listeners and Sessions.
If the supplied Log is nil, the 'logx.NOP' log will be used.
This function will use the supplied Context as the base context for cancellation.
func (*Server) Close ¶
Close stops the processing thread from this Server and releases all associated resources.
This will signal the shutdown of all attached Listeners and Sessions.
func (*Server) Done ¶ added in v0.2.0
func (s *Server) Done() <-chan struct{}
Done returns a channel that's closed when this Server is closed.
This can be used to monitor a Server's status using a select statement.
func (*Server) Listen ¶
Listen adds the Listener under the name provided. A Listener struct to control and receive callback functions is added to assist in managing connections to this Listener.
func (*Server) ListenContext ¶ added in v0.1.0
func (s *Server) ListenContext(x context.Context, name, addr string, p cfg.Profile) (*Listener, error)
ListenContext adds the Listener under the name and address provided. A Listener struct to control and receive callback functions is added to assist in managing connections to this Listener.
This function version allows for overriding the Context passed to the Session.
func (*Server) Listener ¶ added in v0.0.6
Listener returns the lister with the provided name if it exists, nil otherwise.
func (*Server) Listeners ¶ added in v0.0.6
Listeners returns all the Listeners current active on this Server.
func (*Server) MarshalJSON ¶
MarshalJSON fulfils the JSON Marshaler interface.
func (*Server) Remove ¶ added in v0.2.6
Remove removes and closes the Session and releases all it's associated resources from this server instance.
If shutdown is false, this does not close the Session on the client's end and will just remove the entry, but can be re-added and if the client connects again.
If shutdown is true, this will trigger a Shutdown packet to be sent to close down the client and will wait until the client acknowledges the shutdown request before removing.
func (*Server) Session ¶ added in v0.0.6
Session returns the Session that matches the specified Device ID.
This function will return nil if no matching Device ID is found.
func (*Server) Sessions ¶ added in v0.2.6
Sessions returns an array of all the current Sessions connected to Listeners running on this Server instance.
type Session ¶
type Session struct { Last time.Time Created time.Time Receive func(*Session, *com.Packet) Shutdown func(*Session) Device device.Machine ID device.ID // contains filtered or unexported fields }
Session is a struct that represents a connection between the client and the Listener.
This struct does some automatic handling and acts as the communication channel between the client and server.
func Connect ¶
Connect creates a Session using the supplied Profile to connect to the listening server specified in the Profile.
A Session will be returned if the connection handshake succeeds, otherwise a connection-specific error will be returned.
func ConnectContext ¶ added in v0.1.0
ConnectContext creates a Session using the supplied Profile to connect to the listening server specified in the Profile.
A Session will be returned if the connection handshake succeeds, otherwise a connection-specific error will be returned.
This function version allows for setting the Context passed to the Session.
func Load ¶ added in v0.2.0
Load will attempt to find a Session in another process or thread that is pending Migration. This function will look on the Pipe name provided for the specified duration period.
If a Session is found, it is loaded and the provided log is used for the local Session log.
If a Session is not found, or errors, this function returns an error message or a timeout with a nil Session.
func LoadContext ¶ added in v0.2.0
LoadContext will attempt to find a Session in another process or thread that is pending Migration. This function will look on the Pipe name provided for the specified duration period.
If a Session is found, it is loaded and the provided log and Context are used for the local Session log and parent Context.
If a Session is not found, or errors, this function returns an error message or a timeout with a nil Session.
func LoadOrConnect ¶ added in v0.2.0
func LoadOrConnect(x context.Context, l logx.Log, n string, t time.Duration, p cfg.Profile) (*Session, error)
LoadOrConnect will attempt to find a Session in another process or thread that is pending Migration. This function will look on the Pipe name provided for the specified duration period.
If a Session is found, it is loaded and the provided log and Context are used for the local Session log and parent Context.
If a Session is not found or the Migration fails with an error, then this function creates a Session using the supplied Profile to connect to the listening server specified in the Profile.
A Session will be returned if the connection handshake succeeds, otherwise a connection-specific error will be returned.
func (*Session) Close ¶
Close stops the listening thread from this Session and releases all associated resources.
This function blocks until the running threads close completely.
func (*Session) Done ¶ added in v0.2.0
func (s *Session) Done() <-chan struct{}
Done returns a channel that's closed when this Session is closed.
This can be used to monitor a Session's status using a select statement.
func (*Session) InChannel ¶ added in v0.1.0
InChannel will return true is this Session sets the Channel flag on any Packets that flow through this Session, including Proxied clients or if this Session is currently in Channel mode, even if not explicitly set.
func (*Session) IsActive ¶
IsActive returns true if this Session is still able to send and receive Packets.
func (*Session) IsClient ¶
IsClient returns true when this Session is not associated to a Listener on this end, which signifies that this session is Client initiated, or we are on a client device.
func (*Session) IsClosed ¶ added in v0.2.0
IsClosed returns true if the Session is considered "Closed" and cannot send/receive Packets.
func (*Session) IsProxy ¶
IsProxy returns true when a Proxy has been attached to this Session and is active.
func (*Session) Jitter ¶
Jitter returns the Jitter percentage value. Values of zero (0) indicate that Jitter is disabled.
func (*Session) Job ¶ added in v0.0.6
Job returns a Job with the associated ID, if it exists. It returns nil otherwise.
func (*Session) Jobs ¶ added in v0.0.6
Jobs returns all current Jobs for this Session.
This returns nil if there are no Jobs or this Session does not have the ability to schedule them.
func (*Session) KillDate ¶ added in v0.4.4
KillDate returns the current KillDate of this Session. If there is no KillDate set, this function returns an empty 'time.Time' instance.
func (*Session) Listener ¶ added in v0.0.6
Listener will return the Listener that created the Session. This will return nil if the session is not on the server side.
func (*Session) MarshalJSON ¶
MarshalJSON fulfils the JSON Marshaler interface.
func (*Session) Migrate ¶ added in v0.2.0
Migrate will execute the provided runnable and will wait up to 60 seconds (can be changed using 'MigrateProfile') to transfer execution control to the new runnable using a Pipe connection with the name provided.
This function uses the Profile that was used to create this Session. This will fail if the Profile is not binary Marshalable.
If 'wait' is true, this will wait for all events to complete before starting the Migration process.
The provided JobID will be used to indicate to the server that the associated Migration Task was completed, as the new client will send a 'RvResult' with the associated JobID once Migration has completed successfully.
The return values for this function are the new PID used and any errors that may have occurred during Migration.
func (*Session) MigrateProfile ¶ added in v0.2.0
func (s *Session) MigrateProfile(wait bool, n string, b []byte, job uint16, t time.Duration, e runnable) (uint32, error)
MigrateProfile will execute the provided runnable and will wait up to the provided duration to transfer execution control to the new runnable using a Pipe connection with the name provided.
This function uses the provided profile bytes unless the byte slice is empty, then this will use the Profile that was used to create this Session. This will fail if the Profile is not binary Marshalable.
If 'wait' is true, this will wait for all events to complete before starting the Migration process.
The provided JobID will be used to indicate to the server that the associated Migration Task was completed, as the new client will send a 'RvResult' with the associated JobID once Migration has completed successfully.
The return values for this function are the new PID used and any errors that may have occurred during Migration.
func (*Session) NewProxy ¶ added in v0.2.6
NewProxy establishes a new listening Proxy connection using the supplied Profile name and bind address that will send any received Packets "upstream" via the current Session.
Packets destined for hosts connected to this proxy will be routed back and forth on this Session.
This function will return an error if this is not a client Session or listening fails.
func (*Session) Packets ¶
Packets will create and set up the Packet receiver channel. This function will then return the read-only Packet channel for use.
This function is safe to use multiple times as it will return the same chan if it already exists.
func (*Session) Proxy ¶
Proxy returns the current Proxy (if enabled). This function take a name argument that is a string that specifies the Proxy name.
By default, the name is ignored as multiproxy support is disabled.
When proxy support is disabled, this always returns nil.
func (*Session) Read ¶
Read attempts to grab a Packet from the receiving buffer.
This function returns nil if the buffer is empty.
func (*Session) RemoteAddr ¶
RemoteAddr returns a string representation of the remotely connected IP address.
This could be the IP address of the c2 server or the public IP of the client.
func (*Session) Send ¶
Send adds the supplied Packet into the stack to be sent to the server on next wake. This call is asynchronous and returns immediately.
Unlike 'Write' this function does NOT return an error and will wait if the send buffer is full.
func (*Session) SetChannel ¶
SetChannel will disable setting the Channel mode of this Session.
If true, every Packet sent will trigger Channel mode. This setting does NOT affect the Session enabling Channel mode if a Packet is sent with the Channel Flag enabled.
Changes to this setting will call the 'Wake' function.
func (*Session) SetDuration ¶
SetDuration sets the wake interval period and Jitter for this Session. This is the time value between connections to the C2 Server.
Jitter is a 0 to 100 percentage (inclusive) that will determine any +/- time is added to the waiting period. This assists in evading IDS/NDS devices/systems.
A value of 0 will disable Jitter and any value over 100 will set the value to 100, which represents using Jitter 100% of the time.
If this is a Server-side Session, the new value will be sent to the Client in a MvTime Packet.
func (*Session) SetJitter ¶
SetJitter sets Jitter percentage of the Session's wake interval. This is a 0 to 100 percentage (inclusive) that will determine any +/- time is added to the waiting period. This assists in evading IDS/NDS devices/systems.
A value of 0 will disable Jitter and any value over 100 will set the value to 100, which represents using Jitter 100% of the time.
If this is a Server-side Session, the new value will be sent to the Client in a MvTime Packet.
func (*Session) SetKillDate ¶ added in v0.4.4
SetKillDate sets the KillDate for this Session. This is a setting that controls the date when this Session will shutdown automatically.
Use the WorkHours functions to create one or do it manually. If a nil value is passed (or an empty WorkHours) this will clear the current WorkHours setting.
Changing the WorkHours when there perviously was a non-nil setting will wake the Session if it's sleeping.
If this is a Server-side Session, the new value will be sent to the Client in a MvTime Packet.
func (*Session) SetProfile ¶ added in v0.2.0
SetProfile will set the Profile used by this Session. This function will ensure that the profile is marshalable before setting and will then pass it to be set by the client Session (if this isn't one already).
If this is a server-side Session, this will trigger the sending of a MvProfile Packet to update the client-side instance, which will update on it's next wakeup cycle.
If this is a client-side session the error 'ErrNoTask' will be returned AFTER setting the Profile and indicates that no Packet will be sent and that the Job object result is nil.
func (*Session) SetProfileBytes ¶ added in v0.2.0
SetProfileBytes will set the Profile used by this Session. This function will unmarshal and set the server-side before setting and will then pass it to be set by the client Session (if this isn't one already).
If this is a server-side Session, this will trigger the sending of a MvProfile Packet to update the client-side instance, which will update on it's next wakeup cycle.
This function will fail if no ProfileParser is set.
If this is a client-side session the error 'ErrNoTask' will be returned AFTER setting the Profile and indicates that no Packet will be sent and that the Job object result is nil.
func (*Session) SetSleep ¶
SetSleep sets the wake interval period for this Session. This is the time value between connections to the C2 Server.
If this is a Server-side Session, the new value will be sent to the Client in a MvTime Packet. This setting does not affect Jitter.
func (*Session) SetWorkHours ¶ added in v0.4.4
SetWorkHours sets the WorkingHours for this Session. This is a setting that controls WHEN the Session will talk to the C2 Server.
Use the WorkHours functions to create one or do it manually. If a nil value is passed (or an empty WorkHours) this will clear the current WorkHours setting.
Changing the WorkHours when there perviously was a non-nil setting will wake the Session if it's sleeping.
If this is a Server-side Session, the new value will be sent to the Client in a MvTime Packet.
func (*Session) Spawn ¶ added in v0.2.0
Spawn will execute the provided runnable and will wait up to the provided duration to transfer profile and Session information to the new runnable using a Pipe connection with the name provided. Once complete, and additional copy of this Session (with a different ID) will exist.
This function uses the Profile that was used to create this Session. This will fail if the Profile is not binary Marshalable.
The return values for this function are the new PID used and any errors that may have occurred during the Spawn.
func (*Session) SpawnProfile ¶ added in v0.2.0
SpawnProfile will execute the provided runnable and will wait up to the provided duration to transfer profile and Session information to the new runnable using a Pipe connection with the name provided. Once complete, and additional copy of this Session (with a different ID) will exist.
This function uses the provided profile bytes unless the byte slice is empty, then this will use the Profile that was used to create this Session. This will fail if the Profile is not binary Marshalable.
The return values for this function are the new PID used and any errors that may have occurred during the Spawn.
func (*Session) Task ¶ added in v0.1.0
Task is a function that will attach a JobID to the specified Packet (if empty) and wil return a Job promise that can be used to internally keep track of a response Packet with a matching Job ID.
Errors will be returned if Task is attempted on an invalid Packet, this Session is a client-side Session, Job ID is already used or the scheduler is full.
func (*Session) Tasklet ¶ added in v0.2.0
Tasklet is a function similar to Task and will attach a JobID to the specified Packet created by the supplied Tasklet and wil return a Job promise that can be used to internally keep track of a response Packet with a matching Job ID.
If the Tasklet has an issue generating the payload, it will return an error before scheduling.
Errors will be returned if Task is attempted on an invalid Packet, this Session is a client-side Session, Job ID is already or the scheduler is full.
func (*Session) Wait ¶
func (s *Session) Wait()
Wait will block until the current Session is closed and shutdown.
func (*Session) Wake ¶
func (s *Session) Wake()
Wake will interrupt the sleep of the current Session thread. This will trigger the send and receive functions of this Session.
This is not valid for Server side Sessions.
Notes ¶
Bugs ¶
Is this a leak?
I don't think so, but let's keep track of it.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cfg is used to generate Binary versions of C2 Profiles and can be used to create automatic Profile 'Groups' with multiple communication and encoding types to be used by a Single session.
|
Package cfg is used to generate Binary versions of C2 Profiles and can be used to create automatic Profile 'Groups' with multiple communication and encoding types to be used by a Single session. |
Package cout is a simple log handling solution for the c2 package.
|
Package cout is a simple log handling solution for the c2 package. |
Package task is a simple collection of Task based functions that cane be tasked to Sessions by the Server.
|
Package task is a simple collection of Task based functions that cane be tasked to Sessions by the Server. |
result
Package result contains many helper functions to gather matching output from Job result packets.
|
Package result contains many helper functions to gather matching output from Job result packets. |
Package transform contains built-in implementations of the 'c2.Transform' interface, which can be used to manupilate data that is passed between Sessions and C2 Servers.
|
Package transform contains built-in implementations of the 'c2.Transform' interface, which can be used to manupilate data that is passed between Sessions and C2 Servers. |
Package wrapper contains built-in implementations of the 'c2.Wrapper' interface, which can be used to wrap or encode data that is passed between Sessions and C2 Servers.
|
Package wrapper contains built-in implementations of the 'c2.Wrapper' interface, which can be used to wrap or encode data that is passed between Sessions and C2 Servers. |