Home | Trees | Indices | Help |
---|
|
object --+ | pcap
pcap object is a wrapper for the type `pcap_t' defined in PCAP library. Its methods are all PCAP library functions with prototype `type pcap_func(pcap_t *,...)'. Method names are functions names without `pcap_' prefix.
|
|||
|
|||
a new object with type S, a subtype of T |
|
||
None |
|
||
None |
|
||
boolean |
|
||
bpf_program object |
|
||
int |
|
||
int |
|
||
pcap_dumper object |
|
||
pcap_dumper object |
|
||
file object | None |
|
||
int |
|
||
int |
|
||
boolean |
|
||
int |
|
||
boolean |
|
||
(int, int,...) |
|
||
None |
|
||
int |
|
||
int |
|
||
(dict, str) | None |
|
||
(int, dict, str) |
|
||
None |
|
||
None |
|
||
None |
|
||
None |
|
||
None |
|
||
None |
|
||
|
|||
None |
|
||
None |
|
||
int |
|
||
dict |
|
||
Inherited from |
|
|||
Inherited from |
|
x.__init__(...) initializes x; see help(type(x)) for signature
|
|
activate() activate a capture handle. It is a wrapper for pcap_activate() Packet Capture library routine.
|
breakloop() force a dispatch() or loop() call to return. It is a wrapper for pcap_breakloop() Packet Capture library routine.
|
can_set_rfmon() check whether monitor mode can be set for a not- yet-activated capture handle. It is a wrapper for pcap_can_set_rfmon() Packet Capture library routine.
|
compile() compile a filter expression. It is a wrapper for pcap_compile() Packet Capture library routine. Default values for parameters `optimize' and `netmask' are respectively True and 0.
|
datalink() get the link-layer header type. It is a wrapper for pcap_datalink() Packet Capture library routine.
|
dispatch() process packets from a live capture or savefile. It is a wrapper for pcap_dispatch() Packet Capture library routine. See `loop()' method.
|
dump_fopen() open a file to which to write packets. It is a wrapper for pcap_dump_fopen() Packet Capture library routine. Argument `fp' is a file object. File object `fp' should have been opened with mode `wb'.
|
dump_open() open a file to which to write packets. It is a wrapper for pcap_dump_open() Packet Capture library routine.
|
file() get the file object associated to standard I/O stream for a savefile being read. It is a wrapper for pcap_file() Packet Capture library routine. Note: return None if pcap object was not opened with `pcap_offline()'
|
fileno() get the file descriptor for a live capture. It is a wrapper for pcap_fileno() Packet Capture library routine.
|
get_selectable_fd() get a file descriptor on which a select() can be done for a live capture. It is a wrapper for pcap_get_selectable_fd() Packet Capture library routine.
|
getnonblock() get the state of non-blocking mode on a capture device. It is a wrapper for pcap_getnonblock() Packet Capture library routine.
|
inject() transmit a packet. It is a wrapper for pcap_inject() Packet Capture library routine.
|
is_swapped() find out whether a savefile has the native byte order. It is a wrapper for pcap_is_swapped() Packet Capture library routine.
|
list_datalinks() get a list of link-layer header types supported by a capture device. It is a wrapper for pcap_list_datalinks() Packet Capture library routine.
|
loop() process packets from a live capture or savefile. It is a wrapper for pcap_loop() Packet Capture library routine. Argument `callback' is a function or an instance method which takes exactly 3 arguments. First one is the third argument of `loop' (`user') which is passed by `loop' to `callback'. It can be any Python object and it's default value is None. Second argument is a wrapper for `struct pcap_pkthdr' defined in PCAP library. It is a dictionary of the following form: {'caplen': <int>, # length of portion present 'ts': {'tv_sec': <int>, 'tv_usec': <int>}, # time stamp 'len': <int> # length of this packet (off wire) } Last argument of `callback' is a Python string containing the first `caplen' bytes of captured packet.
|
major_version() get the version number of a savefile. It is a wrapper for pcap_major_version() Packet Capture library routine.
|
minor_version() get the version number of a savefile. It is a wrapper for pcap_minor_version() Packet Capture library routine.
|
next() read the next packet from a pcap object. It is a wrapper for pcap_next() Packet Capture library routine. Returned value is a 2-tuple. First element is a Python dictionary which is a wrapper for `struct pcap_pkthdr' defined in PCAP library (see `loop()' documentation for a description of this dictionary) and second element is a Python string containing the captured packet. next() returns None when pcap_next() returned NULL.
|
next_ex() read the next packet from a pcap object. It is a wrapper for pcap_next_ex() Packet Capture library routine. Returned value is a 3-tuple. First element is a Python integer which is the integer returned by PCAP library function pcap_next_ex(). If this integer is 1 (no error), second element is a Python dictionary which is a wrapper for `struct pcap_pkthdr' defined in PCAP library (see `loop()' documentation for a description of this dictionary) and last element is a Python string containing the captured packet. When pcap_next_ex() returns a value different from one (error occured), second element is setted to None and last element is a Python string containing the corresponding error message.
|
inject() transmit a packet. It is a wrapper for pcap_sendpacket() Packet Capture library routine.
|
set_buffer_size() set the buffer size for a not-yet-activated capture handle. It is a wrapper for pcap_set_buffer_size() Packet Capture library routine.
|
set_promisc() set promiscuous mode for a not-yet-activated capture handle. It is a wrapper for pcap_set_promisc() Packet Capture library routine.
|
set_rfmon() set monitor mode for a not-yet-activated capture handle. It is a wrapper for pcap_set_rfmon() Packet Capture library routine.
|
set_snaplen() set the snapshot length for a not-yet-activated capture handle. It is a wrapper for pcap_set_snaplen() Packet Capture library routine.
|
set_timeout() set the read timeout for a not-yet-activated capture handle. It is a wrapper for pcap_set_timeout() Packet Capture library routine.
|
setdirection(pcap.PCAP_D_IN | pcap.PCAP_D_OUT | pcap.PCAP_D_INOUT) -> None setdirection() set the direction for which packets will be captured. It is a wrapper for pcap_setdirection() Packet Capture library routine. |
setfilter() set the filter. It is a wrapper for pcap_setfilter() Packet Capture library routine. Argument `fp' is a bpf_program object, usually the result of a call to compile().
|
setnonblock() set the state of non-blocking mode on a capture device. It is a wrapper for pcap_setnonblock() Packet Capture library routine.
|
snapshot() get the snapshot length. It is a wrapper for pcap_snapshot() Packet Capture library routine.
|
stats() get capture statistics. It is a wrapper for pcap_stats() Packet Capture library routine. Returned dictionary has following format: {'ps_recv': <int>, # number of packets received 'ps_drop': <int> # number of packets dropped }
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Oct 22 15:53:08 2012 | http://epydoc.sourceforge.net |