Documentation ¶
Overview ¶
Package ssh defines chunk types for recordings of the ssh protocol.
Index ¶
- Constants
- func DecodeChunk(_ context.Context, bc *bsr.BaseChunk, data []byte) (bsr.Chunk, error)
- func ValidExecApplicationProgram(d ExecApplicationProgram) bool
- func ValidSessionProgram(d SessionProgram) bool
- type BreakRequest
- type CancelTCPIPForwardRequest
- type ChannelSummary
- type DataChunk
- type DirectTCPIPRequest
- type EnvRequest
- type ExecApplicationProgram
- type ExecRequest
- type ExitSignalRequest
- type ExitStatusRequest
- type FileTransferDirection
- type ForwardedTCPIPRequest
- type OpenChannelError
- type PtyRequest
- type SessionProgram
- type SessionRequest
- type ShellRequest
- type SignalRequest
- type SubsystemRequest
- type TCPIPForwardRequest
- type UnknownRequest
- type WindowChangeRequest
- type X11ForwardingRequest
- type X11Request
- type XonXoffRequest
Constants ¶
const ( // Protocol is used to identify chunks that are recorded from SSH. Protocol bsr.Protocol = "BSSH" // MaxPacketSize is used by the DataWriter to determine if SSH data should // be broken into multiple chunks. MaxPacketSize = 256 * 1024 )
const ( DataChunkType bsr.ChunkType = "DATA" BreakReqChunkType bsr.ChunkType = "BREK" CancelTCPIPForwardReqChunkType bsr.ChunkType = "CTPF" DirectTCPIPReqChunkType bsr.ChunkType = "DTCP" EnvReqChunkType bsr.ChunkType = "ENVR" ExecReqChunkType bsr.ChunkType = "EXEC" ExitSignalReqChunkType bsr.ChunkType = "EXSG" ExitStatusReqChunkType bsr.ChunkType = "EXST" ForwardedTCPIPReqChunkType bsr.ChunkType = "FTCP" PtyReqChunkType bsr.ChunkType = "PTYR" SessionReqChunkType bsr.ChunkType = "SESS" ShellReqChunkType bsr.ChunkType = "SHLL" SignalReqChunkType bsr.ChunkType = "SGNL" SubsystemReqChunkType bsr.ChunkType = "SUBS" TCPIPForwardReqChunkType bsr.ChunkType = "TCPF" UnknownReqChunkType bsr.ChunkType = "UNKR" WindowChangeReqChunkType bsr.ChunkType = "WCHG" X11ForwardingReqChunkType bsr.ChunkType = "X11F" X11ReqChunkType bsr.ChunkType = "X11R" XonXoffReqChunkType bsr.ChunkType = "XOXO" )
Chunk types
const BreakRequestType = "break"
const CancelTCPIPForwardRequestType = "cancel-tcpip-forward"
const DirectTCPIPRequestType = "direct-tcpip"
const EnvRequestType = "env"
const ExecRequestType = "exec"
const ExitSignalRequestType = "exit-signal"
const ExitStatusRequestType = "exit-status"
const ForwardedTCPIPRequestType = "forwarded-tcpip"
const PtyRequestType = "pty-req"
const SessionRequestType = "session"
const ShellRequestType = "shell"
const SignalRequestType = "signal"
const SubsystemRequestType = "subsystem"
const TCPIPForwardRequestType = "tcpip-forward"
const WindowChangeRequestType = "window-change"
const X11ForwardingRequestType = "x11-req"
const X11RequestType = "x11"
const XonXoffRequestType = "xon-xoff"
Variables ¶
This section is empty.
Functions ¶
func DecodeChunk ¶
DecodeChunk will decode any known SSH Chunk type. If the chunk type is not an ssh chunk type, and error is returned.
func ValidExecApplicationProgram ¶
func ValidExecApplicationProgram(d ExecApplicationProgram) bool
ValidExecApplicationProgram checks if a given ExecApplicationProgram is valid.
func ValidSessionProgram ¶
func ValidSessionProgram(d SessionProgram) bool
ValidSessionProgram checks if a given SessionProgram is valid.
Types ¶
type BreakRequest ¶
type BreakRequest struct { *bsr.BaseChunk *pssh.BreakRequest }
BreakRequest is a chunk to contain data for an SSH Break request
func NewBreakRequest ¶
func NewBreakRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*BreakRequest, error)
NewBreakRequest creates a BreakRequest chunk
func (*BreakRequest) MarshalData ¶
func (r *BreakRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes a BreakRequest chunk
type CancelTCPIPForwardRequest ¶
type CancelTCPIPForwardRequest struct { *bsr.BaseChunk *pssh.CancelTCPIPForwardRequest }
CancelTCPIPForwardRequest is a chunk to contain data for an SSH Cancel TCIPIP Forward request
func NewCancelTCPIPForwardRequest ¶
func NewCancelTCPIPForwardRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*CancelTCPIPForwardRequest, error)
NewCancelTCPIPForwardRequest creates a CancelTCPIPForwardRequest chunk
func (*CancelTCPIPForwardRequest) MarshalData ¶
func (r *CancelTCPIPForwardRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes a CancelTCPIPForwardRequest chunk
type ChannelSummary ¶
type ChannelSummary struct { ChannelSummary *bsr.ChannelSummary SessionProgram SessionProgram SubsystemName string ExecProgram ExecApplicationProgram FileTransferDirection FileTransferDirection OpenFailure *OpenChannelError `json:",omitempty"` }
ChannelSummary encapsulates data for a channel SessionProgram can only be one of the following: exec, shell, or subsystem SubsystemName is only populated if SessionProgram is subsystem ExecApplicationProgram is only populated if Channel Program is subsystem, and can be one of the following:
scp, rsync, or unknown
OpenFailure will be nil if the Channel was successfully opened.
type DataChunk ¶
DataChunk contains the raw byte data from an SSH session
type DirectTCPIPRequest ¶
type DirectTCPIPRequest struct { *bsr.BaseChunk *pssh.DirectTCPIPRequest }
DirectTCPIPRequest is a chunk to contain data for an SSH Direct TCPIP request
func NewDirectTCPIPRequest ¶
func NewDirectTCPIPRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*DirectTCPIPRequest, error)
NewDirectTCPIPRequest creates a DirectTCPIPRequest chunk
func (*DirectTCPIPRequest) MarshalData ¶
func (r *DirectTCPIPRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes a DirectTCPIPRequest chunk
type EnvRequest ¶
type EnvRequest struct { *bsr.BaseChunk *pssh.EnvRequest }
EnvRequest is a chunk to contain data for an SSH Env request
func NewEnvRequest ¶
func NewEnvRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*EnvRequest, error)
NewEnvRequest creates an EnvRequest chunk
func (*EnvRequest) MarshalData ¶
func (r *EnvRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an EnvRequest chunk
type ExecApplicationProgram ¶
type ExecApplicationProgram string
ExecApplicationProgram identifies what program was run with exec Currently, only Scp and Rsync are recognized to identify file transfers
const ( ExecApplicationProgramNotApplicable ExecApplicationProgram = "not applicable" Unknown ExecApplicationProgram = "unknown" Scp ExecApplicationProgram = "scp" Rsync ExecApplicationProgram = "rsync" )
ExecApplicationPrograms
type ExecRequest ¶
type ExecRequest struct { *bsr.BaseChunk *pssh.ExecRequest }
ExecRequest is a chunk to contain data for an SSH Exec request
func NewExecRequest ¶
func NewExecRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*ExecRequest, error)
NewExecRequest creates an ExecRequest chunk
func (*ExecRequest) MarshalData ¶
func (r *ExecRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an ExecRequest chunk
type ExitSignalRequest ¶
type ExitSignalRequest struct { *bsr.BaseChunk *pssh.ExitSignalRequest }
ExitSignalRequest is a chunk to contain data for an SSH Exit Signal request
func NewExitSignalRequest ¶
func NewExitSignalRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*ExitSignalRequest, error)
NewExitSignalRequest creates an ExitSignalRequest chunk
func (*ExitSignalRequest) MarshalData ¶
func (r *ExitSignalRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an ExitSignalRequest chunk
type ExitStatusRequest ¶
type ExitStatusRequest struct { *bsr.BaseChunk *pssh.ExitStatusRequest }
ExitStatusRequest is a chunk to contain data for an SSH Exit Status request
func NewExitStatusRequest ¶
func NewExitStatusRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*ExitStatusRequest, error)
NewExitSignalRequest creates an ExitSignalRequest chunk
func (*ExitStatusRequest) MarshalData ¶
func (r *ExitStatusRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an ExitStatusRequest chunk
type FileTransferDirection ¶
type FileTransferDirection string
FileTransferDirection indicates the direction of a file transfer.
const ( FileTransferNotApplicable FileTransferDirection = "not applicable" FileTransferUpload FileTransferDirection = "upload" FileTransferDownload FileTransferDirection = "download" )
Valid file transfer directions.
type ForwardedTCPIPRequest ¶
type ForwardedTCPIPRequest struct { *bsr.BaseChunk *pssh.ForwardedTCPIPRequest }
ForwardedTCPIPRequest is a chunk to contain data for an SSH Forwarded TCPIP request
func NewForwardedTCPIPRequest ¶
func NewForwardedTCPIPRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*ForwardedTCPIPRequest, error)
NewForwardedTCPIPRequest creates an ForwardedTCPIPRequest chunk
func (*ForwardedTCPIPRequest) MarshalData ¶
func (r *ForwardedTCPIPRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an ForwardedTCPIPRequest chunk
type OpenChannelError ¶
type OpenChannelError ssh.OpenChannelError
OpenChannelError provides details if a channel was rejected. This will contain details from the SSH_MSG_CHANNEL_OPEN_FAILURE request that rejected the channel. See: https://www.rfc-editor.org/rfc/rfc4254#section-5.1
type PtyRequest ¶
type PtyRequest struct { *bsr.BaseChunk *pssh.PtyRequest }
PtyPRequest is a chunk to contain data for an SSH Pty request
func NewPtyRequest ¶
func NewPtyRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*PtyRequest, error)
NewPtyRequest creates an PtyRequest chunk
func (*PtyRequest) MarshalData ¶
func (r *PtyRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an PtyRequest chunk
type SessionProgram ¶
type SessionProgram string
SessionProgram identifies the program running on this channel as outlined in https://www.rfc-editor.org/rfc/rfc4254.html#section-6.5 :
Once the session has been set up, a program is started at the remote end. The program can be a shell, an application program, or a subsystem with a host-independent name. Only one of these requests can succeed per channel.
SessionProgram is only valid when the channel type is 'session'
const ( NotApplicable SessionProgram = "not applicable" None SessionProgram = "none" Exec SessionProgram = "exec" Shell SessionProgram = "shell" Subsystem SessionProgram = "subsystem" )
SessionPrograms If the channel type is not of type session, then NotApplicable is expected If the session program is not exec, shell, or subsystem, then None is used
type SessionRequest ¶
type SessionRequest struct { *bsr.BaseChunk *pssh.SessionRequest }
SessionRequest is a chunk to contain data for an SSH Session request
func NewSessionRequest ¶
func NewSessionRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*SessionRequest, error)
NewSessionRequest creates an SessionRequest chunk
func (*SessionRequest) MarshalData ¶
func (r *SessionRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an SessionRequest chunk
type ShellRequest ¶
type ShellRequest struct { *bsr.BaseChunk *pssh.ShellRequest }
ShellRequest is a chunk to contain data for an SSH Shell request
func NewShellRequest ¶
func NewShellRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*ShellRequest, error)
NewShellRequest creates an ShellRequest chunk
func (*ShellRequest) MarshalData ¶
func (r *ShellRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an ShellRequest chunk
type SignalRequest ¶
type SignalRequest struct { *bsr.BaseChunk *pssh.SignalRequest }
SignalRequest is a chunk to contain data for an SSH Signal request
func NewSignalRequest ¶
func NewSignalRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*SignalRequest, error)
NewSignalRequest creates an SignalRequest chunk
func (*SignalRequest) MarshalData ¶
func (r *SignalRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an SignalRequest chunk
type SubsystemRequest ¶
type SubsystemRequest struct { *bsr.BaseChunk *pssh.SubsystemRequest }
SubsystemRequest is a chunk to contain data for an SSH Subsystem request
func NewSubsystemRequest ¶
func NewSubsystemRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*SubsystemRequest, error)
NewSubsystemRequest creates an SubsystemRequest chunk
func (*SubsystemRequest) MarshalData ¶
func (r *SubsystemRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an SubsystemRequest chunk
type TCPIPForwardRequest ¶
type TCPIPForwardRequest struct { *bsr.BaseChunk *pssh.TCPIPForwardRequest }
TCPIPForwardRequest is a chunk to contain data for an SSH TCPIP Forward request
func NewTCPIPForwardRequest ¶
func NewTCPIPForwardRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*TCPIPForwardRequest, error)
NewTCPIPForwardRequest creates an TCPIPForwardRequest chunk
func (*TCPIPForwardRequest) MarshalData ¶
func (r *TCPIPForwardRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an TCPIPForwardRequest chunk
type UnknownRequest ¶
type UnknownRequest struct { *bsr.BaseChunk *pssh.UnknownRequest }
UnknownRequest is a chunk to contain data for any unrecognized SSH request
func NewUnknownRequest ¶
func NewUnknownRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*UnknownRequest, error)
NewUnknownRequest creates an UnknownRequest chunk
func (*UnknownRequest) MarshalData ¶
func (r *UnknownRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an UnknownRequest chunk
type WindowChangeRequest ¶
type WindowChangeRequest struct { *bsr.BaseChunk *pssh.WindowChangeRequest }
WindowChangeRequest is a chunk to contain data for an SSH Window Change request
func NewWindowChangeRequest ¶
func NewWindowChangeRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*WindowChangeRequest, error)
NewWindowChangeRequest creates a WindowChangeRequest chunk
func (*WindowChangeRequest) MarshalData ¶
func (r *WindowChangeRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an WindowChangeRequest chunk
type X11ForwardingRequest ¶
type X11ForwardingRequest struct { *bsr.BaseChunk *pssh.X11ForwardingRequest }
X11ForwardingRequest is a chunk to contain data for an SSH X11 Forwarding request
func NewX11ForwardingRequest ¶
func NewX11ForwardingRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*X11ForwardingRequest, error)
NewX11ForwardingRequest creates an X11ForwardingRequest chunk
func (*X11ForwardingRequest) MarshalData ¶
func (r *X11ForwardingRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an X11ForwardingRequest chunk
type X11Request ¶
type X11Request struct { *bsr.BaseChunk *pssh.X11Request }
X11Request is a chunk to contain data for an SSH X11 request
func NewX11Request ¶
func NewX11Request(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*X11Request, error)
NewX11Request creates an X11Request chunk
func (*X11Request) MarshalData ¶
func (r *X11Request) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an X11Request chunk
type XonXoffRequest ¶
type XonXoffRequest struct { *bsr.BaseChunk *pssh.XonXoffRequest }
XonXoffRequest is a chunk to contain data for an SSH Xon Xoff request
func NewXonXoffRequest ¶
func NewXonXoffRequest(ctx context.Context, d bsr.Direction, t *bsr.Timestamp, r *gssh.Request) (*XonXoffRequest, error)
NewXonXoffRequest creates an XonXoffRequest chunk
func (*XonXoffRequest) MarshalData ¶
func (r *XonXoffRequest) MarshalData(ctx context.Context) ([]byte, error)
MarshalData serializes an XonXoffRequest chunk
Source Files ¶
- chunk.go
- chunk_break_request.go
- chunk_cancel_tcpip_forward_request.go
- chunk_direct_tcpip_request.go
- chunk_env_request.go
- chunk_exec_request.go
- chunk_exit_signal_request.go
- chunk_exit_status_request.go
- chunk_forwarded_tcpip_request.go
- chunk_pty_request.go
- chunk_session_request.go
- chunk_shell_request.go
- chunk_signal_request.go
- chunk_subsystem_request.go
- chunk_tcpip_forward_request.go
- chunk_unknown_request.go
- chunk_window_change_request.go
- chunk_x11_forwarding_request.go
- chunk_x11_request.go
- chunk_xonn_xoff_request.go
- doc.go
- types.go