server

package
v0.0.0-...-05965fc Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 67 Imported by: 1

Documentation

Overview

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	FetchSessions = iota + 1
	FetchSessionsReply

	FetchEvents
	FetchEventsReply

	NewSessions
	NewEvents

	ErrorResponse
)

contains possible set of expected Message requests and response types.

Variables

View Source
var (
	ErrNoServicesGivenPort = fmt.Errorf("no services for the given ports")
)

Functions

func EventServiceStarted

func EventServiceStarted(service string) event.Event

EventServiceStarted will return a service started Event struct

func IsTerminal

func IsTerminal(f *os.File) bool

func PeekConnection

func PeekConnection(conn net.Conn) *peekConnection

func TimeoutConn

func TimeoutConn(conn net.Conn, duration time.Duration) net.Conn

func ToAddr

func ToAddr(input string) (net.Addr, string, int, error)

Addr, proto, port, error

Types

type Bolted

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

Bolted defines a structure which saves delivered events into a giving boltDB database.

func NewBolted

func NewBolted(dbName string, buckets ...string) (*Bolted, error)

NewBolted returns a new instance of a Bolted type.

func (*Bolted) Close

func (d *Bolted) Close() error

Close closes the db and ends the session being used.

func (*Bolted) Get

func (d *Bolted) Get(bucket []byte, from int, length int) ([]map[string]interface{}, error)

Get returns the giving buckets based on the provided cursor point and size. If the `from` and `length` are -1 then all keys and values are returned, else the provided range will be used.

func (*Bolted) GetSize

func (d *Bolted) GetSize(bucket []byte) (int, error)

GetSize returns the giving size of the total items in a given bucket.

func (*Bolted) Save

func (d *Bolted) Save(bucket []byte, events ...map[string]interface{}) error

Save attempts to save the series of passed in events into the underline db.

type Controller

type Controller interface {
	Name() string
	Device() (string, error)
	// TODO:
	// Maybe we should have the container be responsible for itself, so idle timing etc.
	// that way we can create also a simple honeypot (low interaction) controller only with stream as well
	// then IsIdle, Device, Name, Etc are not important anymore, or we can also just solve this
	// with having an other SSHProxyListener, so that will be solved already then....
	IsIdle() bool
	Dial(string) (net.Conn, error)
	CleanUp() error
}

Controller defines the generic properties for controller

type ErrorPayload

type ErrorPayload struct {
	Request MessageType `json:"request"`
	Error   string      `json:"error"`
}

ErrorPayload defines a type which is delievered when an error occurs for a request or action which was not valid or failed.

type Honeytrap

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

Honeytrap defines a struct which coordinates the internal logic for the honeytrap container infrastructure.

func New

func New(options ...OptionFn) (*Honeytrap, error)

New returns a new instance of a Honeytrap struct. func New(conf *config.Config) *Honeytrap {

func (*Honeytrap) PrepareRun

func (hc *Honeytrap) PrepareRun()

PrepareRun will prepare Honeytrap to run

func (*Honeytrap) Run

func (hc *Honeytrap) Run(ctx context.Context)

Run will start honeytrap

func (*Honeytrap) Stop

func (hc *Honeytrap) Stop()

Stop will stop Honeytrap

type Message

type Message struct {
	Type    MessageType `json:"type"`
	Payload interface{} `json:"payload"`
}

Message defines a generic message type send over the wire with a websocket request and response.

type MessageType

type MessageType int

MessageType defines a int type used to represent message type requests incoming.

type OptionFn

type OptionFn func(*Honeytrap) error

func WithCPUProfiler

func WithCPUProfiler() OptionFn

func WithConfig

func WithConfig(s string) (OptionFn, error)

func WithDataDir

func WithDataDir(s string) (OptionFn, error)

func WithMemoryProfiler

func WithMemoryProfiler() OptionFn

func WithRemoteConfig

func WithRemoteConfig(s string) (OptionFn, error)

func WithToken

func WithToken() OptionFn

type ServiceMap

type ServiceMap struct {
	Service services.Servicer

	Name string
	Type string
}

Wraps a Servicer, adding some metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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