Documentation ¶
Index ¶
- Constants
- Variables
- func Oneshot(a string, c client, p *Profile, d *com.Packet) error
- func OneshotQuick(a string, c client, d *com.Packet) error
- func Task(t task.Tasker, s *Session, p *com.Packet)
- type Config
- func (c Config) Add(s Setting) Config
- func (c Config) Len() int
- func (c Config) MarshalStream(w data.Writer) error
- func (c Config) Profile() (*Profile, error)
- func (c *Config) Read(r io.Reader) error
- func (c Config) String() string
- func (c *Config) UnmarshalStream(r data.Reader) error
- func (c Config) Write(w io.Writer) error
- type ConnectFunc
- type Job
- type Listener
- func (l *Listener) Close() error
- func (l *Listener) Connected() []*Session
- func (l *Listener) Context() context.Context
- func (l Listener) IsActive() bool
- func (l *Listener) MarshalJSON() ([]byte, error)
- func (l *Listener) Remove(i device.ID)
- func (l *Listener) Session(i device.ID) *Session
- func (l *Listener) Shutdown(i device.ID)
- func (l *Listener) String() string
- func (l *Listener) Wait()
- type ListenerFunc
- type MultiWrapper
- type Mux
- type MuxFunc
- type Profile
- type Proxy
- type Scheduler
- type Server
- func (s *Server) Close() error
- func (s *Server) Connect(a string, c client, p *Profile) (*Session, error)
- func (s *Server) ConnectQuick(a string, c client) (*Session, error)
- func (s *Server) ConnectWith(a string, c client, p *Profile, d *com.Packet) (*Session, error)
- func (s *Server) Connected() []*Session
- func (s *Server) EnableRPC(a string) error
- func (s *Server) IsActive() bool
- func (s *Server) Listen(n, b string, c listener, p *Profile) (*Listener, error)
- func (s *Server) MarshalJSON() ([]byte, error)
- func (s *Server) Oneshot(a string, c client, p *Profile, d *com.Packet) error
- func (s *Server) OneshotQuick(a string, c client, d *com.Packet) error
- func (s *Server) Wait()
- type Session
- func (s *Session) Close() error
- func (s *Session) Context() context.Context
- func (s Session) IsActive() bool
- func (s Session) IsChannel() bool
- func (s Session) IsClient() bool
- func (s Session) IsProxy() bool
- func (s Session) Jitter() uint8
- func (s Session) MarshalJSON() ([]byte, error)
- func (s *Session) Next() *com.Packet
- func (s *Session) Packets() <-chan *com.Packet
- func (s *Session) Proxy(b string, c listener, p *Profile) (*Proxy, error)
- func (s *Session) Read() *com.Packet
- func (s Session) RemoteAddr() string
- func (s *Session) Schedule(p *com.Packet) (*Job, error)
- func (s *Session) Send(p *com.Packet)
- func (s *Session) SetChannel(c bool)
- func (s *Session) SetDuration(t time.Duration, j int)
- func (s *Session) SetJitter(j int)
- func (s *Session) SetSleep(t time.Duration)
- func (s Session) String() string
- func (s Session) Time() time.Duration
- func (s *Session) Wait()
- func (s *Session) Wake()
- func (s *Session) Write(p *com.Packet) error
- type Setting
- func ConnectIP(p uint) Setting
- func ConnectWC2(url, agent, host string) Setting
- func Jitter(n uint) Setting
- func Size(n uint) Setting
- func Sleep(t time.Duration) Setting
- func TransformBase64Shift(s int) Setting
- func TransformDNS(n ...string) Setting
- func WrapAES(k, iv []byte) Setting
- func WrapCBK(a, b, c, d byte) Setting
- func WrapCBKSize(s, a, b, c, d byte) Setting
- func WrapGzipLevel(l int) Setting
- func WrapXOR(k []byte) Setting
- func WrapZlibLevel(l int) Setting
- type Transform
- type Wrapper
Constants ¶
const ( // DefaultSleep is the default sleep Time when the provided sleep value is empty or negative. DefaultSleep = time.Duration(60) * time.Second // DefaultJitter is the default Jitter value when the provided jitter value is negative. DefaultJitter uint8 = 5 )
const ( Waiting status = 0 Accepted status = iota Completed Error )
These are status values that indicate the general status of the Job.
const ( MvInvalid uint8 = 0x00 MvNop uint8 = 0x01 MvHello uint8 = 0x02 MvError uint8 = 0x07 MvSpawn uint8 = 0x11 MvProxy uint8 = 0x12 MvResult uint8 = 0x14 MvUpdate uint8 = 0x06 MvRegister uint8 = 0x03 MvComplete uint8 = 0x04 MvShutdown uint8 = 0x05 MvMultiple uint8 = 0x13 )
Message ID Values are a byte value from 0 to 255 (uint8).
This value will assist in determining the action of the specified value. Values under 20 (<20) are considered system ID values and are used for controlling the Client session and invoking system specific functions. System functions are handled directly by the Session thread to prevent any lagtime during processing. Many system functions do not have a return.
Custom Message ID Values are defined in the "task" package.
Message ID Value Mappings
MvInvalid - 0: Invalid ID value. This value is always zero and is used to detect corrupted or invalid data. MvNop - 1: Instructs the server or client to wait until the next wakeup as there is no data to return. MvHello - 2: Initial ID value to send to the server as a client to begin the registration process. By design, this
Packet should contain the device information struct.
MvError - 7: Used to inform that the Job ID that this Packet contains resulted in an error. By design, this Packet
should contain a string value that describes the error.
MvSpawn - 17: Instructs the client Session to spawn a separate and independent Session from the current one. By design,
this Packet payload should include an address to connect to and an optional Profile struct. If the Profile struct is not provided, the new Session will use the current Profile.
MvProxy - 18: Instructs the client to open a new Listener to proxy traffic from other clients to the server. By design,
the Packet payload should include a listening address and a Profile struct. These options will specify the listening Proxy type and Profile used.
MvResult - 20: The first non-system ID value. This is used to respond to any Tasks issued with the payload of the
Packet containing the Task result output.
MvUpdate - 6: Instructs the client to update it's time/jitter settings from the server. This Packet should contain
an uint8 (jitter) and a uint64 (sleep) in the payload. This has no effect on the server.
MvRegister - 3: Sent by the server to a client when a client attempts to communicate to a server that it has not
previously registered with. By design, the client should re-invoke the MvHello packet with the device information to establish a proper connection to the target server.
MvComplete - 4: Response by the server when a client issues a MvHello packet. This indicates that registration is
successful and the client may start the standard communication protocol.
MvShutdown - 5: Indicates shutdown by the server or client. If sent by the client, the server will remove the client
Session from its database on the next cycle. If sent by the server, this instructs the client process to stop working and perform cleanup functions.
MvMultiple - 19: Indicates that the Packet payload contains multiple separate Packets. This also indicates to the Packet
reader that the Frag settings on the Packet should be read as Multi-Packet length and size values instead.
Variables ¶
var ( // WrapHex is a Setting that enables the Hex Wrapper for the generated Profile. WrapHex = Setting{hexID} // WrapZlib is a Setting that enables the ZLIB Wrapper for the generated Profile. WrapZlib = Setting{zlibID} // WrapGzip is a Setting that enables the GZIP Wrapper for the generated Profile. WrapGzip = Setting{gzipID} // WrapBase64 is a Setting that enables the Base64 Wrapper for the generated Profile. WrapBase64 = Setting{base64ID} // ConnectTCP will provide a TCP connection 'hint' to the generated Profile. Hints will suggest the connection // type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. If multiple // connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. ConnectTCP = Setting{tcpID} // ConnectTLS will provide a TLS over TCP connection 'hint' to the generated Profile. Hints will suggest the // connection type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. // If multiple connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. This hint // cannot be used as a Listener. ConnectTLS = Setting{tlsID} // ConnectUDP will provide a UCO connection 'hint' to the generated Profile. Hints will suggest the connection // type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. If multiple // connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. ConnectUDP = Setting{udpID} // ConnectICMP will provide a ICMP connection 'hint' to the generated Profile. Hints will suggest the connection // type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. If multiple // connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. ConnectICMP = Setting{ipID, 1} // ConnectTLSNoVerify will provide a TLS over TCP connection 'hint' to the generated Profile. Hints will suggest // the connection type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. // If multiple connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. This setting // DOES NOT check the server certificate for validity. This hint cannot be used as a Listener. ConnectTLSNoVerify = Setting{tlsID, 1} // DefaultProfile is an simple profile for use with testing or filling without having to define all the // profile properties. DefaultProfile = &Profile{Size: uint(limits.MediumLimit()), Sleep: DefaultSleep, Jitter: uint(DefaultJitter)} // TransformBase64 is a Setting that enables the Base64 Transform for the generated Profile. TransformBase64 = Setting{base64TID} // ErrMultipleHints is an error returned by the 'Profile' function if more that one Connection Hint Setting is // attempted to be applied by the Config. ErrMultipleHints = xerr.New("config attempted to add multiple transforms") // ErrInvalidSetting is an error returned by the 'Profile' function if any of the specified Settings are invalid // or do contain valid information. The error returned will be a wrapped version of this error. ErrInvalidSetting = xerr.New("config setting is invalid") // ErrMultipleTransforms is an error returned by the 'Profile' function if more that one Transform Setting is // attempted to be applied by the Config. Unlink Wrappers, Transforms cannot be stacked. ErrMultipleTransforms = xerr.New("config attempted to add multiple transforms") )
var ( // Default is the default Server instance. This can be used to directly use a client without having to // setup a Server instance first. This instance will use the 'NOP' logger, as logging is not needed. Default = NewServerContext(context.Background(), logx.NOP) // ErrNoConnector is a error returned by the Connect and Listen functions when the Connector is nil and the // provided Profile is also nil or does not contain a connection hint. ErrNoConnector = xerr.New("invalid or missing connector") // ErrEmptyPacket is a error returned by the Connect function when the expected return result from the // server was invalid or not expected. ErrEmptyPacket = xerr.New("server sent an invalid response") )
var ( // ErrUnable is an error returned for a generic action if there is some condition that prevents the action // from running. ErrUnable = xerr.New("cannot preform this action") // ErrFullBuffer is returned from the WritePacket function when the send buffer for Session is full. ErrFullBuffer = xerr.New("cannot add a Packet to a full send buffer") )
var DefaultClientMux = MuxFunc(defaultClientMux)
DefaultClientMux is the default Session Mux instance that handles the default C2 server and client functions. This operates cleanly with the default Server Mux instance.
var ErrCannotAssign = xerr.New("unable to assign a unused JobID (is Scheduler full?)")
ErrCannotAssign is an error returned by the 'Schedule' function when the random loop cannot find a valid JobID (unused). This may occur in random circumstances when the Scheduler is overused.
var ErrInvalidPacketCount = xerr.New("frag total is zero on a multi or frag packet")
ErrInvalidPacketCount is returned when attempting to read a packet marked as multi or frag an the total count returned is zero.
Functions ¶
func Oneshot ¶
Oneshot 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 uses the Default Server instance.
func OneshotQuick ¶
OneshotQuick 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. The '*Quick' functions infers the default Profile. This function uses the Default Server instance.
func Task ¶
Task will execute the provided Tasker with the provided Packet as the data input. The Session will be used to return the results to and will supply the context to run in. This function may return instantly if the Task is thread oriented, but will send the results after completion or error without further interaction.
Types ¶
type Config ¶
type Config []Setting
Config is an array of settings that can be transformed into a valid C2 Profile. This alias also allows for reading/writing the settings from/into a Reader/Writer stream.
func (Config) Add ¶
Add will append the specified Setting to the end of this Config array. This function also returns the Config array for convenience and easy chained use.
func (Config) MarshalStream ¶
MarshalStream transforms this Config into a binary format and writes to the supplied data.Writer.
func (Config) Profile ¶
Profile attempts to build a C2 Profile based on the Settings contained in this Config. This function will return 'ErrInvalidSetting' if any of the Settings contain invalid values, 'ErrMultipleTransforms' if multiple Transforms are contained in this Config or 'ErrMultipleHints' if multiple connection hints are contained in this Config.
func (*Config) UnmarshalStream ¶
UnmarshalStream transforms this Config from a binary format that is read from the supplied data.Reader.
type ConnectFunc ¶
ConnectFunc is a wrapper alias that will fulfil the client interface and allow using a single function instead of creating a struct to create connections. This can be used in all Server 'Connect' function calls.
type Job ¶
type Job struct {
Start, Complete time.Time
Result *com.Packet
Session *Session
Update func(*Job)
Error string
ID 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 also offers a Wait function to pause execution until a response is received.
type Listener ¶
type Listener struct {
New, Connect func(*Session)
Oneshot func(*com.Packet)
Receive func(*Session, *com.Packet)
// 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 Listen ¶
Listen adds the Listener under the name provided. A Listener struct to control and receive callback functions is added to assist in manageing connections to this Listener. This function uses the Default Server instance.
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) Connected ¶
Connected returns an array of all the current Sessions connected to this Listener.
func (*Listener) Context ¶
Context returns the current Listener's context. This function can be useful for canceling running processes when this Listener closes.
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) Remove ¶
Remove removes and closes the Session and releases all it's associated resources. This does not close the Session on the client's end, use the Shutdown function to properly shutdown the client process.
func (*Listener) Session ¶
Session returns the Session that matches the specified Device ID. This function will return nil if no matching Device ID is found.
func (*Listener) Shutdown ¶
Shutdown triggers a remote Shutdown and closure of the Session associated with the Device ID. This will not immediately close a Session. The Session will be removed when the Client acknowledges the shutdown request.
type ListenerFunc ¶
ListenerFunc is a wrapper alias that will fulfil the listener interface and allow using a single function instead of creating a struct to create listeners. This can be used in all Server 'Listen' function calls.
type MultiWrapper ¶
type MultiWrapper []Wrapper
MultiWrapper is an alias for an array of Wrappers. This will preform the wrapper/unwrapping operations in the order of the array. This is automatically created by a Config instance when multiple Wrappers are present.
func (MultiWrapper) Unwrap ¶
func (m MultiWrapper) Unwrap(r io.ReadCloser) (io.ReadCloser, error)
Unwrap satisfies the Wrapper interface.
func (MultiWrapper) Wrap ¶
func (m MultiWrapper) Wrap(w io.WriteCloser) (io.WriteCloser, error)
Wrap satisfies the Wrapper interface.
type MuxFunc ¶
MuxFunc is the definition of a Mux Handler func. Once wrapped as a 'MuxFunc', these function aliases can be also used in place of the Mux interface.
type Profile ¶
type Profile struct { Wrapper Wrapper Transform Transform Size uint Sleep time.Duration Jitter uint // contains filtered or unexported fields }
Profile is a struct that represents a C2 profile. This is used for defining the specifics that will be used to listen by servers and for connections by clients. Nil or empty values will be replaced with defaults.
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) 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.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is a handler that can manage and schedule Packets as Jobs to be sent to a Session and tracked. The resulting output (or errors) can be tracked by the resulting Job structs.
func (*Scheduler) Handle ¶
Handle is the function that inherits the Mux interface. This is used to find and redirect received Jobs. This Mux is rarely used in Sessions.
type Server ¶
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 cancelation.
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) Connect ¶
Connect creates a Session using the supplied Profile to connect to the listening server specified. A Session will be returned if the connection handshake succeeds.
func (*Server) ConnectQuick ¶
ConnectQuick creates a Session using the supplied Profile to connect to the listening server specified. A Session will be returned if the connection handshake succeeds. The '*Quick' functions infers the default Profile.
func (*Server) ConnectWith ¶
ConnectWith creates a Session using the supplied Profile to connect to the listening server specified. This function allows for passing the data Packet specified to the server with the initial registration. The data will be passed on normally.
func (*Server) Connected ¶
Connected returns an array of all the current Sessions connected to Listeners connected to this Server.
func (*Server) EnableRPC ¶
EnableRPC will enable the JSON RPC listener at the following address. The RPC listener can be used to instruct and control the Server, as well as view Session information. An error may be returned if the current listening address is in use.
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 manageing connections to this Listener.
func (*Server) MarshalJSON ¶
MarshalJSON fulfils the JSON Marshaler interface.
func (*Server) Oneshot ¶
Oneshot 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 (*Server) OneshotQuick ¶
OneshotQuick 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. The '*Quick' functions infers the default Profile.
type Session ¶
type Session struct {
Last, Created time.Time
Shutdown func(*Session)
Receive func(*Session, *com.Packet)
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 handeling 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. A Session will be returned if the connection handshake succeeds. This function uses the Default Server instance.
func ConnectQuick ¶
ConnectQuick creates a Session using the supplied Profile to connect to the listening server specified. A Session will be returned if the connection handshake succeeds. The '*Quick' functions infers the default Profile. This function uses the Default Server instance.
func ConnectWith ¶
ConnectWith creates a Session using the supplied Profile to connect to the listening server specified. This function allows for passing the data Packet specified to the server with the initial registration. The data will be passed on normally. This function uses the Default Server instance.
func (*Session) Close ¶
Close stops the listening thread from this Session and releases all associated resources.
func (*Session) Context ¶
Context returns the current Session's context. This function can be useful for canceling running processes when this Session closes.
func (Session) IsActive ¶
IsActive returns true if this Session is still able to send and receive Packets.
func (Session) IsChannel ¶
IsChannel will return true is this Session sets the Channel flag on any Packets that flow this this Session, including Proxied clients or if this Session is currently in Channel mode, even if not explicitly set.
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.
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) MarshalJSON ¶
MarshalJSON fulfils the JSON Marshaler interface.
func (*Session) Next ¶
Next attempts to grab a Packet from the receiving buffer. This function will wait for a Packet while the buffer is empty.
func (*Session) Packets ¶
Packets returns a receive only channel that can be used in a for loop for acting on Packets when they arrive without using the Receive function.
func (*Session) Proxy ¶
Proxy establishes a new listening Proxy connection using the supplied listener 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 a wrapped 'ErrUnable' if this is not a client Session.
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) Schedule ¶
Schedule is a quick alias for the 'Server.Scheduler.Schedule' function that uses this current Session in the Session parameter. This function will return a wrapped 'ErrUnable' error if this is a client Session.
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. Channel is NOT supported by non-statefull connections (UDP/Web/ICMP, etc).
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. This does NOT apply to channels. 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 MvUpdate 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 MvUpdate Packet.
func (*Session) SetSleep ¶
SetSleep sets the wake interval period for this Session. This is the time value between connections to the C2 Server. This does NOT apply to channels. If this is a Server-side Session, the new value will be sent to the Client in a MvUpdate Packet. This setting does not affect Jitter.
func (*Session) Wait ¶
func (s *Session) Wait()
Wait will block until the current Session is closed and shutdown.
type Setting ¶
type Setting []byte
Setting is an alias for a byte array that represents a setting in binary form. This can be used inside a Config alias to generate a C2 Profile from binary data or write a Profile to a binary stream.
func ConnectIP ¶
ConnectIP will provide a IP connection 'hint' to the generated Profile with the specified protocol number. Hints will suggest the connection type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. If multiple connection hints are contained in a Config, a 'ErrMultipleHints' will be returned.
func ConnectWC2 ¶
ConnectWC2 will provide a WebC2 connection 'hint' to the generated Profile with the specified User-Agent, URL and Host Matcher strings (strings can be empty). Hints will suggest the connection type used if the connection setting in the 'Connect*', 'Oneshot' or 'Listen' functions is nil. If multiple connection hints are contained in a Config, a 'ErrMultipleHints' will be returned. This hint cannot be used as a Listener.
func Jitter ¶
Jitter returns a Setting that will specify the Jitter setting of the generated Profile. Only Jitter values from zero to one-hundred are valid. Other values are ignored and replaced with the default.
func Size ¶
Size returns a Setting that will specify the buffer size of the generated Profile. Only sizes greater than zero are valid sizes. Otherwise the medium limit setting is used.
func Sleep ¶
Sleep returns a Setting that will specify the Sleep timeout setting of the generated Profile. Values of zero are ignored.
func TransformBase64Shift ¶
TransformBase64Shift returns a Setting that will apply the Base64 Shift Transform to the generated Profile. The specified number will be the shift index of the Transform. If a Transform Setting is already contained in the parent Config, a 'ErrMultipleTransforms' error will be returned when the 'Profile' function is called.
func TransformDNS ¶
TransformDNS returns a Setting that will apply the DNS Transform to the generated Profile. If any DNS Domains are specified, they will be used in the Transform. If a Transform Setting is already contained in the parent Config, a 'ErrMultipleTransforms' error will be returned when the 'Profile' function is called.
func WrapAES ¶
WrapAES returns a Setting that will apply the AES Wrapper to the generated Profile. The specified key and IV will be the AES Key and IV used.
func WrapCBK ¶
WrapCBK returns a Setting that will apply the CBK Wrapper to the generated Profile. The specified ABC and Type values are the CBK letters used. To specify the CBK buffer size, use the 'WrapCBKSize' function instead.
func WrapCBKSize ¶
WrapCBKSize returns a Setting that will apply the CBK Wrapper to the generated Profile. The specified size, ABC and Type values are the CBK size and letters used.
func WrapGzipLevel ¶
WrapGzipLevel returns a Setting that will apply the Gzip Wrapper to the generated Profile. The specified level will determine the compression level. The 'Profile' function will return an 'ErrInvalidSetting' error if the compression level is invalid.
func WrapXOR ¶
WrapXOR returns a Setting that will apply the XOR Wrapper to the generated Profile. The specified key will be the XOR key used.
func WrapZlibLevel ¶
WrapZlibLevel returns a Setting that will apply the Zlib Wrapper to the generated Profile. The specified level will determine the compression level. The 'Profile' function will return an 'ErrInvalidSetting' error if the compression level is invalid.
type Transform ¶
Transform is an interface that can modify the data BEFORE it is written or AFTER is read from a Connection. Transforms may be used to mask and unmask communications as benign protocols such as DNS, FTP or HTTP.
type Wrapper ¶
type Wrapper interface { Wrap(io.WriteCloser) (io.WriteCloser, error) Unwrap(io.ReadCloser) (io.ReadCloser, error) }
Wrapper is an interface that wraps the binary streams into separate stream types. This allows for using encryption or compression (or both!).