A Cython based Python binding for modern libpcap
BSD-3-CLAUSE License
Bot releases are visible (Hide)
Published by github-actions[bot] almost 2 years ago
const
compiler warning.Published by segevfiner over 2 years ago
dumps(..., cypcap.BpfDumpType.C_ARRAY)
outputted wrong syntax.Published by segevfiner almost 3 years ago
BpfProgram
now has __getitem__
, __len__
, __init__
, __iter__
, and can be turneddumps
can now dump the formats that debug_dump
used to output and return them as a stringPcap.set_protocol_linux
, Pcap.get_selectable_fd
,Pcap.get_required_select_timeout
, and Pcap.getevent
.cypcap.bpf
module with constants and utility functions for manually written BPF.Pcap
& Dumper
).cypcap
is now a package rather than a single file module, API remains the same.debug_dump
is merged into dumps
by a new type parameter.set_config
, set_pre_config
had wrong typing. (Although those are not exported to anPublished by segevfiner almost 3 years ago
optimize
parameter to Pcap.compile
now defaults to True
.Pcap.setfilter
with a str
which will be compiled by calling Pcap.compile
.Published by segevfiner almost 3 years ago
Pkthdr
can be created from Python and is mutable (Useful for bpf.offline_filter
).BpfProgram.dumps
/BpfProgram.loads
to dump and load the filter in the format used byPcap
now has a __repr__
.Pcap
now has a type
and source
attributes.PcapType
for indicating the type of a Pcap
.Pkthdr.ts_datetime
& Pkthdr.ts_utcdatetime
that return Pkthdr.ts
as a naivedatetime
.Pcap.set_pre_config
& Pcap.set_config
shortcuts to set Pcap
configuration via keywordfindalldevs
interface address parsing to use the same format as the socket
AF_PACKET
sockaddr_ll
used in Linux.PcapIf.addresses
/PcapAddr
will now be in the formatTuple[socket.AddressFamily, <sockaddr tuple>]
.BpfProgram.dump
renamed to BpfProgram.debug_dump
.set_timeout
& open_live
now accept Python style float seconds instead of milliseconds.netmask
argument to Pcap.compile
is now optional, the package will try to figure outos.PathLike
in dump_open
& dump_open_append
.os.PathLike
in open_offline
.inject
and sendpacket
now take an object implementing the buffer protocol.cythonize
in setup.py
(The built-in setuptools integration uses theold_build_ext
and keyed off whether to generate C sources on whether Cython isNETMASK_UNKNOWN
was of the wrong type.Published by segevfiner almost 3 years ago
Initial beta release. Only tested manually and lightly.