pcap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TcpdumpMagic     = 0xa1b2c3d4
	VersionMajor     = 2
	VersionMinor     = 4
	LinkTypeEthernet = 1
	LinkTypeRaw      = 101
)
View Source
const (
	Unspecified protocolFamily = 0  // syscall.AF_UNSPEC
	Unix        protocolFamily = 1  // syscall.AF_UNIX  - Unix domain sockets
	IPv4        protocolFamily = 2  // syscall.AF_INET  - Internet Protocol v4
	IPv6        protocolFamily = 30 // syscall.AF_INET6 - Internet Protocol v6
)
View Source
const (
	USB iface = 160
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(udid string) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) ReadPacket

func (c *Client) ReadPacket(ctx context.Context, procName string, wr io.Writer, dump func(IOSPacketHeader, []byte)) error

TODO: look at tools/idevicebtlogger.c for ideas on how to properly construct PCAP header (missing directionality)

type GlobalHeader struct {
	MagicNumber  uint32 // magic number
	VersionMajor uint16 // major version number
	VersionMinor uint16 // minor version number
	Thiszone     int32  // GMT to local correction
	Sigfigs      uint32 // accuracy of timestamps
	Snaplen      uint32 // max length of captured packets, in octets
	Network      uint32 // data link type
}

type IOSPacketHeader

type IOSPacketHeader struct {
	HdrLength       uint32
	HdrVersion      uint8
	PktLength       uint32
	InterfaceType   iface
	Unit            uint16
	IO              uint8
	ProtocolFamily  protocolFamily
	FramePreLength  uint32
	FramePostLength uint32
	InterfaceName   [16]byte
	Pid             uint32 // little endian
	ProcName        [17]byte
	Svc             uint32 // little endian TODO: map this to name
	SubPid          uint32 // little endian
	SubProcName     [17]byte
	Seconds         uint32
	MicroSeconds    uint32
}

type PacketHeader

type PacketHeader struct {
	TimestampSecs      uint32 // timestamp seconds
	TimestampMicroSecs uint32 // timestamp microseconds
	InclLength         uint32 // number of octets of packet saved in file
	OrigLength         uint32 // actual length of packet
}

Jump to

Keyboard shortcuts

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