Documentation
¶
Overview ¶
Package mshark is a simple packet capture tool
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterfaceByName ¶
InterfaceByName returns the interface specified by name.
func OpenLive ¶
func OpenLive(conf *Config, pw ...PacketWriter) error
OpenLive opens a live capture based on the given configuration and writes all captured packets to the given PacketWriters.
Types ¶
type Config ¶
type Config struct { Device *net.Interface // The name of the network interface ("any" means listen on all interfaces). Snaplen int // The maximum length of each packet snapshot. Promisc bool // Promiscuous mode. This setting is ignored for "any" interface. Timeout time.Duration // The maximum duration of the packet capture process. PacketCount int // The maximum number of packets to capture. PacketBuffer int // The maximum size for packet buffer (Default: 8192) Expr string // BPF filter expression. }
type PacketWriter ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) WriteHeader ¶
WriteHeader writes a header to the writer.
The header contains metadata about the capture, such as the interface name, snapshot length, promiscuous mode, timeout, number of packets, and BPF filter.
The header is written in the following format:
- Interface: eth0
- Snapshot Length: 65535
- Promiscuous Mode: true
- Timeout: 5s
- Number of Packets: 0
- Packet Buffer Size: 8192
- BPF Filter: "ip proto tcp"
- Verbose: true
Directories
¶
Path | Synopsis |
---|---|
Package arpspoof
|
Package arpspoof |
cmd
|
|
Package layers
|
Package layers |
Package mpcap implements PCAP Capture File Format
|
Package mpcap implements PCAP Capture File Format |
Package mpcapng implements PCAP Next Generation (pcapng) Capture File Format
|
Package mpcapng implements PCAP Next Generation (pcapng) Capture File Format |
Package native determines host machine endianness
|
Package native determines host machine endianness |
Package oui provides functions to generate hardware vendor names from hardware addresses
|
Package oui provides functions to generate hardware vendor names from hardware addresses |
Click to show internal directories.
Click to hide internal directories.