cmon

package module
v0.0.0-...-961211a Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2017 License: AGPL-3.0 Imports: 13 Imported by: 0

README

CMon

A Simple Connection Monitor Written in Go

Installation

To install CMon, simply run:

go get github.com/vaelen/cmon/cmds/cmon

Example Output

The output is well formatted MarkDown.

Thu, 06 Apr 2017 12:10:44 -0500

Active Connections
Interface Source -> Destination Count State
lo 172.28.128.100:0 -> 172.28.128.100:0 1 Closed
lo 127.0.0.1:40066 -> 127.0.1.1:27000 29 Active
lo 127.0.1.1:27000 -> 127.0.0.1:40066 27 Active
enp0s3 0.0.0.0:68 -> 255.255.255.255:67 1 Closed
enp0s3 fe80::9892:755f:c064:a26:546 -> ff02::1:2:547 2 Closed
enp0s3 54.173.82.137:443 -> 192.168.1.135:50716 7 Closed
enp0s3 192.168.1.135:50716 -> 54.173.82.137:443 7 Active
enp0s8 :0 -> :0 3 Active
Inactive Connections
Source -> Destination State
127.0.1.1:27000 -> 127.0.0.1:44778 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:44730 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:40134 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:44724 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.0.1:44778 -> 127.0.1.1:27000 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.0.1:44728 -> 127.0.1.1:27000 Inactive
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
127.0.0.1:40086 -> 127.0.1.1:27000 Inactive
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
127.0.0.1:44726 -> 127.0.1.1:27000 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:40086 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.0.1:44730 -> 127.0.1.1:27000 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:44726 Inactive
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
127.0.1.1:27000 -> 127.0.0.1:44728 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
127.0.0.1:44724 -> 127.0.1.1:27000 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New
127.0.0.1:40134 -> 127.0.1.1:27000 Inactive
172.28.128.100:36948 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36950 -> 172.28.128.101:27000 New
172.28.128.100:36948 -> 172.28.128.101:27000 New

Documentation

Index

Constants

View Source
const ChannelBufferSize int = 100

Variables

This section is empty.

Functions

func AsUint16

func AsUint16(val interface{}) uint16

func Monitor

func Monitor(ifNames []string, filter string, printInterval time.Duration, verbose bool)

Types

type Event

type Event struct {
	SrcIP   net.IP
	SrcPort uint16
	DstIP   net.IP
	DstPort uint16
	State   State
}

func Connections

func Connections(mode Mode) []Event

func (*Event) String

func (e *Event) String() string

type Mode

type Mode int
const (
	SS Mode = iota
	NETSTAT
)

func FindMode

func FindMode() Mode

type PrinterConfig

type PrinterConfig struct {
	Logger        *log.Logger
	Sources       []SnifferConfig
	PrintInterval time.Duration
}

type SnifferConfig

type SnifferConfig struct {
	IfName   string
	Filter   string
	Request  chan bool
	Response chan *Stats
	Event    chan Event
	Verbose  bool
}

type State

type State int
const (
	ACTIVE State = iota
	ESTABLISHED
	OTHER
)

type Stats

type Stats struct {
	Counts map[string]uint64
}

Directories

Path Synopsis
cmds
ns

Jump to

Keyboard shortcuts

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