pcap

package
v1.0.121 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// IOSPacketHeader default is -1
	Pid              = int32(-2)
	ProcName         string
	PacketHeaderSize = uint32(95)
)

Functions

func Start

func Start(device ios.DeviceEntry) error

Types

type IOSPacketHeader added in v1.0.14

type IOSPacketHeader struct {
	HdrSize        uint32 `struc:"uint32,big"`
	Version        uint8  `struc:"uint8,big"`
	PacketSize     uint32 `struc:"uint32,big"`
	Type           uint8  `struc:"uint8,big"`
	Unit           uint16 `struc:"uint16,big"`
	IO             uint8  `struc:"uint8,big"`
	ProtocolFamily uint32 `struc:"uint32,big"`
	FramePreLength uint32 `struc:"uint32,big"`
	FramePstLength uint32 `struc:"uint32,big"`
	IFName         string `struc:"[16]byte"`
	Pid            int32  `struc:"int32,little"`
	ProcName       string `struc:"[17]byte"`
	Unknown        uint32 `struc:"uint32,little"`
	Pid2           int32  `struc:"int32,little"`
	ProcName2      string `struc:"[17]byte"`
	TsSec          int    `struc:"int32,big"` /* timestamp seconds */
	TsUsec         int    `struc:"int32,big"` /* timestamp microseconds */
}

IOSPacketHeader :) ref: https://github.com/gofmt/iOSSniffer/blob/master/pkg/sniffer/sniffer.go#L44

func (*IOSPacketHeader) ToString added in v1.0.14

func (iph *IOSPacketHeader) ToString() string

type NetworkInfo added in v1.0.48

type NetworkInfo struct {
	Mac  string
	IPv4 string
	IPv6 string
}

func FindIp added in v1.0.48

func FindIp(device ios.DeviceEntry) (NetworkInfo, error)

FindIp reads pcap packets until one is found that matches the given MAC and contains an IP address. This won't work if the iOS device "automatic Wifi address" privacy feature is enabled. The MAC needs to be static.

type PcaprecHdrS added in v1.0.12

type PcaprecHdrS struct {
	TsSec   int `struc:"uint32,little"` /* timestamp seconds */
	TsUsec  int `struc:"uint32,little"` /* timestamp microseconds */
	InclLen int `struc:"uint32,little"` /* number of octets of packet saved in file */
	OrigLen int `struc:"uint32,little"` /* actual length of packet */
}

ref: https://www.wireshark.org/~martinm/mac_pcap_sample_code.c

Jump to

Keyboard shortcuts

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