Documentation
¶
Overview ¶
The channel package is the container for first-party framework C2 structures and variables, it holds the internal settings for multiple types of C2s. It is also passed to other external C2 components in order to support extracting components such as lhost and lport.
Index ¶
- type Channel
- func (c *Channel) AddSession(conn *net.Conn, addr string) bool
- func (c *Channel) GetSessionIDByConn(conn net.Conn) (string, bool)
- func (c *Channel) HasSessions() bool
- func (c *Channel) RemoveSession(id string) bool
- func (c *Channel) RemoveSessions() bool
- func (c *Channel) UpdateLastSeenByConn(conn net.Conn, timeStamp time.Time) bool
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { IPAddr string HTTPAddr string Port int HTTPPort int Timeout int IsClient bool Shutdown *atomic.Bool Sessions map[string]Session Input io.Reader Output io.Writer // Currently unused but figured we'd add it ahead of time }
func (*Channel) AddSession ¶ added in v1.43.0
AddSession adds a remote connection for session tracking. If a network connection is being tracked it can be added here and will be cleaned up and closed automatically by the C2 on shutdown.
func (*Channel) GetSessionIDByConn ¶ added in v1.48.0
Returns the session ID that contains a given connection
func (*Channel) HasSessions ¶ added in v1.43.0
HasSessions checks if a channel has any tracked sessions. This can be used to lookup if a C2 successfully received callbacks:
c, ok := c2.GetInstance(conf.C2Type) c.Channel().HasSessions()
func (*Channel) RemoveSession ¶ added in v1.43.0
RemoveSession removes a specific session ID and if a connection exists, closes it.
func (*Channel) RemoveSessions ¶ added in v1.43.0
RemoveSessions removes all tracked sessions and closes any open connections if applicable.