Documentation ¶
Overview ¶
Package gonetmon is a HTTP traffic monitor, capturing packets on all open interfaces and presenting results to the console.
It uses gopacket to sniff traffic packets and, based on filters, allows to select allowed packets and analyse them further. gonetmon's main features are :
- a display giving the operator real-time insight about the traffic
- the number of total http packets received over a specified time frame
- current traffic speed
- network interfaces used by the traffic
- the most visited website over a specified time frame, sections visited, request methods and response codes
- alerting whenever the traffic hits a defined threshold, and when it recovered.
The project contains a ready-to-use monitor to start checking out traffic.
Index ¶
- func CLI(syn *synchronisation)
- func Collector(devices *devices, packetChan chan packetMsg, syn *synchronisation)
- func Display(reportChan <-chan *report, alertChan <-chan alertMsg, syn *synchronisation)
- func InitialiseCapture() (*devices, error)
- func LoadParams() *configuration
- func Monitor(packetChan <-chan packetMsg, reportChan chan<- *report, ...)
- func NewAnalysis() *analysis
- func NewReport(a *analysis, watchdogHits int, t time.Time) *report
- func NewSession(alertChan chan<- alertMsg, syn *synchronisation) *session
- func NewWatchdog(c chan<- alertMsg, syn *synchronisation) *watchdog
- func Sniff(testWait *sync.WaitGroup, result chan<- error) error
- func SnifferTest(duration time.Duration) error
- func WatchdogRoutine(dog *watchdog, syn *synchronisation)
- type MetaPacket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CLI ¶
func CLI(syn *synchronisation)
CLI acts as a command interface that allows an operator to interact with the tool through CLI.
Implemented commands : - stop : through SIGINT or SIGTERM signals
func Collector ¶
func Collector(devices *devices, packetChan chan packetMsg, syn *synchronisation)
Collector listens on all network devices for relevant traffic and sends packets to packetChan Behaviour and filters can be given as argument with parameters
func Display ¶
func Display(reportChan <-chan *report, alertChan <-chan alertMsg, syn *synchronisation)
Display is in charge of rendering a report in to the format of the final output For now, only console output is supported
func InitialiseCapture ¶
func InitialiseCapture() (*devices, error)
InitialiseCapture opens device interfaces and associated handles to listen on, returns a map of these. If the interfaces parameter is not nil, only open those specified.
func LoadParams ¶
func LoadParams() *configuration
LoadParams loads the application's parameters it should run on into an object and returns it
func Monitor ¶
func Monitor(packetChan <-chan packetMsg, reportChan chan<- *report, alertChan chan<- alertMsg, syn *synchronisation)
Monitor is the link between packet capture, alerting, and display, that accumulates data, analyses it and builds report to display
func NewSession ¶
func NewSession(alertChan chan<- alertMsg, syn *synchronisation) *session
NewSession initialises a new monitoring session and launches a watchdog goroutine
func NewWatchdog ¶
func NewWatchdog(c chan<- alertMsg, syn *synchronisation) *watchdog
NewWatchdog returns a watchdog struct and launches a goroutine that will observe its cache to detect alert triggering
func Sniff ¶
Sniff holds examples of initialising a session and manage different routines to perform monitoring
func SnifferTest ¶
SnifferTest is a wrapper function for Sniffer use with a timeout
func WatchdogRoutine ¶
func WatchdogRoutine(dog *watchdog, syn *synchronisation)
WatchdogRoutine is an alert monitor that records a timestamp of each packet inside the current time frame. The watchdog raises an alert if the number of packets meet a given threshold, and informs if alert has recovered. It continuously verifies the cache and will inform about alert status
Types ¶
type MetaPacket ¶
type MetaPacket struct {
// contains filtered or unexported fields
}
MetaPacket is a wrapper around a captured packet with some additional information : /net/http Request or Response struct on which interface the packet was captured
func DataToHTTP ¶
func DataToHTTP(data *packetMsg) (*MetaPacket, error)
DataToHTTP transforms the raw payload into a MetaPacket struct. Returns nil wth an error if data does not contain a valid http payload
func NewMetaPacket ¶
func NewMetaPacket(data *packetMsg) *MetaPacket
NewMetaPacket returns a new struct initialised with values from the packetMsg
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
gonetmon is a network monitoring tool.
|
gonetmon is a network monitoring tool. |