This page contains the Common Package documentation.
Bases: unittest.TestCase
Contains more advanced tests of the common part of the ANT library
Bases: unittest.TestCase
Basics tests of the common part of the ANT library.
Module providing several classes for hash functions.
Bases: object
Very slow Python hash of high quality
Compute Python hash of the key.
key: string
Bases: object
Bob Jenkins hash, as described at http://burtleburtle.net/bob/hash/doobs.html
Compute Jenkins Hash of the key.
key: list of integers, one for each byte.
Set seed of the hash function.
seed: integer seed of the hash function.
Bases: object
Class for Packet storage and packet header parsing.
ProtoHeader fields ———– ————
- ethernet typelength
- src_mac dst_mac
vlan type ipv4 version
header_len tos total_len id flags fragment_offset ttl protocol checksum src_addr dst_addr options
- tcp src_port
- dst_port data_offset tcp_flags tcp_window
- udp src_port
- dst_port udp_len udp_checksum
Parse packet header up to a specified level.
Bases: object
Class for providing access to protocol headers
Returns ProtoHeader of given type.
Convert integer number into list of one-byte numbers, [0] is MSB
integer: integer to convert.
Convert IP in string format x.x.x.x into list of numbers, one number for each byte, [0] is MSB.
ipstr: IPv4 addres in traditional text notation with dots.
Convert IP in string format x.x.x.x into an integer,
ipstr: IPv4 addres in traditional text notation with dots.
Simple parser of pcap files. Extracts raw packet data from a given file.
You can open file by passing its name to constructor or by calling open() method.
For sequential reading of packets, call next_packet() method in a loop. It always returns next packet if the file (an instance of Packet class), or None if there aren’t any packets left.
To enable random access to packets, you must call index() method first. Than you can access packets in the file using indexes (ie. pcap[i]). Note that file is not loaded to memory by calling index(), only positions of packets are saved, so every access means reading from disk.
Writing of pcap files is not implemented (yet).
Bases: object
Class providing access to fields of protocol header
Bases: netbench.common.headerfields.HeaderField