ExPcap (expcap v0.1.2) View Source

This module represents a pcap file that has been parsed.

Link to this section Summary

Functions

Reads a file, parses the pcap contents and returns a list of the parsed packets.

Parses the content of the packet according to the parser for this packet type. Then it recurses until the packet has been parsed completely. It may return something like an ethernet packet that contains an IPv4 packet that contains a UDP packet that contains a DNS packet.

Parses the content of the packet according to the parser for this packet type. Then it recurses until the packet has been parsed completely. It may return something like an ethernet packet that contains an IPv4 packet that contains a UDP packet that contains a DNS packet.

Reads a packet from the file and returns it or returns end of file if there is no data left to be read.

Reads a packet from a file. This packet is then parsed and the result is returned.

Reads all the packets from a file, parses them and returns a list of the parsed packets.

Reads a pcap file and returns the parsed results.

Link to this section Types

Specs

t() :: %ExPcap{
  global_header: ExPcap.GlobalHeader.t(),
  packets: [ExPcap.Packet.t()]
}

Link to this section Functions

Specs

from_file(String.t()) :: t()

Reads a file, parses the pcap contents and returns a list of the parsed packets.

Link to this function

parse_packet(packet_data, global_header)

View Source

Specs

Parses the content of the packet according to the parser for this packet type. Then it recurses until the packet has been parsed completely. It may return something like an ethernet packet that contains an IPv4 packet that contains a UDP packet that contains a DNS packet.

Link to this function

parse_packet(parser, payload, acc)

View Source

Specs

parse_packet(nil, binary(), [ExPcap.Packet.t()]) :: [ExPcap.Packet.t()]
parse_packet(ExPcap.Parser.t(), binary(), [ExPcap.Packet.t()]) :: [
  ExPcap.Packet.t()
]

Parses the content of the packet according to the parser for this packet type. Then it recurses until the packet has been parsed completely. It may return something like an ethernet packet that contains an IPv4 packet that contains a UDP packet that contains a DNS packet.

Link to this function

read_packet(f, global_header)

View Source

Specs

read_packet(String.t(), ExPcap.GlobalHeader.t()) :: :eof | ExPcap.Packet.t()

Reads a packet from the file and returns it or returns end of file if there is no data left to be read.

Link to this function

read_packet(f, global_header, packet_header)

View Source

Specs

Reads a packet from a file. This packet is then parsed and the result is returned.

Link to this function

read_packets(f, global_header, acc \\ [])

View Source

Specs

read_packets(String.t(), ExPcap.GlobalHeader.t(), list()) :: [ExPcap.Packet.t()]

Reads all the packets from a file, parses them and returns a list of the parsed packets.

Specs

read_pcap(String.t()) :: t()

Reads a pcap file and returns the parsed results.